summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alsa-lib/Android.mk76
-rw-r--r--alsa-lib/COPYING504
-rw-r--r--alsa-lib/ChangeLog69
-rw-r--r--alsa-lib/INSTALL122
-rw-r--r--alsa-lib/MEMORY-LEAK13
-rw-r--r--alsa-lib/MODULE_LICENSE_LGPL1
-rw-r--r--alsa-lib/Makefile.am37
-rw-r--r--alsa-lib/Makefile.in726
-rw-r--r--alsa-lib/NOTES56
-rw-r--r--alsa-lib/NOTICE504
-rw-r--r--alsa-lib/README31
-rw-r--r--alsa-lib/TODO4
-rw-r--r--alsa-lib/acinclude.m424
-rw-r--r--alsa-lib/aclocal.m47240
-rw-r--r--alsa-lib/alsalisp/Makefile.am8
-rw-r--r--alsa-lib/alsalisp/Makefile.in527
-rw-r--r--alsa-lib/alsalisp/alsalisp.c110
-rw-r--r--alsa-lib/aserver/COPYING340
-rw-r--r--alsa-lib/aserver/Makefile.am12
-rw-r--r--alsa-lib/aserver/Makefile.in556
-rw-r--r--alsa-lib/aserver/aserver.c1104
-rw-r--r--alsa-lib/compile142
-rw-r--r--alsa-lib/config.guess1507
-rw-r--r--alsa-lib/config.sub1608
-rw-r--r--alsa-lib/configure24093
-rw-r--r--alsa-lib/configure.in612
-rw-r--r--alsa-lib/depcomp530
-rw-r--r--alsa-lib/doc/Makefile.am22
-rw-r--r--alsa-lib/doc/Makefile.in594
-rw-r--r--alsa-lib/doc/README.1st2
-rw-r--r--alsa-lib/doc/asoundrc.txt480
-rw-r--r--alsa-lib/doc/doxygen.cfg119
-rw-r--r--alsa-lib/doc/doxygen.cfg.in119
-rw-r--r--alsa-lib/doc/index.doxygen54
-rw-r--r--alsa-lib/doc/pictures/Makefile.am1
-rw-r--r--alsa-lib/doc/pictures/Makefile.in415
-rw-r--r--alsa-lib/gitcompile19
-rw-r--r--alsa-lib/include/Makefile.am90
-rw-r--r--alsa-lib/include/Makefile.in690
-rw-r--r--alsa-lib/include/alisp.h55
-rw-r--r--alsa-lib/include/alsa1
-rw-r--r--alsa-lib/include/alsa-symbols.h72
-rw-r--r--alsa-lib/include/aserver.h160
-rw-r--r--alsa-lib/include/asoundef.h310
-rw-r--r--alsa-lib/include/asoundlib-head.h48
-rw-r--r--alsa-lib/include/asoundlib-tail.h2
-rw-r--r--alsa-lib/include/asoundlib.h60
-rw-r--r--alsa-lib/include/conf.h198
-rw-r--r--alsa-lib/include/config.h165
-rw-r--r--alsa-lib/include/config.h.in157
-rw-r--r--alsa-lib/include/control.h576
-rw-r--r--alsa-lib/include/control_external.h265
-rw-r--r--alsa-lib/include/error.h78
-rw-r--r--alsa-lib/include/global.h159
-rw-r--r--alsa-lib/include/hwdep.h160
-rw-r--r--alsa-lib/include/iatomic.h1175
-rw-r--r--alsa-lib/include/input.h83
-rw-r--r--alsa-lib/include/list.h166
-rw-r--r--alsa-lib/include/local.h278
-rw-r--r--alsa-lib/include/mixer.h319
-rw-r--r--alsa-lib/include/mixer_abst.h112
-rw-r--r--alsa-lib/include/output.h86
-rw-r--r--alsa-lib/include/pcm.h1140
-rw-r--r--alsa-lib/include/pcm_external.h70
-rw-r--r--alsa-lib/include/pcm_extplug.h189
-rw-r--r--alsa-lib/include/pcm_ioplug.h217
-rw-r--r--alsa-lib/include/pcm_old.h230
-rw-r--r--alsa-lib/include/pcm_plugin.h202
-rw-r--r--alsa-lib/include/pcm_rate.h117
-rw-r--r--alsa-lib/include/rawmidi.h159
-rw-r--r--alsa-lib/include/search.h177
-rw-r--r--alsa-lib/include/seq.h737
-rw-r--r--alsa-lib/include/seq_event.h319
-rw-r--r--alsa-lib/include/seq_midi_event.h65
-rw-r--r--alsa-lib/include/seqmid.h490
-rw-r--r--alsa-lib/include/sound/Makefile.am6
-rw-r--r--alsa-lib/include/sound/Makefile.in497
-rw-r--r--alsa-lib/include/sound/asequencer.h678
-rw-r--r--alsa-lib/include/sound/asound.h954
-rw-r--r--alsa-lib/include/sound/asound_fm.h134
-rw-r--r--alsa-lib/include/sound/asoundef.h227
-rw-r--r--alsa-lib/include/sound/emu10k1.h349
-rw-r--r--alsa-lib/include/sound/hdsp.h112
-rw-r--r--alsa-lib/include/sound/sb16_csp.h115
-rw-r--r--alsa-lib/include/sound/sscape_ioctl.h21
-rw-r--r--alsa-lib/include/sound/type_compat.h40
-rw-r--r--alsa-lib/include/sys.h2
-rw-r--r--alsa-lib/include/timer.h257
-rw-r--r--alsa-lib/include/version.h15
-rw-r--r--alsa-lib/install-sh323
-rw-r--r--alsa-lib/libtool7520
-rw-r--r--alsa-lib/ltmain.sh6863
-rw-r--r--alsa-lib/m4/attributes.m4311
-rw-r--r--alsa-lib/missing360
-rw-r--r--alsa-lib/modules/Makefile.am3
-rw-r--r--alsa-lib/modules/Makefile.in572
-rw-r--r--alsa-lib/modules/mixer/Makefile.am1
-rw-r--r--alsa-lib/modules/mixer/Makefile.in572
-rw-r--r--alsa-lib/modules/mixer/simple/Makefile.am35
-rw-r--r--alsa-lib/modules/mixer/simple/Makefile.in610
-rw-r--r--alsa-lib/modules/mixer/simple/ac97.c89
-rw-r--r--alsa-lib/modules/mixer/simple/hda.c90
-rw-r--r--alsa-lib/modules/mixer/simple/python.c1046
-rw-r--r--alsa-lib/modules/mixer/simple/sbase.c587
-rw-r--r--alsa-lib/modules/mixer/simple/sbase.h111
-rw-r--r--alsa-lib/modules/mixer/simple/sbasedl.c106
-rw-r--r--alsa-lib/src/Makefile.am86
-rw-r--r--alsa-lib/src/Makefile.in753
-rw-r--r--alsa-lib/src/Versions131
-rw-r--r--alsa-lib/src/Versions.in131
-rw-r--r--alsa-lib/src/alisp/Makefile.am11
-rw-r--r--alsa-lib/src/alisp/Makefile.in519
-rw-r--r--alsa-lib/src/alisp/alisp.c3492
-rw-r--r--alsa-lib/src/alisp/alisp_local.h151
-rw-r--r--alsa-lib/src/alisp/alisp_snd.c943
-rw-r--r--alsa-lib/src/async.c206
-rw-r--r--alsa-lib/src/compat/Makefile.am8
-rw-r--r--alsa-lib/src/compat/Makefile.in530
-rw-r--r--alsa-lib/src/compat/hsearch_r.c236
-rw-r--r--alsa-lib/src/conf.c4074
-rw-r--r--alsa-lib/src/conf/Makefile.am15
-rw-r--r--alsa-lib/src/conf/Makefile.in610
-rw-r--r--alsa-lib/src/conf/alsa.conf607
-rw-r--r--alsa-lib/src/conf/cards/AACI.conf47
-rw-r--r--alsa-lib/src/conf/cards/ATIIXP-MODEM.conf22
-rw-r--r--alsa-lib/src/conf/cards/ATIIXP-SPDMA.conf165
-rw-r--r--alsa-lib/src/conf/cards/ATIIXP.conf184
-rw-r--r--alsa-lib/src/conf/cards/AU8810.conf38
-rw-r--r--alsa-lib/src/conf/cards/AU8820.conf14
-rw-r--r--alsa-lib/src/conf/cards/AU8830.conf42
-rw-r--r--alsa-lib/src/conf/cards/Audigy.conf318
-rw-r--r--alsa-lib/src/conf/cards/Audigy2.conf425
-rw-r--r--alsa-lib/src/conf/cards/Aureon51.conf179
-rw-r--r--alsa-lib/src/conf/cards/Aureon71.conf190
-rw-r--r--alsa-lib/src/conf/cards/CA0106.conf280
-rw-r--r--alsa-lib/src/conf/cards/CMI8338-SWIEC.conf129
-rw-r--r--alsa-lib/src/conf/cards/CMI8338.conf143
-rw-r--r--alsa-lib/src/conf/cards/CMI8738-MC6.conf161
-rw-r--r--alsa-lib/src/conf/cards/CMI8738-MC8.conf230
-rw-r--r--alsa-lib/src/conf/cards/CMI8788.conf133
-rw-r--r--alsa-lib/src/conf/cards/CS46xx.conf218
-rw-r--r--alsa-lib/src/conf/cards/EMU10K1.conf310
-rw-r--r--alsa-lib/src/conf/cards/EMU10K1X.conf201
-rw-r--r--alsa-lib/src/conf/cards/ENS1370.conf107
-rw-r--r--alsa-lib/src/conf/cards/ENS1371.conf134
-rw-r--r--alsa-lib/src/conf/cards/ES1968.conf12
-rw-r--r--alsa-lib/src/conf/cards/FM801.conf87
-rw-r--r--alsa-lib/src/conf/cards/GUS.conf66
-rw-r--r--alsa-lib/src/conf/cards/HDA-Intel.conf196
-rw-r--r--alsa-lib/src/conf/cards/ICE1712.conf141
-rw-r--r--alsa-lib/src/conf/cards/ICE1724.conf224
-rw-r--r--alsa-lib/src/conf/cards/ICH-MODEM.conf15
-rw-r--r--alsa-lib/src/conf/cards/ICH.conf222
-rw-r--r--alsa-lib/src/conf/cards/ICH4.conf213
-rw-r--r--alsa-lib/src/conf/cards/Maestro3.conf38
-rw-r--r--alsa-lib/src/conf/cards/Makefile.am73
-rw-r--r--alsa-lib/src/conf/cards/Makefile.in493
-rw-r--r--alsa-lib/src/conf/cards/NFORCE.conf295
-rw-r--r--alsa-lib/src/conf/cards/PC-Speaker.conf52
-rw-r--r--alsa-lib/src/conf/cards/PMac.conf37
-rw-r--r--alsa-lib/src/conf/cards/PMacToonie.conf51
-rw-r--r--alsa-lib/src/conf/cards/PS3.conf85
-rw-r--r--alsa-lib/src/conf/cards/RME9636.conf61
-rw-r--r--alsa-lib/src/conf/cards/RME9652.conf61
-rw-r--r--alsa-lib/src/conf/cards/SI7018.conf166
-rw-r--r--alsa-lib/src/conf/cards/SI7018/sndoc-mixer.alisp11
-rw-r--r--alsa-lib/src/conf/cards/SI7018/sndop-mixer.alisp11
-rw-r--r--alsa-lib/src/conf/cards/TRID4DWAVENX.conf129
-rw-r--r--alsa-lib/src/conf/cards/USB-Audio.conf334
-rw-r--r--alsa-lib/src/conf/cards/VIA686A.conf89
-rw-r--r--alsa-lib/src/conf/cards/VIA8233.conf200
-rw-r--r--alsa-lib/src/conf/cards/VIA8233A.conf204
-rw-r--r--alsa-lib/src/conf/cards/VIA8237.conf190
-rw-r--r--alsa-lib/src/conf/cards/VX222.conf61
-rw-r--r--alsa-lib/src/conf/cards/VXPocket.conf61
-rw-r--r--alsa-lib/src/conf/cards/VXPocket440.conf110
-rw-r--r--alsa-lib/src/conf/cards/YMF744.conf108
-rw-r--r--alsa-lib/src/conf/cards/aliases.alisp29
-rw-r--r--alsa-lib/src/conf/cards/aliases.conf57
-rw-r--r--alsa-lib/src/conf/pcm/Makefile.am12
-rw-r--r--alsa-lib/src/conf/pcm/Makefile.in455
-rw-r--r--alsa-lib/src/conf/pcm/center_lfe.conf58
-rw-r--r--alsa-lib/src/conf/pcm/default.conf57
-rw-r--r--alsa-lib/src/conf/pcm/dmix.conf115
-rw-r--r--alsa-lib/src/conf/pcm/dpl.conf43
-rw-r--r--alsa-lib/src/conf/pcm/dsnoop.conf115
-rw-r--r--alsa-lib/src/conf/pcm/front.conf58
-rw-r--r--alsa-lib/src/conf/pcm/hdmi.conf83
-rw-r--r--alsa-lib/src/conf/pcm/iec958.conf83
-rw-r--r--alsa-lib/src/conf/pcm/modem.conf106
-rw-r--r--alsa-lib/src/conf/pcm/rear.conf58
-rw-r--r--alsa-lib/src/conf/pcm/side.conf58
-rw-r--r--alsa-lib/src/conf/pcm/surround40.conf59
-rw-r--r--alsa-lib/src/conf/pcm/surround41.conf66
-rw-r--r--alsa-lib/src/conf/pcm/surround50.conf66
-rw-r--r--alsa-lib/src/conf/pcm/surround51.conf61
-rw-r--r--alsa-lib/src/conf/pcm/surround71.conf63
-rw-r--r--alsa-lib/src/conf/smixer.conf13
-rw-r--r--alsa-lib/src/conf/sndo-mixer.alisp115
-rw-r--r--alsa-lib/src/confmisc.c1304
-rw-r--r--alsa-lib/src/control/Makefile.am17
-rw-r--r--alsa-lib/src/control/Makefile.in538
-rw-r--r--alsa-lib/src/control/cards.c200
-rw-r--r--alsa-lib/src/control/control.c2585
-rw-r--r--alsa-lib/src/control/control_ext.c679
-rw-r--r--alsa-lib/src/control/control_hw.c469
-rw-r--r--alsa-lib/src/control/control_local.h100
-rw-r--r--alsa-lib/src/control/control_shm.c679
-rw-r--r--alsa-lib/src/control/control_symbols.c37
-rw-r--r--alsa-lib/src/control/hcontrol.c1012
-rw-r--r--alsa-lib/src/control/namehint.c650
-rw-r--r--alsa-lib/src/control/setup.c651
-rw-r--r--alsa-lib/src/control/tlv.c429
-rw-r--r--alsa-lib/src/dlmisc.c242
-rw-r--r--alsa-lib/src/error.c150
-rw-r--r--alsa-lib/src/hwdep/Makefile.am8
-rw-r--r--alsa-lib/src/hwdep/Makefile.in519
-rw-r--r--alsa-lib/src/hwdep/hwdep.c760
-rw-r--r--alsa-lib/src/hwdep/hwdep_hw.c201
-rw-r--r--alsa-lib/src/hwdep/hwdep_local.h46
-rw-r--r--alsa-lib/src/hwdep/hwdep_symbols.c34
-rw-r--r--alsa-lib/src/input.c337
-rw-r--r--alsa-lib/src/mixer/Makefile.am10
-rw-r--r--alsa-lib/src/mixer/Makefile.in523
-rw-r--r--alsa-lib/src/mixer/bag.c73
-rw-r--r--alsa-lib/src/mixer/mixer.c1083
-rw-r--r--alsa-lib/src/mixer/mixer_local.h82
-rw-r--r--alsa-lib/src/mixer/mixer_simple.h31
-rw-r--r--alsa-lib/src/mixer/simple.c1056
-rw-r--r--alsa-lib/src/mixer/simple_abst.c420
-rw-r--r--alsa-lib/src/mixer/simple_none.c1717
-rw-r--r--alsa-lib/src/names.c65
-rw-r--r--alsa-lib/src/output.c380
-rw-r--r--alsa-lib/src/pcm/Makefile.am117
-rw-r--r--alsa-lib/src/pcm/Makefile.in773
-rw-r--r--alsa-lib/src/pcm/atomic.c43
-rw-r--r--alsa-lib/src/pcm/interval.c441
-rw-r--r--alsa-lib/src/pcm/interval.h80
-rw-r--r--alsa-lib/src/pcm/interval_inline.h157
-rw-r--r--alsa-lib/src/pcm/ladspa.h603
-rw-r--r--alsa-lib/src/pcm/mask.c28
-rw-r--r--alsa-lib/src/pcm/mask.h57
-rw-r--r--alsa-lib/src/pcm/mask_inline.h299
-rw-r--r--alsa-lib/src/pcm/pcm.c7439
-rw-r--r--alsa-lib/src/pcm/pcm_adpcm.c679
-rw-r--r--alsa-lib/src/pcm/pcm_alaw.c553
-rw-r--r--alsa-lib/src/pcm/pcm_asym.c119
-rw-r--r--alsa-lib/src/pcm/pcm_copy.c299
-rw-r--r--alsa-lib/src/pcm/pcm_direct.c1666
-rw-r--r--alsa-lib/src/pcm/pcm_direct.h306
-rw-r--r--alsa-lib/src/pcm/pcm_dmix.c1316
-rw-r--r--alsa-lib/src/pcm/pcm_dmix_generic.c535
-rw-r--r--alsa-lib/src/pcm/pcm_dmix_i386.c132
-rw-r--r--alsa-lib/src/pcm/pcm_dmix_i386.h559
-rw-r--r--alsa-lib/src/pcm/pcm_dmix_x86_64.c100
-rw-r--r--alsa-lib/src/pcm/pcm_dmix_x86_64.h341
-rw-r--r--alsa-lib/src/pcm/pcm_dshare.c939
-rw-r--r--alsa-lib/src/pcm/pcm_dsnoop.c816
-rw-r--r--alsa-lib/src/pcm/pcm_empty.c110
-rw-r--r--alsa-lib/src/pcm/pcm_ext_parm.h41
-rw-r--r--alsa-lib/src/pcm/pcm_extplug.c813
-rw-r--r--alsa-lib/src/pcm/pcm_file.c793
-rw-r--r--alsa-lib/src/pcm/pcm_generic.c325
-rw-r--r--alsa-lib/src/pcm/pcm_generic.h151
-rw-r--r--alsa-lib/src/pcm/pcm_hooks.c683
-rw-r--r--alsa-lib/src/pcm/pcm_hw.c1597
-rw-r--r--alsa-lib/src/pcm/pcm_iec958.c679
-rw-r--r--alsa-lib/src/pcm/pcm_ioplug.c1072
-rw-r--r--alsa-lib/src/pcm/pcm_ladspa.c1801
-rw-r--r--alsa-lib/src/pcm/pcm_lfloat.c537
-rw-r--r--alsa-lib/src/pcm/pcm_linear.c567
-rw-r--r--alsa-lib/src/pcm/pcm_local.h967
-rw-r--r--alsa-lib/src/pcm/pcm_meter.c1228
-rw-r--r--alsa-lib/src/pcm/pcm_misc.c833
-rw-r--r--alsa-lib/src/pcm/pcm_mmap.c639
-rw-r--r--alsa-lib/src/pcm/pcm_mmap_emul.c486
-rw-r--r--alsa-lib/src/pcm/pcm_mulaw.c568
-rw-r--r--alsa-lib/src/pcm/pcm_multi.c1214
-rw-r--r--alsa-lib/src/pcm/pcm_null.c431
-rw-r--r--alsa-lib/src/pcm/pcm_params.c2345
-rw-r--r--alsa-lib/src/pcm/pcm_plug.c1304
-rw-r--r--alsa-lib/src/pcm/pcm_plugin.c593
-rw-r--r--alsa-lib/src/pcm/pcm_plugin.h154
-rw-r--r--alsa-lib/src/pcm/pcm_rate.c1510
-rw-r--r--alsa-lib/src/pcm/pcm_rate_linear.c435
-rw-r--r--alsa-lib/src/pcm/pcm_route.c1172
-rw-r--r--alsa-lib/src/pcm/pcm_share.c1722
-rw-r--r--alsa-lib/src/pcm/pcm_shm.c956
-rw-r--r--alsa-lib/src/pcm/pcm_simple.c305
-rw-r--r--alsa-lib/src/pcm/pcm_softvol.c1082
-rw-r--r--alsa-lib/src/pcm/pcm_symbols.c64
-rw-r--r--alsa-lib/src/pcm/plugin_ops.h1081
-rw-r--r--alsa-lib/src/pcm/scopes/Makefile.am9
-rw-r--r--alsa-lib/src/pcm/scopes/Makefile.in557
-rw-r--r--alsa-lib/src/pcm/scopes/level.c271
-rw-r--r--alsa-lib/src/rawmidi/Makefile.am12
-rw-r--r--alsa-lib/src/rawmidi/Makefile.in527
-rw-r--r--alsa-lib/src/rawmidi/rawmidi.c1004
-rw-r--r--alsa-lib/src/rawmidi/rawmidi_hw.c372
-rw-r--r--alsa-lib/src/rawmidi/rawmidi_local.h61
-rw-r--r--alsa-lib/src/rawmidi/rawmidi_symbols.c36
-rw-r--r--alsa-lib/src/rawmidi/rawmidi_virt.c469
-rw-r--r--alsa-lib/src/seq/Makefile.am13
-rw-r--r--alsa-lib/src/seq/Makefile.in530
-rw-r--r--alsa-lib/src/seq/seq.c4783
-rw-r--r--alsa-lib/src/seq/seq_event.c49
-rw-r--r--alsa-lib/src/seq/seq_hw.c568
-rw-r--r--alsa-lib/src/seq/seq_local.h97
-rw-r--r--alsa-lib/src/seq/seq_midi_event.c586
-rw-r--r--alsa-lib/src/seq/seq_old.c222
-rw-r--r--alsa-lib/src/seq/seq_symbols.c34
-rw-r--r--alsa-lib/src/seq/seqmid.c426
-rw-r--r--alsa-lib/src/shmarea.c108
-rw-r--r--alsa-lib/src/socket.c158
-rw-r--r--alsa-lib/src/timer/Makefile.am9
-rw-r--r--alsa-lib/src/timer/Makefile.in524
-rw-r--r--alsa-lib/src/timer/timer.c959
-rw-r--r--alsa-lib/src/timer/timer_hw.c361
-rw-r--r--alsa-lib/src/timer/timer_local.h76
-rw-r--r--alsa-lib/src/timer/timer_query.c594
-rw-r--r--alsa-lib/src/timer/timer_query_hw.c146
-rw-r--r--alsa-lib/src/timer/timer_symbols.c46
-rw-r--r--alsa-lib/src/userfile.c72
-rw-r--r--alsa-lib/test/Makefile.am23
-rw-r--r--alsa-lib/test/Makefile.in630
-rw-r--r--alsa-lib/test/client_event_filter.c46
-rw-r--r--alsa-lib/test/control.c106
-rw-r--r--alsa-lib/test/latency.c689
-rw-r--r--alsa-lib/test/midifile.3336
-rw-r--r--alsa-lib/test/midifile.c1173
-rw-r--r--alsa-lib/test/midifile.h132
-rw-r--r--alsa-lib/test/midiloop.c190
-rw-r--r--alsa-lib/test/namehint.c22
-rw-r--r--alsa-lib/test/oldapi.c42
-rw-r--r--alsa-lib/test/pcm.c902
-rw-r--r--alsa-lib/test/pcm_min.c51
-rw-r--r--alsa-lib/test/playmidi1.c617
-rw-r--r--alsa-lib/test/queue_timer.c128
-rw-r--r--alsa-lib/test/rawmidi.c241
-rw-r--r--alsa-lib/test/seq-decoder.c353
-rw-r--r--alsa-lib/test/seq-sender.c272
-rw-r--r--alsa-lib/test/seq.c233
-rw-r--r--alsa-lib/test/timer.c193
-rw-r--r--alsa-lib/utils/Makefile.am13
-rw-r--r--alsa-lib/utils/Makefile.in480
-rw-r--r--alsa-lib/utils/alsa-lib.spec.in75
-rw-r--r--alsa-lib/utils/alsa.m4141
-rw-r--r--alsa-lib/utils/alsa.pc.in14
-rw-r--r--alsa-lib/utils/buildrpm46
-rw-r--r--alsa-lib/version1
-rw-r--r--alsa-utils/ABOUT-NLS1111
-rw-r--r--alsa-utils/Android.mk98
-rw-r--r--alsa-utils/COPYING340
-rw-r--r--alsa-utils/ChangeLog43
-rw-r--r--alsa-utils/INSTALL46
-rw-r--r--alsa-utils/Makefile.am27
-rw-r--r--alsa-utils/Makefile.in638
-rw-r--r--alsa-utils/README20
-rw-r--r--alsa-utils/TODO4
-rw-r--r--alsa-utils/acinclude.m412
-rw-r--r--alsa-utils/aclocal.m41013
-rw-r--r--alsa-utils/alsaconf/Makefile.am37
-rw-r--r--alsa-utils/alsaconf/Makefile.in557
-rw-r--r--alsa-utils/alsaconf/alsaconf.8102
-rw-r--r--alsa-utils/alsaconf/alsaconf.fr.8111
-rw-r--r--alsa-utils/alsaconf/alsaconf.in1435
-rw-r--r--alsa-utils/alsaconf/po/Makefile.in91
-rw-r--r--alsa-utils/alsaconf/po/ja.po362
-rw-r--r--alsa-utils/alsaconf/po/ru.po373
-rw-r--r--alsa-utils/alsactl/Makefile.am14
-rw-r--r--alsa-utils/alsactl/Makefile.in670
-rw-r--r--alsa-utils/alsactl/alsactl.1118
-rw-r--r--alsa-utils/alsactl/alsactl.c192
-rw-r--r--alsa-utils/alsactl/alsactl.h94
-rw-r--r--alsa-utils/alsactl/alsactl_init.xml590
-rw-r--r--alsa-utils/alsactl/init/00main46
-rw-r--r--alsa-utils/alsactl/init/Makefile.am7
-rw-r--r--alsa-utils/alsactl/init/Makefile.in366
-rw-r--r--alsa-utils/alsactl/init/default145
-rw-r--r--alsa-utils/alsactl/init/hda34
-rw-r--r--alsa-utils/alsactl/init/help8
-rw-r--r--alsa-utils/alsactl/init/info22
-rw-r--r--alsa-utils/alsactl/init/test270
-rw-r--r--alsa-utils/alsactl/init_parse.c1739
-rw-r--r--alsa-utils/alsactl/init_sysdeps.c63
-rw-r--r--alsa-utils/alsactl/init_sysfs.c158
-rw-r--r--alsa-utils/alsactl/init_utils_run.c247
-rw-r--r--alsa-utils/alsactl/init_utils_string.c194
-rw-r--r--alsa-utils/alsactl/list.h289
-rw-r--r--alsa-utils/alsactl/state.c1653
-rw-r--r--alsa-utils/alsactl/utils.c98
-rw-r--r--alsa-utils/alsamixer/Makefile.am10
-rw-r--r--alsa-utils/alsamixer/Makefile.in504
-rw-r--r--alsa-utils/alsamixer/README84
-rw-r--r--alsa-utils/alsamixer/alsamixer.1174
-rw-r--r--alsa-utils/alsamixer/alsamixer.c2408
-rw-r--r--alsa-utils/amidi/Makefile.am5
-rw-r--r--alsa-utils/amidi/Makefile.in498
-rw-r--r--alsa-utils/amidi/amidi.1155
-rw-r--r--alsa-utils/amidi/amidi.c679
-rw-r--r--alsa-utils/amixer/Makefile.am10
-rw-r--r--alsa-utils/amixer/Makefile.in505
-rw-r--r--alsa-utils/amixer/amixer.1141
-rw-r--r--alsa-utils/amixer/amixer.c2013
-rw-r--r--alsa-utils/amixer/amixer.h21
-rw-r--r--alsa-utils/android/aconfig.h14
-rw-r--r--alsa-utils/android/sys/signal.h2
-rw-r--r--alsa-utils/aplay/Makefile.am29
-rw-r--r--alsa-utils/aplay/Makefile.in527
-rw-r--r--alsa-utils/aplay/aplay.1160
-rw-r--r--alsa-utils/aplay/aplay.c2565
-rw-r--r--alsa-utils/aplay/arecord.1160
-rw-r--r--alsa-utils/aplay/formats.h127
-rw-r--r--alsa-utils/config.guess1507
-rw-r--r--alsa-utils/config.rpath614
-rw-r--r--alsa-utils/config.sub1608
-rw-r--r--alsa-utils/configure10157
-rw-r--r--alsa-utils/configure.in153
-rw-r--r--alsa-utils/depcomp530
-rw-r--r--alsa-utils/gitcompile25
-rw-r--r--alsa-utils/iecset/Makefile.am9
-rw-r--r--alsa-utils/iecset/Makefile.in502
-rw-r--r--alsa-utils/iecset/iecbits.c259
-rw-r--r--alsa-utils/iecset/iecset.1104
-rw-r--r--alsa-utils/iecset/iecset.c432
-rw-r--r--alsa-utils/include/Makefile.am25
-rw-r--r--alsa-utils/include/Makefile.in418
-rw-r--r--alsa-utils/include/aconfig.h.in74
-rw-r--r--alsa-utils/include/gettext.h16
-rw-r--r--alsa-utils/include/version.h12
-rw-r--r--alsa-utils/install-sh323
-rw-r--r--alsa-utils/m4/Makefile.am1
-rw-r--r--alsa-utils/m4/Makefile.in329
-rw-r--r--alsa-utils/m4/codeset.m421
-rw-r--r--alsa-utils/m4/gettext.m4631
-rw-r--r--alsa-utils/m4/glibc2.m430
-rw-r--r--alsa-utils/m4/glibc21.m430
-rw-r--r--alsa-utils/m4/iconv.m4101
-rw-r--r--alsa-utils/m4/intdiv0.m470
-rw-r--r--alsa-utils/m4/intmax.m430
-rw-r--r--alsa-utils/m4/inttypes-h.m425
-rw-r--r--alsa-utils/m4/inttypes-pri.m430
-rw-r--r--alsa-utils/m4/inttypes_h.m426
-rw-r--r--alsa-utils/m4/lcmessage.m430
-rw-r--r--alsa-utils/m4/lib-ld.m4110
-rw-r--r--alsa-utils/m4/lib-link.m4630
-rw-r--r--alsa-utils/m4/lib-prefix.m4185
-rw-r--r--alsa-utils/m4/lock.m4289
-rw-r--r--alsa-utils/m4/longdouble.m431
-rw-r--r--alsa-utils/m4/longlong.m423
-rw-r--r--alsa-utils/m4/nls.m431
-rw-r--r--alsa-utils/m4/po.m4428
-rw-r--r--alsa-utils/m4/printf-posix.m444
-rw-r--r--alsa-utils/m4/progtest.m492
-rw-r--r--alsa-utils/m4/signed.m417
-rw-r--r--alsa-utils/m4/size_max.m460
-rw-r--r--alsa-utils/m4/stdint_h.m426
-rw-r--r--alsa-utils/m4/uintmax_t.m430
-rw-r--r--alsa-utils/m4/ulonglong.m423
-rw-r--r--alsa-utils/m4/visibility.m452
-rw-r--r--alsa-utils/m4/wchar_t.m420
-rw-r--r--alsa-utils/m4/wint_t.m420
-rw-r--r--alsa-utils/m4/xsize.m413
-rw-r--r--alsa-utils/missing360
-rw-r--r--alsa-utils/po/LINGUAS1
-rw-r--r--alsa-utils/po/Makefile.in.in393
-rw-r--r--alsa-utils/po/Makevars41
-rw-r--r--alsa-utils/po/POTFILES.in4
-rw-r--r--alsa-utils/po/Rules-quot47
-rw-r--r--alsa-utils/po/alsa-utils.pot1108
-rw-r--r--alsa-utils/po/boldquot.sed10
-rw-r--r--alsa-utils/po/en@boldquot.header25
-rw-r--r--alsa-utils/po/en@quot.header22
-rw-r--r--alsa-utils/po/insert-header.sin23
-rw-r--r--alsa-utils/po/ja.po1177
-rw-r--r--alsa-utils/po/quot.sed6
-rw-r--r--alsa-utils/po/remove-potcdate.sin19
-rw-r--r--alsa-utils/po/stamp-po1
-rw-r--r--alsa-utils/seq/Makefile.am1
-rw-r--r--alsa-utils/seq/Makefile.in485
-rw-r--r--alsa-utils/seq/aconnect/Makefile.am7
-rw-r--r--alsa-utils/seq/aconnect/Makefile.in502
-rw-r--r--alsa-utils/seq/aconnect/README.aconnect46
-rw-r--r--alsa-utils/seq/aconnect/aconnect.1145
-rw-r--r--alsa-utils/seq/aconnect/aconnect.c411
-rw-r--r--alsa-utils/seq/aplaymidi/Makefile.am5
-rw-r--r--alsa-utils/seq/aplaymidi/Makefile.in505
-rw-r--r--alsa-utils/seq/aplaymidi/aplaymidi.155
-rw-r--r--alsa-utils/seq/aplaymidi/aplaymidi.c927
-rw-r--r--alsa-utils/seq/aplaymidi/arecordmidi.182
-rw-r--r--alsa-utils/seq/aplaymidi/arecordmidi.c880
-rw-r--r--alsa-utils/seq/aseqdump/Makefile.am5
-rw-r--r--alsa-utils/seq/aseqdump/Makefile.in498
-rw-r--r--alsa-utils/seq/aseqdump/aseqdump.139
-rw-r--r--alsa-utils/seq/aseqdump/aseqdump.c438
-rw-r--r--alsa-utils/seq/aseqnet/Makefile.am7
-rw-r--r--alsa-utils/seq/aseqnet/Makefile.in501
-rw-r--r--alsa-utils/seq/aseqnet/README.aseqnet53
-rw-r--r--alsa-utils/seq/aseqnet/aseqnet.181
-rw-r--r--alsa-utils/seq/aseqnet/aseqnet.c609
-rw-r--r--alsa-utils/speaker-test/Makefile.am9
-rw-r--r--alsa-utils/speaker-test/Makefile.in616
-rw-r--r--alsa-utils/speaker-test/pink.c96
-rw-r--r--alsa-utils/speaker-test/pink.h15
-rw-r--r--alsa-utils/speaker-test/readme.txt12
-rw-r--r--alsa-utils/speaker-test/samples/Makefile.am20
-rw-r--r--alsa-utils/speaker-test/samples/Makefile.in396
-rw-r--r--alsa-utils/speaker-test/samples/sample_map.csv2
-rw-r--r--alsa-utils/speaker-test/speaker-test.1125
-rw-r--r--alsa-utils/speaker-test/speaker-test.c1031
-rw-r--r--alsa-utils/utils/Makefile.am4
-rw-r--r--alsa-utils/utils/Makefile.in335
-rw-r--r--alsa-utils/utils/alsa-utils.spec.in76
-rw-r--r--alsa-utils/utils/buildrpm44
-rw-r--r--libaudio/Android.mk82
-rw-r--r--libaudio/AudioHardwareALSA.cpp2361
-rw-r--r--libaudio/AudioHardwareALSA.h411
-rw-r--r--libaudio/AudioPolicyManager.cpp1865
-rw-r--r--libaudio/AudioPolicyManager.h218
-rw-r--r--libaudio/AudioPolicyManagerBase.cpp2121
-rw-r--r--libaudio/NOTICE191
-rw-r--r--libcamera/Android.mk45
-rw-r--r--libcamera/SecCamera.cpp3932
-rw-r--r--libcamera/SecCamera.h886
-rw-r--r--libcamera/SecCameraHWInterface.cpp2370
-rw-r--r--libcamera/SecCameraHWInterface.h257
526 files changed, 252746 insertions, 0 deletions
diff --git a/alsa-lib/Android.mk b/alsa-lib/Android.mk
new file mode 100644
index 0000000..8bd4353
--- /dev/null
+++ b/alsa-lib/Android.mk
@@ -0,0 +1,76 @@
+# external/alsa-lib/Android.mk
+#
+# Copyright 2008 Wind River Systems
+#
+
+ifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),true)
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+##
+## Copy ALSA configuration files to rootfs
+##
+TARGET_ALSA_CONF_DIR := $(TARGET_OUT)/usr/share/alsa
+LOCAL_ALSA_CONF_DIR := $(LOCAL_PATH)/src/conf
+
+copy_from := \
+ alsa.conf \
+ pcm/dsnoop.conf \
+ pcm/modem.conf \
+ pcm/dpl.conf \
+ pcm/default.conf \
+ pcm/surround51.conf \
+ pcm/surround41.conf \
+ pcm/surround50.conf \
+ pcm/dmix.conf \
+ pcm/center_lfe.conf \
+ pcm/surround40.conf \
+ pcm/side.conf \
+ pcm/iec958.conf \
+ pcm/rear.conf \
+ pcm/surround71.conf \
+ pcm/front.conf \
+ cards/aliases.conf
+
+copy_to := $(addprefix $(TARGET_ALSA_CONF_DIR)/,$(copy_from))
+copy_from := $(addprefix $(LOCAL_ALSA_CONF_DIR)/,$(copy_from))
+
+$(copy_to) : $(TARGET_ALSA_CONF_DIR)/% : $(LOCAL_ALSA_CONF_DIR)/% | $(ACP)
+ $(transform-prebuilt-to-target)
+
+ALL_PREBUILT += $(copy_to)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libasound
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
+
+# libasound must be compiled with -fno-short-enums, as it makes extensive
+# use of enums which are often type casted to unsigned ints.
+LOCAL_CFLAGS := \
+ -fPIC -DPIC -D_POSIX_SOURCE \
+ -DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
+ -DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
+ -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
+
+LOCAL_SRC_FILES := $(sort $(call all-c-files-under, src))
+
+# It is easier to exclude the ones we don't want...
+#
+LOCAL_SRC_FILES := $(filter-out src/alisp/alisp_snd.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/compat/hsearch_r.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/control/control_shm.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/pcm/pcm_d%.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/pcm/pcm_ladspa.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/pcm/pcm_shm.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/pcm/scopes/level.c, $(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out src/shmarea.c, $(LOCAL_SRC_FILES))
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif
+
diff --git a/alsa-lib/COPYING b/alsa-lib/COPYING
new file mode 100644
index 0000000..b1e3f5a
--- /dev/null
+++ b/alsa-lib/COPYING
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/alsa-lib/ChangeLog b/alsa-lib/ChangeLog
new file mode 100644
index 0000000..22df356
--- /dev/null
+++ b/alsa-lib/ChangeLog
@@ -0,0 +1,69 @@
+* update to libtool 1.3.3
+
+0.1.3 -> 0.2.0
+
+* added snd_pcm_loopback_block_mode to PCM loopback interface
+* fixups in header files (according to documentation)
+* version is now compatible with driver
+
+0.1.2 -> 0.1.3
+
+* added PCM loopback interface
+
+0.1.1 -> 0.1.2
+
+* bug fixes in open() functions
+
+0.1.0 -> 0.1.1
+
+* added more switch functions to control interface
+
+0.0.9 -> 0.1.0
+
+* renamed soundlib.h to asoundlib.h
+* renamed libraries from libsound to libasound
+* big API changes
+ - added switches interfaces
+* added RawMIDI API
+
+0.0.8 -> 0.0.9
+
+* Makefile and configure.in changes
+ - added check for alsa driver package
+ - added spec file for RPM
+
+0.0.7 -> 0.0.8
+
+* added LGPL notice to all source and header files
+
+0.0.6 -> 0.0.7
+
+* added snd_cards_name function
+
+0.0.5 -> 0.0.6
+
+* fixed SND_PCM_OPEN constants
+
+0.0.4 -> 0.0.5
+
+* added snd_cards_mask function
+* added info functions for pcm playback/record in control interface
+* fixed Makefile bugs for shared library (added -fPIC)
+
+0.0.3 -> 0.0.4
+
+* changed COPYING policy from GPL to LGPL
+* fixed bug in snd_mixer_channel_read & write
+* added mixer exact support
+* added pcm time mode support
+* 'make install' is now possible
+
+0.0.2 -> 0.0.3
+
+* corrected documentation
+
+0.0.1 -> 0.0.2
+
+* added file COPYING
+* added documentation in sgml + plan.txt
+* minor changes in API for MIXER & PCM
diff --git a/alsa-lib/INSTALL b/alsa-lib/INSTALL
new file mode 100644
index 0000000..91a8648
--- /dev/null
+++ b/alsa-lib/INSTALL
@@ -0,0 +1,122 @@
+
+ ALSA library installation
+ =========================
+
+Installation from tarball
+-------------------------
+
+For installation you can use these commands:
+
+ ./configure
+ make install
+
+
+Compilation from HG sources
+---------------------------
+
+You need also GNU packages automake and libtool installed in your system
+to compile HG (Mercurial) sources of alsa-lib package.
+
+For compilation you can use these commands:
+
+ libtoolize --force --copy --automake
+ aclocal
+ autoheader
+ automake --foreign --copy --add-missing
+ autoconf
+ ./configure
+ make
+
+The included hgcompile script does this job for you.
+
+Note: Some automake packages have missing aclocal program. Use newer version
+ in the case.
+
+
+Compilation of static library
+-----------------------------
+
+If you would like to use the static ALSA library, you need to use these
+options for the configure script:
+
+ ./configure --enable-shared=no --enable-static=yes
+
+Unfortunately, due to bug in the libtool script, the shared and static
+library cannot be built together.
+
+
+Partial Builds
+--------------
+
+You can choose the core components to build via --enable-* or --disable-*
+configure option for reducing the size of libasound. The selectable
+components are: pcm, mixer, rawmidi, hwdep, seq and instr.
+For example, --disable-rawmidi will prevent to build the stuff related
+with raw MIDI. As default, all components are enabled.
+
+The PCM plugins to build can be selected via --with-pcm-plugins
+configure option. Multiple plugins can be passed by separation with
+comma. For example, to select _only_ rate and linear plugins (and
+disable other plugins), pass
+ --with-pcm-plugins=rate,linear
+Note that "hw" plugin is always enabled.
+Passing "all" will select all available plugins (which is the default
+behavior).
+
+When you select "plug" plugin, copy and linear plugins will be
+automatically selected, too. That is, the linear-format and
+access-type conversions are always available with plug layer.
+The other conversions of plug (channel shrink/expansion, rate,
+non-linear and float conversions) are enabled when the corresponding
+plugin is selected, too.
+
+
+Configuration for cross-compilation
+-----------------------------------
+
+When you would like to cross-compile ALSA library (e.g. compile on
+i686 host but for arm architecture) you will need to call ./configure
+script with additional parameters:
+
+CC=arm-linux-gcc ./configure --target=arm-linux
+
+In this example host where the library is build is guessed (should be
+given with --host=platform) and target for which is the library build is
+Linux on ARM architecture. You should omit setting 'CC' variable and
+cross-compiler will be guessed too.
+
+So simplest version would be:
+
+./configure --target=arm-linux
+
+For platform names in the form cpu-vendor-os (or aliases for this)
+you should look in 'config.guess' script. Target and all paths
+used here are only examples and should not be directly applicable to
+your system.
+
+Configuration for machines without FPU
+--------------------------------------
+
+If your machine does not have FP unit, you should use '--with-softfloat'
+option. This option disables usage of float numbers in PCM route plugin.
+ALSA could then leave much more CPU cycles for your applications, but you
+could still need some floating point emulator.
+
+Jack plugin
+-----------
+
+JACK plugin is moved to alsa-plugins package.
+
+Trouble Shooting
+----------------
+
+* Install path on Fedora Core 3
+
+ FC3 installs its system ALSA library to /lib instead of /usr/lib.
+ Specify --libdir=/lib to configure to overwrite it with the new library,
+ or run like
+
+ # ln -sf /usr/lib/libasound.so.2.0.0 /lib/libasound.so.2.0.0
+
+ to make symlink to the new path.
+ Note that /lib might be /lib64 on 64bit architecture.
diff --git a/alsa-lib/MEMORY-LEAK b/alsa-lib/MEMORY-LEAK
new file mode 100644
index 0000000..d9677d8
--- /dev/null
+++ b/alsa-lib/MEMORY-LEAK
@@ -0,0 +1,13 @@
+
+
+ Memory leaks - really?
+ ----------------------
+
+Note that some developers are thinking that the ALSA library has some memory
+leaks. Sure, it can be truth, but before contacting us, please, be sure that
+these leaks are not forced.
+
+The biggest reported leak is that the global configuration is cached for
+next usage. If you do not want this feature, simply, call
+snd_config_update_free_global() after all snd_*_open*() calls. This function
+will free the cache.
diff --git a/alsa-lib/MODULE_LICENSE_LGPL b/alsa-lib/MODULE_LICENSE_LGPL
new file mode 100644
index 0000000..8d1c8b6
--- /dev/null
+++ b/alsa-lib/MODULE_LICENSE_LGPL
@@ -0,0 +1 @@
+
diff --git a/alsa-lib/Makefile.am b/alsa-lib/Makefile.am
new file mode 100644
index 0000000..f0c39c1
--- /dev/null
+++ b/alsa-lib/Makefile.am
@@ -0,0 +1,37 @@
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS=doc include src
+if BUILD_MODULES
+SUBDIRS += modules
+endif
+if BUILD_PCM_PLUGIN_SHM
+SUBDIRS += aserver
+endif
+if BUILD_MIXER
+if BUILD_ALISP
+SUBDIRS += alsalisp
+endif
+endif
+SUBDIRS += test utils
+EXTRA_DIST=ChangeLog INSTALL TODO NOTES configure gitcompile libtool \
+ depcomp version MEMORY-LEAK m4/attributes.m4
+AUTOMAKE_OPTIONS=foreign
+
+INCLUDES=-I$(top_srcdir)/include
+
+rpm: dist
+ $(MAKE) -C utils rpm
+
+dist-hook:
+ -chmod -R a+r $(distdir)
+ @if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ else \
+ $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ fi
+
+doc-dummy:
+
+doc: doc-dummy
+ $(MAKE) -C include all
+ $(MAKE) -C doc doc
diff --git a/alsa-lib/Makefile.in b/alsa-lib/Makefile.in
new file mode 100644
index 0000000..5c5fc43
--- /dev/null
+++ b/alsa-lib/Makefile.in
@@ -0,0 +1,726 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_MODULES_TRUE@am__append_1 = modules
+@BUILD_PCM_PLUGIN_SHM_TRUE@am__append_2 = aserver
+@BUILD_ALISP_TRUE@@BUILD_MIXER_TRUE@am__append_3 = alsalisp
+DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure COPYING \
+ ChangeLog INSTALL TODO compile config.guess config.sub depcomp \
+ install-sh ltconfig ltmain.sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = doc include src modules aserver alsalisp test utils
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+ACLOCAL_AMFLAGS = -I m4
+SUBDIRS = doc include src $(am__append_1) $(am__append_2) \
+ $(am__append_3) test utils
+EXTRA_DIST = ChangeLog INSTALL TODO NOTES configure gitcompile libtool \
+ depcomp version MEMORY-LEAK m4/attributes.m4
+
+AUTOMAKE_OPTIONS = foreign
+INCLUDES = -I$(top_srcdir)/include
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/doc $(distdir)/m4 $(distdir)/src $(distdir)/utils
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-libtool clean-recursive \
+ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-generic distclean-libtool distclean-recursive \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+
+rpm: dist
+ $(MAKE) -C utils rpm
+
+dist-hook:
+ -chmod -R a+r $(distdir)
+ @if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ else \
+ $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ fi
+
+doc-dummy:
+
+doc: doc-dummy
+ $(MAKE) -C include all
+ $(MAKE) -C doc doc
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/NOTES b/alsa-lib/NOTES
new file mode 100644
index 0000000..b318d1f
--- /dev/null
+++ b/alsa-lib/NOTES
@@ -0,0 +1,56 @@
+Old versus new PCM API (values returned using indirect pointers)
+================================================================
+
+From the binary compatibility view, there is no change. For compilation,
+1.0 ALSA applications do not need any change. The older applications must
+use this include sequence:
+
+#define ALSA_PCM_OLD_HW_PARAMS_API
+#define ALSA_PCM_OLD_SW_PARAMS_API
+#include <alsa/asoundlib.h>
+
+If you use already the new API, you may remove old defines selecting
+this API, because they are no longer used:
+
+#define ALSA_PCM_NEW_HW_PARAMS_API
+#define ALSA_PCM_NEW_SW_PARAMS_API
+
+
+Verbose Error Messages
+======================
+
+Since version 1.0.8, assert() for some non-fatal errors are removed
+and error messages are no longer shown to stderr as default. Instead,
+the error messages appear only when the environment variable
+LIBASOUND_DEBUG is set (to a non-empty value).
+
+When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration
+will be dumped to stderr. Note that this will show even the non-fatal
+errors of plug layer (trial-and-error of parameters).
+
+This feature is disabled when --with-debug=no is passed to configure,
+i.e. no strict checking is done in alsa-lib.
+
+In addition, when --enable-debug-assert configure option is given and
+when LIBASOUND_DEBUG_ASSERT=1 is set, the default error message
+handler can call assert() to catch with a debugger. This feature was
+formerly activated via LIBASOUND_DEBUG=2.
+
+
+Blocking Open Mode
+==================
+
+The default behavior of blocking at snd_pcm_open is changed to
+non-blocking since version 1.0.11. That is, snd_pcm_open() returns
+-EAGAIN immediately when the device is in use and cannot be opened,
+while the function was blocked in the former version. This influences
+only on the opening behavior. The behavior of the further access,
+read/write, poll or commit, are not changed. They follow the extra
+flag argument of snd_pcm_open() as well as the former version.
+
+For taking back the compatible behavior of open blocking mode, set
+
+ defaults.pcm.nonblock 0
+
+in /etc/asound.conf or ~/.asoundrc file.
+
diff --git a/alsa-lib/NOTICE b/alsa-lib/NOTICE
new file mode 100644
index 0000000..b1e3f5a
--- /dev/null
+++ b/alsa-lib/NOTICE
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/alsa-lib/README b/alsa-lib/README
new file mode 100644
index 0000000..dc80cc5
--- /dev/null
+++ b/alsa-lib/README
@@ -0,0 +1,31 @@
+This version of the ALSA library was obtained from the following location:
+ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.19.tar.bz2
+
+This package was (previously in 1.0.16) configured with the following options:
+
+./configure \
+ --disable-debug \
+ --disable-resmgr \
+ --enable-aload \
+ --enable-mixer \
+ --enable-pcm \
+ --disable-rawmidi \
+ --enable-hwdep \
+ --disable-seq \
+ --disable-alisp \
+ --disable-old-symbols \
+ --disable-python \
+ --with-confdir=/system/usr/share/alsa \
+ --with-plugindir=/system/usr/lib/alsa-lib \
+ --with-versioned=no \
+ --with-debug=no \
+ --with-tmpdir=/tmp \
+ --with-softfloat=yes \
+ --with-libdl=yes \
+ --with-pthread=yes \
+ --with-librt=no \
+ --with-alsa-devdir=/dev/snd \
+ --with-aload-devdir=/dev \
+ --with-pcm-plugins="plug null empty hooks asym extplug ioplug" \
+ --with-ctl-plugins="ext"
+
diff --git a/alsa-lib/TODO b/alsa-lib/TODO
new file mode 100644
index 0000000..f4a99ff
--- /dev/null
+++ b/alsa-lib/TODO
@@ -0,0 +1,4 @@
+H add serious PCM test application to test various period/buffer size
+ combinations to determine possible problems in the lowlevel drivers
+M think about xrun recovery helpers
+L move OSS emulation to user space? (pseudo device driver and daemon)
diff --git a/alsa-lib/acinclude.m4 b/alsa-lib/acinclude.m4
new file mode 100644
index 0000000..35486a0
--- /dev/null
+++ b/alsa-lib/acinclude.m4
@@ -0,0 +1,24 @@
+AC_DEFUN([SAVE_LIBRARY_VERSION], [
+AC_MSG_CHECKING(for library version)
+SND_LIB_VERSION=$VERSION
+echo $VERSION > $srcdir/version
+AC_DEFINE_UNQUOTED(VERSION, "$SND_LIB_VERSION", [sound library version string])
+AC_SUBST(SND_LIB_VERSION)
+SND_LIB_MAJOR=`echo $VERSION | cut -d . -f 1`
+AC_SUBST(SND_LIB_MAJOR)
+SND_LIB_MINOR=`echo $VERSION | cut -d . -f 2`
+AC_SUBST(SND_LIB_MINOR)
+SND_LIB_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\(.*\)$/\1/g'`
+AC_SUBST(SND_LIB_SUBMINOR)
+SND_LIB_EXTRASTR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\([[[:alpha:]]]*\)\([[[:digit:]]]*\)\(.*\)$/\2/g'`
+SND_LIB_EXTRAVER=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\([[[:alpha:]]]*\)\([[[:digit:]]]*\)\(.*\)$/\3/g'`
+case "$SND_LIB_EXTRASTR" in
+ pre) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 00000` ;;
+ alpha) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 10000` ;;
+ beta) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 20000` ;;
+ rc) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 100000` ;;
+ *) SND_LIB_EXTRAVER=1000000 ;;
+esac
+AC_MSG_RESULT(major $SND_LIB_MAJOR minor $SND_LIB_MINOR subminor $SND_LIB_SUBMINOR extrastr $SND_LIB_EXTRASTR extraver $SND_LIB_EXTRAVER)
+AC_SUBST(SND_LIB_EXTRAVER)
+])
diff --git a/alsa-lib/aclocal.m4 b/alsa-lib/aclocal.m4
new file mode 100644
index 0000000..5dd2d98
--- /dev/null
+++ b/alsa-lib/aclocal.m4
@@ -0,0 +1,7240 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 48 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+ [AC_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+[$]*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+ ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$5], , :, [$5])
+else
+ ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$4], , :, [$4])
+else
+ ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ freebsd*) # from 4.6 on
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix3*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+ [include additional configurations @<:@automatic@:>@])],
+ [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ AC_MSG_WARN([output file `$ofile' does not exist])
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+ else
+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix3*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!). If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ AC_PROG_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ freebsd-elf*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ interix3*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The C++ compiler is used as linker so we must use $wl
+ # flag to pass the commands to the underlying system
+ # linker. We must also pass each convience library through
+ # to the system linker between allextract/defaultextract.
+ # The C++ compiler will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix3*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_AC_TAGVAR(predep_objects,$1)=
+ _LT_AC_TAGVAR(postdep_objects,$1)=
+ _LT_AC_TAGVAR(postdeps,$1)=
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code=" subroutine t\n return\n end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code=" program t\n end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
+ esac
+
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+])
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDGIRSTW]]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix4* | aix5*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ icpc* | ecpc*)
+ # Intel C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler.
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix4* | aix5*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+],[
+ runpath_var=
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)=
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+ _LT_AC_TAGVAR(module_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_AC_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ _LT_CC_BASENAME([$compiler])
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ interix3*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ else
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ # see comment about different semantics on the GNU ld section
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ bsdi[[45]]*)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl, iff we do not link with $LD.
+ # Luckily, gcc supports the same syntax we need for Sun Studio.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ case $wlarc in
+ '')
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ *)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ esac ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_AC_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([acinclude.m4])
diff --git a/alsa-lib/alsalisp/Makefile.am b/alsa-lib/alsalisp/Makefile.am
new file mode 100644
index 0000000..6df915a
--- /dev/null
+++ b/alsa-lib/alsalisp/Makefile.am
@@ -0,0 +1,8 @@
+noinst_PROGRAMS = alsalisp
+
+alsalisp_SOURCES = alsalisp.c
+alsalisp_LDADD = ../src/libasound.la
+
+all: alsalisp
+
+INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/alisp
diff --git a/alsa-lib/alsalisp/Makefile.in b/alsa-lib/alsalisp/Makefile.in
new file mode 100644
index 0000000..4f6aa6e
--- /dev/null
+++ b/alsa-lib/alsalisp/Makefile.in
@@ -0,0 +1,527 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = alsalisp$(EXEEXT)
+subdir = alsalisp
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_alsalisp_OBJECTS = alsalisp.$(OBJEXT)
+alsalisp_OBJECTS = $(am_alsalisp_OBJECTS)
+alsalisp_DEPENDENCIES = ../src/libasound.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(alsalisp_SOURCES)
+DIST_SOURCES = $(alsalisp_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+alsalisp_SOURCES = alsalisp.c
+alsalisp_LDADD = ../src/libasound.la
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/alisp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsalisp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign alsalisp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+alsalisp$(EXEEXT): $(alsalisp_OBJECTS) $(alsalisp_DEPENDENCIES)
+ @rm -f alsalisp$(EXEEXT)
+ $(LINK) $(alsalisp_LDFLAGS) $(alsalisp_OBJECTS) $(alsalisp_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsalisp.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+
+all: alsalisp
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/alsalisp/alsalisp.c b/alsa-lib/alsalisp/alsalisp.c
new file mode 100644
index 0000000..2a2a77b
--- /dev/null
+++ b/alsa-lib/alsalisp/alsalisp.c
@@ -0,0 +1,110 @@
+/*
+ * ALSA lisp implementation
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+
+#include "asoundlib.h"
+#include "alisp.h"
+
+static int verbose = 0;
+static int warning = 0;
+static int debug = 0;
+
+static void interpret_filename(const char *file)
+{
+ struct alisp_cfg cfg;
+ snd_input_t *in;
+ snd_output_t *out;
+ int err;
+
+ memset(&cfg, 0, sizeof(cfg));
+ if (file != NULL && strcmp(file, "-") != 0) {
+ if ((err = snd_input_stdio_open(&in, file, "r")) < 0) {
+ fprintf(stderr, "unable to open filename '%s' (%s)\n", file, snd_strerror(err));
+ return;
+ }
+ } else {
+ if ((err = snd_input_stdio_attach(&in, stdin, 0)) < 0) {
+ fprintf(stderr, "unable to attach stdin '%s' (%s)\n", file, snd_strerror(err));
+ return;
+ }
+ }
+ if (snd_output_stdio_attach(&out, stdout, 0) < 0) {
+ snd_input_close(in);
+ fprintf(stderr, "unable to attach stdout (%s)\n", strerror(errno));
+ return;
+ }
+ cfg.verbose = verbose;
+ cfg.warning = warning;
+ cfg.debug = debug;
+ cfg.in = in;
+ cfg.out = cfg.eout = cfg.vout = cfg.wout = cfg.dout = out;
+ err = alsa_lisp(&cfg, NULL);
+ if (err < 0)
+ fprintf(stderr, "alsa lisp returned error %i (%s)\n", err, strerror(err));
+ else if (verbose)
+ printf("file %s passed ok via alsa lisp interpreter\n", file);
+ snd_output_close(out);
+ snd_input_close(in);
+}
+
+static void usage(void)
+{
+ fprintf(stderr, "usage: alsalisp [-vdw] [file...]\n");
+ exit(1);
+}
+
+int main(int argc, char **argv)
+{
+ int c;
+
+ while ((c = getopt(argc, argv, "vdw")) != -1) {
+ switch (c) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ case 'w':
+ warning = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1)
+ interpret_filename(NULL);
+ else
+ while (*argv)
+ interpret_filename(*argv++);
+
+ return 0;
+}
diff --git a/alsa-lib/aserver/COPYING b/alsa-lib/aserver/COPYING
new file mode 100644
index 0000000..b07ad0d
--- /dev/null
+++ b/alsa-lib/aserver/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/alsa-lib/aserver/Makefile.am b/alsa-lib/aserver/Makefile.am
new file mode 100644
index 0000000..116f578
--- /dev/null
+++ b/alsa-lib/aserver/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = aserver
+aserver_SOURCES = aserver.c
+# aserver_LDADD = -lasound
+aserver_LDADD = ../src/libasound.la
+
+all: aserver
+
+INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm
+
+../src/libasound.la:
+ $(MAKE) -C ../src libasound.la
+
diff --git a/alsa-lib/aserver/Makefile.in b/alsa-lib/aserver/Makefile.in
new file mode 100644
index 0000000..2e9828a
--- /dev/null
+++ b/alsa-lib/aserver/Makefile.in
@@ -0,0 +1,556 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aserver$(EXEEXT)
+subdir = aserver
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_aserver_OBJECTS = aserver.$(OBJEXT)
+aserver_OBJECTS = $(am_aserver_OBJECTS)
+aserver_DEPENDENCIES = ../src/libasound.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(aserver_SOURCES)
+DIST_SOURCES = $(aserver_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+aserver_SOURCES = aserver.c
+# aserver_LDADD = -lasound
+aserver_LDADD = ../src/libasound.la
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/pcm
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign aserver/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign aserver/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+aserver$(EXEEXT): $(aserver_OBJECTS) $(aserver_DEPENDENCIES)
+ @rm -f aserver$(EXEEXT)
+ $(LINK) $(aserver_LDFLAGS) $(aserver_OBJECTS) $(aserver_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aserver.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am
+
+
+all: aserver
+
+../src/libasound.la:
+ $(MAKE) -C ../src libasound.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/aserver/aserver.c b/alsa-lib/aserver/aserver.c
new file mode 100644
index 0000000..73ea4e9
--- /dev/null
+++ b/alsa-lib/aserver/aserver.c
@@ -0,0 +1,1104 @@
+/*
+ * ALSA server
+ * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <sys/shm.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <sys/un.h>
+#include <sys/uio.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <getopt.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <limits.h>
+#include <signal.h>
+
+#include "aserver.h"
+
+char *command;
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define ERROR(...) do {\
+ fprintf(stderr, "%s %s:%i:(%s) ", command, __FILE__, __LINE__, __FUNCTION__); \
+ fprintf(stderr, __VA_ARGS__); \
+ putc('\n', stderr); \
+} while (0)
+#else
+#define ERROR(args...) do {\
+ fprintf(stderr, "%s %s:%i:(%s) ", command, __FILE__, __LINE__, __FUNCTION__); \
+ fprintf(stderr, ##args); \
+ putc('\n', stderr); \
+} while (0)
+#endif
+
+#define SYSERROR(string) ERROR(string ": %s", strerror(errno))
+
+static int make_local_socket(const char *filename)
+{
+ size_t l = strlen(filename);
+ size_t size = offsetof(struct sockaddr_un, sun_path) + l;
+ struct sockaddr_un *addr = alloca(size);
+ int sock;
+
+ sock = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (sock < 0) {
+ int result = -errno;
+ SYSERROR("socket failed");
+ return result;
+ }
+
+ unlink(filename);
+
+ addr->sun_family = AF_LOCAL;
+ memcpy(addr->sun_path, filename, l);
+
+ if (bind(sock, (struct sockaddr *) addr, size) < 0) {
+ int result = -errno;
+ SYSERROR("bind failed");
+ return result;
+ }
+
+ return sock;
+}
+
+static int make_inet_socket(int port)
+{
+ struct sockaddr_in addr;
+ int sock;
+
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ int result = -errno;
+ SYSERROR("socket failed");
+ return result;
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ addr.sin_addr.s_addr = INADDR_ANY;
+
+ if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ int result = -errno;
+ SYSERROR("bind failed");
+ return result;
+ }
+
+ return sock;
+}
+
+struct pollfd *pollfds;
+unsigned int pollfds_count = 0;
+typedef struct waiter waiter_t;
+typedef int (*waiter_handler_t)(waiter_t *waiter, unsigned short events);
+struct waiter {
+ int fd;
+ void *private_data;
+ waiter_handler_t handler;
+};
+waiter_t *waiters;
+
+static void add_waiter(int fd, unsigned short events, waiter_handler_t handler,
+ void *data)
+{
+ waiter_t *w = &waiters[fd];
+ struct pollfd *pfd = &pollfds[pollfds_count];
+ assert(!w->handler);
+ pfd->fd = fd;
+ pfd->events = events;
+ pfd->revents = 0;
+ w->fd = fd;
+ w->private_data = data;
+ w->handler = handler;
+ pollfds_count++;
+}
+
+static void del_waiter(int fd)
+{
+ waiter_t *w = &waiters[fd];
+ unsigned int k;
+ assert(w->handler);
+ w->handler = 0;
+ for (k = 0; k < pollfds_count; ++k) {
+ if (pollfds[k].fd == fd)
+ break;
+ }
+ assert(k < pollfds_count);
+ pollfds_count--;
+ memmove(&pollfds[k], &pollfds[k + 1], pollfds_count - k);
+}
+
+typedef struct client client_t;
+
+typedef struct {
+ int (*open)(client_t *client, int *cookie);
+ int (*cmd)(client_t *client);
+ int (*close)(client_t *client);
+} transport_ops_t;
+
+struct client {
+ struct list_head list;
+ int poll_fd;
+ int ctrl_fd;
+ int local;
+ int transport_type;
+ int dev_type;
+ char name[256];
+ int stream;
+ int mode;
+ transport_ops_t *ops;
+ snd_async_handler_t *async_handler;
+ int async_sig;
+ pid_t async_pid;
+ union {
+ struct {
+ snd_pcm_t *handle;
+ int fd;
+ } pcm;
+ struct {
+ snd_ctl_t *handle;
+ int fd;
+ } ctl;
+#if 0
+ struct {
+ snd_rawmidi_t *handle;
+ } rawmidi;
+ struct {
+ snd_timer_open_t *handle;
+ } timer;
+ struct {
+ snd_hwdep_t *handle;
+ } hwdep;
+ struct {
+ snd_seq_t *handle;
+ } seq;
+#endif
+ } device;
+ int polling;
+ int open;
+ int cookie;
+ union {
+ struct {
+ int ctrl_id;
+ void *ctrl;
+ } shm;
+ } transport;
+};
+
+LIST_HEAD(clients);
+
+typedef struct {
+ struct list_head list;
+ int fd;
+ uint32_t cookie;
+} inet_pending_t;
+LIST_HEAD(inet_pendings);
+
+#if 0
+static int pcm_handler(waiter_t *waiter, unsigned short events)
+{
+ client_t *client = waiter->private_data;
+ char buf[1];
+ ssize_t n;
+ if (events & POLLIN) {
+ n = write(client->poll_fd, buf, 1);
+ if (n != 1) {
+ SYSERROR("write failed");
+ return -errno;
+ }
+ } else if (events & POLLOUT) {
+ n = read(client->poll_fd, buf, 1);
+ if (n != 1) {
+ SYSERROR("read failed");
+ return -errno;
+ }
+ }
+ del_waiter(waiter->fd);
+ client->polling = 0;
+ return 0;
+}
+#endif
+
+static void pcm_shm_hw_ptr_changed(snd_pcm_t *pcm, snd_pcm_t *src ATTRIBUTE_UNUSED)
+{
+ client_t *client = pcm->hw.private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ snd_pcm_t *loop;
+
+ ctrl->hw.changed = 1;
+ if (pcm->hw.fd >= 0) {
+ ctrl->hw.use_mmap = 1;
+ ctrl->hw.offset = pcm->hw.offset;
+ return;
+ }
+ ctrl->hw.use_mmap = 0;
+ ctrl->hw.ptr = pcm->hw.ptr ? *pcm->hw.ptr : 0;
+ for (loop = pcm->hw.master; loop; loop = loop->hw.master)
+ loop->hw.ptr = &ctrl->hw.ptr;
+ pcm->hw.ptr = &ctrl->hw.ptr;
+}
+
+static void pcm_shm_appl_ptr_changed(snd_pcm_t *pcm, snd_pcm_t *src ATTRIBUTE_UNUSED)
+{
+ client_t *client = pcm->appl.private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ snd_pcm_t *loop;
+
+ ctrl->appl.changed = 1;
+ if (pcm->appl.fd >= 0) {
+ ctrl->appl.use_mmap = 1;
+ ctrl->appl.offset = pcm->appl.offset;
+ return;
+ }
+ ctrl->appl.use_mmap = 0;
+ ctrl->appl.ptr = pcm->appl.ptr ? *pcm->appl.ptr : 0;
+ for (loop = pcm->appl.master; loop; loop = loop->appl.master)
+ loop->appl.ptr = &ctrl->appl.ptr;
+ pcm->appl.ptr = &ctrl->appl.ptr;
+}
+
+static int pcm_shm_open(client_t *client, int *cookie)
+{
+ int shmid;
+ snd_pcm_t *pcm;
+ int err;
+ int result;
+ err = snd_pcm_open(&pcm, client->name, client->stream, SND_PCM_NONBLOCK);
+ if (err < 0)
+ return err;
+ client->device.pcm.handle = pcm;
+ client->device.pcm.fd = _snd_pcm_poll_descriptor(pcm);
+ pcm->hw.private_data = client;
+ pcm->hw.changed = pcm_shm_hw_ptr_changed;
+ pcm->appl.private_data = client;
+ pcm->appl.changed = pcm_shm_appl_ptr_changed;
+
+ shmid = shmget(IPC_PRIVATE, PCM_SHM_SIZE, 0666);
+ if (shmid < 0) {
+ result = -errno;
+ SYSERROR("shmget failed");
+ goto _err;
+ }
+ client->transport.shm.ctrl_id = shmid;
+ client->transport.shm.ctrl = shmat(shmid, 0, 0);
+ if (client->transport.shm.ctrl == (void*) -1) {
+ result = -errno;
+ shmctl(shmid, IPC_RMID, 0);
+ SYSERROR("shmat failed");
+ goto _err;
+ }
+ *cookie = shmid;
+ return 0;
+
+ _err:
+ snd_pcm_close(pcm);
+ return result;
+
+}
+
+static int pcm_shm_close(client_t *client)
+{
+ int err;
+ snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ if (client->polling) {
+ del_waiter(client->device.pcm.fd);
+ client->polling = 0;
+ }
+ err = snd_pcm_close(client->device.pcm.handle);
+ ctrl->result = err;
+ if (err < 0)
+ ERROR("snd_pcm_close");
+ if (client->transport.shm.ctrl) {
+ err = shmdt((void *)client->transport.shm.ctrl);
+ if (err < 0)
+ SYSERROR("shmdt failed");
+ err = shmctl(client->transport.shm.ctrl_id, IPC_RMID, 0);
+ if (err < 0)
+ SYSERROR("shmctl IPC_RMID failed");
+ client->transport.shm.ctrl = 0;
+ }
+ client->open = 0;
+ return 0;
+}
+
+static int shm_ack(client_t *client)
+{
+ struct pollfd pfd;
+ int err;
+ char buf[1];
+ pfd.fd = client->ctrl_fd;
+ pfd.events = POLLHUP;
+ if (poll(&pfd, 1, 0) == 1)
+ return -EBADFD;
+ err = write(client->ctrl_fd, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ return 0;
+}
+
+static int shm_ack_fd(client_t *client, int fd)
+{
+ struct pollfd pfd;
+ int err;
+ char buf[1];
+ pfd.fd = client->ctrl_fd;
+ pfd.events = POLLHUP;
+ if (poll(&pfd, 1, 0) == 1)
+ return -EBADFD;
+ err = snd_send_fd(client->ctrl_fd, buf, 1, fd);
+ if (err != 1)
+ return -EBADFD;
+ return 0;
+}
+
+static int shm_rbptr_fd(client_t *client, snd_pcm_rbptr_t *rbptr)
+{
+ if (rbptr->fd < 0)
+ return -EINVAL;
+ return shm_ack_fd(client, rbptr->fd);
+}
+
+static void async_handler(snd_async_handler_t *handler)
+{
+ client_t *client = snd_async_handler_get_callback_private(handler);
+ /* FIXME: use sigqueue */
+ kill(client->async_pid, client->async_sig);
+}
+
+static int pcm_shm_cmd(client_t *client)
+{
+ volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ char buf[1];
+ int err;
+ int cmd;
+ snd_pcm_t *pcm;
+ err = read(client->ctrl_fd, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ cmd = ctrl->cmd;
+ ctrl->cmd = 0;
+ pcm = client->device.pcm.handle;
+ switch (cmd) {
+ case SND_PCM_IOCTL_ASYNC:
+ ctrl->result = snd_pcm_async(pcm, ctrl->u.async.sig, ctrl->u.async.pid);
+ if (ctrl->result < 0)
+ break;
+ if (ctrl->u.async.sig >= 0) {
+ assert(client->async_sig < 0);
+ ctrl->result = snd_async_add_pcm_handler(&client->async_handler, pcm, async_handler, client);
+ if (ctrl->result < 0)
+ break;
+ } else {
+ assert(client->async_sig >= 0);
+ snd_async_del_handler(client->async_handler);
+ }
+ client->async_sig = ctrl->u.async.sig;
+ client->async_pid = ctrl->u.async.pid;
+ break;
+ case SNDRV_PCM_IOCTL_INFO:
+ ctrl->result = snd_pcm_info(pcm, (snd_pcm_info_t *) &ctrl->u.info);
+ break;
+ case SNDRV_PCM_IOCTL_HW_REFINE:
+ ctrl->result = snd_pcm_hw_refine(pcm, (snd_pcm_hw_params_t *) &ctrl->u.hw_refine);
+ break;
+ case SNDRV_PCM_IOCTL_HW_PARAMS:
+ ctrl->result = snd_pcm_hw_params(pcm, (snd_pcm_hw_params_t *) &ctrl->u.hw_params);
+ break;
+ case SNDRV_PCM_IOCTL_HW_FREE:
+ ctrl->result = snd_pcm_hw_free(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_SW_PARAMS:
+ ctrl->result = snd_pcm_sw_params(pcm, (snd_pcm_sw_params_t *) &ctrl->u.sw_params);
+ break;
+ case SNDRV_PCM_IOCTL_STATUS:
+ ctrl->result = snd_pcm_status(pcm, (snd_pcm_status_t *) &ctrl->u.status);
+ break;
+ case SND_PCM_IOCTL_STATE:
+ ctrl->result = snd_pcm_state(pcm);
+ break;
+ case SND_PCM_IOCTL_HWSYNC:
+ ctrl->result = snd_pcm_hwsync(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_DELAY:
+ ctrl->result = snd_pcm_delay(pcm, (snd_pcm_sframes_t *) &ctrl->u.delay.frames);
+ break;
+ case SND_PCM_IOCTL_AVAIL_UPDATE:
+ ctrl->result = snd_pcm_avail_update(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_PREPARE:
+ ctrl->result = snd_pcm_prepare(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_RESET:
+ ctrl->result = snd_pcm_reset(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_START:
+ ctrl->result = snd_pcm_start(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_DRAIN:
+ ctrl->result = snd_pcm_drain(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_DROP:
+ ctrl->result = snd_pcm_drop(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_PAUSE:
+ ctrl->result = snd_pcm_pause(pcm, ctrl->u.pause.enable);
+ break;
+ case SNDRV_PCM_IOCTL_CHANNEL_INFO:
+ ctrl->result = snd_pcm_channel_info(pcm, (snd_pcm_channel_info_t *) &ctrl->u.channel_info);
+ if (ctrl->result >= 0 &&
+ ctrl->u.channel_info.type == SND_PCM_AREA_MMAP)
+ return shm_ack_fd(client, ctrl->u.channel_info.u.mmap.fd);
+ break;
+ case SNDRV_PCM_IOCTL_REWIND:
+ ctrl->result = snd_pcm_rewind(pcm, ctrl->u.rewind.frames);
+ break;
+ case SND_PCM_IOCTL_FORWARD:
+ ctrl->result = snd_pcm_forward(pcm, ctrl->u.forward.frames);
+ break;
+ case SNDRV_PCM_IOCTL_LINK:
+ {
+ /* FIXME */
+ ctrl->result = -ENOSYS;
+ break;
+ }
+ case SNDRV_PCM_IOCTL_UNLINK:
+ ctrl->result = snd_pcm_unlink(pcm);
+ break;
+ case SNDRV_PCM_IOCTL_RESUME:
+ ctrl->result = snd_pcm_resume(pcm);
+ break;
+ case SND_PCM_IOCTL_MMAP:
+ {
+ ctrl->result = snd_pcm_mmap(pcm);
+ }
+ case SND_PCM_IOCTL_MUNMAP:
+ {
+ ctrl->result = snd_pcm_munmap(pcm);
+ break;
+ }
+ case SND_PCM_IOCTL_MMAP_COMMIT:
+ ctrl->result = snd_pcm_mmap_commit(pcm,
+ ctrl->u.mmap_commit.offset,
+ ctrl->u.mmap_commit.frames);
+ break;
+ case SND_PCM_IOCTL_POLL_DESCRIPTOR:
+ ctrl->result = 0;
+ return shm_ack_fd(client, _snd_pcm_poll_descriptor(pcm));
+ case SND_PCM_IOCTL_CLOSE:
+ client->ops->close(client);
+ break;
+ case SND_PCM_IOCTL_HW_PTR_FD:
+ return shm_rbptr_fd(client, &pcm->hw);
+ case SND_PCM_IOCTL_APPL_PTR_FD:
+ return shm_rbptr_fd(client, &pcm->appl);
+ default:
+ ERROR("Bogus cmd: %x", ctrl->cmd);
+ ctrl->result = -ENOSYS;
+ }
+ return shm_ack(client);
+}
+
+transport_ops_t pcm_shm_ops = {
+ .open = pcm_shm_open,
+ .cmd = pcm_shm_cmd,
+ .close = pcm_shm_close,
+};
+
+static int ctl_handler(waiter_t *waiter, unsigned short events)
+{
+ client_t *client = waiter->private_data;
+ char buf[1];
+ ssize_t n;
+ if (events & POLLIN) {
+ n = write(client->poll_fd, buf, 1);
+ if (n != 1) {
+ SYSERROR("write failed");
+ return -errno;
+ }
+ }
+ del_waiter(waiter->fd);
+ client->polling = 0;
+ return 0;
+}
+
+static int ctl_shm_open(client_t *client, int *cookie)
+{
+ int shmid;
+ snd_ctl_t *ctl;
+ int err;
+ int result;
+ err = snd_ctl_open(&ctl, client->name, SND_CTL_NONBLOCK);
+ if (err < 0)
+ return err;
+ client->device.ctl.handle = ctl;
+ client->device.ctl.fd = _snd_ctl_poll_descriptor(ctl);
+
+ shmid = shmget(IPC_PRIVATE, CTL_SHM_SIZE, 0666);
+ if (shmid < 0) {
+ result = -errno;
+ SYSERROR("shmget failed");
+ goto _err;
+ }
+ client->transport.shm.ctrl_id = shmid;
+ client->transport.shm.ctrl = shmat(shmid, 0, 0);
+ if (!client->transport.shm.ctrl) {
+ result = -errno;
+ shmctl(shmid, IPC_RMID, 0);
+ SYSERROR("shmat failed");
+ goto _err;
+ }
+ *cookie = shmid;
+ add_waiter(client->device.ctl.fd, POLLIN, ctl_handler, client);
+ client->polling = 1;
+ return 0;
+
+ _err:
+ snd_ctl_close(ctl);
+ return result;
+
+}
+
+static int ctl_shm_close(client_t *client)
+{
+ int err;
+ snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ if (client->polling) {
+ del_waiter(client->device.ctl.fd);
+ client->polling = 0;
+ }
+ err = snd_ctl_close(client->device.ctl.handle);
+ ctrl->result = err;
+ if (err < 0)
+ ERROR("snd_ctl_close");
+ if (client->transport.shm.ctrl) {
+ err = shmdt((void *)client->transport.shm.ctrl);
+ if (err < 0)
+ SYSERROR("shmdt failed");
+ err = shmctl(client->transport.shm.ctrl_id, IPC_RMID, 0);
+ if (err < 0)
+ SYSERROR("shmctl failed");
+ client->transport.shm.ctrl = 0;
+ }
+ client->open = 0;
+ return 0;
+}
+
+static int ctl_shm_cmd(client_t *client)
+{
+ snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
+ char buf[1];
+ int err;
+ int cmd;
+ snd_ctl_t *ctl;
+ err = read(client->ctrl_fd, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ cmd = ctrl->cmd;
+ ctrl->cmd = 0;
+ ctl = client->device.ctl.handle;
+ switch (cmd) {
+ case SND_CTL_IOCTL_ASYNC:
+ ctrl->result = snd_ctl_async(ctl, ctrl->u.async.sig, ctrl->u.async.pid);
+ if (ctrl->result < 0)
+ break;
+ if (ctrl->u.async.sig >= 0) {
+ assert(client->async_sig < 0);
+ ctrl->result = snd_async_add_ctl_handler(&client->async_handler, ctl, async_handler, client);
+ if (ctrl->result < 0)
+ break;
+ } else {
+ assert(client->async_sig >= 0);
+ snd_async_del_handler(client->async_handler);
+ }
+ client->async_sig = ctrl->u.async.sig;
+ client->async_pid = ctrl->u.async.pid;
+ break;
+ break;
+ case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS:
+ ctrl->result = snd_ctl_subscribe_events(ctl, ctrl->u.subscribe_events);
+ break;
+ case SNDRV_CTL_IOCTL_CARD_INFO:
+ ctrl->result = snd_ctl_card_info(ctl, &ctrl->u.card_info);
+ break;
+ case SNDRV_CTL_IOCTL_ELEM_LIST:
+ {
+ size_t maxsize = CTL_SHM_DATA_MAXLEN;
+ if (ctrl->u.element_list.space * sizeof(*ctrl->u.element_list.pids) > maxsize) {
+ ctrl->result = -EFAULT;
+ break;
+ }
+ ctrl->u.element_list.pids = (snd_ctl_elem_id_t*) ctrl->data;
+ ctrl->result = snd_ctl_elem_list(ctl, &ctrl->u.element_list);
+ break;
+ }
+ case SNDRV_CTL_IOCTL_ELEM_INFO:
+ ctrl->result = snd_ctl_elem_info(ctl, &ctrl->u.element_info);
+ break;
+ case SNDRV_CTL_IOCTL_ELEM_READ:
+ ctrl->result = snd_ctl_elem_read(ctl, &ctrl->u.element_read);
+ break;
+ case SNDRV_CTL_IOCTL_ELEM_WRITE:
+ ctrl->result = snd_ctl_elem_write(ctl, &ctrl->u.element_write);
+ break;
+ case SNDRV_CTL_IOCTL_ELEM_LOCK:
+ ctrl->result = snd_ctl_elem_lock(ctl, &ctrl->u.element_lock);
+ break;
+ case SNDRV_CTL_IOCTL_ELEM_UNLOCK:
+ ctrl->result = snd_ctl_elem_unlock(ctl, &ctrl->u.element_unlock);
+ break;
+ case SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE:
+ ctrl->result = snd_ctl_hwdep_next_device(ctl, &ctrl->u.device);
+ break;
+ case SNDRV_CTL_IOCTL_HWDEP_INFO:
+ ctrl->result = snd_ctl_hwdep_info(ctl, &ctrl->u.hwdep_info);
+ break;
+ case SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE:
+ ctrl->result = snd_ctl_pcm_next_device(ctl, &ctrl->u.device);
+ break;
+ case SNDRV_CTL_IOCTL_PCM_INFO:
+ ctrl->result = snd_ctl_pcm_info(ctl, &ctrl->u.pcm_info);
+ break;
+ case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE:
+ ctrl->result = snd_ctl_pcm_prefer_subdevice(ctl, ctrl->u.pcm_prefer_subdevice);
+ break;
+ case SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE:
+ ctrl->result = snd_ctl_rawmidi_next_device(ctl, &ctrl->u.device);
+ break;
+ case SNDRV_CTL_IOCTL_RAWMIDI_INFO:
+ ctrl->result = snd_ctl_rawmidi_info(ctl, &ctrl->u.rawmidi_info);
+ break;
+ case SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE:
+ ctrl->result = snd_ctl_rawmidi_prefer_subdevice(ctl, ctrl->u.rawmidi_prefer_subdevice);
+ break;
+ case SNDRV_CTL_IOCTL_POWER:
+ ctrl->result = snd_ctl_set_power_state(ctl, ctrl->u.power_state);
+ break;
+ case SNDRV_CTL_IOCTL_POWER_STATE:
+ ctrl->result = snd_ctl_get_power_state(ctl, &ctrl->u.power_state);
+ break;
+ case SND_CTL_IOCTL_READ:
+ ctrl->result = snd_ctl_read(ctl, &ctrl->u.read);
+ break;
+ case SND_CTL_IOCTL_CLOSE:
+ client->ops->close(client);
+ break;
+ case SND_CTL_IOCTL_POLL_DESCRIPTOR:
+ ctrl->result = 0;
+ return shm_ack_fd(client, _snd_ctl_poll_descriptor(ctl));
+ default:
+ ERROR("Bogus cmd: %x", ctrl->cmd);
+ ctrl->result = -ENOSYS;
+ }
+ return shm_ack(client);
+}
+
+transport_ops_t ctl_shm_ops = {
+ .open = ctl_shm_open,
+ .cmd = ctl_shm_cmd,
+ .close = ctl_shm_close,
+};
+
+static int snd_client_open(client_t *client)
+{
+ int err;
+ snd_client_open_request_t req;
+ snd_client_open_answer_t ans;
+ char *name;
+ memset(&ans, 0, sizeof(ans));
+ err = read(client->ctrl_fd, &req, sizeof(req));
+ if (err < 0) {
+ SYSERROR("read failed");
+ exit(1);
+ }
+ if (err != sizeof(req)) {
+ ans.result = -EINVAL;
+ goto _answer;
+ }
+ name = alloca(req.namelen);
+ err = read(client->ctrl_fd, name, req.namelen);
+ if (err < 0) {
+ SYSERROR("read failed");
+ exit(1);
+ }
+ if (err != req.namelen) {
+ ans.result = -EINVAL;
+ goto _answer;
+ }
+
+ switch (req.transport_type) {
+ case SND_TRANSPORT_TYPE_SHM:
+ if (!client->local) {
+ ans.result = -EINVAL;
+ goto _answer;
+ }
+ switch (req.dev_type) {
+ case SND_DEV_TYPE_PCM:
+ client->ops = &pcm_shm_ops;
+ break;
+ case SND_DEV_TYPE_CONTROL:
+ client->ops = &ctl_shm_ops;
+ break;
+ default:
+ ans.result = -EINVAL;
+ goto _answer;
+ }
+ break;
+ default:
+ ans.result = -EINVAL;
+ goto _answer;
+ }
+
+ name[req.namelen] = '\0';
+
+ client->transport_type = req.transport_type;
+ strcpy(client->name, name);
+ client->stream = req.stream;
+ client->mode = req.mode;
+
+ err = client->ops->open(client, &ans.cookie);
+ if (err < 0) {
+ ans.result = err;
+ } else {
+ client->open = 1;
+ ans.result = 0;
+ }
+
+ _answer:
+ err = write(client->ctrl_fd, &ans, sizeof(ans));
+ if (err != sizeof(ans)) {
+ SYSERROR("write failed");
+ exit(1);
+ }
+ return 0;
+}
+
+static int client_poll_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+{
+ client_t *client = waiter->private_data;
+ if (client->open)
+ client->ops->close(client);
+ close(client->poll_fd);
+ close(client->ctrl_fd);
+ del_waiter(client->poll_fd);
+ del_waiter(client->ctrl_fd);
+ list_del(&client->list);
+ free(client);
+ return 0;
+}
+
+static int client_ctrl_handler(waiter_t *waiter, unsigned short events)
+{
+ client_t *client = waiter->private_data;
+ if (events & POLLHUP) {
+ if (client->open)
+ client->ops->close(client);
+ close(client->ctrl_fd);
+ del_waiter(client->ctrl_fd);
+ list_del(&client->list);
+ free(client);
+ return 0;
+ }
+ if (client->open)
+ return client->ops->cmd(client);
+ else
+ return snd_client_open(client);
+}
+
+static int inet_pending_handler(waiter_t *waiter, unsigned short events)
+{
+ inet_pending_t *pending = waiter->private_data;
+ inet_pending_t *pdata;
+ client_t *client;
+ uint32_t cookie;
+ struct list_head *item;
+ int remove = 0;
+ if (events & POLLHUP)
+ remove = 1;
+ else {
+ int err = read(waiter->fd, &cookie, sizeof(cookie));
+ if (err != sizeof(cookie))
+ remove = 1;
+ else {
+ err = write(waiter->fd, &cookie, sizeof(cookie));
+ if (err != sizeof(cookie))
+ remove = 1;
+ }
+ }
+ del_waiter(waiter->fd);
+ if (remove) {
+ close(waiter->fd);
+ list_del(&pending->list);
+ free(pending);
+ return 0;
+ }
+
+ list_for_each(item, &inet_pendings) {
+ pdata = list_entry(item, inet_pending_t, list);
+ if (pdata->cookie == cookie)
+ goto found;
+ }
+ pending->cookie = cookie;
+ return 0;
+
+ found:
+ client = calloc(1, sizeof(*client));
+ client->local = 0;
+ client->poll_fd = pdata->fd;
+ client->ctrl_fd = waiter->fd;
+ add_waiter(client->ctrl_fd, POLLIN | POLLHUP, client_ctrl_handler, client);
+ add_waiter(client->poll_fd, POLLHUP, client_poll_handler, client);
+ client->open = 0;
+ list_add_tail(&client->list, &clients);
+ list_del(&pending->list);
+ list_del(&pdata->list);
+ free(pending);
+ free(pdata);
+ return 0;
+}
+
+static int local_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+{
+ int sock;
+ sock = accept(waiter->fd, 0, 0);
+ if (sock < 0) {
+ int result = -errno;
+ SYSERROR("accept failed");
+ return result;
+ } else {
+ client_t *client = calloc(1, sizeof(*client));
+ client->ctrl_fd = sock;
+ client->local = 1;
+ client->open = 0;
+ add_waiter(sock, POLLIN | POLLHUP, client_ctrl_handler, client);
+ list_add_tail(&client->list, &clients);
+ }
+ return 0;
+}
+
+static int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+{
+ int sock;
+ sock = accept(waiter->fd, 0, 0);
+ if (sock < 0) {
+ int result = -errno;
+ SYSERROR("accept failed");
+ return result;
+ } else {
+ inet_pending_t *pending = calloc(1, sizeof(*pending));
+ pending->fd = sock;
+ pending->cookie = 0;
+ add_waiter(sock, POLLIN, inet_pending_handler, pending);
+ list_add_tail(&pending->list, &inet_pendings);
+ }
+ return 0;
+}
+
+static int server(const char *sockname, int port)
+{
+ int err;
+ unsigned int k;
+ long open_max;
+ int result;
+
+ if (!sockname && port < 0)
+ return -EINVAL;
+ open_max = sysconf(_SC_OPEN_MAX);
+ if (open_max < 0) {
+ result = -errno;
+ SYSERROR("sysconf failed");
+ return result;
+ }
+ pollfds = calloc((size_t) open_max, sizeof(*pollfds));
+ waiters = calloc((size_t) open_max, sizeof(*waiters));
+
+ if (sockname) {
+ int sock = make_local_socket(sockname);
+ if (sock < 0)
+ return sock;
+ if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
+ result = -errno;
+ SYSERROR("fcntl O_NONBLOCK failed");
+ goto _end;
+ }
+ if (listen(sock, 4) < 0) {
+ result = -errno;
+ SYSERROR("listen failed");
+ goto _end;
+ }
+ add_waiter(sock, POLLIN, local_handler, NULL);
+ }
+ if (port >= 0) {
+ int sock = make_inet_socket(port);
+ if (sock < 0)
+ return sock;
+ if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
+ result = -errno;
+ SYSERROR("fcntl failed");
+ goto _end;
+ }
+ if (listen(sock, 4) < 0) {
+ result = -errno;
+ SYSERROR("listen failed");
+ goto _end;
+ }
+ add_waiter(sock, POLLIN, inet_handler, NULL);
+ }
+
+ while (1) {
+ struct pollfd pfds[open_max];
+ size_t pfds_count;
+ do {
+ err = poll(pollfds, pollfds_count, -1);
+ } while (err == 0);
+ if (err < 0) {
+ SYSERROR("poll failed");
+ continue;
+ }
+
+ pfds_count = pollfds_count;
+ memcpy(pfds, pollfds, sizeof(*pfds) * pfds_count);
+ for (k = 0; k < pfds_count; k++) {
+ struct pollfd *pfd = &pfds[k];
+ if (pfd->revents) {
+ waiter_t *w = &waiters[pfd->fd];
+ if (!w->handler)
+ continue;
+ err = w->handler(w, pfd->revents);
+ if (err < 0)
+ ERROR("waiter handler failed");
+ }
+ }
+ }
+ _end:
+ free(pollfds);
+ free(waiters);
+ return result;
+}
+
+
+static void usage(void)
+{
+ fprintf(stderr,
+ "Usage: %s [OPTIONS] server\n"
+ "--help help\n",
+ command);
+}
+
+int main(int argc, char **argv)
+{
+ static const struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ { 0 , 0 , 0, 0 }
+ };
+ int c;
+ snd_config_t *conf;
+ snd_config_iterator_t i, next;
+ const char *sockname = NULL;
+ const char *host = NULL;
+ long port = -1;
+ int err;
+ char *srvname;
+ struct hostent *h;
+ command = argv[0];
+ while ((c = getopt_long(argc, argv, "h", long_options, 0)) != -1) {
+ switch (c) {
+ case 'h':
+ usage();
+ return 0;
+ default:
+ fprintf(stderr, "Try `%s --help' for more information\n", command);
+ return 1;
+ }
+ }
+ if (argc - optind != 1) {
+ ERROR("you need to specify server name");
+ return 1;
+ }
+ err = snd_config_update();
+ if (err < 0) {
+ ERROR("cannot read configuration file");
+ return 1;
+ }
+ srvname = argv[optind];
+ err = snd_config_search_definition(snd_config, "server", srvname, &conf);
+ if (err < 0) {
+ ERROR("Missing definition for server %s", srvname);
+ return 1;
+ }
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for server %s definition", srvname);
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
+ if (err < 0) {
+ ERROR("Invalid type for %s", id);
+ return 1;
+ }
+ continue;
+ }
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &sockname);
+ if (err < 0) {
+ ERROR("Invalid type for %s", id);
+ return 1;
+ }
+ continue;
+ }
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
+ if (err < 0) {
+ ERROR("Invalid type for %s", id);
+ return 1;
+ }
+ continue;
+ }
+ ERROR("Unknown field %s", id);
+ return 1;
+ }
+ if (!host) {
+ ERROR("host is not defined");
+ return 1;
+ }
+ h = gethostbyname(host);
+ if (!h) {
+ ERROR("Cannot resolve %s", host);
+ return 1;
+ }
+ if (!snd_is_local(h)) {
+ ERROR("%s is not the local host", host);
+ return 1;
+ }
+ if (!sockname && port < 0) {
+ ERROR("either socket or port need to be defined");
+ return 1;
+ }
+ server(sockname, port);
+ return 0;
+}
diff --git a/alsa-lib/compile b/alsa-lib/compile
new file mode 100644
index 0000000..1b1d232
--- /dev/null
+++ b/alsa-lib/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as `compile cc -o foo foo.c'.
+ # So we strip `-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no `-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # `.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-lib/config.guess b/alsa-lib/config.guess
new file mode 100644
index 0000000..33c9ad7
--- /dev/null
+++ b/alsa-lib/config.guess
@@ -0,0 +1,1507 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2006-05-13'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_MACHINE}" in
+ i?86)
+ test -z "$VENDOR" && VENDOR=pc
+ ;;
+ *)
+ test -z "$VENDOR" && VENDOR=unknown
+ ;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[345]*)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T:Interix*:[345]*)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-${VENDOR}-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-${VENDOR}-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-${VENDOR}-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-${VENDOR}-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
+ PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
+ *) echo hppa-${VENDOR}-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-${VENDOR}-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-${VENDOR}-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/alsa-lib/config.sub b/alsa-lib/config.sub
new file mode 100644
index 0000000..4d936e2
--- /dev/null
+++ b/alsa-lib/config.sub
@@ -0,0 +1,1608 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2006-05-13'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/alsa-lib/configure b/alsa-lib/configure
new file mode 100644
index 0000000..f042527
--- /dev/null
+++ b/alsa-lib/configure
@@ -0,0 +1,24093 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.60.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="src/control/control.c"
+ac_default_prefix=/usr
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+INSTALL_M4_TRUE
+INSTALL_M4_FALSE
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+LN_S
+GREP
+EGREP
+ECHO
+AR
+RANLIB
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+ALSA_HSEARCH_R_TRUE
+ALSA_HSEARCH_R_FALSE
+SND_LIB_VERSION
+SND_LIB_MAJOR
+SND_LIB_MINOR
+SND_LIB_SUBMINOR
+SND_LIB_EXTRAVER
+LIBTOOL_VERSION_INFO
+ALSA_CONFIG_DIR
+ALSA_PLUGIN_DIR
+VERSIONED_SYMBOLS_TRUE
+VERSIONED_SYMBOLS_FALSE
+SYMBOLIC_FUNCTIONS_TRUE
+SYMBOLIC_FUNCTIONS_FALSE
+SYMBOL_PREFIX
+BUILD_MODULES_TRUE
+BUILD_MODULES_FALSE
+ALSA_DEPLIBS
+KEEP_OLD_SYMBOLS_TRUE
+KEEP_OLD_SYMBOLS_FALSE
+PYTHON_LIBS
+PYTHON_INCLUDES
+BUILD_MIXER_TRUE
+BUILD_MIXER_FALSE
+BUILD_PCM_TRUE
+BUILD_PCM_FALSE
+BUILD_RAWMIDI_TRUE
+BUILD_RAWMIDI_FALSE
+BUILD_HWDEP_TRUE
+BUILD_HWDEP_FALSE
+BUILD_SEQ_TRUE
+BUILD_SEQ_FALSE
+BUILD_ALISP_TRUE
+BUILD_ALISP_FALSE
+BUILD_PYTHON_TRUE
+BUILD_PYTHON_FALSE
+BUILD_PCM_PLUGIN_TRUE
+BUILD_PCM_PLUGIN_FALSE
+BUILD_PCM_PLUGIN_COPY_TRUE
+BUILD_PCM_PLUGIN_COPY_FALSE
+BUILD_PCM_PLUGIN_LINEAR_TRUE
+BUILD_PCM_PLUGIN_LINEAR_FALSE
+BUILD_PCM_PLUGIN_ROUTE_TRUE
+BUILD_PCM_PLUGIN_ROUTE_FALSE
+BUILD_PCM_PLUGIN_MULAW_TRUE
+BUILD_PCM_PLUGIN_MULAW_FALSE
+BUILD_PCM_PLUGIN_ALAW_TRUE
+BUILD_PCM_PLUGIN_ALAW_FALSE
+BUILD_PCM_PLUGIN_ADPCM_TRUE
+BUILD_PCM_PLUGIN_ADPCM_FALSE
+BUILD_PCM_PLUGIN_RATE_TRUE
+BUILD_PCM_PLUGIN_RATE_FALSE
+BUILD_PCM_PLUGIN_PLUG_TRUE
+BUILD_PCM_PLUGIN_PLUG_FALSE
+BUILD_PCM_PLUGIN_MULTI_TRUE
+BUILD_PCM_PLUGIN_MULTI_FALSE
+BUILD_PCM_PLUGIN_SHM_TRUE
+BUILD_PCM_PLUGIN_SHM_FALSE
+BUILD_PCM_PLUGIN_FILE_TRUE
+BUILD_PCM_PLUGIN_FILE_FALSE
+BUILD_PCM_PLUGIN_NULL_TRUE
+BUILD_PCM_PLUGIN_NULL_FALSE
+BUILD_PCM_PLUGIN_EMPTY_TRUE
+BUILD_PCM_PLUGIN_EMPTY_FALSE
+BUILD_PCM_PLUGIN_SHARE_TRUE
+BUILD_PCM_PLUGIN_SHARE_FALSE
+BUILD_PCM_PLUGIN_METER_TRUE
+BUILD_PCM_PLUGIN_METER_FALSE
+BUILD_PCM_PLUGIN_HOOKS_TRUE
+BUILD_PCM_PLUGIN_HOOKS_FALSE
+BUILD_PCM_PLUGIN_LFLOAT_TRUE
+BUILD_PCM_PLUGIN_LFLOAT_FALSE
+BUILD_PCM_PLUGIN_LADSPA_TRUE
+BUILD_PCM_PLUGIN_LADSPA_FALSE
+BUILD_PCM_PLUGIN_DMIX_TRUE
+BUILD_PCM_PLUGIN_DMIX_FALSE
+BUILD_PCM_PLUGIN_DSHARE_TRUE
+BUILD_PCM_PLUGIN_DSHARE_FALSE
+BUILD_PCM_PLUGIN_DSNOOP_TRUE
+BUILD_PCM_PLUGIN_DSNOOP_FALSE
+BUILD_PCM_PLUGIN_ASYM_TRUE
+BUILD_PCM_PLUGIN_ASYM_FALSE
+BUILD_PCM_PLUGIN_IEC958_TRUE
+BUILD_PCM_PLUGIN_IEC958_FALSE
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE
+BUILD_PCM_PLUGIN_IOPLUG_TRUE
+BUILD_PCM_PLUGIN_IOPLUG_FALSE
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE
+BUILD_CTL_PLUGIN_TRUE
+BUILD_CTL_PLUGIN_FALSE
+BUILD_CTL_PLUGIN_SHM_TRUE
+BUILD_CTL_PLUGIN_SHM_FALSE
+BUILD_CTL_PLUGIN_EXT_TRUE
+BUILD_CTL_PLUGIN_EXT_FALSE
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval with_$ac_package=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-static[=PKGS] build static libraries [default=no]
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-symbolic-functions
+ use -Bsymbolic-functions option if available
+ (optmization for size and speed)
+ --enable-debug enable assert call at the default error message
+ handler
+ --enable-resmgr support resmgr (optional)
+ --disable-aload disable reading /dev/aload*
+ --disable-mixer disable the mixer component
+ --disable-pcm disable the PCM component
+ --disable-rawmidi disable the raw MIDI component
+ --disable-hwdep disable the hwdep component
+ --disable-seq disable the sequencer component
+ --disable-alisp disable the alisp component
+ --disable-old-symbols disable old obsoleted symbols
+ --disable-python disable the python components
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-tags[=TAGS] include additional configurations [automatic]
+ --with-configdir=dir path where ALSA config files are stored
+ --with-plugindir=dir path where ALSA plugin files are stored
+ --with-versioned shared library will be compiled with versioned
+ symbols (default = yes)
+ --with-debug library will be compiled with asserts (default =
+ yes)
+ --with-tmpdir=directory directory to put tmp socket files (/tmp)
+ --with-softfloat do you have floating point unit on this machine?
+ (optional)
+ --with-libdl Use libdl for plugins (default = yes)
+ --with-pthread Use pthread (default = yes)
+ --with-librt Use librt for monotonic clock (default = yes)
+ --with-alsa-devdir=dir directory with ALSA device files (default /dev/snd)
+ --with-aload-devdir=dir directory with aload* device files (default /dev)
+ --with-pythonlibs=ldflags
+ specify python libraries (-lpthread -lm -ldl
+ -lpython2.4)
+ --with-pythonincludes=Cflags
+ specify python C header files
+ (-I/usr/include/python)
+ --with-pcm-plugins=<list>
+ build PCM plugins (default = all)
+ --with-ctl-plugins=<list>
+ build control plugins (default = all)
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CXXCPP C++ preprocessor
+ F77 Fortran 77 compiler command
+ FFLAGS Fortran 77 compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.60
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+case m4 in
+ [\\/]* | ?:[\\/]* ) ac_macro_dir=m4 ;;
+ *) ac_macro_dir=$srcdir/m4 ;;
+esac
+test -d "$ac_macro_dir" ||
+ { { echo "$as_me:$LINENO: error: cannot find macro directory \`m4'" >&5
+echo "$as_me: error: cannot find macro directory \`m4'" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+am__api_version="1.9"
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ SET_MAKE=
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=alsa-lib
+ VERSION=1.0.19
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+eval LIBTOOL_VERSION_INFO="2:0:0"
+
+
+if test -n "${ACLOCAL}"; then
+ INSTALL_M4_TRUE=
+ INSTALL_M4_FALSE='#'
+else
+ INSTALL_M4_TRUE='#'
+ INSTALL_M4_FALSE=
+fi
+
+
+
+
+
+if test "x$host" != "x$build" -a -z "`echo $CC | grep -e '-gcc'`";
+then
+ { echo "$as_me:$LINENO: checking for cross-compiler" >&5
+echo $ECHO_N "checking for cross-compiler... $ECHO_C" >&6; }
+
+ which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
+ which ${host_cpu}-${host_os}-gcc >/dev/null 2>&1 \
+ && CC=${host_cpu}-${host-os}-gcc
+ which ${host_cpu}-${host_vendor}-${host_os}-gcc >/dev/null 2>&1 \
+ && CC=${host_cpu}-${host_vendor}-${host_os}-gcc
+
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=no
+fi
+
+
+
+
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | kfreebsd*-gnu | dragonfly*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix3*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 4857 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_cxx_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$F77"; then
+ ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+ { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$F77" && break
+ done
+fi
+if test -z "$F77"; then
+ ac_ct_F77=$F77
+ for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_F77"; then
+ ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_F77="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_F77" && break
+done
+
+ if test "x$ac_ct_F77" = x; then
+ F77=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ F77=$ac_ct_F77
+ fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file. (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+#ifndef __GNUC__
+ choke me
+#endif
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_f77_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+ FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+ FFLAGS="-g -O2"
+ else
+ FFLAGS="-g"
+ fi
+else
+ if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+ FFLAGS="-O2"
+ else
+ FFLAGS=
+ fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDGIRSTW]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+ { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+enable_dlopen=yes
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7558: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:7562: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7826: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:7830: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works=yes
+ fi
+ else
+ lt_prog_compiler_static_works=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:7930: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:7934: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ enable_shared_with_static_runtimes=no
+ archive_cmds=
+ archive_expsym_cmds=
+ old_archive_From_new_cmds=
+ old_archive_from_expsyms_cmds=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ thread_safe_flag_spec=
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_direct=no
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ link_all_deplibs=unknown
+ hardcode_automatic=no
+ module_cmds=
+ module_expsym_cmds=
+ always_export_symbols=no
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ interix3*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ hardcode_direct=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl, iff we do not link with $LD.
+ # Luckily, gcc supports the same syntax we need for Sun Studio.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ case $wlarc in
+ '')
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ *)
+ whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ esac ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ freebsd*) # from 4.6 on
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix3*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var" || \
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+ ;;
+ *)
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ ;;
+ esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+ { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
+else
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_svld_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_dld_link=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 10382 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 10482 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler \
+ CC \
+ LD \
+ lt_prog_compiler_wl \
+ lt_prog_compiler_pic \
+ lt_prog_compiler_static \
+ lt_prog_compiler_no_builtin_flag \
+ export_dynamic_flag_spec \
+ thread_safe_flag_spec \
+ whole_archive_flag_spec \
+ enable_shared_with_static_runtimes \
+ old_archive_cmds \
+ old_archive_from_new_cmds \
+ predep_objects \
+ postdep_objects \
+ predeps \
+ postdeps \
+ compiler_lib_search_path \
+ archive_cmds \
+ archive_expsym_cmds \
+ postinstall_cmds \
+ postuninstall_cmds \
+ old_archive_from_expsyms_cmds \
+ allow_undefined_flag \
+ no_undefined_flag \
+ export_symbols_cmds \
+ hardcode_libdir_flag_spec \
+ hardcode_libdir_flag_spec_ld \
+ hardcode_libdir_separator \
+ hardcode_automatic \
+ module_cmds \
+ module_expsym_cmds \
+ lt_cv_prog_compiler_c_o \
+ exclude_expsyms \
+ include_expsyms; do
+
+ case $var in
+ old_archive_cmds | \
+ old_archive_from_new_cmds | \
+ archive_cmds | \
+ archive_expsym_cmds | \
+ module_cmds | \
+ module_expsym_cmds | \
+ old_archive_from_expsyms_cmds | \
+ export_symbols_cmds | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+ cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+ withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+ else
+ { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+ "") ;;
+ *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+ lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct_CXX=yes
+ else
+ # We have old collect2
+ hardcode_direct_CXX=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_CXX=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_CXX='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ whole_archive_flag_spec_CXX=''
+ link_all_deplibs_CXX=yes
+
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ else
+ archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ freebsd[12]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
+ ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ interix3*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+ openbsd*)
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The C++ compiler is used as linker so we must use $wl
+ # flag to pass the commands to the underlying system
+ # linker. We must also pass each convience library through
+ # to the system linker between allextract/defaultextract.
+ # The C++ compiler will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ link_all_deplibs_CXX=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ no_undefined_flag_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$compiler_lib_search_path_CXX"; then
+ compiler_lib_search_path_CXX="${prev}${p}"
+ else
+ compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$postdeps_CXX"; then
+ postdeps_CXX="${prev}${p}"
+ else
+ postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$predep_objects_CXX"; then
+ predep_objects_CXX="$p"
+ else
+ predep_objects_CXX="$predep_objects_CXX $p"
+ fi
+ else
+ if test -z "$postdep_objects_CXX"; then
+ postdep_objects_CXX="$p"
+ else
+ postdep_objects_CXX="$postdep_objects_CXX $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix3*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ predep_objects_CXX=
+ postdep_objects_CXX=
+ postdeps_CXX=
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ postdeps_CXX='-lCstd -lCrun'
+ ;;
+ esac
+ ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ fi
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | os2* | pw32*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_CXX='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ lt_prog_compiler_pic_CXX=
+ ;;
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_CXX=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix4* | aix5*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_CXX='-Bstatic'
+ else
+ lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_CXX='-qnocommon'
+ lt_prog_compiler_wl_CXX='-Wl,'
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ lt_prog_compiler_pic_CXX='+Z'
+ fi
+ ;;
+ aCC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_static_CXX='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux*)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ lt_prog_compiler_pic_CXX='-fPIC'
+ ;;
+ icpc* | ecpc*)
+ # Intel C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ lt_prog_compiler_pic_CXX='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ lt_prog_compiler_wl_CXX='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ lt_prog_compiler_wl_CXX='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_static_CXX='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ lt_prog_compiler_wl_CXX='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ lt_prog_compiler_pic_CXX='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ lt_prog_compiler_pic_CXX='-pic'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ lt_prog_compiler_pic_CXX='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ lt_prog_compiler_pic_CXX='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ lt_prog_compiler_can_build_shared_CXX=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:12850: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:12854: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works_CXX=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+ case $lt_prog_compiler_pic_CXX in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+ esac
+else
+ lt_prog_compiler_pic_CXX=
+ lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works_CXX=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works_CXX=yes
+ fi
+ else
+ lt_prog_compiler_static_works_CXX=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+ :
+else
+ lt_prog_compiler_static_CXX=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o_CXX=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:12954: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:12958: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_CXX=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix4* | aix5*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_CXX=no
+ else
+ archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ freebsd*) # from 4.6 on
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix3*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+ test -n "$runpath_var_CXX" || \
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_CXX" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_CXX \
+ CC_CXX \
+ LD_CXX \
+ lt_prog_compiler_wl_CXX \
+ lt_prog_compiler_pic_CXX \
+ lt_prog_compiler_static_CXX \
+ lt_prog_compiler_no_builtin_flag_CXX \
+ export_dynamic_flag_spec_CXX \
+ thread_safe_flag_spec_CXX \
+ whole_archive_flag_spec_CXX \
+ enable_shared_with_static_runtimes_CXX \
+ old_archive_cmds_CXX \
+ old_archive_from_new_cmds_CXX \
+ predep_objects_CXX \
+ postdep_objects_CXX \
+ predeps_CXX \
+ postdeps_CXX \
+ compiler_lib_search_path_CXX \
+ archive_cmds_CXX \
+ archive_expsym_cmds_CXX \
+ postinstall_cmds_CXX \
+ postuninstall_cmds_CXX \
+ old_archive_from_expsyms_cmds_CXX \
+ allow_undefined_flag_CXX \
+ no_undefined_flag_CXX \
+ export_symbols_cmds_CXX \
+ hardcode_libdir_flag_spec_CXX \
+ hardcode_libdir_flag_spec_ld_CXX \
+ hardcode_libdir_separator_CXX \
+ hardcode_automatic_CXX \
+ module_cmds_CXX \
+ module_expsym_cmds_CXX \
+ lt_cv_prog_compiler_c_o_CXX \
+ exclude_expsyms_CXX \
+ include_expsyms_CXX; do
+
+ case $var in
+ old_archive_cmds_CXX | \
+ old_archive_from_new_cmds_CXX | \
+ archive_cmds_CXX | \
+ archive_expsym_cmds_CXX | \
+ module_cmds_CXX | \
+ module_expsym_cmds_CXX | \
+ old_archive_from_expsyms_cmds_CXX | \
+ export_symbols_cmds_CXX | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_CXX"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code=" subroutine t\n return\n end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code=" program t\n end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_static_F77='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_F77='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_F77='-fno-common'
+ ;;
+
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared_F77=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_F77=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_F77='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_F77='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_F77='-Bstatic'
+ else
+ lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_F77='-qnocommon'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_F77='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-fpic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static_F77='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl_F77='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl_F77='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl_F77='-Qoption ld '
+ lt_prog_compiler_pic_F77='-PIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic_F77='-Kconform_pic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_can_build_shared_F77=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic_F77='-pic'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared_F77=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works_F77=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_F77"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:14524: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:14528: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works_F77=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+ case $lt_prog_compiler_pic_F77 in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+ esac
+else
+ lt_prog_compiler_pic_F77=
+ lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_F77=
+ ;;
+ *)
+ lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works_F77=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works_F77=yes
+ fi
+ else
+ lt_prog_compiler_static_works_F77=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+ :
+else
+ lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o_F77=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:14628: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:14632: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_F77=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+ runpath_var=
+ allow_undefined_flag_F77=
+ enable_shared_with_static_runtimes_F77=no
+ archive_cmds_F77=
+ archive_expsym_cmds_F77=
+ old_archive_From_new_cmds_F77=
+ old_archive_from_expsyms_cmds_F77=
+ export_dynamic_flag_spec_F77=
+ whole_archive_flag_spec_F77=
+ thread_safe_flag_spec_F77=
+ hardcode_libdir_flag_spec_F77=
+ hardcode_libdir_flag_spec_ld_F77=
+ hardcode_libdir_separator_F77=
+ hardcode_direct_F77=no
+ hardcode_minus_L_F77=no
+ hardcode_shlibpath_var_F77=unsupported
+ link_all_deplibs_F77=unknown
+ hardcode_automatic_F77=no
+ module_cmds_F77=
+ module_expsym_cmds_F77=
+ always_export_symbols_F77=no
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms_F77=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs_F77=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_F77=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_F77=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_F77=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_F77=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ allow_undefined_flag_F77=unsupported
+ always_export_symbols_F77=no
+ enable_shared_with_static_runtimes_F77=yes
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ interix3*)
+ hardcode_direct_F77=no
+ hardcode_shlibpath_var_F77=no
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_F77='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs_F77=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs_F77=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_F77=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs_F77" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec_F77=
+ export_dynamic_flag_spec_F77=
+ whole_archive_flag_spec_F77=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag_F77=unsupported
+ always_export_symbols_F77=yes
+ archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L_F77=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct_F77=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_F77=''
+ hardcode_direct_F77=yes
+ hardcode_libdir_separator_F77=':'
+ link_all_deplibs_F77=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct_F77=yes
+ else
+ # We have old collect2
+ hardcode_direct_F77=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_F77=yes
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_libdir_separator_F77=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_F77=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_F77='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_F77="-z nodefs"
+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_F77=' ${wl}-bernotok'
+ allow_undefined_flag_F77=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_F77='$convenience'
+ archive_cmds_need_lc_F77=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_F77=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec_F77=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec_F77=' '
+ allow_undefined_flag_F77=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds_F77='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_F77=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_F77=no
+ hardcode_direct_F77=no
+ hardcode_automatic_F77=yes
+ hardcode_shlibpath_var_F77=unsupported
+ whole_archive_flag_spec_F77=''
+ link_all_deplibs_F77=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs_F77=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes
+ hardcode_minus_L_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ hardcode_direct_F77=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+
+ hardcode_direct_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+ hardcode_direct_F77=no
+ hardcode_shlibpath_var_F77=no
+ ;;
+ *)
+ hardcode_direct_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_F77=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ link_all_deplibs_F77=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ newsos6)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ openbsd*)
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_F77='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ ;;
+ *)
+ archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_minus_L_F77=yes
+ allow_undefined_flag_F77=unsupported
+ archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag_F77=' -expect_unresolved \*'
+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag_F77=' -expect_unresolved \*'
+ archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec_F77='-rpath $libdir'
+ fi
+ hardcode_libdir_separator_F77=:
+ ;;
+
+ solaris*)
+ no_undefined_flag_F77=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec_F77='-R$libdir'
+ hardcode_shlibpath_var_F77=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl, iff we do not link with $LD.
+ # Luckily, gcc supports the same syntax we need for Sun Studio.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ case $wlarc in
+ '')
+ whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+ *)
+ whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ esac ;;
+ esac
+ link_all_deplibs_F77=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_direct_F77=yes
+ hardcode_minus_L_F77=yes
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds_F77='$CC -r -o $output$reload_objs'
+ hardcode_direct_F77=no
+ ;;
+ motorola)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_F77=no
+ export_dynamic_flag_spec_F77='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_F77=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs_F77=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ no_undefined_flag_F77='${wl}-z,text'
+ archive_cmds_need_lc_F77=no
+ hardcode_shlibpath_var_F77=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag_F77='${wl}-z,text'
+ allow_undefined_flag_F77='${wl}-z,nodefs'
+ archive_cmds_need_lc_F77=no
+ hardcode_shlibpath_var_F77=no
+ hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_F77=':'
+ link_all_deplibs_F77=yes
+ export_dynamic_flag_spec_F77='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ hardcode_shlibpath_var_F77=no
+ ;;
+
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_F77=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_F77 in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_F77
+ pic_flag=$lt_prog_compiler_pic_F77
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+ allow_undefined_flag_F77=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_F77=no
+ else
+ archive_cmds_need_lc_F77=yes
+ fi
+ allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ freebsd*) # from 4.6 on
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix3*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+ test -n "$runpath_var_F77" || \
+ test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_F77" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+ test "$hardcode_minus_L_F77" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_F77=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_F77=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_F77 \
+ CC_F77 \
+ LD_F77 \
+ lt_prog_compiler_wl_F77 \
+ lt_prog_compiler_pic_F77 \
+ lt_prog_compiler_static_F77 \
+ lt_prog_compiler_no_builtin_flag_F77 \
+ export_dynamic_flag_spec_F77 \
+ thread_safe_flag_spec_F77 \
+ whole_archive_flag_spec_F77 \
+ enable_shared_with_static_runtimes_F77 \
+ old_archive_cmds_F77 \
+ old_archive_from_new_cmds_F77 \
+ predep_objects_F77 \
+ postdep_objects_F77 \
+ predeps_F77 \
+ postdeps_F77 \
+ compiler_lib_search_path_F77 \
+ archive_cmds_F77 \
+ archive_expsym_cmds_F77 \
+ postinstall_cmds_F77 \
+ postuninstall_cmds_F77 \
+ old_archive_from_expsyms_cmds_F77 \
+ allow_undefined_flag_F77 \
+ no_undefined_flag_F77 \
+ export_symbols_cmds_F77 \
+ hardcode_libdir_flag_spec_F77 \
+ hardcode_libdir_flag_spec_ld_F77 \
+ hardcode_libdir_separator_F77 \
+ hardcode_automatic_F77 \
+ module_cmds_F77 \
+ module_expsym_cmds_F77 \
+ lt_cv_prog_compiler_c_o_F77 \
+ exclude_expsyms_F77 \
+ include_expsyms_F77; do
+
+ case $var in
+ old_archive_cmds_F77 | \
+ old_archive_from_new_cmds_F77 | \
+ archive_cmds_F77 | \
+ archive_expsym_cmds_F77 | \
+ module_cmds_F77 | \
+ module_expsym_cmds_F77 | \
+ old_archive_from_expsyms_cmds_F77 | \
+ export_symbols_cmds_F77 | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_F77"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:16858: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:16862: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_static_GCJ='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_GCJ='-fno-common'
+ ;;
+
+ interix3*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared_GCJ=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_GCJ=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_GCJ='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ else
+ lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_GCJ='-qnocommon'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-fpic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl_GCJ='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld '
+ lt_prog_compiler_pic_GCJ='-PIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic_GCJ='-Kconform_pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic_GCJ='-pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works_GCJ=no
+ ac_outfile=conftest.$ac_objext
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:17126: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:17130: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works_GCJ=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+ case $lt_prog_compiler_pic_GCJ in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+ esac
+else
+ lt_prog_compiler_pic_GCJ=
+ lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_GCJ=
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+ ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works_GCJ=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ printf "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works_GCJ=yes
+ fi
+ else
+ lt_prog_compiler_static_works_GCJ=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+ :
+else
+ lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o_GCJ=no
+ $rm -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:17230: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:17234: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o_GCJ=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+ runpath_var=
+ allow_undefined_flag_GCJ=
+ enable_shared_with_static_runtimes_GCJ=no
+ archive_cmds_GCJ=
+ archive_expsym_cmds_GCJ=
+ old_archive_From_new_cmds_GCJ=
+ old_archive_from_expsyms_cmds_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ thread_safe_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_ld_GCJ=
+ hardcode_libdir_separator_GCJ=
+ hardcode_direct_GCJ=no
+ hardcode_minus_L_GCJ=no
+ hardcode_shlibpath_var_GCJ=unsupported
+ link_all_deplibs_GCJ=unknown
+ hardcode_automatic_GCJ=no
+ module_cmds_GCJ=
+ module_expsym_cmds_GCJ=
+ always_export_symbols_GCJ=no
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms_GCJ=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs_GCJ=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_GCJ=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_GCJ=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_GCJ=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=no
+ enable_shared_with_static_runtimes_GCJ=yes
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ interix3*)
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ $echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs_GCJ=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs_GCJ=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs_GCJ" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=yes
+ archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L_GCJ=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct_GCJ=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds_GCJ=''
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct_GCJ=yes
+ else
+ # We have old collect2
+ hardcode_direct_GCJ=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_libdir_separator_GCJ=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols_GCJ=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag_GCJ='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_GCJ="-z nodefs"
+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`; fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag_GCJ=' ${wl}-bernotok'
+ allow_undefined_flag_GCJ=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_GCJ='$convenience'
+ archive_cmds_need_lc_GCJ=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_GCJ=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec_GCJ=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec_GCJ=' '
+ allow_undefined_flag_GCJ=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds_GCJ='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_GCJ=yes
+ ;;
+
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_GCJ=no
+ hardcode_direct_GCJ=no
+ hardcode_automatic_GCJ=yes
+ hardcode_shlibpath_var_GCJ=unsupported
+ whole_archive_flag_spec_GCJ=''
+ link_all_deplibs_GCJ=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs_GCJ=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_direct_GCJ=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ *)
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ link_all_deplibs_GCJ=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ newsos6)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ openbsd*)
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ allow_undefined_flag_GCJ=unsupported
+ archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_separator_GCJ=:
+ ;;
+
+ solaris*)
+ no_undefined_flag_GCJ=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine linker options so we
+ # cannot just pass the convience library names through
+ # without $wl, iff we do not link with $LD.
+ # Luckily, gcc supports the same syntax we need for Sun Studio.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ case $wlarc in
+ '')
+ whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+ *)
+ whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ esac ;;
+ esac
+ link_all_deplibs_GCJ=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+ hardcode_direct_GCJ=no
+ ;;
+ motorola)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ export_dynamic_flag_spec_GCJ='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs_GCJ=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ no_undefined_flag_GCJ='${wl}-z,text'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag_GCJ='${wl}-z,text'
+ allow_undefined_flag_GCJ='${wl}-z,nodefs'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_GCJ=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_GCJ in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_GCJ
+ pic_flag=$lt_prog_compiler_pic_GCJ
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+ allow_undefined_flag_GCJ=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_GCJ=no
+ else
+ archive_cmds_need_lc_GCJ=yes
+ fi
+ allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+ if test "$GCC" = yes; then
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+ else
+ sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+ fi
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+kfreebsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ freebsd*) # from 4.6 on
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix3*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+knetbsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+nto-qnx*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+ test -n "$runpath_var_GCJ" || \
+ test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_GCJ" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+ test "$hardcode_minus_L_GCJ" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_GCJ=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_GCJ=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_GCJ \
+ CC_GCJ \
+ LD_GCJ \
+ lt_prog_compiler_wl_GCJ \
+ lt_prog_compiler_pic_GCJ \
+ lt_prog_compiler_static_GCJ \
+ lt_prog_compiler_no_builtin_flag_GCJ \
+ export_dynamic_flag_spec_GCJ \
+ thread_safe_flag_spec_GCJ \
+ whole_archive_flag_spec_GCJ \
+ enable_shared_with_static_runtimes_GCJ \
+ old_archive_cmds_GCJ \
+ old_archive_from_new_cmds_GCJ \
+ predep_objects_GCJ \
+ postdep_objects_GCJ \
+ predeps_GCJ \
+ postdeps_GCJ \
+ compiler_lib_search_path_GCJ \
+ archive_cmds_GCJ \
+ archive_expsym_cmds_GCJ \
+ postinstall_cmds_GCJ \
+ postuninstall_cmds_GCJ \
+ old_archive_from_expsyms_cmds_GCJ \
+ allow_undefined_flag_GCJ \
+ no_undefined_flag_GCJ \
+ export_symbols_cmds_GCJ \
+ hardcode_libdir_flag_spec_GCJ \
+ hardcode_libdir_flag_spec_ld_GCJ \
+ hardcode_libdir_separator_GCJ \
+ hardcode_automatic_GCJ \
+ module_cmds_GCJ \
+ module_expsym_cmds_GCJ \
+ lt_cv_prog_compiler_c_o_GCJ \
+ exclude_expsyms_GCJ \
+ include_expsyms_GCJ; do
+
+ case $var in
+ old_archive_cmds_GCJ | \
+ old_archive_from_new_cmds_GCJ | \
+ archive_cmds_GCJ | \
+ archive_expsym_cmds_GCJ | \
+ module_cmds_GCJ | \
+ module_expsym_cmds_GCJ | \
+ old_archive_from_expsyms_cmds_GCJ | \
+ export_symbols_cmds_GCJ | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_GCJ"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_RC \
+ CC_RC \
+ LD_RC \
+ lt_prog_compiler_wl_RC \
+ lt_prog_compiler_pic_RC \
+ lt_prog_compiler_static_RC \
+ lt_prog_compiler_no_builtin_flag_RC \
+ export_dynamic_flag_spec_RC \
+ thread_safe_flag_spec_RC \
+ whole_archive_flag_spec_RC \
+ enable_shared_with_static_runtimes_RC \
+ old_archive_cmds_RC \
+ old_archive_from_new_cmds_RC \
+ predep_objects_RC \
+ postdep_objects_RC \
+ predeps_RC \
+ postdeps_RC \
+ compiler_lib_search_path_RC \
+ archive_cmds_RC \
+ archive_expsym_cmds_RC \
+ postinstall_cmds_RC \
+ postuninstall_cmds_RC \
+ old_archive_from_expsyms_cmds_RC \
+ allow_undefined_flag_RC \
+ no_undefined_flag_RC \
+ export_symbols_cmds_RC \
+ hardcode_libdir_flag_spec_RC \
+ hardcode_libdir_flag_spec_ld_RC \
+ hardcode_libdir_separator_RC \
+ hardcode_automatic_RC \
+ module_cmds_RC \
+ module_expsym_cmds_RC \
+ lt_cv_prog_compiler_c_o_RC \
+ exclude_expsyms_RC \
+ include_expsyms_RC; do
+
+ case $var in
+ old_archive_cmds_RC | \
+ old_archive_from_new_cmds_RC | \
+ archive_cmds_RC | \
+ archive_expsym_cmds_RC | \
+ module_cmds_RC | \
+ module_expsym_cmds_RC | \
+ old_archive_from_expsyms_cmds_RC | \
+ export_symbols_cmds_RC | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_RC"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+ ;;
+
+ *)
+ { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CC_NOUNDEFINED
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+ac_config_headers="$ac_config_headers include/config.h"
+
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !x[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_inline=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+if test $ac_cv_c_compiler_gnu = yes; then
+ { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; }
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; }
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+{ echo "$as_me:$LINENO: checking for hsearch_r" >&5
+echo $ECHO_N "checking for hsearch_r... $ECHO_C" >&6; }
+if test "${ac_cv_func_hsearch_r+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define hsearch_r to an innocuous variant, in case <limits.h> declares hsearch_r.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define hsearch_r innocuous_hsearch_r
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char hsearch_r (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef hsearch_r
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char hsearch_r ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_hsearch_r || defined __stub___hsearch_r
+choke me
+#endif
+
+int
+main ()
+{
+return hsearch_r ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_hsearch_r=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_hsearch_r=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_hsearch_r" >&5
+echo "${ECHO_T}$ac_cv_func_hsearch_r" >&6; }
+if test $ac_cv_func_hsearch_r = yes; then
+ HAVE_HSEARCH_R=yes
+fi
+
+
+
+if test "x$HAVE_HSEARCH_R" != xyes; then
+ ALSA_HSEARCH_R_TRUE=
+ ALSA_HSEARCH_R_FALSE='#'
+else
+ ALSA_HSEARCH_R_TRUE='#'
+ ALSA_HSEARCH_R_FALSE=
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking for library version" >&5
+echo $ECHO_N "checking for library version... $ECHO_C" >&6; }
+SND_LIB_VERSION=$VERSION
+echo $VERSION > $srcdir/version
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$SND_LIB_VERSION"
+_ACEOF
+
+
+SND_LIB_MAJOR=`echo $VERSION | cut -d . -f 1`
+
+SND_LIB_MINOR=`echo $VERSION | cut -d . -f 2`
+
+SND_LIB_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([^[:alpha:]]*\)\(.*\)$/\1/g'`
+
+SND_LIB_EXTRASTR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([^[:alpha:]]*\)\([[:alpha:]]*\)\([[:digit:]]*\)\(.*\)$/\2/g'`
+SND_LIB_EXTRAVER=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([^[:alpha:]]*\)\([[:alpha:]]*\)\([[:digit:]]*\)\(.*\)$/\3/g'`
+case "$SND_LIB_EXTRASTR" in
+ pre) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 00000` ;;
+ alpha) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 10000` ;;
+ beta) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 20000` ;;
+ rc) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 100000` ;;
+ *) SND_LIB_EXTRAVER=1000000 ;;
+esac
+{ echo "$as_me:$LINENO: result: major $SND_LIB_MAJOR minor $SND_LIB_MINOR subminor $SND_LIB_SUBMINOR extrastr $SND_LIB_EXTRASTR extraver $SND_LIB_EXTRAVER" >&5
+echo "${ECHO_T}major $SND_LIB_MAJOR minor $SND_LIB_MINOR subminor $SND_LIB_SUBMINOR extrastr $SND_LIB_EXTRASTR extraver $SND_LIB_EXTRAVER" >&6; }
+
+
+
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+
+
+# Check whether --with-configdir was given.
+if test "${with_configdir+set}" = set; then
+ withval=$with_configdir; confdir="$withval"
+else
+ confdir=""
+fi
+
+if test -z "$confdir"; then
+ eval dir="$datadir"
+ case "$dir" in
+ /*) ;;
+ *) dir="$prefix/share"
+ esac
+ confdir="$dir/alsa"
+fi
+ALSA_CONFIG_DIR="$confdir"
+
+cat >>confdefs.h <<_ACEOF
+#define ALSA_CONFIG_DIR "$confdir"
+_ACEOF
+
+
+
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+
+
+# Check whether --with-plugindir was given.
+if test "${with_plugindir+set}" = set; then
+ withval=$with_plugindir; plugindir="$withval"
+else
+ plugindir=""
+fi
+
+if test -z "$plugindir"; then
+ eval dir="$libdir"
+ case "$dir" in
+ /*) ;;
+ *) dir="$dir"
+ esac
+ plugindir="$dir/$PACKAGE"
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define ALSA_PLUGIN_DIR "$plugindir"
+_ACEOF
+
+ALSA_PLUGIN_DIR="$plugindir"
+
+
+{ echo "$as_me:$LINENO: checking for versioned symbols" >&5
+echo $ECHO_N "checking for versioned symbols... $ECHO_C" >&6; }
+
+# Check whether --with-versioned was given.
+if test "${with_versioned+set}" = set; then
+ withval=$with_versioned; versioned="$withval"
+else
+ versioned="yes"
+fi
+
+if test "$versioned" = "yes"; then
+ # it seems that GNU ld versions since 2.10 are not broken
+ xres=`grep '^VERSION=' libtool | cut -d = -f 2 | cut -d \" -f 2`
+ major=`echo $xres | cut -d . -f 1`
+ minor=`echo $xres | cut -d . -f 2`
+ pass=0
+ if test $major -eq 1 -a $minor -gt 3; then
+ pass=1
+ else
+ if test $major -gt 1; then
+ pass=1
+ fi
+ fi
+ if test $pass -eq 1; then
+
+cat >>confdefs.h <<\_ACEOF
+#define VERSIONED_SYMBOLS
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ else
+ { echo "$as_me:$LINENO: result: broken libtool - use libtool v1.4+; no versions" >&5
+echo "${ECHO_T}broken libtool - use libtool v1.4+; no versions" >&6; }
+ fi
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test x$versioned = xyes; then
+ VERSIONED_SYMBOLS_TRUE=
+ VERSIONED_SYMBOLS_FALSE='#'
+else
+ VERSIONED_SYMBOLS_TRUE='#'
+ VERSIONED_SYMBOLS_FALSE=
+fi
+
+
+{ echo "$as_me:$LINENO: checking for symbolic-functions" >&5
+echo $ECHO_N "checking for symbolic-functions... $ECHO_C" >&6; }
+# Check whether --enable-symbolic-functions was given.
+if test "${enable_symbolic_functions+set}" = set; then
+ enableval=$enable_symbolic_functions; symfuncs="$enableval"
+else
+ symfuncs="no"
+fi
+
+if test "$symfuncs" = "yes"; then
+ if ld --help | grep -q -- '-Bsymbolic-functions'; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ else
+ { echo "$as_me:$LINENO: result: not supported by ld" >&5
+echo "${ECHO_T}not supported by ld" >&6; }
+ symfuncs="no"
+ fi
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test x"$symfuncs" = xyes; then
+ SYMBOLIC_FUNCTIONS_TRUE=
+ SYMBOLIC_FUNCTIONS_FALSE='#'
+else
+ SYMBOLIC_FUNCTIONS_TRUE='#'
+ SYMBOLIC_FUNCTIONS_FALSE=
+fi
+
+
+{ echo "$as_me:$LINENO: checking for custom symbol prefixes" >&5
+echo $ECHO_N "checking for custom symbol prefixes... $ECHO_C" >&6; }
+SYMBOL_PREFIX=` \
+ echo "PREFIX=__USER_LABEL_PREFIX__" \
+ | ${CPP-${CC-gcc} -E} - 2>&1 \
+ | ${EGREP-grep} "^PREFIX=" \
+ | ${SED-sed} "s:^PREFIX=::"`
+
+cat >>confdefs.h <<_ACEOF
+#define __SYMBOL_PREFIX "$SYMBOL_PREFIX"
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: result: $SYMBOL_PREFIX" >&5
+echo "${ECHO_T}$SYMBOL_PREFIX" >&6; }
+
+{ echo "$as_me:$LINENO: checking for debug" >&5
+echo $ECHO_N "checking for debug... $ECHO_C" >&6; }
+
+# Check whether --with-debug was given.
+if test "${with_debug+set}" = set; then
+ withval=$with_debug; debug="$withval"
+else
+ debug="yes"
+fi
+
+if test "$debug" = "yes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define NDEBUG
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test "$debug" = "yes"; then
+ { echo "$as_me:$LINENO: checking for debug assert" >&5
+echo $ECHO_N "checking for debug assert... $ECHO_C" >&6; }
+ # Check whether --enable-debug-assert was given.
+if test "${enable_debug_assert+set}" = set; then
+ enableval=$enable_debug_assert; debug_assert="$enableval"
+else
+ debug_assert="no"
+fi
+
+ if test "$debug_assert" = "yes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define ALSA_DEBUG_ASSERT
+_ACEOF
+
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ fi
+fi
+
+{ echo "$as_me:$LINENO: checking for tmpdir" >&5
+echo $ECHO_N "checking for tmpdir... $ECHO_C" >&6; }
+
+# Check whether --with-tmpdir was given.
+if test "${with_tmpdir+set}" = set; then
+ withval=$with_tmpdir; tmpdir="$withval"
+else
+ tmpdir="/tmp"
+fi
+
+{ echo "$as_me:$LINENO: result: $tmpdir" >&5
+echo "${ECHO_T}$tmpdir" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define TMPDIR "$tmpdir"
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking for softfloat" >&5
+echo $ECHO_N "checking for softfloat... $ECHO_C" >&6; }
+
+# Check whether --with-softfloat was given.
+if test "${with_softfloat+set}" = set; then
+ withval=$with_softfloat;
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SOFT_FLOAT "1"
+_ACEOF
+
+ softfloat=yes
+fi
+
+if test "$softfloat" = "yes" ; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ALSA_DEPLIBS=""
+if test "$softfloat" != "yes"; then
+ ALSA_DEPLIBS="-lm"
+fi
+
+{ echo "$as_me:$LINENO: checking for libdl" >&5
+echo $ECHO_N "checking for libdl... $ECHO_C" >&6; }
+
+# Check whether --with-libdl was given.
+if test "${with_libdl+set}" = set; then
+ withval=$with_libdl; have_libdl="$withval"
+else
+ have_libdl="yes"
+fi
+
+if test "$have_libdl" = "yes"; then
+ { echo "$as_me:$LINENO: checking for dlsym in -ldl" >&5
+echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlsym+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlsym ();
+int
+main ()
+{
+return dlsym ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlsym=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlsym=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlsym" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6; }
+if test $ac_cv_lib_dl_dlsym = yes; then
+ HAVE_LIBDL="yes"
+fi
+
+ if test "$HAVE_LIBDL" = "yes" ; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ fi
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+if test "$HAVE_LIBDL"="yes"; then
+ BUILD_MODULES_TRUE=
+ BUILD_MODULES_FALSE='#'
+else
+ BUILD_MODULES_TRUE='#'
+ BUILD_MODULES_FALSE=
+fi
+
+
+{ echo "$as_me:$LINENO: checking for pthread" >&5
+echo $ECHO_N "checking for pthread... $ECHO_C" >&6; }
+
+# Check whether --with-pthread was given.
+if test "${with_pthread+set}" = set; then
+ withval=$with_pthread; have_pthread="$withval"
+else
+ have_pthread="yes"
+fi
+
+if test "$have_pthread" = "yes"; then
+ { echo "$as_me:$LINENO: checking for pthread_join in -lpthread" >&5
+echo $ECHO_N "checking for pthread_join in -lpthread... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pthread_pthread_join+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_join ();
+int
+main ()
+{
+return pthread_join ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pthread_pthread_join=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_pthread_pthread_join=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_join" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_join" >&6; }
+if test $ac_cv_lib_pthread_pthread_join = yes; then
+ HAVE_LIBPTHREAD="yes"
+fi
+
+ if test "$HAVE_LIBPTHREAD" = "yes"; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+ fi
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for librt" >&5
+echo $ECHO_N "checking for librt... $ECHO_C" >&6; }
+
+# Check whether --with-librt was given.
+if test "${with_librt+set}" = set; then
+ withval=$with_librt; have_librt="$withval"
+else
+ have_librt="yes"
+fi
+
+if test "$have_librt" = "yes"; then
+ { echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5
+echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6; }
+if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_rt_clock_gettime=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_rt_clock_gettime=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
+echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6; }
+if test $ac_cv_lib_rt_clock_gettime = yes; then
+ HAVE_LIBRT="yes"
+fi
+
+ if test "$HAVE_LIBRT" = "yes" ; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBRT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CLOCK_GETTIME 1
+_ACEOF
+
+ fi
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking for architecture" >&5
+echo $ECHO_N "checking for architecture... $ECHO_C" >&6; }
+case "$host" in
+i?86*)
+ { echo "$as_me:$LINENO: result: x86" >&5
+echo "${ECHO_T}x86" >&6; }
+ ;;
+x86_64*)
+ { echo "$as_me:$LINENO: result: x86" >&5
+echo "${ECHO_T}x86" >&6; }
+ ;;
+alpha*)
+ { echo "$as_me:$LINENO: result: alpha" >&5
+echo "${ECHO_T}alpha" >&6; }
+ ;;
+powerpc*|ppc*)
+ { echo "$as_me:$LINENO: result: ppc" >&5
+echo "${ECHO_T}ppc" >&6; }
+ CPPFLAGS="$CPPFLAGS -D__ppc__"
+ ;;
+ia64*)
+ { echo "$as_me:$LINENO: result: ia64" >&5
+echo "${ECHO_T}ia64" >&6; }
+ CPPFLAGS="$CPPFLAGS -D__ia64__"
+ ;;
+mips*)
+ { echo "$as_me:$LINENO: result: mips" >&5
+echo "${ECHO_T}mips" >&6; }
+ CPPFLAGS="$CPPFLAGS -D__mips__"
+ ;;
+arm*)
+ { echo "$as_me:$LINENO: result: arm" >&5
+echo "${ECHO_T}arm" >&6; }
+ CPPFLAGS="$CPPFLAGS -D__arm__"
+ ;;
+*)
+ { echo "$as_me:$LINENO: result: $host_cpu" >&5
+echo "${ECHO_T}$host_cpu" >&6; }
+ echo "No atomic operations supported.."
+ ;;
+esac
+
+
+for ac_header in wordexp.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for resmgr support" >&5
+echo $ECHO_N "checking for resmgr support... $ECHO_C" >&6; }
+# Check whether --enable-resmgr was given.
+if test "${enable_resmgr+set}" = set; then
+ enableval=$enable_resmgr; resmgr="$enableval"
+else
+ resmgr="no"
+fi
+
+{ echo "$as_me:$LINENO: result: $resmgr" >&5
+echo "${ECHO_T}$resmgr" >&6; }
+if test "$resmgr" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking for rsm_open_device in -lresmgr" >&5
+echo $ECHO_N "checking for rsm_open_device in -lresmgr... $ECHO_C" >&6; }
+if test "${ac_cv_lib_resmgr_rsm_open_device+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresmgr $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char rsm_open_device ();
+int
+main ()
+{
+return rsm_open_device ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_resmgr_rsm_open_device=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_resmgr_rsm_open_device=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_resmgr_rsm_open_device" >&5
+echo "${ECHO_T}$ac_cv_lib_resmgr_rsm_open_device" >&6; }
+if test $ac_cv_lib_resmgr_rsm_open_device = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBRESMGR 1
+_ACEOF
+
+ LIBS="-lresmgr $LIBS"
+
+else
+ { { echo "$as_me:$LINENO: error: Cannot find libresmgr" >&5
+echo "$as_me: error: Cannot find libresmgr" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SUPPORT_RESMGR "1"
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for aload* support" >&5
+echo $ECHO_N "checking for aload* support... $ECHO_C" >&6; }
+# Check whether --enable-aload was given.
+if test "${enable_aload+set}" = set; then
+ enableval=$enable_aload; aload="$enableval"
+else
+ aload="yes"
+fi
+
+{ echo "$as_me:$LINENO: result: $aload" >&5
+echo "${ECHO_T}$aload" >&6; }
+if test "$aload" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SUPPORT_ALOAD "1"
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for ALSA device file directory" >&5
+echo $ECHO_N "checking for ALSA device file directory... $ECHO_C" >&6; }
+
+# Check whether --with-alsa-devdir was given.
+if test "${with_alsa_devdir+set}" = set; then
+ withval=$with_alsa_devdir; alsa_dev_dir="$withval"
+else
+ alsa_dev_dir="/dev/snd"
+fi
+
+if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then
+ alsa_dev_dir="$alsa_dev_dir/"
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define ALSA_DEVICE_DIRECTORY "$alsa_dev_dir"
+_ACEOF
+
+{ echo "$as_me:$LINENO: result: $alsa_dev_dir" >&5
+echo "${ECHO_T}$alsa_dev_dir" >&6; }
+
+{ echo "$as_me:$LINENO: checking for aload* device file directory" >&5
+echo $ECHO_N "checking for aload* device file directory... $ECHO_C" >&6; }
+
+# Check whether --with-aload-devdir was given.
+if test "${with_aload_devdir+set}" = set; then
+ withval=$with_aload_devdir; aload_dev_dir="$withval"
+else
+ aload_dev_dir="/dev"
+fi
+
+if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then
+ aload_dev_dir="$aload_dev_dir/"
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define ALOAD_DEVICE_DIRECTORY "$aload_dev_dir"
+_ACEOF
+
+{ echo "$as_me:$LINENO: result: $aload_dev_dir" >&5
+echo "${ECHO_T}$aload_dev_dir" >&6; }
+
+# Check whether --enable-mixer was given.
+if test "${enable_mixer+set}" = set; then
+ enableval=$enable_mixer; build_mixer="$enableval"
+else
+ build_mixer="yes"
+fi
+
+# Check whether --enable-pcm was given.
+if test "${enable_pcm+set}" = set; then
+ enableval=$enable_pcm; build_pcm="$enableval"
+else
+ build_pcm="yes"
+fi
+
+# Check whether --enable-rawmidi was given.
+if test "${enable_rawmidi+set}" = set; then
+ enableval=$enable_rawmidi; build_rawmidi="$enableval"
+else
+ build_rawmidi="yes"
+fi
+
+# Check whether --enable-hwdep was given.
+if test "${enable_hwdep+set}" = set; then
+ enableval=$enable_hwdep; build_hwdep="$enableval"
+else
+ build_hwdep="yes"
+fi
+
+# Check whether --enable-seq was given.
+if test "${enable_seq+set}" = set; then
+ enableval=$enable_seq; build_seq="$enableval"
+else
+ build_seq="yes"
+fi
+
+# Check whether --enable-alisp was given.
+if test "${enable_alisp+set}" = set; then
+ enableval=$enable_alisp; build_alisp="$enableval"
+else
+ build_alisp="yes"
+fi
+
+# Check whether --enable-old-symbols was given.
+if test "${enable_old_symbols+set}" = set; then
+ enableval=$enable_old_symbols; keep_old_symbols="$enableval"
+else
+ keep_old_symbols="yes"
+fi
+
+
+
+if test x$keep_old_symbols = xyes; then
+ KEEP_OLD_SYMBOLS_TRUE=
+ KEEP_OLD_SYMBOLS_FALSE='#'
+else
+ KEEP_OLD_SYMBOLS_TRUE='#'
+ KEEP_OLD_SYMBOLS_FALSE=
+fi
+
+
+# Check whether --enable-python was given.
+if test "${enable_python+set}" = set; then
+ enableval=$enable_python; build_python="$enableval"
+else
+ build_python="yes"
+fi
+
+PYTHON_LIBS=""
+PYTHON_INCLUDES=""
+if test "$build_python" = "yes"; then
+
+# Check whether --with-pythonlibs was given.
+if test "${with_pythonlibs+set}" = set; then
+ withval=$with_pythonlibs; pythonlibs="$withval"
+else
+ pythonlibs=`python-config --libs`
+fi
+
+
+# Check whether --with-pythonincludes was given.
+if test "${with_pythonincludes+set}" = set; then
+ withval=$with_pythonincludes; pythonincludes="$withval"
+else
+ pythonincludes=`python-config --includes`
+fi
+
+ if test -z "$pythonlibs"; then
+ echo "Unable to determine python libraries! Probably python-config is not"
+ echo "available on this system. Please, use --with-pythonlibs and"
+ echo "--with-pythonincludes options. Python components are disabled in this build."
+ build_python="no"
+ else
+ PYTHON_LIBS="$pythonlibs"
+ PYTHON_INCLUDES="$pythonincludes"
+ fi
+fi
+
+
+
+
+
+if test x$build_mixer = xyes; then
+ BUILD_MIXER_TRUE=
+ BUILD_MIXER_FALSE='#'
+else
+ BUILD_MIXER_TRUE='#'
+ BUILD_MIXER_FALSE=
+fi
+
+
+
+if test x$build_pcm = xyes; then
+ BUILD_PCM_TRUE=
+ BUILD_PCM_FALSE='#'
+else
+ BUILD_PCM_TRUE='#'
+ BUILD_PCM_FALSE=
+fi
+
+
+
+if test x$build_rawmidi = xyes; then
+ BUILD_RAWMIDI_TRUE=
+ BUILD_RAWMIDI_FALSE='#'
+else
+ BUILD_RAWMIDI_TRUE='#'
+ BUILD_RAWMIDI_FALSE=
+fi
+
+
+
+if test x$build_hwdep = xyes; then
+ BUILD_HWDEP_TRUE=
+ BUILD_HWDEP_FALSE='#'
+else
+ BUILD_HWDEP_TRUE='#'
+ BUILD_HWDEP_FALSE=
+fi
+
+
+
+if test x$build_seq = xyes; then
+ BUILD_SEQ_TRUE=
+ BUILD_SEQ_FALSE='#'
+else
+ BUILD_SEQ_TRUE='#'
+ BUILD_SEQ_FALSE=
+fi
+
+
+
+if test x$build_alisp = xyes; then
+ BUILD_ALISP_TRUE=
+ BUILD_ALISP_FALSE='#'
+else
+ BUILD_ALISP_TRUE='#'
+ BUILD_ALISP_FALSE=
+fi
+
+
+
+if test x$build_python = xyes; then
+ BUILD_PYTHON_TRUE=
+ BUILD_PYTHON_FALSE='#'
+else
+ BUILD_PYTHON_TRUE='#'
+ BUILD_PYTHON_FALSE=
+fi
+
+
+if test "$build_mixer" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_MIXER "1"
+_ACEOF
+
+fi
+if test "$build_pcm" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM "1"
+_ACEOF
+
+fi
+if test "$build_rawmidi" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_RAWMIDI "1"
+_ACEOF
+
+fi
+if test "$build_hwdep" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_HWDEP "1"
+_ACEOF
+
+fi
+if test "$build_seq" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_SEQ "1"
+_ACEOF
+
+fi
+
+
+if test "$build_pcm" = "yes"; then
+
+# Check whether --with-pcm-plugins was given.
+if test "${with_pcm_plugins+set}" = set; then
+ withval=$with_pcm_plugins; pcm_plugins="$withval"
+else
+ pcm_plugins="all"
+fi
+
+else
+pcm_plugins=""
+fi
+
+PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
+
+build_pcm_plugin="no"
+for t in $PCM_PLUGIN_LIST; do
+ eval build_pcm_$t="no"
+done
+
+pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'`
+for p in $pcm_plugins; do
+ for t in $PCM_PLUGIN_LIST; do
+ if test "$p" = "$t" -o "$p" = "all"; then
+ eval build_pcm_$t="yes"
+ build_pcm_plugin="yes"
+ fi
+ done
+done
+
+if test "$build_pcm_plug" = "yes"; then
+ build_pcm_linear="yes"
+ build_pcm_copy="yes"
+fi
+
+if test "$build_pcm_ioplug" = "yes"; then
+ build_pcm_extplug="yes"
+fi
+
+if test "$HAVE_LIBDL" != "yes"; then
+ build_pcm_meter="no"
+ build_pcm_ladspa="no"
+ build_pcm_pcm_ioplug="no"
+ build_pcm_pcm_extplug="no"
+fi
+
+if test "$HAVE_LIBPTHREAD" != "yes"; then
+ build_pcm_share="no"
+fi
+
+if test "$softfloat" = "yes"; then
+ build_pcm_lfloat="no"
+fi
+
+
+
+if test x$build_pcm_plugin = xyes; then
+ BUILD_PCM_PLUGIN_TRUE=
+ BUILD_PCM_PLUGIN_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_TRUE='#'
+ BUILD_PCM_PLUGIN_FALSE=
+fi
+
+
+
+if test x$build_pcm_copy = xyes; then
+ BUILD_PCM_PLUGIN_COPY_TRUE=
+ BUILD_PCM_PLUGIN_COPY_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_COPY_TRUE='#'
+ BUILD_PCM_PLUGIN_COPY_FALSE=
+fi
+
+
+
+if test x$build_pcm_linear = xyes; then
+ BUILD_PCM_PLUGIN_LINEAR_TRUE=
+ BUILD_PCM_PLUGIN_LINEAR_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_LINEAR_TRUE='#'
+ BUILD_PCM_PLUGIN_LINEAR_FALSE=
+fi
+
+
+
+if test x$build_pcm_route = xyes; then
+ BUILD_PCM_PLUGIN_ROUTE_TRUE=
+ BUILD_PCM_PLUGIN_ROUTE_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_ROUTE_TRUE='#'
+ BUILD_PCM_PLUGIN_ROUTE_FALSE=
+fi
+
+
+
+if test x$build_pcm_mulaw = xyes; then
+ BUILD_PCM_PLUGIN_MULAW_TRUE=
+ BUILD_PCM_PLUGIN_MULAW_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_MULAW_TRUE='#'
+ BUILD_PCM_PLUGIN_MULAW_FALSE=
+fi
+
+
+
+if test x$build_pcm_alaw = xyes; then
+ BUILD_PCM_PLUGIN_ALAW_TRUE=
+ BUILD_PCM_PLUGIN_ALAW_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_ALAW_TRUE='#'
+ BUILD_PCM_PLUGIN_ALAW_FALSE=
+fi
+
+
+
+if test x$build_pcm_adpcm = xyes; then
+ BUILD_PCM_PLUGIN_ADPCM_TRUE=
+ BUILD_PCM_PLUGIN_ADPCM_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_ADPCM_TRUE='#'
+ BUILD_PCM_PLUGIN_ADPCM_FALSE=
+fi
+
+
+
+if test x$build_pcm_rate = xyes; then
+ BUILD_PCM_PLUGIN_RATE_TRUE=
+ BUILD_PCM_PLUGIN_RATE_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_RATE_TRUE='#'
+ BUILD_PCM_PLUGIN_RATE_FALSE=
+fi
+
+
+
+if test x$build_pcm_plug = xyes; then
+ BUILD_PCM_PLUGIN_PLUG_TRUE=
+ BUILD_PCM_PLUGIN_PLUG_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_PLUG_TRUE='#'
+ BUILD_PCM_PLUGIN_PLUG_FALSE=
+fi
+
+
+
+if test x$build_pcm_multi = xyes; then
+ BUILD_PCM_PLUGIN_MULTI_TRUE=
+ BUILD_PCM_PLUGIN_MULTI_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_MULTI_TRUE='#'
+ BUILD_PCM_PLUGIN_MULTI_FALSE=
+fi
+
+
+
+if test x$build_pcm_shm = xyes; then
+ BUILD_PCM_PLUGIN_SHM_TRUE=
+ BUILD_PCM_PLUGIN_SHM_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_SHM_TRUE='#'
+ BUILD_PCM_PLUGIN_SHM_FALSE=
+fi
+
+
+
+if test x$build_pcm_file = xyes; then
+ BUILD_PCM_PLUGIN_FILE_TRUE=
+ BUILD_PCM_PLUGIN_FILE_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_FILE_TRUE='#'
+ BUILD_PCM_PLUGIN_FILE_FALSE=
+fi
+
+
+
+if test x$build_pcm_null = xyes; then
+ BUILD_PCM_PLUGIN_NULL_TRUE=
+ BUILD_PCM_PLUGIN_NULL_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_NULL_TRUE='#'
+ BUILD_PCM_PLUGIN_NULL_FALSE=
+fi
+
+
+
+if test x$build_pcm_empty = xyes; then
+ BUILD_PCM_PLUGIN_EMPTY_TRUE=
+ BUILD_PCM_PLUGIN_EMPTY_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_EMPTY_TRUE='#'
+ BUILD_PCM_PLUGIN_EMPTY_FALSE=
+fi
+
+
+
+if test x$build_pcm_share = xyes; then
+ BUILD_PCM_PLUGIN_SHARE_TRUE=
+ BUILD_PCM_PLUGIN_SHARE_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_SHARE_TRUE='#'
+ BUILD_PCM_PLUGIN_SHARE_FALSE=
+fi
+
+
+
+if test x$build_pcm_meter = xyes; then
+ BUILD_PCM_PLUGIN_METER_TRUE=
+ BUILD_PCM_PLUGIN_METER_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_METER_TRUE='#'
+ BUILD_PCM_PLUGIN_METER_FALSE=
+fi
+
+
+
+if test x$build_pcm_hooks = xyes; then
+ BUILD_PCM_PLUGIN_HOOKS_TRUE=
+ BUILD_PCM_PLUGIN_HOOKS_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_HOOKS_TRUE='#'
+ BUILD_PCM_PLUGIN_HOOKS_FALSE=
+fi
+
+
+
+if test x$build_pcm_lfloat = xyes; then
+ BUILD_PCM_PLUGIN_LFLOAT_TRUE=
+ BUILD_PCM_PLUGIN_LFLOAT_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_LFLOAT_TRUE='#'
+ BUILD_PCM_PLUGIN_LFLOAT_FALSE=
+fi
+
+
+
+if test x$build_pcm_ladspa = xyes; then
+ BUILD_PCM_PLUGIN_LADSPA_TRUE=
+ BUILD_PCM_PLUGIN_LADSPA_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_LADSPA_TRUE='#'
+ BUILD_PCM_PLUGIN_LADSPA_FALSE=
+fi
+
+
+
+if test x$build_pcm_dmix = xyes; then
+ BUILD_PCM_PLUGIN_DMIX_TRUE=
+ BUILD_PCM_PLUGIN_DMIX_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_DMIX_TRUE='#'
+ BUILD_PCM_PLUGIN_DMIX_FALSE=
+fi
+
+
+
+if test x$build_pcm_dshare = xyes; then
+ BUILD_PCM_PLUGIN_DSHARE_TRUE=
+ BUILD_PCM_PLUGIN_DSHARE_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_DSHARE_TRUE='#'
+ BUILD_PCM_PLUGIN_DSHARE_FALSE=
+fi
+
+
+
+if test x$build_pcm_dsnoop = xyes; then
+ BUILD_PCM_PLUGIN_DSNOOP_TRUE=
+ BUILD_PCM_PLUGIN_DSNOOP_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_DSNOOP_TRUE='#'
+ BUILD_PCM_PLUGIN_DSNOOP_FALSE=
+fi
+
+
+
+if test x$build_pcm_asym = xyes; then
+ BUILD_PCM_PLUGIN_ASYM_TRUE=
+ BUILD_PCM_PLUGIN_ASYM_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_ASYM_TRUE='#'
+ BUILD_PCM_PLUGIN_ASYM_FALSE=
+fi
+
+
+
+if test x$build_pcm_iec958 = xyes; then
+ BUILD_PCM_PLUGIN_IEC958_TRUE=
+ BUILD_PCM_PLUGIN_IEC958_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_IEC958_TRUE='#'
+ BUILD_PCM_PLUGIN_IEC958_FALSE=
+fi
+
+
+
+if test x$build_pcm_softvol = xyes; then
+ BUILD_PCM_PLUGIN_SOFTVOL_TRUE=
+ BUILD_PCM_PLUGIN_SOFTVOL_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_SOFTVOL_TRUE='#'
+ BUILD_PCM_PLUGIN_SOFTVOL_FALSE=
+fi
+
+
+
+if test x$build_pcm_extplug = xyes; then
+ BUILD_PCM_PLUGIN_EXTPLUG_TRUE=
+ BUILD_PCM_PLUGIN_EXTPLUG_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_EXTPLUG_TRUE='#'
+ BUILD_PCM_PLUGIN_EXTPLUG_FALSE=
+fi
+
+
+
+if test x$build_pcm_ioplug = xyes; then
+ BUILD_PCM_PLUGIN_IOPLUG_TRUE=
+ BUILD_PCM_PLUGIN_IOPLUG_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_IOPLUG_TRUE='#'
+ BUILD_PCM_PLUGIN_IOPLUG_FALSE=
+fi
+
+
+
+if test x$build_pcm_mmap_emul = xyes; then
+ BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE=
+ BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE='#'
+else
+ BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE='#'
+ BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE=
+fi
+
+
+if test "$build_pcm_rate" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_RATE "1"
+_ACEOF
+
+fi
+if test "$build_pcm_route" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_ROUTE "1"
+_ACEOF
+
+fi
+if test "$build_pcm_lfloat" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_LFLOAT "1"
+_ACEOF
+
+fi
+if test "$build_pcm_adpcm" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_ADPCM "1"
+_ACEOF
+
+fi
+if test "$build_pcm_mulaw" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_MULAW "1"
+_ACEOF
+
+fi
+if test "$build_pcm_alaw" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_ALAW "1"
+_ACEOF
+
+fi
+if test "$build_pcm_mmap_emul" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
+_ACEOF
+
+fi
+
+
+rm -f "$srcdir"/src/pcm/pcm_symbols_list.c
+touch "$srcdir"/src/pcm/pcm_symbols_list.c
+for t in $PCM_PLUGIN_LIST; do
+ if eval test \$build_pcm_$t = yes; then
+ echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c
+ fi
+done
+
+
+
+# Check whether --with-ctl-plugins was given.
+if test "${with_ctl_plugins+set}" = set; then
+ withval=$with_ctl_plugins; ctl_plugins="$withval"
+else
+ ctl_plugins="all"
+fi
+
+
+CTL_PLUGIN_LIST="shm ext"
+
+build_ctl_plugin="no"
+for t in $CTL_PLUGIN_LIST; do
+ eval build_ctl_$t="no"
+done
+
+ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'`
+for p in $ctl_plugins; do
+ for t in $CTL_PLUGIN_LIST; do
+ if test "$p" = "$t" -o "$p" = "all"; then
+ eval build_ctl_$t="yes"
+ build_ctl_plugin="yes"
+ fi
+ done
+done
+
+
+
+if test x$build_ctl_plugin = xyes; then
+ BUILD_CTL_PLUGIN_TRUE=
+ BUILD_CTL_PLUGIN_FALSE='#'
+else
+ BUILD_CTL_PLUGIN_TRUE='#'
+ BUILD_CTL_PLUGIN_FALSE=
+fi
+
+
+
+if test x$build_ctl_shm = xyes; then
+ BUILD_CTL_PLUGIN_SHM_TRUE=
+ BUILD_CTL_PLUGIN_SHM_FALSE='#'
+else
+ BUILD_CTL_PLUGIN_SHM_TRUE='#'
+ BUILD_CTL_PLUGIN_SHM_FALSE=
+fi
+
+
+
+if test x$build_ctl_ext = xyes; then
+ BUILD_CTL_PLUGIN_EXT_TRUE=
+ BUILD_CTL_PLUGIN_EXT_FALSE='#'
+else
+ BUILD_CTL_PLUGIN_EXT_TRUE='#'
+ BUILD_CTL_PLUGIN_EXT_FALSE=
+fi
+
+
+rm -f "$srcdir"/src/control/ctl_symbols_list.c
+touch "$srcdir"/src/control/ctl_symbols_list.c
+for t in $CTL_PLUGIN_LIST; do
+ if eval test \$build_ctl_$t = yes; then
+ echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c
+ fi
+done
+
+if test ! -L "$srcdir"/include/alsa ; then
+ echo "Making a symlink include/alsa"
+ rm -f "$srcdir"/include/alsa
+ ln -sf . "$srcdir"/include/alsa
+fi
+
+ac_config_files="$ac_config_files Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg include/Makefile include/sound/Makefile src/Versions src/Makefile src/control/Makefile src/mixer/Makefile src/pcm/Makefile src/pcm/scopes/Makefile src/rawmidi/Makefile src/timer/Makefile src/hwdep/Makefile src/seq/Makefile src/compat/Makefile src/alisp/Makefile src/conf/Makefile src/conf/cards/Makefile src/conf/pcm/Makefile modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile alsalisp/Makefile aserver/Makefile test/Makefile utils/Makefile utils/alsa-lib.spec utils/alsa.pc"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${INSTALL_M4_TRUE}" && test -z "${INSTALL_M4_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"INSTALL_M4\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"INSTALL_M4\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${ALSA_HSEARCH_R_TRUE}" && test -z "${ALSA_HSEARCH_R_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"ALSA_HSEARCH_R\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ALSA_HSEARCH_R\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${VERSIONED_SYMBOLS_TRUE}" && test -z "${VERSIONED_SYMBOLS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"VERSIONED_SYMBOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"VERSIONED_SYMBOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${SYMBOLIC_FUNCTIONS_TRUE}" && test -z "${SYMBOLIC_FUNCTIONS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"SYMBOLIC_FUNCTIONS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"SYMBOLIC_FUNCTIONS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MODULES_TRUE}" && test -z "${BUILD_MODULES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_MODULES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MODULES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${KEEP_OLD_SYMBOLS_TRUE}" && test -z "${KEEP_OLD_SYMBOLS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"KEEP_OLD_SYMBOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"KEEP_OLD_SYMBOLS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MIXER_TRUE}" && test -z "${BUILD_MIXER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_MIXER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MIXER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_TRUE}" && test -z "${BUILD_PCM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_RAWMIDI_TRUE}" && test -z "${BUILD_RAWMIDI_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_RAWMIDI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_RAWMIDI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_HWDEP_TRUE}" && test -z "${BUILD_HWDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_HWDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_HWDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_SEQ_TRUE}" && test -z "${BUILD_SEQ_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_SEQ\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_SEQ\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_ALISP_TRUE}" && test -z "${BUILD_ALISP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_ALISP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_ALISP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PYTHON_TRUE}" && test -z "${BUILD_PYTHON_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_TRUE}" && test -z "${BUILD_PCM_PLUGIN_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_COPY_TRUE}" && test -z "${BUILD_PCM_PLUGIN_COPY_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_COPY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_COPY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_LINEAR_TRUE}" && test -z "${BUILD_PCM_PLUGIN_LINEAR_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_LINEAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_LINEAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_ROUTE_TRUE}" && test -z "${BUILD_PCM_PLUGIN_ROUTE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_ROUTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_ROUTE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_MULAW_TRUE}" && test -z "${BUILD_PCM_PLUGIN_MULAW_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_MULAW\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_MULAW\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_ALAW_TRUE}" && test -z "${BUILD_PCM_PLUGIN_ALAW_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_ALAW\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_ALAW\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_ADPCM_TRUE}" && test -z "${BUILD_PCM_PLUGIN_ADPCM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_ADPCM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_ADPCM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_RATE_TRUE}" && test -z "${BUILD_PCM_PLUGIN_RATE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_RATE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_RATE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_PLUG_TRUE}" && test -z "${BUILD_PCM_PLUGIN_PLUG_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_PLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_PLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_MULTI_TRUE}" && test -z "${BUILD_PCM_PLUGIN_MULTI_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_MULTI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_MULTI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_SHM_TRUE}" && test -z "${BUILD_PCM_PLUGIN_SHM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_SHM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_SHM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_FILE_TRUE}" && test -z "${BUILD_PCM_PLUGIN_FILE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_FILE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_FILE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_NULL_TRUE}" && test -z "${BUILD_PCM_PLUGIN_NULL_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_NULL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_NULL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_EMPTY_TRUE}" && test -z "${BUILD_PCM_PLUGIN_EMPTY_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_EMPTY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_EMPTY\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_SHARE_TRUE}" && test -z "${BUILD_PCM_PLUGIN_SHARE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_SHARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_SHARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_METER_TRUE}" && test -z "${BUILD_PCM_PLUGIN_METER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_METER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_METER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_HOOKS_TRUE}" && test -z "${BUILD_PCM_PLUGIN_HOOKS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_HOOKS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_HOOKS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_LFLOAT_TRUE}" && test -z "${BUILD_PCM_PLUGIN_LFLOAT_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_LFLOAT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_LFLOAT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_LADSPA_TRUE}" && test -z "${BUILD_PCM_PLUGIN_LADSPA_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_LADSPA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_LADSPA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_DMIX_TRUE}" && test -z "${BUILD_PCM_PLUGIN_DMIX_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_DMIX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_DMIX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_DSHARE_TRUE}" && test -z "${BUILD_PCM_PLUGIN_DSHARE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_DSHARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_DSHARE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_DSNOOP_TRUE}" && test -z "${BUILD_PCM_PLUGIN_DSNOOP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_DSNOOP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_DSNOOP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_ASYM_TRUE}" && test -z "${BUILD_PCM_PLUGIN_ASYM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_ASYM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_ASYM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_IEC958_TRUE}" && test -z "${BUILD_PCM_PLUGIN_IEC958_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_IEC958\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_IEC958\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_SOFTVOL_TRUE}" && test -z "${BUILD_PCM_PLUGIN_SOFTVOL_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_SOFTVOL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_SOFTVOL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_EXTPLUG_TRUE}" && test -z "${BUILD_PCM_PLUGIN_EXTPLUG_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_EXTPLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_EXTPLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_IOPLUG_TRUE}" && test -z "${BUILD_PCM_PLUGIN_IOPLUG_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_IOPLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_IOPLUG\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE}" && test -z "${BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_PCM_PLUGIN_MMAP_EMUL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_PCM_PLUGIN_MMAP_EMUL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_CTL_PLUGIN_TRUE}" && test -z "${BUILD_CTL_PLUGIN_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_CTL_PLUGIN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_CTL_PLUGIN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_CTL_PLUGIN_SHM_TRUE}" && test -z "${BUILD_CTL_PLUGIN_SHM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_CTL_PLUGIN_SHM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_CTL_PLUGIN_SHM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_CTL_PLUGIN_EXT_TRUE}" && test -z "${BUILD_CTL_PLUGIN_EXT_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_CTL_PLUGIN_EXT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_CTL_PLUGIN_EXT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "doc/pictures/Makefile") CONFIG_FILES="$CONFIG_FILES doc/pictures/Makefile" ;;
+ "doc/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES doc/doxygen.cfg" ;;
+ "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+ "include/sound/Makefile") CONFIG_FILES="$CONFIG_FILES include/sound/Makefile" ;;
+ "src/Versions") CONFIG_FILES="$CONFIG_FILES src/Versions" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "src/control/Makefile") CONFIG_FILES="$CONFIG_FILES src/control/Makefile" ;;
+ "src/mixer/Makefile") CONFIG_FILES="$CONFIG_FILES src/mixer/Makefile" ;;
+ "src/pcm/Makefile") CONFIG_FILES="$CONFIG_FILES src/pcm/Makefile" ;;
+ "src/pcm/scopes/Makefile") CONFIG_FILES="$CONFIG_FILES src/pcm/scopes/Makefile" ;;
+ "src/rawmidi/Makefile") CONFIG_FILES="$CONFIG_FILES src/rawmidi/Makefile" ;;
+ "src/timer/Makefile") CONFIG_FILES="$CONFIG_FILES src/timer/Makefile" ;;
+ "src/hwdep/Makefile") CONFIG_FILES="$CONFIG_FILES src/hwdep/Makefile" ;;
+ "src/seq/Makefile") CONFIG_FILES="$CONFIG_FILES src/seq/Makefile" ;;
+ "src/compat/Makefile") CONFIG_FILES="$CONFIG_FILES src/compat/Makefile" ;;
+ "src/alisp/Makefile") CONFIG_FILES="$CONFIG_FILES src/alisp/Makefile" ;;
+ "src/conf/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/Makefile" ;;
+ "src/conf/cards/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/cards/Makefile" ;;
+ "src/conf/pcm/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/pcm/Makefile" ;;
+ "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;;
+ "modules/mixer/Makefile") CONFIG_FILES="$CONFIG_FILES modules/mixer/Makefile" ;;
+ "modules/mixer/simple/Makefile") CONFIG_FILES="$CONFIG_FILES modules/mixer/simple/Makefile" ;;
+ "alsalisp/Makefile") CONFIG_FILES="$CONFIG_FILES alsalisp/Makefile" ;;
+ "aserver/Makefile") CONFIG_FILES="$CONFIG_FILES aserver/Makefile" ;;
+ "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+ "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;;
+ "utils/alsa-lib.spec") CONFIG_FILES="$CONFIG_FILES utils/alsa-lib.spec" ;;
+ "utils/alsa.pc") CONFIG_FILES="$CONFIG_FILES utils/alsa.pc" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+INSTALL_M4_TRUE!$INSTALL_M4_TRUE$ac_delim
+INSTALL_M4_FALSE!$INSTALL_M4_FALSE$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CPP!$CPP$ac_delim
+LN_S!$LN_S$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+ALSA_HSEARCH_R_TRUE!$ALSA_HSEARCH_R_TRUE$ac_delim
+ALSA_HSEARCH_R_FALSE!$ALSA_HSEARCH_R_FALSE$ac_delim
+SND_LIB_VERSION!$SND_LIB_VERSION$ac_delim
+SND_LIB_MAJOR!$SND_LIB_MAJOR$ac_delim
+SND_LIB_MINOR!$SND_LIB_MINOR$ac_delim
+SND_LIB_SUBMINOR!$SND_LIB_SUBMINOR$ac_delim
+SND_LIB_EXTRAVER!$SND_LIB_EXTRAVER$ac_delim
+LIBTOOL_VERSION_INFO!$LIBTOOL_VERSION_INFO$ac_delim
+ALSA_CONFIG_DIR!$ALSA_CONFIG_DIR$ac_delim
+ALSA_PLUGIN_DIR!$ALSA_PLUGIN_DIR$ac_delim
+VERSIONED_SYMBOLS_TRUE!$VERSIONED_SYMBOLS_TRUE$ac_delim
+VERSIONED_SYMBOLS_FALSE!$VERSIONED_SYMBOLS_FALSE$ac_delim
+SYMBOLIC_FUNCTIONS_TRUE!$SYMBOLIC_FUNCTIONS_TRUE$ac_delim
+SYMBOLIC_FUNCTIONS_FALSE!$SYMBOLIC_FUNCTIONS_FALSE$ac_delim
+SYMBOL_PREFIX!$SYMBOL_PREFIX$ac_delim
+BUILD_MODULES_TRUE!$BUILD_MODULES_TRUE$ac_delim
+BUILD_MODULES_FALSE!$BUILD_MODULES_FALSE$ac_delim
+ALSA_DEPLIBS!$ALSA_DEPLIBS$ac_delim
+KEEP_OLD_SYMBOLS_TRUE!$KEEP_OLD_SYMBOLS_TRUE$ac_delim
+KEEP_OLD_SYMBOLS_FALSE!$KEEP_OLD_SYMBOLS_FALSE$ac_delim
+PYTHON_LIBS!$PYTHON_LIBS$ac_delim
+PYTHON_INCLUDES!$PYTHON_INCLUDES$ac_delim
+BUILD_MIXER_TRUE!$BUILD_MIXER_TRUE$ac_delim
+BUILD_MIXER_FALSE!$BUILD_MIXER_FALSE$ac_delim
+BUILD_PCM_TRUE!$BUILD_PCM_TRUE$ac_delim
+BUILD_PCM_FALSE!$BUILD_PCM_FALSE$ac_delim
+BUILD_RAWMIDI_TRUE!$BUILD_RAWMIDI_TRUE$ac_delim
+BUILD_RAWMIDI_FALSE!$BUILD_RAWMIDI_FALSE$ac_delim
+BUILD_HWDEP_TRUE!$BUILD_HWDEP_TRUE$ac_delim
+BUILD_HWDEP_FALSE!$BUILD_HWDEP_FALSE$ac_delim
+BUILD_SEQ_TRUE!$BUILD_SEQ_TRUE$ac_delim
+BUILD_SEQ_FALSE!$BUILD_SEQ_FALSE$ac_delim
+BUILD_ALISP_TRUE!$BUILD_ALISP_TRUE$ac_delim
+BUILD_ALISP_FALSE!$BUILD_ALISP_FALSE$ac_delim
+BUILD_PYTHON_TRUE!$BUILD_PYTHON_TRUE$ac_delim
+BUILD_PYTHON_FALSE!$BUILD_PYTHON_FALSE$ac_delim
+BUILD_PCM_PLUGIN_TRUE!$BUILD_PCM_PLUGIN_TRUE$ac_delim
+BUILD_PCM_PLUGIN_FALSE!$BUILD_PCM_PLUGIN_FALSE$ac_delim
+BUILD_PCM_PLUGIN_COPY_TRUE!$BUILD_PCM_PLUGIN_COPY_TRUE$ac_delim
+BUILD_PCM_PLUGIN_COPY_FALSE!$BUILD_PCM_PLUGIN_COPY_FALSE$ac_delim
+BUILD_PCM_PLUGIN_LINEAR_TRUE!$BUILD_PCM_PLUGIN_LINEAR_TRUE$ac_delim
+BUILD_PCM_PLUGIN_LINEAR_FALSE!$BUILD_PCM_PLUGIN_LINEAR_FALSE$ac_delim
+BUILD_PCM_PLUGIN_ROUTE_TRUE!$BUILD_PCM_PLUGIN_ROUTE_TRUE$ac_delim
+BUILD_PCM_PLUGIN_ROUTE_FALSE!$BUILD_PCM_PLUGIN_ROUTE_FALSE$ac_delim
+BUILD_PCM_PLUGIN_MULAW_TRUE!$BUILD_PCM_PLUGIN_MULAW_TRUE$ac_delim
+BUILD_PCM_PLUGIN_MULAW_FALSE!$BUILD_PCM_PLUGIN_MULAW_FALSE$ac_delim
+BUILD_PCM_PLUGIN_ALAW_TRUE!$BUILD_PCM_PLUGIN_ALAW_TRUE$ac_delim
+BUILD_PCM_PLUGIN_ALAW_FALSE!$BUILD_PCM_PLUGIN_ALAW_FALSE$ac_delim
+BUILD_PCM_PLUGIN_ADPCM_TRUE!$BUILD_PCM_PLUGIN_ADPCM_TRUE$ac_delim
+BUILD_PCM_PLUGIN_ADPCM_FALSE!$BUILD_PCM_PLUGIN_ADPCM_FALSE$ac_delim
+BUILD_PCM_PLUGIN_RATE_TRUE!$BUILD_PCM_PLUGIN_RATE_TRUE$ac_delim
+BUILD_PCM_PLUGIN_RATE_FALSE!$BUILD_PCM_PLUGIN_RATE_FALSE$ac_delim
+BUILD_PCM_PLUGIN_PLUG_TRUE!$BUILD_PCM_PLUGIN_PLUG_TRUE$ac_delim
+BUILD_PCM_PLUGIN_PLUG_FALSE!$BUILD_PCM_PLUGIN_PLUG_FALSE$ac_delim
+BUILD_PCM_PLUGIN_MULTI_TRUE!$BUILD_PCM_PLUGIN_MULTI_TRUE$ac_delim
+BUILD_PCM_PLUGIN_MULTI_FALSE!$BUILD_PCM_PLUGIN_MULTI_FALSE$ac_delim
+BUILD_PCM_PLUGIN_SHM_TRUE!$BUILD_PCM_PLUGIN_SHM_TRUE$ac_delim
+BUILD_PCM_PLUGIN_SHM_FALSE!$BUILD_PCM_PLUGIN_SHM_FALSE$ac_delim
+BUILD_PCM_PLUGIN_FILE_TRUE!$BUILD_PCM_PLUGIN_FILE_TRUE$ac_delim
+BUILD_PCM_PLUGIN_FILE_FALSE!$BUILD_PCM_PLUGIN_FILE_FALSE$ac_delim
+BUILD_PCM_PLUGIN_NULL_TRUE!$BUILD_PCM_PLUGIN_NULL_TRUE$ac_delim
+BUILD_PCM_PLUGIN_NULL_FALSE!$BUILD_PCM_PLUGIN_NULL_FALSE$ac_delim
+BUILD_PCM_PLUGIN_EMPTY_TRUE!$BUILD_PCM_PLUGIN_EMPTY_TRUE$ac_delim
+BUILD_PCM_PLUGIN_EMPTY_FALSE!$BUILD_PCM_PLUGIN_EMPTY_FALSE$ac_delim
+BUILD_PCM_PLUGIN_SHARE_TRUE!$BUILD_PCM_PLUGIN_SHARE_TRUE$ac_delim
+BUILD_PCM_PLUGIN_SHARE_FALSE!$BUILD_PCM_PLUGIN_SHARE_FALSE$ac_delim
+BUILD_PCM_PLUGIN_METER_TRUE!$BUILD_PCM_PLUGIN_METER_TRUE$ac_delim
+BUILD_PCM_PLUGIN_METER_FALSE!$BUILD_PCM_PLUGIN_METER_FALSE$ac_delim
+BUILD_PCM_PLUGIN_HOOKS_TRUE!$BUILD_PCM_PLUGIN_HOOKS_TRUE$ac_delim
+BUILD_PCM_PLUGIN_HOOKS_FALSE!$BUILD_PCM_PLUGIN_HOOKS_FALSE$ac_delim
+BUILD_PCM_PLUGIN_LFLOAT_TRUE!$BUILD_PCM_PLUGIN_LFLOAT_TRUE$ac_delim
+BUILD_PCM_PLUGIN_LFLOAT_FALSE!$BUILD_PCM_PLUGIN_LFLOAT_FALSE$ac_delim
+BUILD_PCM_PLUGIN_LADSPA_TRUE!$BUILD_PCM_PLUGIN_LADSPA_TRUE$ac_delim
+BUILD_PCM_PLUGIN_LADSPA_FALSE!$BUILD_PCM_PLUGIN_LADSPA_FALSE$ac_delim
+BUILD_PCM_PLUGIN_DMIX_TRUE!$BUILD_PCM_PLUGIN_DMIX_TRUE$ac_delim
+BUILD_PCM_PLUGIN_DMIX_FALSE!$BUILD_PCM_PLUGIN_DMIX_FALSE$ac_delim
+BUILD_PCM_PLUGIN_DSHARE_TRUE!$BUILD_PCM_PLUGIN_DSHARE_TRUE$ac_delim
+BUILD_PCM_PLUGIN_DSHARE_FALSE!$BUILD_PCM_PLUGIN_DSHARE_FALSE$ac_delim
+BUILD_PCM_PLUGIN_DSNOOP_TRUE!$BUILD_PCM_PLUGIN_DSNOOP_TRUE$ac_delim
+BUILD_PCM_PLUGIN_DSNOOP_FALSE!$BUILD_PCM_PLUGIN_DSNOOP_FALSE$ac_delim
+BUILD_PCM_PLUGIN_ASYM_TRUE!$BUILD_PCM_PLUGIN_ASYM_TRUE$ac_delim
+BUILD_PCM_PLUGIN_ASYM_FALSE!$BUILD_PCM_PLUGIN_ASYM_FALSE$ac_delim
+BUILD_PCM_PLUGIN_IEC958_TRUE!$BUILD_PCM_PLUGIN_IEC958_TRUE$ac_delim
+BUILD_PCM_PLUGIN_IEC958_FALSE!$BUILD_PCM_PLUGIN_IEC958_FALSE$ac_delim
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE!$BUILD_PCM_PLUGIN_SOFTVOL_TRUE$ac_delim
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE!$BUILD_PCM_PLUGIN_SOFTVOL_FALSE$ac_delim
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE!$BUILD_PCM_PLUGIN_EXTPLUG_TRUE$ac_delim
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE!$BUILD_PCM_PLUGIN_EXTPLUG_FALSE$ac_delim
+BUILD_PCM_PLUGIN_IOPLUG_TRUE!$BUILD_PCM_PLUGIN_IOPLUG_TRUE$ac_delim
+BUILD_PCM_PLUGIN_IOPLUG_FALSE!$BUILD_PCM_PLUGIN_IOPLUG_FALSE$ac_delim
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE!$BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE$ac_delim
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE!$BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+BUILD_CTL_PLUGIN_TRUE!$BUILD_CTL_PLUGIN_TRUE$ac_delim
+BUILD_CTL_PLUGIN_FALSE!$BUILD_CTL_PLUGIN_FALSE$ac_delim
+BUILD_CTL_PLUGIN_SHM_TRUE!$BUILD_CTL_PLUGIN_SHM_TRUE$ac_delim
+BUILD_CTL_PLUGIN_SHM_FALSE!$BUILD_CTL_PLUGIN_SHM_FALSE$ac_delim
+BUILD_CTL_PLUGIN_EXT_TRUE!$BUILD_CTL_PLUGIN_EXT_TRUE$ac_delim
+BUILD_CTL_PLUGIN_EXT_FALSE!$BUILD_CTL_PLUGIN_EXT_FALSE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+ if test x"$ac_file" != x-; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
+ fi
+ else
+ echo "/* $configure_input */"
+ cat "$ac_result"
+ fi
+ rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+echo "Creating asoundlib.h..."
+cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
+test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
+test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
+test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
+test "$build_hwdep" = "yes" && echo "#include <alsa/hwdep.h>" >> include/asoundlib.h
+echo "#include <alsa/control.h>" >> include/asoundlib.h
+test "$build_mixer" = "yes" && echo "#include <alsa/mixer.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq_event.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq_midi_event.h>" >> include/asoundlib.h
+cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h
+
diff --git a/alsa-lib/configure.in b/alsa-lib/configure.in
new file mode 100644
index 0000000..9a71d95
--- /dev/null
+++ b/alsa-lib/configure.in
@@ -0,0 +1,612 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.59)
+AC_INIT(src/control/control.c)
+
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl *************************************************
+dnl current:revision:age
+dnl change (without API) = c:r+1:a
+dnl change API = c+1:0:a
+dnl add API = c+1:0:a+1
+dnl remove API = c+1:0:0
+dnl *************************************************
+AC_CANONICAL_HOST
+AM_INIT_AUTOMAKE(alsa-lib, 1.0.19)
+eval LIBTOOL_VERSION_INFO="2:0:0"
+dnl *************************************************
+AM_CONDITIONAL(INSTALL_M4, test -n "${ACLOCAL}")
+
+AC_PREFIX_DEFAULT(/usr)
+
+dnl Checks for programs.
+
+dnl try to gues cross-compiler if not set
+if test "x$host" != "x$build" -a -z "`echo $CC | grep -e '-gcc'`";
+then
+ AC_MSG_CHECKING(for cross-compiler)
+
+ which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
+ which ${host_cpu}-${host_os}-gcc >/dev/null 2>&1 \
+ && CC=${host_cpu}-${host-os}-gcc
+ which ${host_cpu}-${host_vendor}-${host_os}-gcc >/dev/null 2>&1 \
+ && CC=${host_cpu}-${host_vendor}-${host_os}-gcc
+
+ AC_MSG_RESULT($CC)
+fi
+
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_DISABLE_STATIC
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+
+CC_NOUNDEFINED
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AM_CONFIG_HEADER(include/config.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_CHECK_FUNC([hsearch_r], [HAVE_HSEARCH_R=yes])
+AM_CONDITIONAL(ALSA_HSEARCH_R, [test "x$HAVE_HSEARCH_R" != xyes])
+
+SAVE_LIBRARY_VERSION
+AC_SUBST(LIBTOOL_VERSION_INFO)
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+
+dnl ALSA configuration directory
+AC_ARG_WITH(configdir,
+ AS_HELP_STRING([--with-configdir=dir],
+ [path where ALSA config files are stored]),
+ confdir="$withval", confdir="")
+if test -z "$confdir"; then
+ eval dir="$datadir"
+ case "$dir" in
+ /*) ;;
+ *) dir="$prefix/share"
+ esac
+ confdir="$dir/alsa"
+fi
+ALSA_CONFIG_DIR="$confdir"
+AC_DEFINE_UNQUOTED(ALSA_CONFIG_DIR, "$confdir", [directory containing ALSA configuration database])
+AC_SUBST(ALSA_CONFIG_DIR)
+
+dnl ALSA plugin directory
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+
+AC_ARG_WITH(plugindir,
+ AS_HELP_STRING([--with-plugindir=dir],
+ [path where ALSA plugin files are stored]),
+ plugindir="$withval", plugindir="")
+if test -z "$plugindir"; then
+ eval dir="$libdir"
+ case "$dir" in
+ /*) ;;
+ *) dir="$dir"
+ esac
+ plugindir="$dir/$PACKAGE"
+fi
+AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir", [directory containing ALSA add-on modules])
+ALSA_PLUGIN_DIR="$plugindir"
+AC_SUBST(ALSA_PLUGIN_DIR)
+
+dnl Check for versioned symbols
+AC_MSG_CHECKING(for versioned symbols)
+AC_ARG_WITH(versioned,
+ AS_HELP_STRING([--with-versioned],
+ [shared library will be compiled with versioned symbols (default = yes)]),
+ versioned="$withval", versioned="yes")
+if test "$versioned" = "yes"; then
+ # it seems that GNU ld versions since 2.10 are not broken
+ xres=`grep '^VERSION=' libtool | cut -d = -f 2 | cut -d \" -f 2`
+ major=`echo $xres | cut -d . -f 1`
+ minor=`echo $xres | cut -d . -f 2`
+ pass=0
+ if test $major -eq 1 -a $minor -gt 3; then
+ pass=1
+ else
+ if test $major -gt 1; then
+ pass=1
+ fi
+ fi
+ if test $pass -eq 1; then
+ AC_DEFINE(VERSIONED_SYMBOLS,,[compiled with versioned symbols])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(broken libtool - use libtool v1.4+; no versions)
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(VERSIONED_SYMBOLS, test x$versioned = xyes)
+
+dnl Check for symbolic-functions
+AC_MSG_CHECKING(for symbolic-functions)
+AC_ARG_ENABLE(symbolic-functions,
+ AS_HELP_STRING([--enable-symbolic-functions],
+ [use -Bsymbolic-functions option if available (optmization for size and speed)]),
+ symfuncs="$enableval", symfuncs="no")
+if test "$symfuncs" = "yes"; then
+ if ld --help | grep -q -- '-Bsymbolic-functions'; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(not supported by ld)
+ symfuncs="no"
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(SYMBOLIC_FUNCTIONS, test x"$symfuncs" = xyes)
+
+dnl See if toolchain has a custom prefix for symbols ...
+AC_MSG_CHECKING(for custom symbol prefixes)
+SYMBOL_PREFIX=` \
+ echo "PREFIX=__USER_LABEL_PREFIX__" \
+ | ${CPP-${CC-gcc} -E} - 2>&1 \
+ | ${EGREP-grep} "^PREFIX=" \
+ | ${SED-sed} "s:^PREFIX=::"`
+AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix])
+AC_SUBST(SYMBOL_PREFIX)
+AC_MSG_RESULT($SYMBOL_PREFIX)
+
+dnl Check for debug...
+AC_MSG_CHECKING(for debug)
+AC_ARG_WITH(debug,
+ AS_HELP_STRING([--with-debug],
+ [library will be compiled with asserts (default = yes)]),
+ debug="$withval", debug="yes")
+if test "$debug" = "yes"; then
+ AC_MSG_RESULT(yes)
+else
+ AC_DEFINE(NDEBUG,,[No assert debug])
+ AC_MSG_RESULT(no)
+fi
+
+if test "$debug" = "yes"; then
+ AC_MSG_CHECKING(for debug assert)
+ AC_ARG_ENABLE(debug-assert,
+ AS_HELP_STRING([--enable-debug],
+ [enable assert call at the default error message handler]),
+ debug_assert="$enableval", debug_assert="no")
+ if test "$debug_assert" = "yes"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler])
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+dnl Temporary directory
+AC_MSG_CHECKING(for tmpdir)
+AC_ARG_WITH(tmpdir,
+ AS_HELP_STRING([--with-tmpdir=directory],
+ [directory to put tmp socket files (/tmp)]),
+ tmpdir="$withval", tmpdir="/tmp")
+AC_MSG_RESULT($tmpdir)
+AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [directory to put tmp socket files])
+
+dnl Check for softfloat...
+AC_MSG_CHECKING(for softfloat)
+AC_ARG_WITH(softfloat,
+ AS_HELP_STRING([--with-softfloat],
+ [do you have floating point unit on this machine? (optional)]),
+ [ AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float])
+ softfloat=yes ],)
+if test "$softfloat" = "yes" ; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+ALSA_DEPLIBS=""
+if test "$softfloat" != "yes"; then
+ ALSA_DEPLIBS="-lm"
+fi
+
+dnl Check for libdl
+AC_MSG_CHECKING(for libdl)
+AC_ARG_WITH(libdl,
+ AS_HELP_STRING([--with-libdl], [Use libdl for plugins (default = yes)]),
+ [ have_libdl="$withval" ], [ have_libdl="yes" ])
+if test "$have_libdl" = "yes"; then
+ AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"])
+ if test "$HAVE_LIBDL" = "yes" ; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
+ AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL(BUILD_MODULES, test "$HAVE_LIBDL"="yes")
+
+dnl Check for pthread
+AC_MSG_CHECKING(for pthread)
+AC_ARG_WITH(pthread,
+ AS_HELP_STRING([--with-pthread], [Use pthread (default = yes)]),
+ [ have_pthread="$withval" ], [ have_pthread="yes" ])
+if test "$have_pthread" = "yes"; then
+ AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"])
+ if test "$HAVE_LIBPTHREAD" = "yes"; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread"
+ AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread])
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+
+dnl Check for librt
+AC_MSG_CHECKING(for librt)
+AC_ARG_WITH(librt,
+ AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
+ [ have_librt="$withval" ], [ have_librt="yes" ])
+if test "$have_librt" = "yes"; then
+ AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
+ if test "$HAVE_LIBRT" = "yes" ; then
+ ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt"
+ AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
+ AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
+ fi
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_SUBST(ALSA_DEPLIBS)
+
+dnl Check for architecture
+AC_MSG_CHECKING(for architecture)
+case "$host" in
+i?86*)
+ AC_MSG_RESULT(x86)
+ ;;
+x86_64*)
+ AC_MSG_RESULT(x86)
+ ;;
+alpha*)
+ AC_MSG_RESULT(alpha)
+ ;;
+powerpc*|ppc*)
+ AC_MSG_RESULT(ppc)
+ CPPFLAGS="$CPPFLAGS -D__ppc__"
+ ;;
+ia64*)
+ AC_MSG_RESULT(ia64)
+ CPPFLAGS="$CPPFLAGS -D__ia64__"
+ ;;
+mips*)
+ AC_MSG_RESULT(mips)
+ CPPFLAGS="$CPPFLAGS -D__mips__"
+ ;;
+arm*)
+ AC_MSG_RESULT(arm)
+ CPPFLAGS="$CPPFLAGS -D__arm__"
+ ;;
+*)
+ AC_MSG_RESULT($host_cpu)
+ echo "No atomic operations supported.."
+ ;;
+esac
+
+dnl Check for wordexp.h
+AC_CHECK_HEADERS([wordexp.h])
+
+dnl Check for resmgr support...
+AC_MSG_CHECKING(for resmgr support)
+AC_ARG_ENABLE(resmgr,
+ AS_HELP_STRING([--enable-resmgr], [support resmgr (optional)]),
+ resmgr="$enableval", resmgr="no")
+AC_MSG_RESULT($resmgr)
+if test "$resmgr" = "yes"; then
+ AC_CHECK_LIB(resmgr, rsm_open_device,,
+ AC_ERROR([Cannot find libresmgr]))
+ AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib])
+fi
+
+dnl Check for aload* support...
+AC_MSG_CHECKING(for aload* support)
+AC_ARG_ENABLE(aload,
+ AS_HELP_STRING([--disable-aload], [disable reading /dev/aload*]),
+ aload="$enableval", aload="yes")
+AC_MSG_RESULT($aload)
+if test "$aload" = "yes"; then
+ AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading])
+fi
+
+dnl Check for non-standard /dev directory
+AC_MSG_CHECKING([for ALSA device file directory])
+AC_ARG_WITH(alsa-devdir,
+ AS_HELP_STRING([--with-alsa-devdir=dir],
+ [directory with ALSA device files (default /dev/snd)]),
+ [alsa_dev_dir="$withval"],
+ [alsa_dev_dir="/dev/snd"])
+dnl make sure it has a trailing slash
+if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then
+ alsa_dev_dir="$alsa_dev_dir/"
+fi
+AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files])
+AC_MSG_RESULT([$alsa_dev_dir])
+
+AC_MSG_CHECKING([for aload* device file directory])
+AC_ARG_WITH(aload-devdir,
+ AS_HELP_STRING([--with-aload-devdir=dir],
+ [directory with aload* device files (default /dev)]),
+ [aload_dev_dir="$withval"],
+ [aload_dev_dir="/dev"])
+if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then
+ aload_dev_dir="$aload_dev_dir/"
+fi
+AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files])
+AC_MSG_RESULT([$aload_dev_dir])
+
+dnl Build conditions
+AC_ARG_ENABLE(mixer,
+ AS_HELP_STRING([--disable-mixer], [disable the mixer component]),
+ [build_mixer="$enableval"], [build_mixer="yes"])
+AC_ARG_ENABLE(pcm,
+ AS_HELP_STRING([--disable-pcm], [disable the PCM component]),
+ [build_pcm="$enableval"], [build_pcm="yes"])
+AC_ARG_ENABLE(rawmidi,
+ AS_HELP_STRING([--disable-rawmidi], [disable the raw MIDI component]),
+ [build_rawmidi="$enableval"], [build_rawmidi="yes"])
+AC_ARG_ENABLE(hwdep,
+ AS_HELP_STRING([--disable-hwdep], [disable the hwdep component]),
+ [build_hwdep="$enableval"], [build_hwdep="yes"])
+AC_ARG_ENABLE(seq,
+ AS_HELP_STRING([--disable-seq], [disable the sequencer component]),
+ [build_seq="$enableval"], [build_seq="yes"])
+AC_ARG_ENABLE(alisp,
+ AS_HELP_STRING([--disable-alisp], [disable the alisp component]),
+ [build_alisp="$enableval"], [build_alisp="yes"])
+AC_ARG_ENABLE(old-symbols,
+ AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
+ [keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
+AM_CONDITIONAL(KEEP_OLD_SYMBOLS, test x$keep_old_symbols = xyes)
+
+AC_ARG_ENABLE(python,
+ AS_HELP_STRING([--disable-python], [disable the python components]),
+ [build_python="$enableval"], [build_python="yes"])
+PYTHON_LIBS=""
+PYTHON_INCLUDES=""
+if test "$build_python" = "yes"; then
+ AC_ARG_WITH(pythonlibs,
+ AS_HELP_STRING([--with-pythonlibs=ldflags],
+ [specify python libraries (-lpthread -lm -ldl -lpython2.4)]),
+ pythonlibs="$withval", pythonlibs=`python-config --libs`)
+ AC_ARG_WITH(pythonincludes,
+ AS_HELP_STRING([--with-pythonincludes=Cflags],
+ [specify python C header files (-I/usr/include/python)]),
+ pythonincludes="$withval", pythonincludes=`python-config --includes`)
+ if test -z "$pythonlibs"; then
+ echo "Unable to determine python libraries! Probably python-config is not"
+ echo "available on this system. Please, use --with-pythonlibs and"
+ echo "--with-pythonincludes options. Python components are disabled in this build."
+ build_python="no"
+ else
+ PYTHON_LIBS="$pythonlibs"
+ PYTHON_INCLUDES="$pythonincludes"
+ fi
+fi
+AC_SUBST(PYTHON_LIBS)
+AC_SUBST(PYTHON_INCLUDES)
+
+AM_CONDITIONAL(BUILD_MIXER, test x$build_mixer = xyes)
+AM_CONDITIONAL(BUILD_PCM, test x$build_pcm = xyes)
+AM_CONDITIONAL(BUILD_RAWMIDI, test x$build_rawmidi = xyes)
+AM_CONDITIONAL(BUILD_HWDEP, test x$build_hwdep = xyes)
+AM_CONDITIONAL(BUILD_SEQ, test x$build_seq = xyes)
+AM_CONDITIONAL(BUILD_ALISP, test x$build_alisp = xyes)
+AM_CONDITIONAL(BUILD_PYTHON, test x$build_python = xyes)
+
+if test "$build_mixer" = "yes"; then
+ AC_DEFINE([BUILD_MIXER], "1", [Build mixer component])
+fi
+if test "$build_pcm" = "yes"; then
+ AC_DEFINE([BUILD_PCM], "1", [Build PCM component])
+fi
+if test "$build_rawmidi" = "yes"; then
+ AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component])
+fi
+if test "$build_hwdep" = "yes"; then
+ AC_DEFINE([BUILD_HWDEP], "1", [Build hwdep component])
+fi
+if test "$build_seq" = "yes"; then
+ AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component])
+fi
+
+dnl PCM Plugins
+
+if test "$build_pcm" = "yes"; then
+AC_ARG_WITH(pcm-plugins,
+ AS_HELP_STRING([--with-pcm-plugins=<list>],
+ [build PCM plugins (default = all)]),
+ [pcm_plugins="$withval"], [pcm_plugins="all"])
+else
+pcm_plugins=""
+fi
+
+PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
+
+build_pcm_plugin="no"
+for t in $PCM_PLUGIN_LIST; do
+ eval build_pcm_$t="no"
+done
+
+pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'`
+for p in $pcm_plugins; do
+ for t in $PCM_PLUGIN_LIST; do
+ if test "$p" = "$t" -o "$p" = "all"; then
+ eval build_pcm_$t="yes"
+ build_pcm_plugin="yes"
+ fi
+ done
+done
+
+dnl special dependencies
+if test "$build_pcm_plug" = "yes"; then
+ build_pcm_linear="yes"
+ build_pcm_copy="yes"
+fi
+
+if test "$build_pcm_ioplug" = "yes"; then
+ build_pcm_extplug="yes"
+fi
+
+if test "$HAVE_LIBDL" != "yes"; then
+ build_pcm_meter="no"
+ build_pcm_ladspa="no"
+ build_pcm_pcm_ioplug="no"
+ build_pcm_pcm_extplug="no"
+fi
+
+if test "$HAVE_LIBPTHREAD" != "yes"; then
+ build_pcm_share="no"
+fi
+
+if test "$softfloat" = "yes"; then
+ build_pcm_lfloat="no"
+fi
+
+AM_CONDITIONAL(BUILD_PCM_PLUGIN, test x$build_pcm_plugin = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_COPY, test x$build_pcm_copy = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_LINEAR, test x$build_pcm_linear = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_ROUTE, test x$build_pcm_route = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_MULAW, test x$build_pcm_mulaw = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_ALAW, test x$build_pcm_alaw = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_ADPCM, test x$build_pcm_adpcm = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_RATE, test x$build_pcm_rate = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_PLUG, test x$build_pcm_plug = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_MULTI, test x$build_pcm_multi = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHM, test x$build_pcm_shm = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_FILE, test x$build_pcm_file = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_NULL, test x$build_pcm_null = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_EMPTY, test x$build_pcm_empty = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_SHARE, test x$build_pcm_share = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_METER, test x$build_pcm_meter = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_HOOKS, test x$build_pcm_hooks = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_LFLOAT, test x$build_pcm_lfloat = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_LADSPA, test x$build_pcm_ladspa = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_DMIX, test x$build_pcm_dmix = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_DSHARE, test x$build_pcm_dshare = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_DSNOOP, test x$build_pcm_dsnoop = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_ASYM, test x$build_pcm_asym = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_IEC958, test x$build_pcm_iec958 = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_SOFTVOL, test x$build_pcm_softvol = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_EXTPLUG, test x$build_pcm_extplug = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_IOPLUG, test x$build_pcm_ioplug = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_MMAP_EMUL, test x$build_pcm_mmap_emul = xyes)
+
+dnl Defines for plug plugin
+if test "$build_pcm_rate" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin])
+fi
+if test "$build_pcm_route" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin])
+fi
+if test "$build_pcm_lfloat" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin])
+fi
+if test "$build_pcm_adpcm" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin])
+fi
+if test "$build_pcm_mulaw" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin])
+fi
+if test "$build_pcm_alaw" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin])
+fi
+if test "$build_pcm_mmap_emul" = "yes"; then
+ AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin])
+fi
+
+
+dnl Create PCM plugin symbol list for static library
+rm -f "$srcdir"/src/pcm/pcm_symbols_list.c
+touch "$srcdir"/src/pcm/pcm_symbols_list.c
+for t in $PCM_PLUGIN_LIST; do
+ if eval test \$build_pcm_$t = yes; then
+ echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c
+ fi
+done
+
+dnl Control Plugins
+
+AC_ARG_WITH(ctl-plugins,
+ AS_HELP_STRING([--with-ctl-plugins=<list>],
+ [build control plugins (default = all)]),
+ [ctl_plugins="$withval"], [ctl_plugins="all"])
+
+CTL_PLUGIN_LIST="shm ext"
+
+build_ctl_plugin="no"
+for t in $CTL_PLUGIN_LIST; do
+ eval build_ctl_$t="no"
+done
+
+ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'`
+for p in $ctl_plugins; do
+ for t in $CTL_PLUGIN_LIST; do
+ if test "$p" = "$t" -o "$p" = "all"; then
+ eval build_ctl_$t="yes"
+ build_ctl_plugin="yes"
+ fi
+ done
+done
+
+AM_CONDITIONAL(BUILD_CTL_PLUGIN, test x$build_ctl_plugin = xyes)
+AM_CONDITIONAL(BUILD_CTL_PLUGIN_SHM, test x$build_ctl_shm = xyes)
+AM_CONDITIONAL(BUILD_CTL_PLUGIN_EXT, test x$build_ctl_ext = xyes)
+
+dnl Create ctl plugin symbol list for static library
+rm -f "$srcdir"/src/control/ctl_symbols_list.c
+touch "$srcdir"/src/control/ctl_symbols_list.c
+for t in $CTL_PLUGIN_LIST; do
+ if eval test \$build_ctl_$t = yes; then
+ echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c
+ fi
+done
+
+dnl Make a symlink for inclusion of alsa/xxx.h
+if test ! -L "$srcdir"/include/alsa ; then
+ echo "Making a symlink include/alsa"
+ rm -f "$srcdir"/include/alsa
+ ln -sf . "$srcdir"/include/alsa
+fi
+
+AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
+ include/Makefile include/sound/Makefile src/Versions src/Makefile \
+ src/control/Makefile src/mixer/Makefile \
+ src/pcm/Makefile src/pcm/scopes/Makefile \
+ src/rawmidi/Makefile src/timer/Makefile \
+ src/hwdep/Makefile src/seq/Makefile \
+ src/compat/Makefile src/alisp/Makefile src/conf/Makefile \
+ src/conf/cards/Makefile \
+ src/conf/pcm/Makefile \
+ modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
+ alsalisp/Makefile aserver/Makefile test/Makefile utils/Makefile \
+ utils/alsa-lib.spec utils/alsa.pc)
+
+dnl Create asoundlib.h dynamically according to configure options
+echo "Creating asoundlib.h..."
+cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
+test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
+test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
+test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
+test "$build_hwdep" = "yes" && echo "#include <alsa/hwdep.h>" >> include/asoundlib.h
+echo "#include <alsa/control.h>" >> include/asoundlib.h
+test "$build_mixer" = "yes" && echo "#include <alsa/mixer.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq_event.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h
+test "$build_seq" = "yes" && echo "#include <alsa/seq_midi_event.h>" >> include/asoundlib.h
+cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h
+
diff --git a/alsa-lib/depcomp b/alsa-lib/depcomp
new file mode 100644
index 0000000..04701da
--- /dev/null
+++ b/alsa-lib/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-lib/doc/Makefile.am b/alsa-lib/doc/Makefile.am
new file mode 100644
index 0000000..a5896a7
--- /dev/null
+++ b/alsa-lib/doc/Makefile.am
@@ -0,0 +1,22 @@
+SUBDIRS=pictures
+
+EXTRA_DIST=README.1st asoundrc.txt doxygen.cfg index.doxygen
+
+INCLUDES=-I$(top_srcdir)/include
+
+doc:
+ test -e doxygen.cfg || sed s:@top_srcdir@:..:g doxygen.cfg.in > doxygen.cfg
+ doxygen doxygen.cfg
+
+doc-pack: doc
+ -chmod a+r $(top_srcdir)/doc/doxygen/html/*
+ -chmod a-w $(top_srcdir)/doc/doxygen/html/*
+ if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
+ else \
+ $(TAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
+ fi
+ rm -f $(top_srcdir)/doc/doxygen/html/*
+
+doc-clean:
+ rm -f $(top_srcdir)/doc/doxygen/html/*
diff --git a/alsa-lib/doc/Makefile.in b/alsa-lib/doc/Makefile.in
new file mode 100644
index 0000000..503d651
--- /dev/null
+++ b/alsa-lib/doc/Makefile.in
@@ -0,0 +1,594 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/doxygen.cfg.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES = doxygen.cfg
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = pictures
+EXTRA_DIST = README.1st asoundrc.txt doxygen.cfg index.doxygen
+INCLUDES = -I$(top_srcdir)/include
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+doxygen.cfg: $(top_builddir)/config.status $(srcdir)/doxygen.cfg.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+
+doc:
+ test -e doxygen.cfg || sed s:@top_srcdir@:..:g doxygen.cfg.in > doxygen.cfg
+ doxygen doxygen.cfg
+
+doc-pack: doc
+ -chmod a+r $(top_srcdir)/doc/doxygen/html/*
+ -chmod a-w $(top_srcdir)/doc/doxygen/html/*
+ if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
+ else \
+ $(TAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
+ fi
+ rm -f $(top_srcdir)/doc/doxygen/html/*
+
+doc-clean:
+ rm -f $(top_srcdir)/doc/doxygen/html/*
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/doc/README.1st b/alsa-lib/doc/README.1st
new file mode 100644
index 0000000..f96b21c
--- /dev/null
+++ b/alsa-lib/doc/README.1st
@@ -0,0 +1,2 @@
+The doxygen documentation is created with command 'make doc' in toplevel
+directory.
diff --git a/alsa-lib/doc/asoundrc.txt b/alsa-lib/doc/asoundrc.txt
new file mode 100644
index 0000000..f79d528
--- /dev/null
+++ b/alsa-lib/doc/asoundrc.txt
@@ -0,0 +1,480 @@
+# Configuration file syntax
+
+# Include a new configuration file
+<filename>
+
+# Simple assign
+name [=] value [,|;]
+
+# Compound assign (first style)
+name [=] {
+ name1 [=] value [,|;]
+ ...
+}
+
+# Compound assign (second style)
+name.name1 [=] value [,|;]
+
+# Array assign (first style)
+name [
+ value0 [,|;]
+ value1 [,|;]
+ ...
+]
+
+# Array assign (second style)
+name.0 [=] value0 [,|;]
+name.1 [=] value1 [,|;]
+
+# ******************************************************************************
+
+# Server definition
+server.NAME {
+ host STR # host where the server is located (if map to local address
+ # server is local, and then it may be started automatically)
+ [socket STR] # PF_LOCAL socket name to listen/connect
+ [port INT] # PF_INET port number to listen/connect
+}
+
+# PCM type definition
+pcm_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_pcm_NAME_open)
+ [redirect { # Redirect this PCM to an another
+ [filename STR] # Configuration file specification
+ name STR # PCM name specification
+ }]
+}
+
+# PCM scope type definition
+pcm_scope_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_pcm_scope_NAME_open)
+}
+
+# PCM scope definition
+pcm_scope.NAME {
+ type STR # Scope type
+ ...
+}
+
+# Slave PCM definition
+pcm_slave.NAME {
+ pcm STR # PCM name
+ # or
+ pcm { } # PCM definition
+ format STR # Format
+ channels INT # Channels
+ rate INT # Rate
+ period_time INT # Period time
+ buffer_time INT # Buffer time
+ etc.
+}
+
+# Hook arguments definition
+hook_args.NAME {
+ ... # Arbitrary arguments
+}
+
+# PCM hook type
+pcm_hook_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [install STR] # Install function (default _snd_pcm_hook_NAME_install)
+}
+
+# PCM hook definition
+pcm_hook.NAME {
+ type STR # PCM Hook type (see pcm_hook_type)
+ [args STR] # Arguments for install function (see hook_args)
+ # or
+ [args { }] # Arguments for install function
+}
+
+# PCM definition
+pcm.NAME {
+ type STR # Type
+ [comment ANY] # Saved comments
+
+
+# PCM types:
+ type hw # Kernel PCM
+ card INT/STR # Card name or number
+ [device] INT # Device number (default 0)
+ [subdevice] INT # Subdevice number, -1 first available (default -1)
+ mmap_emulation BOOL # enable mmap emulation for ro/wo devices
+
+
+ type hooks # PCM with hooks
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ hooks {
+ ID STR # Hook name (see pcm_hook)
+ # or
+ ID { } # Hook definition (see pcm_hook)
+ }
+
+ type plug # Format adjusted PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format (default nearest) or "unchanged"
+ [channels INT] # Slave channels (default nearest) or "unchanged"
+ [rate INT] # Slave rate (default nearest) or "unchanged"
+ }
+ route_policy STR # route policy for automatic ttable generation
+ # STR can be 'default', 'average', 'copy', 'duplicate'
+ # average: result is average of input channels
+ # copy: only first channels are copied to destination
+ # duplicate: duplicate first set of channels
+ # default: copy policy, except for mono capture - sum
+ ttable { # Transfer table (bidimensional compound of
+ # cchannels * schannels numbers)
+ CCHANNEL {
+ SCHANNEL REAL # route value (0.0 ... 1.0)
+ }
+ }
+
+
+ type copy # Copy conversion PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+
+
+ type linear # Linear format conversion PCM
+ type adpcm # IMA-ADPCM format conversion PCM
+ type alaw # A-Law format conversion PCM
+ type mulaw # Mu-Law format conversion PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+
+
+ type rate # Rate conversion PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format (default client format)
+ rate INT # Slave rate
+ }
+
+
+ type route # Attenuated static route PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format (default client format)
+ [channels INT] # Slave channels (default client channels)
+ }
+ ttable { # Transfer table (bidimensional compound of
+ # cchannels * schannels numbers)
+ CCHANNEL {
+ SCHANNEL REAL # route value (0.0 ... 1.0)
+ }
+ }
+
+
+ type multi # Linked PCMs (exclusive access to selected channels)
+ slaves { # Slaves definitions
+ ID STR # Slave name for slave N (see pcm_slave)
+ # or
+ ID { # Slave definition for slave N
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ channels INT # Slave channels
+ }
+ }
+ bindings { # Bindings table
+ N { # Binding for client channel N
+ slave STR # Slave key
+ channel INT # Slave channel
+ }
+ }
+ [master INT] # Define the master slave
+
+
+ type file # File plugin
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ file STR # File name
+ # or
+ file INT # File descriptor
+ [format STR] # File format (NYI)
+ [perm INT] # File permission (default 0600)
+
+ type meter # Meter PCM
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition or name
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ [frequency INT] # Updates per second
+ scopes { # Scopes
+ ID STR # Scope name (see pcm_scope)
+ # or
+ ID { } # Scope definition (see pcm_scope)
+ }
+
+
+ type droute # Attenuated dynamic route PCM (NYI)
+ slave STR # Slave name (see pcm_slave)
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format (default client format)
+ [channels INT] # Slave channels (default client channels)
+ }
+ ctl STR # Ctl name
+ bindings { # Bindings table
+ ID { # Binding entry
+ cchannels { # Client channels
+ C INT # Client channel
+ }
+ schannel { # Slave channels
+ S INT # Slave channel
+ }
+ control STR # Control name of C * S (or C values: only if C == S)
+ }
+ }
+
+
+ type null # Null endpoint plugin
+ [time INT] # Time related or not (NYI)
+
+
+ type shm # Shared memory client PCM
+ server STR # Server name
+ pcm STR # PCM name on server
+
+
+ type share # Share PCM
+ slave STR # Slave name (see pcm_slave)
+ bindings { # Bindings table
+ N INT # Slave channel for client channel N
+ }
+
+
+ type mix # Mix PCM
+ slave STR # Slave name (see pcm_slave)
+ bindings { # Bindings table
+ N INT # Slave channel for client channel N
+ }
+
+
+ type ladspa # LADSPA plugin PCM
+ slave STR # Slave name (see pcm_slave)
+ path STR # Path or paths (delimited with ':')
+ plugins | playback_plugins | capture_plugins {
+ N { # Configuration for LADSPA plugin N
+ id # # LADSPA plugin ID (for example 1043)
+ label STR # LADSPA plugin label (for example 'delay_5s')
+ filename STR # Full filename of .so library with LADPA plugin code
+ policy STR # Policy can be 'none' or 'duplicate'
+ input | output {
+ bindings {
+ C INT or STR # C - channel, INT - audio port index, STR - audio port name
+ }
+ controls {
+ I INT or REAL # I - control port index, INT or REAL - control value
+ }
+ }
+ }
+ }
+
+ type dmix # Direct mixing plugin
+ slave STR # Slave name (see pcm_slave)
+ ipc_key INT # Unique ipc key
+ ipc_perm INT # ipc permissions (default 0600)
+ ipc_gid INT # ipc gid (default -1 = disable)
+ ipc_key_add_uid BOOL # Add current uid to ipc_key
+ bindings { # Bindings table
+ N INT # Slave channel for client channel N
+ }
+
+ type dsnoop # Direct snoop (split one capture stream to more)
+ slave STR # Slave name (see pcm_slave)
+ ipc_key INT # Unique ipc key
+ ipc_perm INT # ipc permissions (default 0600)
+ ipc_gid INT # ipc gid (default -1 = disable)
+ ipc_key_add_uid BOOL # Add current uid to ipc_key
+ bindings { # Bindings table
+ N INT # Slave channel for client channel N
+ }
+
+ type dshare # Share channels from one stream
+ slave STR # Slave name (see pcm_slave)
+ ipc_key INT # Unique ipc key
+ ipc_perm INT # ipc permissions (default 0600)
+ ipc_gid INT # ipc gid (default -1 = disable)
+ ipc_key_add_uid BOOL # Add current uid to ipc_key
+ bindings { # Bindings table
+ N INT # Slave channel for client channel N
+ }
+}
+
+# CTL type definition
+ctl_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_ctl_NAME_open)
+}
+
+# CTL definition
+ctl.NAME {
+ type STR # Type
+ [comment ANY] # Saved comments
+
+# CTL types
+ type hw
+ card STR/INT # Card name or number
+
+
+ type shm # Shared memory client CTL
+ server STR # Server name
+ ctl STR # CTL name on server
+
+
+}
+
+
+# RAWMIDI type definition
+rawmidi_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_rawmidi_NAME_open)
+}
+
+# RAWMIDI definition
+rawmidi.NAME {
+ type STR # Type
+ [comment ANY] # Saved comments
+
+# RAWMIDI types:
+ type hw # Kernel RAWMIDI
+ card INT/STR # Card name or number
+ [device] INT # Device number (default 0)
+ [subdevice] INT # Subdevice number, -1 first available (default -1)
+
+
+}
+
+# SEQ type definition
+seq_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_seq_NAME_open)
+}
+
+# SEQ definition
+seq.NAME {
+ type STR # Type
+ [comment ANY] # Saved comments
+
+# SEQ types:
+ type hw # Kernel SEQ
+
+
+}
+
+# Aliases
+DEF.NAME1 NAME2 # DEF.NAME1 is an alias for DEF.NAME2
+
+Some examples:
+
+pcm.trident {
+ type hw
+ card 0
+ device 0
+}
+
+pcm.ice1712 {
+ type hw
+ card 1
+ device 0
+}
+
+pcm.ice1712_spdif {
+ type plug
+ ttable.0.8 1
+ ttable.1.9 1
+ slave.pcm ice1712
+}
+
+pcm_slave.rs {
+ pcm trident
+ rate 44100
+}
+
+pcm.r {
+ type rate
+ slave rs
+}
+
+pcm.m {
+ type meter
+ slave.pcm plug:trident
+ frequency 50
+ scopes [
+ {
+ type level
+ }
+ ]
+}
+
+pcm_scope_type.level {
+ lib /home/abramo/scopes/scope-level.so
+}
+
+# an example command is 'aplay -D plug:ladspa <filename>'
+# otherwise, the ladspa plugin expects FLOAT type which
+# is very rare
+pcm.ladspa {
+ type ladspa
+ slave.pcm "plughw:0,0";
+ path "/home/perex/src/ladspa_sdk/plugins";
+ plugins [
+ {
+ label delay_5s
+ input {
+ controls [ 0.8 0.2 ]
+ }
+ }
+ ]
+}
+
+# an example command for dmix plugin to force 44100Hz mixing rate:
+# aplay -D"plug:'dmix:RATE=44100'" <filename>
+# an example command for dmix plugin to force 44100Hz and hw:1,0 output device
+# aplay -Dplug:\'dmix:SLAVE=\"hw:1,0\",RATE=44100\' <filename>
+# an example command for dmix plugin to force 32-bit signed little endian format
+# aplay -D"plug:'dmix:FORMAT=S32_LE'" <filename>
diff --git a/alsa-lib/doc/doxygen.cfg b/alsa-lib/doc/doxygen.cfg
new file mode 100644
index 0000000..9ee4c3c
--- /dev/null
+++ b/alsa-lib/doc/doxygen.cfg
@@ -0,0 +1,119 @@
+PROJECT_NAME = "ALSA project - the C library reference"
+OUTPUT_DIRECTORY = doxygen
+GENERATE_LATEX = NO
+GENERATE_MAN = NO
+GENERATE_RTF = NO
+
+CASE_SENSE_NAMES = NO
+INPUT = ../doc/index.doxygen \
+ ../include/asoundlib.h \
+ ../include/version.h \
+ ../include/global.h \
+ ../include/asoundef.h \
+ ../include/input.h \
+ ../include/output.h \
+ ../include/error.h \
+ ../include/conf.h \
+ ../include/control.h \
+ ../include/pcm.h \
+ ../include/rawmidi.h \
+ ../include/timer.h \
+ ../include/hwdep.h \
+ ../include/seq.h \
+ ../include/seq_event.h \
+ ../include/seqmid.h \
+ ../include/seq_midi_event.h \
+ ../include/pcm_external.h \
+ ../include/pcm_extplug.h \
+ ../include/pcm_ioplug.h \
+ ../include/control_external.h \
+ ../include/mixer.h \
+ ../src/error.c \
+ ../src/dlmisc.c \
+ ../src/async.c \
+ ../src/input.c \
+ ../src/output.c \
+ ../src/conf.c \
+ ../src/confmisc.c \
+ ../src/names.c \
+ ../src/shmarea.c \
+ ../src/userfile.c \
+ ../src/control \
+ ../src/mixer \
+ ../src/pcm/pcm.c \
+ ../src/pcm/pcm_mmap.c \
+ ../src/pcm/pcm_plugin.c \
+ ../src/pcm/pcm_hw.c \
+ ../src/pcm/pcm_mmap_emul.c \
+ ../src/pcm/pcm_shm.c \
+ ../src/pcm/pcm_null.c \
+ ../src/pcm/pcm_copy.c \
+ ../src/pcm/pcm_linear.c \
+ ../src/pcm/pcm_lfloat.c \
+ ../src/pcm/pcm_mulaw.c \
+ ../src/pcm/pcm_alaw.c \
+ ../src/pcm/pcm_adpcm.c \
+ ../src/pcm/pcm_route.c \
+ ../src/pcm/pcm_rate.c \
+ ../src/pcm/pcm_plug.c \
+ ../src/pcm/pcm_file.c \
+ ../src/pcm/pcm_multi.c \
+ ../src/pcm/pcm_share.c \
+ ../src/pcm/pcm_hooks.c \
+ ../src/pcm/pcm_dmix.c \
+ ../src/pcm/pcm_dshare.c \
+ ../src/pcm/pcm_dsnoop.c \
+ ../src/pcm/pcm_meter.c \
+ ../src/pcm/pcm_ladspa.c \
+ ../src/pcm/pcm_asym.c \
+ ../src/pcm/pcm_iec958.c \
+ ../src/pcm/pcm_softvol.c \
+ ../src/pcm/pcm_extplug.c \
+ ../src/pcm/pcm_ioplug.c \
+ ../src/pcm/pcm_empty.c \
+ ../src/pcm/pcm_misc.c \
+ ../src/pcm/pcm_simple.c \
+ ../src/rawmidi \
+ ../src/timer \
+ ../src/hwdep \
+ ../src/seq
+EXCLUDE = ../src/control/control_local.h \
+ ../src/pcm/atomic.h \
+ ../src/pcm/interval.h \
+ ../src/pcm/interval_inline.h \
+ ../src/pcm/mask.h \
+ ../src/pcm/mask_inline.h \
+ ../src/pcm/pcm_local.h \
+ ../src/pcm/pcm_meter.h \
+ ../src/pcm/pcm_plugin.h \
+ ../src/pcm/plugin_ops.h \
+ ../src/pcm/ladspa.h \
+ ../src/hwdep/hwdep_local.h \
+ ../src/mixer/mixer_local.h \
+ ../src/rawmidi/rawmidi_local.h \
+ ../src/seq/seq_local.h
+RECURSIVE = YES
+FILE_PATTERNS = *.c *.h
+EXAMPLE_PATH = ../test
+IMAGE_PATH = pictures
+QUIET = YES
+
+EXTRACT_ALL = NO
+EXTRACT_STATIC = NO
+SHOW_INCLUDE_FILES = NO
+JAVADOC_AUTOBRIEF = NO
+INHERIT_DOCS = YES
+ENABLED_SECTIONS = ""
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
+ "ATTRIBUTE_UNUSED=" \
+ ALSA_PCM_NEW_HW_PARAMS_API \
+ _POSIX_C_SOURCE \
+ "use_default_symbol_version(x,y,z)=" \
+ "link_warning(x,y)="
+
+OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option
+
+#INPUT_FILTER = inputfilter
+#FILTER_SOURCE_FILES = YES
diff --git a/alsa-lib/doc/doxygen.cfg.in b/alsa-lib/doc/doxygen.cfg.in
new file mode 100644
index 0000000..4f682cf
--- /dev/null
+++ b/alsa-lib/doc/doxygen.cfg.in
@@ -0,0 +1,119 @@
+PROJECT_NAME = "ALSA project - the C library reference"
+OUTPUT_DIRECTORY = doxygen
+GENERATE_LATEX = NO
+GENERATE_MAN = NO
+GENERATE_RTF = NO
+
+CASE_SENSE_NAMES = NO
+INPUT = @top_srcdir@/doc/index.doxygen \
+ @top_srcdir@/include/asoundlib.h \
+ @top_srcdir@/include/version.h \
+ @top_srcdir@/include/global.h \
+ @top_srcdir@/include/asoundef.h \
+ @top_srcdir@/include/input.h \
+ @top_srcdir@/include/output.h \
+ @top_srcdir@/include/error.h \
+ @top_srcdir@/include/conf.h \
+ @top_srcdir@/include/control.h \
+ @top_srcdir@/include/pcm.h \
+ @top_srcdir@/include/rawmidi.h \
+ @top_srcdir@/include/timer.h \
+ @top_srcdir@/include/hwdep.h \
+ @top_srcdir@/include/seq.h \
+ @top_srcdir@/include/seq_event.h \
+ @top_srcdir@/include/seqmid.h \
+ @top_srcdir@/include/seq_midi_event.h \
+ @top_srcdir@/include/pcm_external.h \
+ @top_srcdir@/include/pcm_extplug.h \
+ @top_srcdir@/include/pcm_ioplug.h \
+ @top_srcdir@/include/control_external.h \
+ @top_srcdir@/include/mixer.h \
+ @top_srcdir@/src/error.c \
+ @top_srcdir@/src/dlmisc.c \
+ @top_srcdir@/src/async.c \
+ @top_srcdir@/src/input.c \
+ @top_srcdir@/src/output.c \
+ @top_srcdir@/src/conf.c \
+ @top_srcdir@/src/confmisc.c \
+ @top_srcdir@/src/names.c \
+ @top_srcdir@/src/shmarea.c \
+ @top_srcdir@/src/userfile.c \
+ @top_srcdir@/src/control \
+ @top_srcdir@/src/mixer \
+ @top_srcdir@/src/pcm/pcm.c \
+ @top_srcdir@/src/pcm/pcm_mmap.c \
+ @top_srcdir@/src/pcm/pcm_plugin.c \
+ @top_srcdir@/src/pcm/pcm_hw.c \
+ @top_srcdir@/src/pcm/pcm_mmap_emul.c \
+ @top_srcdir@/src/pcm/pcm_shm.c \
+ @top_srcdir@/src/pcm/pcm_null.c \
+ @top_srcdir@/src/pcm/pcm_copy.c \
+ @top_srcdir@/src/pcm/pcm_linear.c \
+ @top_srcdir@/src/pcm/pcm_lfloat.c \
+ @top_srcdir@/src/pcm/pcm_mulaw.c \
+ @top_srcdir@/src/pcm/pcm_alaw.c \
+ @top_srcdir@/src/pcm/pcm_adpcm.c \
+ @top_srcdir@/src/pcm/pcm_route.c \
+ @top_srcdir@/src/pcm/pcm_rate.c \
+ @top_srcdir@/src/pcm/pcm_plug.c \
+ @top_srcdir@/src/pcm/pcm_file.c \
+ @top_srcdir@/src/pcm/pcm_multi.c \
+ @top_srcdir@/src/pcm/pcm_share.c \
+ @top_srcdir@/src/pcm/pcm_hooks.c \
+ @top_srcdir@/src/pcm/pcm_dmix.c \
+ @top_srcdir@/src/pcm/pcm_dshare.c \
+ @top_srcdir@/src/pcm/pcm_dsnoop.c \
+ @top_srcdir@/src/pcm/pcm_meter.c \
+ @top_srcdir@/src/pcm/pcm_ladspa.c \
+ @top_srcdir@/src/pcm/pcm_asym.c \
+ @top_srcdir@/src/pcm/pcm_iec958.c \
+ @top_srcdir@/src/pcm/pcm_softvol.c \
+ @top_srcdir@/src/pcm/pcm_extplug.c \
+ @top_srcdir@/src/pcm/pcm_ioplug.c \
+ @top_srcdir@/src/pcm/pcm_empty.c \
+ @top_srcdir@/src/pcm/pcm_misc.c \
+ @top_srcdir@/src/pcm/pcm_simple.c \
+ @top_srcdir@/src/rawmidi \
+ @top_srcdir@/src/timer \
+ @top_srcdir@/src/hwdep \
+ @top_srcdir@/src/seq
+EXCLUDE = @top_srcdir@/src/control/control_local.h \
+ @top_srcdir@/src/pcm/atomic.h \
+ @top_srcdir@/src/pcm/interval.h \
+ @top_srcdir@/src/pcm/interval_inline.h \
+ @top_srcdir@/src/pcm/mask.h \
+ @top_srcdir@/src/pcm/mask_inline.h \
+ @top_srcdir@/src/pcm/pcm_local.h \
+ @top_srcdir@/src/pcm/pcm_meter.h \
+ @top_srcdir@/src/pcm/pcm_plugin.h \
+ @top_srcdir@/src/pcm/plugin_ops.h \
+ @top_srcdir@/src/pcm/ladspa.h \
+ @top_srcdir@/src/hwdep/hwdep_local.h \
+ @top_srcdir@/src/mixer/mixer_local.h \
+ @top_srcdir@/src/rawmidi/rawmidi_local.h \
+ @top_srcdir@/src/seq/seq_local.h
+RECURSIVE = YES
+FILE_PATTERNS = *.c *.h
+EXAMPLE_PATH = @top_srcdir@/test
+IMAGE_PATH = pictures
+QUIET = YES
+
+EXTRACT_ALL = NO
+EXTRACT_STATIC = NO
+SHOW_INCLUDE_FILES = NO
+JAVADOC_AUTOBRIEF = NO
+INHERIT_DOCS = YES
+ENABLED_SECTIONS = ""
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
+ "ATTRIBUTE_UNUSED=" \
+ ALSA_PCM_NEW_HW_PARAMS_API \
+ _POSIX_C_SOURCE \
+ "use_default_symbol_version(x,y,z)=" \
+ "link_warning(x,y)="
+
+OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option
+
+#INPUT_FILTER = inputfilter
+#FILTER_SOURCE_FILES = YES
diff --git a/alsa-lib/doc/index.doxygen b/alsa-lib/doc/index.doxygen
new file mode 100644
index 0000000..f76cc10
--- /dev/null
+++ b/alsa-lib/doc/index.doxygen
@@ -0,0 +1,54 @@
+/*! \page Index Preamble and License
+
+\author Jaroslav Kysela <perex@perex.cz>
+\author Abramo Bagnara <abramo@alsa-project.org>
+\author Takashi Iwai <tiwai@suse.de>
+\author Frank van de Pol <fvdpol@coil.demon.nl>
+
+<H2>Preface</H2>
+<P>The Advanced Linux Sound Architecture (\e ALSA) comes with a kernel
+API and a library API. This document describes the library API and how
+it interfaces with the kernel API.</P>
+
+<H2>Documentation License</H2>
+
+<P>This documentation is free; you can redistribute it without
+any restrictions. Modifications or derived work must retain
+the copyright and list all authors.</P>
+
+<P>This documentation is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
+
+<H2>API usage</H2>
+<P>Application programmers should use the library API rather than the
+kernel API. The library offers 100% of the functionality of the kernel API,
+but adds major improvements in usability, making the application code simpler
+and better looking. In addition, future fixes or compatibility code
+may be placed in the library code instead of the kernel driver.</P>
+
+<H2>API links</H2>
+
+<UL>
+ <LI>Page \ref control explains the primitive controls API.
+ <LI>Page \ref hcontrol explains the high-level primitive controls API.
+ <LI>Page \ref mixer explains the mixer controls API.
+ <LI>Page \ref pcm explains the design of the PCM (digital audio) API.
+ <LI>Page \ref pcm_plugins explains the design of PCM (digital audio) plugins.
+ <LI>Page \ref pcm_external_plugins explains the external PCM plugin SDK.
+ <LI>Page \ref ctl_external_plugins explains the external control plugin SDK.
+ <LI>Page \ref rawmidi explains the design of the RawMidi API.
+ <LI>Page \ref timer explains the design of the Timer API.
+ <LI>Page \ref seq explains the design of the Sequencer API.
+</UL>
+
+<H2>Configuration</H2>
+
+<UL>
+ <LI>Page \ref conf explains the syntax of library configuration files.
+ <LI>Page \ref confarg explains the run-time argument syntax.
+ <LI>Page \ref conffunc explains run-time function definitions and their usage.
+ <LI>Page \ref confhooks explains run-time hook definitions and their usage.
+</UL>
+
+*/
diff --git a/alsa-lib/doc/pictures/Makefile.am b/alsa-lib/doc/pictures/Makefile.am
new file mode 100644
index 0000000..17b6e12
--- /dev/null
+++ b/alsa-lib/doc/pictures/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST=wave1.gif wave2.gif
diff --git a/alsa-lib/doc/pictures/Makefile.in b/alsa-lib/doc/pictures/Makefile.in
new file mode 100644
index 0000000..4265232
--- /dev/null
+++ b/alsa-lib/doc/pictures/Makefile.in
@@ -0,0 +1,415 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc/pictures
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = wave1.gif wave2.gif
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/pictures/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign doc/pictures/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/gitcompile b/alsa-lib/gitcompile
new file mode 100644
index 0000000..6954cf2
--- /dev/null
+++ b/alsa-lib/gitcompile
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+
+touch ltconfig
+libtoolize --force --copy --automake
+aclocal $ACLOCAL_FLAGS
+autoheader
+automake --foreign --copy --add-missing
+touch depcomp # seems to be missing for old automake
+autoconf
+export CFLAGS='-O2 -Wall -W -pipe -g'
+echo "CFLAGS=$CFLAGS"
+echo "./configure $@"
+./configure $@ || exit 1
+unset CFLAGS
+if [ -z "$GITCOMPILE_NO_MAKE" ]; then
+ make
+fi
diff --git a/alsa-lib/include/Makefile.am b/alsa-lib/include/Makefile.am
new file mode 100644
index 0000000..a291503
--- /dev/null
+++ b/alsa-lib/include/Makefile.am
@@ -0,0 +1,90 @@
+SUBDIRS = sound
+
+sysincludedir = ${includedir}/sys
+alsaincludedir = ${includedir}/alsa
+
+alsainclude_HEADERS = asoundlib.h asoundef.h \
+ version.h global.h input.h output.h error.h \
+ conf.h control.h iatomic.h
+
+if BUILD_CTL_PLUGIN_EXT
+alsainclude_HEADERS += control_external.h
+endif
+
+if BUILD_PCM
+alsainclude_HEADERS += pcm.h pcm_old.h timer.h
+if BUILD_PCM_PLUGIN
+alsainclude_HEADERS += pcm_plugin.h
+endif
+if BUILD_PCM_PLUGIN_RATE
+alsainclude_HEADERS += pcm_rate.h
+endif
+if BUILD_PCM_PLUGIN_EXTPLUG
+alsainclude_HEADERS += pcm_external.h pcm_extplug.h
+endif
+if BUILD_PCM_PLUGIN_IOPLUG
+if !BUILD_PCM_PLUGIN_EXTPLUG
+alsainclude_HEADERS += pcm_external.h
+endif
+alsainclude_HEADERS += pcm_ioplug.h
+endif
+endif
+
+if BUILD_RAWMIDI
+alsainclude_HEADERS += rawmidi.h
+endif
+
+if BUILD_HWDEP
+alsainclude_HEADERS += hwdep.h
+endif
+
+if BUILD_MIXER
+alsainclude_HEADERS += mixer.h mixer_abst.h
+endif
+
+if BUILD_SEQ
+alsainclude_HEADERS += seq_event.h seq.h seqmid.h seq_midi_event.h
+endif
+
+if BUILD_ALISP
+alsainclude_HEADERS += alisp.h
+endif
+
+noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \
+ asoundlib-head.h asoundlib-tail.h
+
+DISTCLEANFILES = stamp-vh version.h alsa asoundlib.h
+
+alsa:
+ ln -s $(top_srcdir)/include alsa
+
+version.h: stamp-vh alsa
+ @:
+
+stamp-vh: $(top_builddir)/configure.in
+ @echo "/*" > ver.tmp
+ @echo " * version.h" >> ver.tmp
+ @echo " */" >> ver.tmp
+ @echo "" >> ver.tmp
+ @echo "#define SND_LIB_MAJOR $(SND_LIB_MAJOR) /**< major number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_MINOR $(SND_LIB_MINOR) /**< minor number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_SUBMINOR $(SND_LIB_SUBMINOR) /**< subminor number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_EXTRAVER $(SND_LIB_EXTRAVER) /**< extra version number, used mainly for betas */" >> ver.tmp
+ @echo "/** library version */" >> ver.tmp
+ @echo "#define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\\" >> ver.tmp
+ @echo " (SND_LIB_MINOR<<8)|\\" >> ver.tmp
+ @echo " SND_LIB_SUBMINOR)" >> ver.tmp
+ @echo "/** library version (string) */" >> ver.tmp
+ @echo "#define SND_LIB_VERSION_STR \"$(SND_LIB_VERSION)\"" >> ver.tmp
+ @echo >> ver.tmp
+ @cmp -s version.h ver.tmp \
+ || (echo "Updating version.h"; \
+ cp ver.tmp version.h; \
+ echo timestamp > stamp-vh)
+ -@rm -f ver.tmp
+
+INCLUDES=-I$(top_srcdir)/include
+
+install-data-hook:
+ test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
+ $(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
diff --git a/alsa-lib/include/Makefile.in b/alsa-lib/include/Makefile.in
new file mode 100644
index 0000000..bf081c6
--- /dev/null
+++ b/alsa-lib/include/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_CTL_PLUGIN_EXT_TRUE@am__append_1 = control_external.h
+@BUILD_PCM_TRUE@am__append_2 = pcm.h pcm_old.h timer.h
+@BUILD_PCM_PLUGIN_TRUE@@BUILD_PCM_TRUE@am__append_3 = pcm_plugin.h
+@BUILD_PCM_PLUGIN_RATE_TRUE@@BUILD_PCM_TRUE@am__append_4 = pcm_rate.h
+@BUILD_PCM_PLUGIN_EXTPLUG_TRUE@@BUILD_PCM_TRUE@am__append_5 = pcm_external.h pcm_extplug.h
+@BUILD_PCM_PLUGIN_EXTPLUG_FALSE@@BUILD_PCM_PLUGIN_IOPLUG_TRUE@@BUILD_PCM_TRUE@am__append_6 = pcm_external.h
+@BUILD_PCM_PLUGIN_IOPLUG_TRUE@@BUILD_PCM_TRUE@am__append_7 = pcm_ioplug.h
+@BUILD_RAWMIDI_TRUE@am__append_8 = rawmidi.h
+@BUILD_HWDEP_TRUE@am__append_9 = hwdep.h
+@BUILD_MIXER_TRUE@am__append_10 = mixer.h mixer_abst.h
+@BUILD_SEQ_TRUE@am__append_11 = seq_event.h seq.h seqmid.h seq_midi_event.h
+@BUILD_ALISP_TRUE@am__append_12 = alisp.h
+subdir = include
+DIST_COMMON = $(am__alsainclude_HEADERS_DIST) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+am__alsainclude_HEADERS_DIST = asoundlib.h asoundef.h version.h \
+ global.h input.h output.h error.h conf.h control.h iatomic.h \
+ control_external.h pcm.h pcm_old.h timer.h pcm_plugin.h \
+ pcm_rate.h pcm_external.h pcm_extplug.h pcm_ioplug.h rawmidi.h \
+ hwdep.h mixer.h mixer_abst.h seq_event.h seq.h seqmid.h \
+ seq_midi_event.h alisp.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsaincludedir)"
+alsaincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(alsainclude_HEADERS) $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = sound
+sysincludedir = ${includedir}/sys
+alsaincludedir = ${includedir}/alsa
+alsainclude_HEADERS = asoundlib.h asoundef.h version.h global.h \
+ input.h output.h error.h conf.h control.h iatomic.h \
+ $(am__append_1) $(am__append_2) $(am__append_3) \
+ $(am__append_4) $(am__append_5) $(am__append_6) \
+ $(am__append_7) $(am__append_8) $(am__append_9) \
+ $(am__append_10) $(am__append_11) $(am__append_12)
+noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \
+ asoundlib-head.h asoundlib-tail.h
+
+DISTCLEANFILES = stamp-vh version.h alsa asoundlib.h
+INCLUDES = -I$(top_srcdir)/include
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status include/config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-alsaincludeHEADERS: $(alsainclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsaincludedir)" || $(mkdir_p) "$(DESTDIR)$(alsaincludedir)"
+ @list='$(alsainclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsaincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(alsaincludedir)/$$f'"; \
+ $(alsaincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(alsaincludedir)/$$f"; \
+ done
+
+uninstall-alsaincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsainclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsaincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsaincludedir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(alsaincludedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-alsaincludeHEADERS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-alsaincludeHEADERS uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-hdr \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install \
+ install-alsaincludeHEADERS install-am install-data \
+ install-data-am install-data-hook install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-alsaincludeHEADERS \
+ uninstall-am uninstall-info-am
+
+
+alsa:
+ ln -s $(top_srcdir)/include alsa
+
+version.h: stamp-vh alsa
+ @:
+
+stamp-vh: $(top_builddir)/configure.in
+ @echo "/*" > ver.tmp
+ @echo " * version.h" >> ver.tmp
+ @echo " */" >> ver.tmp
+ @echo "" >> ver.tmp
+ @echo "#define SND_LIB_MAJOR $(SND_LIB_MAJOR) /**< major number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_MINOR $(SND_LIB_MINOR) /**< minor number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_SUBMINOR $(SND_LIB_SUBMINOR) /**< subminor number of library version */" >> ver.tmp
+ @echo "#define SND_LIB_EXTRAVER $(SND_LIB_EXTRAVER) /**< extra version number, used mainly for betas */" >> ver.tmp
+ @echo "/** library version */" >> ver.tmp
+ @echo "#define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\\" >> ver.tmp
+ @echo " (SND_LIB_MINOR<<8)|\\" >> ver.tmp
+ @echo " SND_LIB_SUBMINOR)" >> ver.tmp
+ @echo "/** library version (string) */" >> ver.tmp
+ @echo "#define SND_LIB_VERSION_STR \"$(SND_LIB_VERSION)\"" >> ver.tmp
+ @echo >> ver.tmp
+ @cmp -s version.h ver.tmp \
+ || (echo "Updating version.h"; \
+ cp ver.tmp version.h; \
+ echo timestamp > stamp-vh)
+ -@rm -f ver.tmp
+
+install-data-hook:
+ test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
+ $(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/include/alisp.h b/alsa-lib/include/alisp.h
new file mode 100644
index 0000000..407ed64
--- /dev/null
+++ b/alsa-lib/include/alisp.h
@@ -0,0 +1,55 @@
+/*
+ * ALSA lisp implementation
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+struct alisp_cfg {
+ int verbose: 1,
+ warning: 1,
+ debug: 1;
+ snd_input_t *in; /* program code */
+ snd_output_t *out; /* program output */
+ snd_output_t *eout; /* error output */
+ snd_output_t *vout; /* verbose output */
+ snd_output_t *wout; /* warning output */
+ snd_output_t *dout; /* debug output */
+};
+
+struct alisp_instance;
+struct alisp_object;
+struct alisp_seq_iterator;
+
+struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input);
+void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg);
+int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **instance);
+void alsa_lisp_free(struct alisp_instance *instance);
+int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
+ const char *id, const char *args, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (printf, 4, 5)))
+#endif
+ ;
+void alsa_lisp_result_free(struct alisp_instance *instance,
+ struct alisp_seq_iterator *result);
+int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
+ struct alisp_seq_iterator **seq);
+int alsa_lisp_seq_next(struct alisp_seq_iterator **seq);
+int alsa_lisp_seq_count(struct alisp_seq_iterator *seq);
+int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val);
+int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr);
diff --git a/alsa-lib/include/alsa b/alsa-lib/include/alsa
new file mode 100644
index 0000000..945c9b4
--- /dev/null
+++ b/alsa-lib/include/alsa
@@ -0,0 +1 @@
+. \ No newline at end of file
diff --git a/alsa-lib/include/alsa-symbols.h b/alsa-lib/include/alsa-symbols.h
new file mode 100644
index 0000000..51cb982
--- /dev/null
+++ b/alsa-lib/include/alsa-symbols.h
@@ -0,0 +1,72 @@
+/*
+ * ALSA lib - dynamic symbol versions
+ * Copyright (c) 2002 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SYMBOLS_H
+#define __ALSA_SYMBOLS_H
+
+#if defined(PIC) && defined(VERSIONED_SYMBOLS) /* might be also configurable */
+#define USE_VERSIONED_SYMBOLS
+#endif
+
+#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
+#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
+
+#ifdef __powerpc64__
+# define symbol_version(real, name, version) \
+ __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version); \
+ __asm__ (".symver ." ASM_NAME(#real) ",." ASM_NAME(#name) "@" #version)
+# define default_symbol_version(real, name, version) \
+ __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version); \
+ __asm__ (".symver ." ASM_NAME(#real) ",." ASM_NAME(#name) "@@" #version)
+#else
+# define symbol_version(real, name, version) \
+ __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
+# define default_symbol_version(real, name, version) \
+ __asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)
+#endif
+
+#ifdef USE_VERSIONED_SYMBOLS
+#define use_symbol_version(real, name, version) \
+ symbol_version(real, name, version)
+#define use_default_symbol_version(real, name, version) \
+ default_symbol_version(real, name, version)
+#else
+#define use_symbol_version(real, name, version) /* nothing */
+#ifdef __powerpc64__
+#define use_default_symbol_version(real, name, version) \
+ __asm__ (".weak " ASM_NAME(#name)); \
+ __asm__ (".weak ." ASM_NAME(#name)); \
+ __asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real)); \
+ __asm__ (".set ." ASM_NAME(#name) ",." ASM_NAME(#real))
+#else
+#if defined(__alpha__) || defined(__mips__)
+#define use_default_symbol_version(real, name, version) \
+ __asm__ (".weak " ASM_NAME(#name)); \
+ __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
+#else
+#define use_default_symbol_version(real, name, version) \
+ __asm__ (".weak " ASM_NAME(#name)); \
+ __asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real))
+#endif
+#endif
+#endif
+
+#endif /* __ALSA_SYMBOLS_H */
diff --git a/alsa-lib/include/aserver.h b/alsa-lib/include/aserver.h
new file mode 100644
index 0000000..2586832
--- /dev/null
+++ b/alsa-lib/include/aserver.h
@@ -0,0 +1,160 @@
+/*
+ * ALSA client/server header file
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <netdb.h>
+#include "../src/pcm/pcm_local.h"
+#include "../src/control/control_local.h"
+
+int snd_receive_fd(int sock, void *data, size_t len, int *fd);
+int snd_is_local(struct hostent *hent);
+
+typedef enum _snd_dev_type {
+ SND_DEV_TYPE_PCM,
+ SND_DEV_TYPE_CONTROL,
+ SND_DEV_TYPE_RAWMIDI,
+ SND_DEV_TYPE_TIMER,
+ SND_DEV_TYPE_HWDEP,
+ SND_DEV_TYPE_SEQ,
+} snd_dev_type_t;
+
+typedef enum _snd_transport_type {
+ SND_TRANSPORT_TYPE_SHM,
+ SND_TRANSPORT_TYPE_TCP,
+} snd_transport_type_t;
+
+#define SND_PCM_IOCTL_HWSYNC _IO ('A', 0x22)
+#define SND_PCM_IOCTL_STATE _IO ('A', 0xf1)
+#define SND_PCM_IOCTL_MMAP _IO ('A', 0xf2)
+#define SND_PCM_IOCTL_MUNMAP _IO ('A', 0xf3)
+#define SND_PCM_IOCTL_MMAP_COMMIT _IO ('A', 0xf4)
+#define SND_PCM_IOCTL_AVAIL_UPDATE _IO ('A', 0xf5)
+#define SND_PCM_IOCTL_ASYNC _IO ('A', 0xf6)
+#define SND_PCM_IOCTL_CLOSE _IO ('A', 0xf7)
+#define SND_PCM_IOCTL_POLL_DESCRIPTOR _IO ('A', 0xf8)
+#define SND_PCM_IOCTL_HW_PTR_FD _IO ('A', 0xf9)
+#define SND_PCM_IOCTL_APPL_PTR_FD _IO ('A', 0xfa)
+#define SND_PCM_IOCTL_FORWARD _IO ('A', 0xfb)
+
+typedef struct {
+ snd_pcm_uframes_t ptr;
+ int use_mmap;
+ off_t offset; /* for mmap */
+ int changed;
+} snd_pcm_shm_rbptr_t;
+
+typedef struct {
+ long result;
+ int cmd;
+ snd_pcm_shm_rbptr_t hw;
+ snd_pcm_shm_rbptr_t appl;
+ union {
+ struct {
+ int sig;
+ pid_t pid;
+ } async;
+ snd_pcm_info_t info;
+ snd_pcm_hw_params_t hw_refine;
+ snd_pcm_hw_params_t hw_params;
+ snd_pcm_sw_params_t sw_params;
+ snd_pcm_status_t status;
+ struct {
+ snd_pcm_uframes_t frames;
+ } avail;
+ struct {
+ snd_pcm_sframes_t frames;
+ } delay;
+ struct {
+ int enable;
+ } pause;
+ snd_pcm_channel_info_t channel_info;
+ struct {
+ snd_pcm_uframes_t frames;
+ } rewind;
+ struct {
+ snd_pcm_uframes_t frames;
+ } forward;
+ struct {
+ int fd;
+ } link;
+ struct {
+ snd_pcm_uframes_t offset;
+ snd_pcm_uframes_t frames;
+ } mmap_commit;
+ struct {
+ char use_mmap;
+ int shmid;
+ off_t offset;
+ } rbptr;
+ } u;
+ char data[0];
+} snd_pcm_shm_ctrl_t;
+
+#define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
+
+#define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t)
+#define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2)
+#define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3)
+#define SND_CTL_IOCTL_ASYNC _IO ('U', 0xf4)
+
+typedef struct {
+ int result;
+ int cmd;
+ union {
+ struct {
+ int sig;
+ pid_t pid;
+ } async;
+ int device;
+ int subscribe_events;
+ snd_ctl_card_info_t card_info;
+ snd_ctl_elem_list_t element_list;
+ snd_ctl_elem_info_t element_info;
+ snd_ctl_elem_value_t element_read;
+ snd_ctl_elem_value_t element_write;
+ snd_ctl_elem_id_t element_lock;
+ snd_ctl_elem_id_t element_unlock;
+ snd_hwdep_info_t hwdep_info;
+ snd_pcm_info_t pcm_info;
+ int pcm_prefer_subdevice;
+ snd_rawmidi_info_t rawmidi_info;
+ int rawmidi_prefer_subdevice;
+ unsigned int power_state;
+ snd_ctl_event_t read;
+ } u;
+ char data[0];
+} snd_ctl_shm_ctrl_t;
+
+#define CTL_SHM_SIZE 65536
+#define CTL_SHM_DATA_MAXLEN (CTL_SHM_SIZE - offsetof(snd_ctl_shm_ctrl_t, data))
+
+typedef struct {
+ unsigned char dev_type;
+ unsigned char transport_type;
+ unsigned char stream;
+ unsigned char mode;
+ unsigned char namelen;
+ char name[0];
+} snd_client_open_request_t;
+
+typedef struct {
+ long result;
+ int cookie;
+} snd_client_open_answer_t;
+
diff --git a/alsa-lib/include/asoundef.h b/alsa-lib/include/asoundef.h
new file mode 100644
index 0000000..c6c4eec
--- /dev/null
+++ b/alsa-lib/include/asoundef.h
@@ -0,0 +1,310 @@
+/**
+ * \file include/asoundef.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Definitions of constants for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_ASOUNDEF_H
+#define __ALSA_ASOUNDEF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Digital_Audio_Interface Constants for Digital Audio Interfaces
+ * AES/IEC958 channel status bits.
+ * \{
+ */
+
+#define IEC958_AES0_PROFESSIONAL (1<<0) /**< 0 = consumer, 1 = professional */
+#define IEC958_AES0_NONAUDIO (1<<1) /**< 0 = audio, 1 = non-audio */
+#define IEC958_AES0_PRO_EMPHASIS (7<<2) /**< mask - emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /**< emphasis not indicated */
+#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /**< no emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /**< 50/15us emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /**< CCITT J.17 emphasis */
+#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /**< source sample frequency: 0 = locked, 1 = unlocked */
+#define IEC958_AES0_PRO_FS (3<<6) /**< mask - sample frequency */
+#define IEC958_AES0_PRO_FS_NOTID (0<<6) /**< fs not indicated */
+#define IEC958_AES0_PRO_FS_44100 (1<<6) /**< 44.1kHz */
+#define IEC958_AES0_PRO_FS_48000 (2<<6) /**< 48kHz */
+#define IEC958_AES0_PRO_FS_32000 (3<<6) /**< 32kHz */
+#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /**< 0 = copyright, 1 = not copyright */
+#define IEC958_AES0_CON_EMPHASIS (7<<3) /**< mask - emphasis */
+#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /**< no emphasis */
+#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /**< 50/15us emphasis */
+#define IEC958_AES0_CON_MODE (3<<6) /**< mask - mode */
+#define IEC958_AES1_PRO_MODE (15<<0) /**< mask - channel mode */
+#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /**< mode not indicated */
+#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /**< stereophonic - ch A is left */
+#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /**< single channel */
+#define IEC958_AES1_PRO_MODE_TWO (8<<0) /**< two channels */
+#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /**< primary/secondary */
+#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /**< vector to byte 3 */
+#define IEC958_AES1_PRO_USERBITS (15<<4) /**< mask - user bits */
+#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /**< user bits not indicated */
+#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /**< 192-bit structure */
+#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /**< user defined application */
+#define IEC958_AES1_CON_CATEGORY 0x7f /**< consumer category */
+#define IEC958_AES1_CON_GENERAL 0x00 /**< general category */
+#define IEC958_AES1_CON_LASEROPT_MASK 0x07 /**< Laser-optical mask */
+#define IEC958_AES1_CON_LASEROPT_ID 0x01 /**< Laser-optical ID */
+#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) /**< IEC958 CD compatible device */
+#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) /**< non-IEC958 CD compatible device */
+#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48) /**< Mini-Disc device */
+#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18) /**< DVD device */
+#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78) /**< Other laser-optical product */
+#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07 /**< digital<->digital converter mask */
+#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02 /**< digital<->digital converter id */
+#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) /**< PCM coder */
+#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) /**< Digital signal mixer */
+#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) /**< Rate converter */
+#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20) /**< PCM sampler */
+#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28) /**< Digital sound processor */
+#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78) /**< Other digital<->digital product */
+#define IEC958_AES1_CON_MAGNETIC_MASK 0x07 /**< Magnetic device mask */
+#define IEC958_AES1_CON_MAGNETIC_ID 0x03 /**< Magnetic device ID */
+#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) /**< Digital Audio Tape */
+#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) /**< Video recorder */
+#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40) /**< Digital compact cassette */
+#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18) /**< Magnetic disc digital audio device */
+#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78) /**< Other magnetic device */
+#define IEC958_AES1_CON_BROADCAST1_MASK 0x07 /**< Broadcast mask */
+#define IEC958_AES1_CON_BROADCAST1_ID 0x04 /**< Broadcast ID */
+#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00) /**< Digital audio broadcast (Japan) */
+#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08) /**< Digital audio broadcast (Europe) */
+#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60) /**< Digital audio broadcast (USA) */
+#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40) /**< Electronic software delivery */
+#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20) /**< Used by another standard (IEC 62105) */
+#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78) /**< Other broadcast product */
+#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f /**< Broadcast alternative mask */
+#define IEC958_AES1_CON_BROADCAST2_ID 0x0e /**< Broadcast alternative ID */
+#define IEC958_AES1_CON_MUSICAL_MASK 0x07 /**< Musical device mask */
+#define IEC958_AES1_CON_MUSICAL_ID 0x05 /**< Musical device ID */
+#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) /**< Synthesizer */
+#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) /**< Microphone */
+#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78) /**< Other musical device */
+#define IEC958_AES1_CON_ADC_MASK 0x1f /**< ADC Mask */
+#define IEC958_AES1_CON_ADC_ID 0x06 /**< ADC ID */
+#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00) /**< ADC without copyright information */
+#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60) /**< Other ADC product (with no copyright information) */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f /**< ADC Copyright mask */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16 /**< ADC Copyright ID */
+#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00) /**< ADC with copyright information */
+#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60) /**< Other ADC with copyright information product */
+#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f /**< Solid memory based products mask */
+#define IEC958_AES1_CON_SOLIDMEM_ID 0x08 /**< Solid memory based products ID */
+#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00) /**< Digital audio recorder and player using solid state memory */
+#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70) /**< Other solid state memory based product */
+#define IEC958_AES1_CON_EXPERIMENTAL 0x40 /**< experimental category */
+#define IEC958_AES1_CON_ORIGINAL (1<<7) /**< this bits depends on the category code */
+#define IEC958_AES2_PRO_SBITS (7<<0) /**< mask - sample bits */
+#define IEC958_AES2_PRO_SBITS_20 (2<<0) /**< 20-bit - coordination */
+#define IEC958_AES2_PRO_SBITS_24 (4<<0) /**< 24-bit - main audio */
+#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /**< user defined application */
+#define IEC958_AES2_PRO_WORDLEN (7<<3) /**< mask - source word length */
+#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /**< source word length not indicated */
+#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /**< 22-bit or 18-bit */
+#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /**< 23-bit or 19-bit */
+#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /**< 24-bit or 20-bit */
+#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /**< 20-bit or 16-bit */
+#define IEC958_AES2_CON_SOURCE (15<<0) /**< mask - source number */
+#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /**< source number unspecified */
+#define IEC958_AES2_CON_CHANNEL (15<<4) /**< mask - channel number */
+#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /**< channel number unspecified */
+#define IEC958_AES3_CON_FS (15<<0) /**< mask - sample frequency */
+#define IEC958_AES3_CON_FS_44100 (0<<0) /**< 44.1kHz */
+#define IEC958_AES3_CON_FS_NOTID (1<<0) /**< sample frequency non indicated */
+#define IEC958_AES3_CON_FS_48000 (2<<0) /**< 48kHz */
+#define IEC958_AES3_CON_FS_32000 (3<<0) /**< 32kHz */
+#define IEC958_AES3_CON_FS_22050 (4<<0) /**< 22.05kHz */
+#define IEC958_AES3_CON_FS_24000 (6<<0) /**< 24kHz */
+#define IEC958_AES3_CON_FS_88200 (8<<0) /**< 88.2kHz */
+#define IEC958_AES3_CON_FS_768000 (9<<0) /**< 768kHz */
+#define IEC958_AES3_CON_FS_96000 (10<<0) /**< 96kHz */
+#define IEC958_AES3_CON_FS_176400 (12<<0) /**< 176.4kHz */
+#define IEC958_AES3_CON_FS_192000 (14<<0) /**< 192kHz */
+#define IEC958_AES3_CON_CLOCK (3<<4) /**< mask - clock accuracy */
+#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /**< 1000 ppm */
+#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /**< 50 ppm */
+#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /**< variable pitch */
+#define IEC958_AES4_CON_MAX_WORDLEN_24 (1<<0) /**< 0 = 20-bit, 1 = 24-bit */
+#define IEC958_AES4_CON_WORDLEN (7<<1) /**< mask - sample word length */
+#define IEC958_AES4_CON_WORDLEN_NOTID (0<<1) /**< not indicated */
+#define IEC958_AES4_CON_WORDLEN_20_16 (1<<1) /**< 20-bit or 16-bit */
+#define IEC958_AES4_CON_WORDLEN_22_18 (2<<1) /**< 22-bit or 18-bit */
+#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /**< 23-bit or 19-bit */
+#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /**< 24-bit or 20-bit */
+#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /**< 21-bit or 17-bit */
+#define IEC958_AES4_CON_ORIGFS (15<<4) /**< mask - original sample frequency */
+#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /**< original sample frequency not indicated */
+#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /**< 192kHz */
+#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /**< 12kHz */
+#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /**< 176.4kHz */
+#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /**< 96kHz */
+#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /**< 8kHz */
+#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /**< 88.2kHz */
+#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /**< 16kHz */
+#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /**< 24kHz */
+#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /**< 11.025kHz */
+#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /**< 22.05kHz */
+#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /**< 32kHz */
+#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /**< 48kHz */
+#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /**< 44.1kHz */
+#define IEC958_AES5_CON_CGMSA (3<<0) /**< mask - CGMS-A */
+#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /**< copying is permitted without restriction */
+#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /**< one generation of copies may be made */
+#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /**< condition not be used */
+#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /**< no copying is permitted */
+
+/** \} */
+
+/**
+ * \defgroup MIDI_Interface Constants for MIDI v1.0
+ * Constants for MIDI v1.0.
+ * \{
+ */
+
+#define MIDI_CHANNELS 16 /**< Number of channels per port/cable. */
+#define MIDI_GM_DRUM_CHANNEL (10-1) /**< Channel number for GM drums. */
+
+/**
+ * \defgroup MIDI_Commands MIDI Commands
+ * MIDI command codes.
+ * \{
+ */
+
+#define MIDI_CMD_NOTE_OFF 0x80 /**< note off */
+#define MIDI_CMD_NOTE_ON 0x90 /**< note on */
+#define MIDI_CMD_NOTE_PRESSURE 0xa0 /**< key pressure */
+#define MIDI_CMD_CONTROL 0xb0 /**< control change */
+#define MIDI_CMD_PGM_CHANGE 0xc0 /**< program change */
+#define MIDI_CMD_CHANNEL_PRESSURE 0xd0 /**< channel pressure */
+#define MIDI_CMD_BENDER 0xe0 /**< pitch bender */
+
+#define MIDI_CMD_COMMON_SYSEX 0xf0 /**< sysex (system exclusive) begin */
+#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1 /**< MTC quarter frame */
+#define MIDI_CMD_COMMON_SONG_POS 0xf2 /**< song position */
+#define MIDI_CMD_COMMON_SONG_SELECT 0xf3 /**< song select */
+#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6 /**< tune request */
+#define MIDI_CMD_COMMON_SYSEX_END 0xf7 /**< end of sysex */
+#define MIDI_CMD_COMMON_CLOCK 0xf8 /**< clock */
+#define MIDI_CMD_COMMON_START 0xfa /**< start */
+#define MIDI_CMD_COMMON_CONTINUE 0xfb /**< continue */
+#define MIDI_CMD_COMMON_STOP 0xfc /**< stop */
+#define MIDI_CMD_COMMON_SENSING 0xfe /**< active sensing */
+#define MIDI_CMD_COMMON_RESET 0xff /**< reset */
+
+/** \} */
+
+/**
+ * \defgroup MIDI_Controllers MIDI Controllers
+ * MIDI controller numbers.
+ * \{
+ */
+
+#define MIDI_CTL_MSB_BANK 0x00 /**< Bank selection */
+#define MIDI_CTL_MSB_MODWHEEL 0x01 /**< Modulation */
+#define MIDI_CTL_MSB_BREATH 0x02 /**< Breath */
+#define MIDI_CTL_MSB_FOOT 0x04 /**< Foot */
+#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05 /**< Portamento time */
+#define MIDI_CTL_MSB_DATA_ENTRY 0x06 /**< Data entry */
+#define MIDI_CTL_MSB_MAIN_VOLUME 0x07 /**< Main volume */
+#define MIDI_CTL_MSB_BALANCE 0x08 /**< Balance */
+#define MIDI_CTL_MSB_PAN 0x0a /**< Panpot */
+#define MIDI_CTL_MSB_EXPRESSION 0x0b /**< Expression */
+#define MIDI_CTL_MSB_EFFECT1 0x0c /**< Effect1 */
+#define MIDI_CTL_MSB_EFFECT2 0x0d /**< Effect2 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10 /**< General purpose 1 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11 /**< General purpose 2 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12 /**< General purpose 3 */
+#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13 /**< General purpose 4 */
+#define MIDI_CTL_LSB_BANK 0x20 /**< Bank selection */
+#define MIDI_CTL_LSB_MODWHEEL 0x21 /**< Modulation */
+#define MIDI_CTL_LSB_BREATH 0x22 /**< Breath */
+#define MIDI_CTL_LSB_FOOT 0x24 /**< Foot */
+#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25 /**< Portamento time */
+#define MIDI_CTL_LSB_DATA_ENTRY 0x26 /**< Data entry */
+#define MIDI_CTL_LSB_MAIN_VOLUME 0x27 /**< Main volume */
+#define MIDI_CTL_LSB_BALANCE 0x28 /**< Balance */
+#define MIDI_CTL_LSB_PAN 0x2a /**< Panpot */
+#define MIDI_CTL_LSB_EXPRESSION 0x2b /**< Expression */
+#define MIDI_CTL_LSB_EFFECT1 0x2c /**< Effect1 */
+#define MIDI_CTL_LSB_EFFECT2 0x2d /**< Effect2 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30 /**< General purpose 1 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31 /**< General purpose 2 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32 /**< General purpose 3 */
+#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33 /**< General purpose 4 */
+#define MIDI_CTL_SUSTAIN 0x40 /**< Sustain pedal */
+#define MIDI_CTL_PORTAMENTO 0x41 /**< Portamento */
+#define MIDI_CTL_SOSTENUTO 0x42 /**< Sostenuto */
+#define MIDI_CTL_SUSTENUTO 0x42 /**< Sostenuto (a typo in the older version) */
+#define MIDI_CTL_SOFT_PEDAL 0x43 /**< Soft pedal */
+#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44 /**< Legato foot switch */
+#define MIDI_CTL_HOLD2 0x45 /**< Hold2 */
+#define MIDI_CTL_SC1_SOUND_VARIATION 0x46 /**< SC1 Sound Variation */
+#define MIDI_CTL_SC2_TIMBRE 0x47 /**< SC2 Timbre */
+#define MIDI_CTL_SC3_RELEASE_TIME 0x48 /**< SC3 Release Time */
+#define MIDI_CTL_SC4_ATTACK_TIME 0x49 /**< SC4 Attack Time */
+#define MIDI_CTL_SC5_BRIGHTNESS 0x4a /**< SC5 Brightness */
+#define MIDI_CTL_SC6 0x4b /**< SC6 */
+#define MIDI_CTL_SC7 0x4c /**< SC7 */
+#define MIDI_CTL_SC8 0x4d /**< SC8 */
+#define MIDI_CTL_SC9 0x4e /**< SC9 */
+#define MIDI_CTL_SC10 0x4f /**< SC10 */
+#define MIDI_CTL_GENERAL_PURPOSE5 0x50 /**< General purpose 5 */
+#define MIDI_CTL_GENERAL_PURPOSE6 0x51 /**< General purpose 6 */
+#define MIDI_CTL_GENERAL_PURPOSE7 0x52 /**< General purpose 7 */
+#define MIDI_CTL_GENERAL_PURPOSE8 0x53 /**< General purpose 8 */
+#define MIDI_CTL_PORTAMENTO_CONTROL 0x54 /**< Portamento control */
+#define MIDI_CTL_E1_REVERB_DEPTH 0x5b /**< E1 Reverb Depth */
+#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c /**< E2 Tremolo Depth */
+#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d /**< E3 Chorus Depth */
+#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e /**< E4 Detune Depth */
+#define MIDI_CTL_E5_PHASER_DEPTH 0x5f /**< E5 Phaser Depth */
+#define MIDI_CTL_DATA_INCREMENT 0x60 /**< Data Increment */
+#define MIDI_CTL_DATA_DECREMENT 0x61 /**< Data Decrement */
+#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62 /**< Non-registered parameter number */
+#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63 /**< Non-registered parameter number */
+#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64 /**< Registered parameter number */
+#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65 /**< Registered parameter number */
+#define MIDI_CTL_ALL_SOUNDS_OFF 0x78 /**< All sounds off */
+#define MIDI_CTL_RESET_CONTROLLERS 0x79 /**< Reset Controllers */
+#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a /**< Local control switch */
+#define MIDI_CTL_ALL_NOTES_OFF 0x7b /**< All notes off */
+#define MIDI_CTL_OMNI_OFF 0x7c /**< Omni off */
+#define MIDI_CTL_OMNI_ON 0x7d /**< Omni on */
+#define MIDI_CTL_MONO1 0x7e /**< Mono1 */
+#define MIDI_CTL_MONO2 0x7f /**< Mono2 */
+
+/** \} */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_ASOUNDEF_H */
diff --git a/alsa-lib/include/asoundlib-head.h b/alsa-lib/include/asoundlib-head.h
new file mode 100644
index 0000000..20c8a68
--- /dev/null
+++ b/alsa-lib/include/asoundlib-head.h
@@ -0,0 +1,48 @@
+/**
+ * \file include/asoundlib.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASOUNDLIB_H
+#define __ASOUNDLIB_H
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <endian.h>
+#include <sys/poll.h>
+#include <errno.h>
+#include <stdarg.h>
+
+#include <alsa/asoundef.h>
+#include <alsa/version.h>
+#include <alsa/global.h>
+#include <alsa/input.h>
+#include <alsa/output.h>
+#include <alsa/error.h>
+#include <alsa/conf.h>
diff --git a/alsa-lib/include/asoundlib-tail.h b/alsa-lib/include/asoundlib-tail.h
new file mode 100644
index 0000000..e20f5ad
--- /dev/null
+++ b/alsa-lib/include/asoundlib-tail.h
@@ -0,0 +1,2 @@
+
+#endif /* __ASOUNDLIB_H */
diff --git a/alsa-lib/include/asoundlib.h b/alsa-lib/include/asoundlib.h
new file mode 100644
index 0000000..9fc860a
--- /dev/null
+++ b/alsa-lib/include/asoundlib.h
@@ -0,0 +1,60 @@
+/**
+ * \file include/asoundlib.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASOUNDLIB_H
+#define __ASOUNDLIB_H
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <endian.h>
+#include <sys/poll.h>
+#include <errno.h>
+#include <stdarg.h>
+
+#include <alsa/asoundef.h>
+#include <alsa/version.h>
+#include <alsa/global.h>
+#include <alsa/input.h>
+#include <alsa/output.h>
+#include <alsa/error.h>
+#include <alsa/conf.h>
+#include <alsa/pcm.h>
+#include <alsa/rawmidi.h>
+#include <alsa/timer.h>
+#include <alsa/hwdep.h>
+#include <alsa/control.h>
+#include <alsa/mixer.h>
+#include <alsa/seq_event.h>
+#include <alsa/seq.h>
+#include <alsa/seqmid.h>
+#include <alsa/seq_midi_event.h>
+
+#endif /* __ASOUNDLIB_H */
diff --git a/alsa-lib/include/conf.h b/alsa-lib/include/conf.h
new file mode 100644
index 0000000..7c0cab0
--- /dev/null
+++ b/alsa-lib/include/conf.h
@@ -0,0 +1,198 @@
+/**
+ * \file include/conf.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_CONF_H
+#define __ALSA_CONF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Config Configuration Interface
+ * The configuration functions and types allow you to read, enumerate,
+ * modify and write the contents of ALSA configuration files.
+ * \{
+ */
+
+/** \brief \c dlsym version for the config evaluate callback. */
+#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
+/** \brief \c dlsym version for the config hook callback. */
+#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
+
+/** Configuration node type. */
+typedef enum _snd_config_type {
+ /** Integer number. */
+ SND_CONFIG_TYPE_INTEGER,
+ /** 64 bit Integer number. */
+ SND_CONFIG_TYPE_INTEGER64,
+ /** Real number. */
+ SND_CONFIG_TYPE_REAL,
+ /** Character string. */
+ SND_CONFIG_TYPE_STRING,
+ /** Pointer (runtime only, cannot be saved). */
+ SND_CONFIG_TYPE_POINTER,
+ /** Compound node. */
+ SND_CONFIG_TYPE_COMPOUND = 1024
+} snd_config_type_t;
+
+/**
+ * \brief Internal structure for a configuration node object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to a
+ * configuration node. Applications don't access its contents directly.
+ */
+typedef struct _snd_config snd_config_t;
+/**
+ * \brief Type for a configuration compound iterator.
+ *
+ * The ALSA library uses this pointer type as a handle to a configuration
+ * compound iterator. Applications don't directly access the contents of
+ * the structure pointed to by this type.
+ */
+typedef struct _snd_config_iterator *snd_config_iterator_t;
+/**
+ * \brief Internal structure for a configuration private update object.
+ *
+ * The ALSA library uses this structure to save private update information.
+ */
+typedef struct _snd_config_update snd_config_update_t;
+
+extern snd_config_t *snd_config;
+
+int snd_config_top(snd_config_t **config);
+
+int snd_config_load(snd_config_t *config, snd_input_t *in);
+int snd_config_load_override(snd_config_t *config, snd_input_t *in);
+int snd_config_save(snd_config_t *config, snd_output_t *out);
+int snd_config_update(void);
+int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
+int snd_config_update_free(snd_config_update_t *update);
+int snd_config_update_free_global(void);
+
+int snd_config_search(snd_config_t *config, const char *key,
+ snd_config_t **result);
+int snd_config_searchv(snd_config_t *config,
+ snd_config_t **result, ...);
+int snd_config_search_definition(snd_config_t *config,
+ const char *base, const char *key,
+ snd_config_t **result);
+
+int snd_config_expand(snd_config_t *config, snd_config_t *root,
+ const char *args, snd_config_t *private_data,
+ snd_config_t **result);
+int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
+ snd_config_t *private_data, snd_config_t **result);
+
+int snd_config_add(snd_config_t *config, snd_config_t *leaf);
+int snd_config_delete(snd_config_t *config);
+int snd_config_delete_compound_members(const snd_config_t *config);
+int snd_config_copy(snd_config_t **dst, snd_config_t *src);
+
+int snd_config_make(snd_config_t **config, const char *key,
+ snd_config_type_t type);
+int snd_config_make_integer(snd_config_t **config, const char *key);
+int snd_config_make_integer64(snd_config_t **config, const char *key);
+int snd_config_make_real(snd_config_t **config, const char *key);
+int snd_config_make_string(snd_config_t **config, const char *key);
+int snd_config_make_pointer(snd_config_t **config, const char *key);
+int snd_config_make_compound(snd_config_t **config, const char *key, int join);
+
+int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
+int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
+int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
+int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
+int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
+
+snd_config_type_t snd_config_get_type(const snd_config_t *config);
+
+int snd_config_set_id(snd_config_t *config, const char *id);
+int snd_config_set_integer(snd_config_t *config, long value);
+int snd_config_set_integer64(snd_config_t *config, long long value);
+int snd_config_set_real(snd_config_t *config, double value);
+int snd_config_set_string(snd_config_t *config, const char *value);
+int snd_config_set_ascii(snd_config_t *config, const char *ascii);
+int snd_config_set_pointer(snd_config_t *config, const void *ptr);
+int snd_config_get_id(const snd_config_t *config, const char **value);
+int snd_config_get_integer(const snd_config_t *config, long *value);
+int snd_config_get_integer64(const snd_config_t *config, long long *value);
+int snd_config_get_real(const snd_config_t *config, double *value);
+int snd_config_get_ireal(const snd_config_t *config, double *value);
+int snd_config_get_string(const snd_config_t *config, const char **value);
+int snd_config_get_ascii(const snd_config_t *config, char **value);
+int snd_config_get_pointer(const snd_config_t *config, const void **value);
+int snd_config_test_id(const snd_config_t *config, const char *id);
+
+snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
+snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
+snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
+snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
+
+/**
+ * \brief Helper macro to iterate over the children of a compound node.
+ * \param pos Iterator variable for the current node.
+ * \param next Iterator variable for the next node.
+ * \param node Handle to the compound configuration node to iterate over.
+ *
+ * This macro is designed to permit the removal of the current node.
+ */
+#define snd_config_for_each(pos, next, node) \
+ for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
+
+/* Misc functions */
+
+int snd_config_get_bool_ascii(const char *ascii);
+int snd_config_get_bool(const snd_config_t *conf);
+int snd_config_get_ctl_iface_ascii(const char *ascii);
+int snd_config_get_ctl_iface(const snd_config_t *conf);
+
+/* Names functions */
+
+/**
+ * Device-name list element
+ */
+typedef struct snd_devname snd_devname_t;
+
+/**
+ * Device-name list element (definition)
+ */
+struct snd_devname {
+ char *name; /**< Device name string */
+ char *comment; /**< Comments */
+ snd_devname_t *next; /**< Next pointer */
+};
+
+int snd_names_list(const char *iface, snd_devname_t **list);
+void snd_names_list_free(snd_devname_t *list);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONF_H */
diff --git a/alsa-lib/include/config.h b/alsa-lib/include/config.h
new file mode 100644
index 0000000..52dfc11
--- /dev/null
+++ b/alsa-lib/include/config.h
@@ -0,0 +1,165 @@
+/* include/config.h. Generated from config.h.in by configure. */
+/* include/config.h.in. Generated from configure.in by autoheader. */
+
+/* Directory with aload* device files */
+#ifndef ALOAD_DEVICE_DIRECTORY
+#define ALOAD_DEVICE_DIRECTORY "/dev/"
+#endif
+
+/* directory containing ALSA configuration database */
+#ifndef ALSA_CONFIG_DIR
+#define ALSA_CONFIG_DIR "/usr/share/alsa"
+#endif
+
+/* Enable assert at error message handler */
+/* #undef ALSA_DEBUG_ASSERT */
+
+/* Directory with ALSA device files */
+#ifndef ALSA_DEVICE_DIRECTORY
+#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
+#endif
+
+/* directory containing ALSA add-on modules */
+#ifndef ALSA_PLUGIN_DIR
+#define ALSA_PLUGIN_DIR "/usr/lib/alsa-lib"
+#endif
+
+/* Build hwdep component */
+#define BUILD_HWDEP "1"
+
+/* Build mixer component */
+#define BUILD_MIXER "1"
+
+/* Build PCM component */
+#define BUILD_PCM "1"
+
+/* Build PCM adpcm plugin */
+/* #undef BUILD_PCM_PLUGIN_ADPCM */
+
+/* Build PCM alaw plugin */
+/* #undef BUILD_PCM_PLUGIN_ALAW */
+
+/* Build PCM lfloat plugin */
+/* #undef BUILD_PCM_PLUGIN_LFLOAT */
+
+/* Build PCM mulaw plugin */
+/* #undef BUILD_PCM_PLUGIN_MULAW */
+
+/* Build PCM rate plugin */
+/* #undef BUILD_PCM_PLUGIN_RATE */
+
+/* Build PCM route plugin */
+/* #undef BUILD_PCM_PLUGIN_ROUTE */
+
+/* Build raw MIDI component */
+/* #undef BUILD_RAWMIDI */
+
+/* Build sequencer component */
+/* #undef BUILD_SEQ */
+
+/* Have clock gettime */
+/* #undef HAVE_CLOCK_GETTIME */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Have libdl */
+#define HAVE_LIBDL 1
+
+/* Have libpthread */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the `resmgr' library (-lresmgr). */
+/* #undef HAVE_LIBRESMGR */
+
+/* Have librt */
+/* #undef HAVE_LIBRT */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Avoid calculation in float */
+#define HAVE_SOFT_FLOAT "1"
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <wordexp.h> header file. */
+/* #undef HAVE_WORDEXP_H */
+
+/* No assert debug */
+#ifndef NDEBUG
+#define NDEBUG
+#endif
+
+/* Name of package */
+#define PACKAGE "alsa-lib"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Support /dev/aload* access for auto-loading */
+#define SUPPORT_ALOAD "1"
+
+/* Support resmgr with alsa-lib */
+/* #undef SUPPORT_RESMGR */
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* directory to put tmp socket files */
+#define TMPDIR "/tmp"
+
+/* sound library version string */
+#define VERSION "1.0.16"
+
+/* compiled with versioned symbols */
+/* #undef VERSIONED_SYMBOLS */
+
+/* Toolchain Symbol Prefix */
+#define __SYMBOL_PREFIX ""
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
diff --git a/alsa-lib/include/config.h.in b/alsa-lib/include/config.h.in
new file mode 100644
index 0000000..d20667f
--- /dev/null
+++ b/alsa-lib/include/config.h.in
@@ -0,0 +1,157 @@
+/* include/config.h.in. Generated from configure.in by autoheader. */
+
+/* Directory with aload* device files */
+#undef ALOAD_DEVICE_DIRECTORY
+
+/* directory containing ALSA configuration database */
+#undef ALSA_CONFIG_DIR
+
+/* Enable assert at error message handler */
+#undef ALSA_DEBUG_ASSERT
+
+/* Directory with ALSA device files */
+#undef ALSA_DEVICE_DIRECTORY
+
+/* directory containing ALSA add-on modules */
+#undef ALSA_PLUGIN_DIR
+
+/* Build hwdep component */
+#undef BUILD_HWDEP
+
+/* Build mixer component */
+#undef BUILD_MIXER
+
+/* Build PCM component */
+#undef BUILD_PCM
+
+/* Build PCM adpcm plugin */
+#undef BUILD_PCM_PLUGIN_ADPCM
+
+/* Build PCM alaw plugin */
+#undef BUILD_PCM_PLUGIN_ALAW
+
+/* Build PCM lfloat plugin */
+#undef BUILD_PCM_PLUGIN_LFLOAT
+
+/* Build PCM mmap-emul plugin */
+#undef BUILD_PCM_PLUGIN_MMAP_EMUL
+
+/* Build PCM mulaw plugin */
+#undef BUILD_PCM_PLUGIN_MULAW
+
+/* Build PCM rate plugin */
+#undef BUILD_PCM_PLUGIN_RATE
+
+/* Build PCM route plugin */
+#undef BUILD_PCM_PLUGIN_ROUTE
+
+/* Build raw MIDI component */
+#undef BUILD_RAWMIDI
+
+/* Build sequencer component */
+#undef BUILD_SEQ
+
+/* Have clock gettime */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Have libdl */
+#undef HAVE_LIBDL
+
+/* Have libpthread */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the `resmgr' library (-lresmgr). */
+#undef HAVE_LIBRESMGR
+
+/* Have librt */
+#undef HAVE_LIBRT
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Avoid calculation in float */
+#undef HAVE_SOFT_FLOAT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <wordexp.h> header file. */
+#undef HAVE_WORDEXP_H
+
+/* No assert debug */
+#undef NDEBUG
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Support /dev/aload* access for auto-loading */
+#undef SUPPORT_ALOAD
+
+/* Support resmgr with alsa-lib */
+#undef SUPPORT_RESMGR
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* directory to put tmp socket files */
+#undef TMPDIR
+
+/* sound library version string */
+#undef VERSION
+
+/* compiled with versioned symbols */
+#undef VERSIONED_SYMBOLS
+
+/* Toolchain Symbol Prefix */
+#undef __SYMBOL_PREFIX
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
diff --git a/alsa-lib/include/control.h b/alsa-lib/include/control.h
new file mode 100644
index 0000000..2361dc3
--- /dev/null
+++ b/alsa-lib/include/control.h
@@ -0,0 +1,576 @@
+/**
+ * \file include/control.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_CONTROL_H
+#define __ALSA_CONTROL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Control Control Interface
+ * The control interface.
+ * See \ref control page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001
+
+/** IEC958 structure */
+typedef struct snd_aes_iec958 {
+ unsigned char status[24]; /**< AES/IEC958 channel status bits */
+ unsigned char subcode[147]; /**< AES/IEC958 subcode bits */
+ unsigned char pad; /**< nothing */
+ unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */
+} snd_aes_iec958_t;
+
+/** CTL card info container */
+typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
+
+/** CTL element identifier container */
+typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
+
+/** CTL element identifier list container */
+typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
+
+/** CTL element info container */
+typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
+
+/** CTL element value container */
+typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
+
+/** CTL event container */
+typedef struct _snd_ctl_event snd_ctl_event_t;
+
+/** CTL element type */
+typedef enum _snd_ctl_elem_type {
+ /** Invalid type */
+ SND_CTL_ELEM_TYPE_NONE = 0,
+ /** Boolean contents */
+ SND_CTL_ELEM_TYPE_BOOLEAN,
+ /** Integer contents */
+ SND_CTL_ELEM_TYPE_INTEGER,
+ /** Enumerated contents */
+ SND_CTL_ELEM_TYPE_ENUMERATED,
+ /** Bytes contents */
+ SND_CTL_ELEM_TYPE_BYTES,
+ /** IEC958 (S/PDIF) setting content */
+ SND_CTL_ELEM_TYPE_IEC958,
+ /** 64-bit integer contents */
+ SND_CTL_ELEM_TYPE_INTEGER64,
+ SND_CTL_ELEM_TYPE_LAST = SND_CTL_ELEM_TYPE_INTEGER64
+} snd_ctl_elem_type_t;
+
+/** CTL related interface */
+typedef enum _snd_ctl_elem_iface {
+ /** Card level */
+ SND_CTL_ELEM_IFACE_CARD = 0,
+ /** Hardware dependent device */
+ SND_CTL_ELEM_IFACE_HWDEP,
+ /** Mixer */
+ SND_CTL_ELEM_IFACE_MIXER,
+ /** PCM */
+ SND_CTL_ELEM_IFACE_PCM,
+ /** RawMidi */
+ SND_CTL_ELEM_IFACE_RAWMIDI,
+ /** Timer */
+ SND_CTL_ELEM_IFACE_TIMER,
+ /** Sequencer */
+ SND_CTL_ELEM_IFACE_SEQUENCER,
+ SND_CTL_ELEM_IFACE_LAST = SND_CTL_ELEM_IFACE_SEQUENCER
+} snd_ctl_elem_iface_t;
+
+/** Event class */
+typedef enum _snd_ctl_event_type {
+ /** Elements related event */
+ SND_CTL_EVENT_ELEM = 0,
+ SND_CTL_EVENT_LAST = SND_CTL_EVENT_ELEM
+}snd_ctl_event_type_t;
+
+/** Element has been removed (Warning: test this first and if set don't
+ * test the other masks) \hideinitializer */
+#define SND_CTL_EVENT_MASK_REMOVE (~0U)
+/** Element value has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_VALUE (1<<0)
+/** Element info has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_INFO (1<<1)
+/** Element has been added \hideinitializer */
+#define SND_CTL_EVENT_MASK_ADD (1<<2)
+/** Element's TLV value has been changed \hideinitializer */
+#define SND_CTL_EVENT_MASK_TLV (1<<3)
+
+/** CTL name helper */
+#define SND_CTL_NAME_NONE ""
+/** CTL name helper */
+#define SND_CTL_NAME_PLAYBACK "Playback "
+/** CTL name helper */
+#define SND_CTL_NAME_CAPTURE "Capture "
+
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_NONE ""
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_SWITCH "Switch"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_VOLUME "Volume"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_DEFAULT "Default"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_MASK "Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_CON_MASK "Con Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
+/** CTL name helper */
+#define SND_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
+/** Element name for IEC958 (S/PDIF) */
+#define SND_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what
+
+/** Mask for the major Power State identifier */
+#define SND_CTL_POWER_MASK 0xff00
+/** ACPI/PCI Power State D0 */
+#define SND_CTL_POWER_D0 0x0000
+/** ACPI/PCI Power State D1 */
+#define SND_CTL_POWER_D1 0x0100
+/** ACPI/PCI Power State D2 */
+#define SND_CTL_POWER_D2 0x0200
+/** ACPI/PCI Power State D3 */
+#define SND_CTL_POWER_D3 0x0300
+/** ACPI/PCI Power State D3hot */
+#define SND_CTL_POWER_D3hot (SND_CTL_POWER_D3|0x0000)
+/** ACPI/PCI Power State D3cold */
+#define SND_CTL_POWER_D3cold (SND_CTL_POWER_D3|0x0001)
+
+/** TLV type - Container */
+#define SND_CTL_TLVT_CONTAINER 0x0000
+/** TLV type - basic dB scale */
+#define SND_CTL_TLVT_DB_SCALE 0x0001
+/** TLV type - linear volume */
+#define SND_CTL_TLVT_DB_LINEAR 0x0002
+/** TLV type - dB range container */
+#define SND_CTL_TLVT_DB_RANGE 0x0003
+
+/** Mute state */
+#define SND_CTL_TLV_DB_GAIN_MUTE -9999999
+
+/** CTL type */
+typedef enum _snd_ctl_type {
+ /** Kernel level CTL */
+ SND_CTL_TYPE_HW,
+ /** Shared memory client CTL */
+ SND_CTL_TYPE_SHM,
+ /** INET client CTL (not yet implemented) */
+ SND_CTL_TYPE_INET,
+ /** External control plugin */
+ SND_CTL_TYPE_EXT
+} snd_ctl_type_t;
+
+/** Non blocking mode (flag for open mode) \hideinitializer */
+#define SND_CTL_NONBLOCK 0x0001
+
+/** Async notification (flag for open mode) \hideinitializer */
+#define SND_CTL_ASYNC 0x0002
+
+/** Read only (flag for open mode) \hideinitializer */
+#define SND_CTL_READONLY 0x0004
+
+/** CTL handle */
+typedef struct _snd_ctl snd_ctl_t;
+
+/** Don't destroy the ctl handle when close */
+#define SND_SCTL_NOFREE 0x0001
+
+/** SCTL type */
+typedef struct _snd_sctl snd_sctl_t;
+
+int snd_card_load(int card);
+int snd_card_next(int *card);
+int snd_card_get_index(const char *name);
+int snd_card_get_name(int card, char **name);
+int snd_card_get_longname(int card, char **name);
+
+int snd_device_name_hint(int card, const char *iface, void ***hints);
+int snd_device_name_free_hint(void **hints);
+char *snd_device_name_get_hint(const void *hint, const char *id);
+
+int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
+int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);
+int snd_ctl_close(snd_ctl_t *ctl);
+int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
+int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
+ snd_async_callback_t callback, void *private_data);
+snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
+int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
+int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
+int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
+int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
+int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list);
+int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
+int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
+int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
+int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int *tlv, unsigned int tlv_size);
+int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv);
+int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv);
+#ifdef __ALSA_HWDEP_H
+int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
+int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
+#endif
+#ifdef __ALSA_PCM_H
+int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
+int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
+int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
+#endif
+#ifdef __ALSA_RAWMIDI_H
+int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
+int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
+int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
+#endif
+int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);
+int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);
+
+int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
+int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
+const char *snd_ctl_name(snd_ctl_t *ctl);
+snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
+
+const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
+const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
+const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
+
+unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
+void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
+snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
+const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
+unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
+
+int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
+void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
+
+size_t snd_ctl_elem_id_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id)
+int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr);
+void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_copy(snd_ctl_elem_id_t *dst, const snd_ctl_elem_id_t *src);
+unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_subdevice(const snd_ctl_elem_id_t *obj);
+const char *snd_ctl_elem_id_get_name(const snd_ctl_elem_id_t *obj);
+unsigned int snd_ctl_elem_id_get_index(const snd_ctl_elem_id_t *obj);
+void snd_ctl_elem_id_set_numid(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_interface(snd_ctl_elem_id_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_id_set_device(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val);
+void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val);
+void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val);
+
+size_t snd_ctl_card_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_card_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info)
+int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
+void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
+void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj);
+void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src);
+int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
+const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj);
+
+size_t snd_ctl_event_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_event_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event)
+int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
+void snd_ctl_event_free(snd_ctl_event_t *obj);
+void snd_ctl_event_clear(snd_ctl_event_t *obj);
+void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
+snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
+
+size_t snd_ctl_elem_list_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list)
+int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr);
+void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_copy(snd_ctl_elem_list_t *dst, const snd_ctl_elem_list_t *src);
+void snd_ctl_elem_list_set_offset(snd_ctl_elem_list_t *obj, unsigned int val);
+unsigned int snd_ctl_elem_list_get_used(const snd_ctl_elem_list_t *obj);
+unsigned int snd_ctl_elem_list_get_count(const snd_ctl_elem_list_t *obj);
+void snd_ctl_elem_list_get_id(const snd_ctl_elem_list_t *obj, unsigned int idx, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_list_get_numid(const snd_ctl_elem_list_t *obj, unsigned int idx);
+snd_ctl_elem_iface_t snd_ctl_elem_list_get_interface(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_device(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_subdevice(const snd_ctl_elem_list_t *obj, unsigned int idx);
+const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx);
+
+size_t snd_ctl_elem_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info)
+int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr);
+void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_copy(snd_ctl_elem_info_t *dst, const snd_ctl_elem_info_t *src);
+snd_ctl_elem_type_t snd_ctl_elem_info_get_type(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_readable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_writable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_readable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_writable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_tlv_commandable(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_is_user(const snd_ctl_elem_info_t *obj);
+pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_max(const snd_ctl_elem_info_t *obj);
+long snd_ctl_elem_info_get_step(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_min64(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_max64(const snd_ctl_elem_info_t *obj);
+long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val);
+const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj);
+int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx);
+void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_device(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_subdevice(const snd_ctl_elem_info_t *obj);
+const char *snd_ctl_elem_info_get_name(const snd_ctl_elem_info_t *obj);
+unsigned int snd_ctl_elem_info_get_index(const snd_ctl_elem_info_t *obj);
+void snd_ctl_elem_info_set_id(snd_ctl_elem_info_t *obj, const snd_ctl_elem_id_t *ptr);
+void snd_ctl_elem_info_set_numid(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_interface(snd_ctl_elem_info_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_info_set_device(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val);
+void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val);
+void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val);
+
+int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long imin, long imax, long istep);
+int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long long imin, long long imax, long long istep);
+int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count);
+int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
+int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
+
+size_t snd_ctl_elem_value_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value)
+int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr);
+void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src);
+void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj);
+snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_device(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_subdevice(const snd_ctl_elem_value_t *obj);
+const char *snd_ctl_elem_value_get_name(const snd_ctl_elem_value_t *obj);
+unsigned int snd_ctl_elem_value_get_index(const snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_set_id(snd_ctl_elem_value_t *obj, const snd_ctl_elem_id_t *ptr);
+void snd_ctl_elem_value_set_numid(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_interface(snd_ctl_elem_value_t *obj, snd_ctl_elem_iface_t val);
+void snd_ctl_elem_value_set_device(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int val);
+void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val);
+void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val);
+int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx);
+long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx);
+long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx);
+unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx);
+unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx);
+void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
+void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
+void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val);
+void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val);
+void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val);
+void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
+const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj);
+void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr);
+void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr);
+
+int snd_tlv_parse_dB_info(unsigned int *tlv, unsigned int tlv_size,
+ unsigned int **db_tlvp);
+int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
+ long *min, long *max);
+int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long volume, long *db_gain);
+int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long db_gain, long *value, int xdir);
+int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long *min, long *max);
+int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long volume, long *db_gain);
+int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long db_gain, long *value, int xdir);
+
+/**
+ * \defgroup HControl High level Control Interface
+ * \ingroup Control
+ * The high level control interface.
+ * See \ref hcontrol page for more details.
+ * \{
+ */
+
+/** HCTL element handle */
+typedef struct _snd_hctl_elem snd_hctl_elem_t;
+
+/** HCTL handle */
+typedef struct _snd_hctl snd_hctl_t;
+
+/**
+ * \brief Compare function for sorting HCTL elements
+ * \param e1 First element
+ * \param e2 Second element
+ * \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
+ */
+typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
+ const snd_hctl_elem_t *e2);
+int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2);
+/**
+ * \brief HCTL callback function
+ * \param hctl HCTL handle
+ * \param mask event mask
+ * \param elem related HCTL element (if any)
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
+ unsigned int mask,
+ snd_hctl_elem_t *elem);
+/**
+ * \brief HCTL element callback function
+ * \param elem HCTL element
+ * \param mask event mask
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
+ unsigned int mask);
+
+int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
+int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl);
+int snd_hctl_close(snd_hctl_t *hctl);
+int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
+int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
+int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
+int snd_hctl_poll_descriptors_revents(snd_hctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
+int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
+snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
+snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
+snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
+void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
+void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
+void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
+int snd_hctl_load(snd_hctl_t *hctl);
+int snd_hctl_free(snd_hctl_t *hctl);
+int snd_hctl_handle_events(snd_hctl_t *hctl);
+const char *snd_hctl_name(snd_hctl_t *hctl);
+int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
+snd_ctl_t *snd_hctl_ctl(snd_hctl_t *hctl);
+
+snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
+snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
+int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
+int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
+int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
+int snd_hctl_elem_tlv_read(snd_hctl_elem_t *elem, unsigned int *tlv, unsigned int tlv_size);
+int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv);
+int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv);
+
+snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);
+
+void snd_hctl_elem_get_id(const snd_hctl_elem_t *obj, snd_ctl_elem_id_t *ptr);
+unsigned int snd_hctl_elem_get_numid(const snd_hctl_elem_t *obj);
+snd_ctl_elem_iface_t snd_hctl_elem_get_interface(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_device(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_subdevice(const snd_hctl_elem_t *obj);
+const char *snd_hctl_elem_get_name(const snd_hctl_elem_t *obj);
+unsigned int snd_hctl_elem_get_index(const snd_hctl_elem_t *obj);
+void snd_hctl_elem_set_callback(snd_hctl_elem_t *obj, snd_hctl_elem_callback_t val);
+void * snd_hctl_elem_get_callback_private(const snd_hctl_elem_t *obj);
+void snd_hctl_elem_set_callback_private(snd_hctl_elem_t *obj, void * val);
+
+/** \} */
+
+/** \} */
+
+/**
+ * \defgroup SControl Setup Control Interface
+ * \ingroup Control
+ * The setup control interface - set or modify control elements from a configuration file.
+ * \{
+ */
+
+int snd_sctl_build(snd_sctl_t **ctl, snd_ctl_t *handle, snd_config_t *config,
+ snd_config_t *private_data, int mode);
+int snd_sctl_free(snd_sctl_t *handle);
+int snd_sctl_install(snd_sctl_t *handle);
+int snd_sctl_remove(snd_sctl_t *handle);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONTROL_H */
diff --git a/alsa-lib/include/control_external.h b/alsa-lib/include/control_external.h
new file mode 100644
index 0000000..7c066cf
--- /dev/null
+++ b/alsa-lib/include/control_external.h
@@ -0,0 +1,265 @@
+/**
+ * \file include/control_external.h
+ * \brief External control plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External control plugin SDK.
+ */
+
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __ALSA_CONTROL_EXTERNAL_H
+#define __ALSA_CONTROL_EXTERNAL_H
+
+#include "control.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup CtlPlugin_SDK External Control Plugin SDK
+ * \{
+ */
+
+/**
+ * Define the object entry for external control plugins
+ */
+#define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
+
+/**
+ * Define the symbols of the given control plugin with versions
+ */
+#define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
+
+/**
+ * Define the control plugin
+ */
+#define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
+int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
+ snd_config_t *root, snd_config_t *conf, int mode)
+
+/** External control plugin handle */
+typedef struct snd_ctl_ext snd_ctl_ext_t;
+/** Callback table of control ext */
+typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
+/** Key to access a control pointer */
+typedef unsigned long snd_ctl_ext_key_t;
+
+/*
+ * Protocol version
+ */
+#define SND_CTL_EXT_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_CTL_EXT_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_CTL_EXT_VERSION_TINY 0 /**< Protocol tiny version */
+/**
+ * external plugin protocol version
+ */
+#define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
+ (SND_CTL_EXT_VERSION_MINOR<<8) |\
+ (SND_CTL_EXT_VERSION_TINY))
+
+/** Handle of control ext */
+struct snd_ctl_ext {
+ /**
+ * protocol version; #SND_CTL_EXT_VERSION must be filled here
+ * before calling #snd_ctl_ext_create()
+ */
+ unsigned int version;
+ /**
+ * Index of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ int card_idx;
+ /**
+ * ID string of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char id[16];
+ /**
+ * Driver name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char driver[16];
+ /**
+ * short name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char name[32];
+ /**
+ * Long name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char longname[80];
+ /**
+ * Mixer name of this card; must be filled before calling #snd_ctl_ext_create()
+ */
+ char mixername[80];
+ /**
+ * poll descriptor
+ */
+ int poll_fd;
+
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const snd_ctl_ext_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * control handle filled by #snd_ctl_ext_create()
+ */
+ snd_ctl_t *handle;
+
+ int nonblock; /**< non-block mode; read-only */
+ int subscribed; /**< events subscribed; read-only */
+};
+
+/** Callback table of ext */
+struct snd_ctl_ext_callback {
+ /**
+ * close the control handle; optional
+ */
+ void (*close)(snd_ctl_ext_t *ext);
+ /**
+ * return the total number of elements; required
+ */
+ int (*elem_count)(snd_ctl_ext_t *ext);
+ /**
+ * return the element id of the given offset (array index); required
+ */
+ int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
+ /**
+ * convert the element id to a search key; required
+ */
+ snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
+ /**
+ * the destructor of the key; optional
+ */
+ void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
+ /**
+ * get the attribute of the element; required
+ */
+ int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ int *type, unsigned int *acc, unsigned int *count);
+ /**
+ * get the element information of integer type
+ */
+ int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ long *imin, long *imax, long *istep);
+ /**
+ * get the element information of integer64 type
+ */
+ int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
+ int64_t *imin, int64_t *imax, int64_t *istep);
+ /**
+ * get the element information of enumerated type
+ */
+ int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * get the name of the enumerated item
+ */
+ int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
+ char *name, size_t name_max_len);
+ /**
+ * read the current values of integer type
+ */
+ int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
+ /**
+ * read the current values of integer64 type
+ */
+ int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
+ /**
+ * read the current values of enumerated type
+ */
+ int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * read the current values of bytes type
+ */
+ int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
+ size_t max_bytes);
+ /**
+ * read the current values of iec958 type
+ */
+ int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
+ /**
+ * update the current values of integer type with the given values
+ */
+ int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
+ /**
+ * update the current values of integer64 type with the given values
+ */
+ int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
+ /**
+ * update the current values of enumerated type with the given values
+ */
+ int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
+ /**
+ * update the current values of bytes type with the given values
+ */
+ int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
+ size_t max_bytes);
+ /**
+ * update the current values of iec958 type with the given values
+ */
+ int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
+ /**
+ * subscribe/unsubscribe the event notification; optional
+ */
+ void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
+ /**
+ * read a pending notification event; optional
+ */
+ int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
+ /**
+ * return the number of poll descriptors; optional
+ */
+ int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
+ /**
+ * fill the poll descriptors; optional
+ */
+ int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
+ /**
+ * mangle the revents of poll descriptors
+ */
+ int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+};
+
+/**
+ * The access type bits stored in get_attribute callback
+ */
+typedef enum snd_ctl_ext_access {
+ SND_CTL_EXT_ACCESS_READ = (1<<0),
+ SND_CTL_EXT_ACCESS_WRITE = (1<<1),
+ SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
+ SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
+ SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
+} snd_ctl_ext_access_t;
+
+/**
+ * find_elem callback returns this if no matching control element is found
+ */
+#define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
+
+int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
+int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_CONTROL_EXTERNAL_H */
diff --git a/alsa-lib/include/error.h b/alsa-lib/include/error.h
new file mode 100644
index 0000000..6d27083
--- /dev/null
+++ b/alsa-lib/include/error.h
@@ -0,0 +1,78 @@
+/**
+ * \file include/error.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_ERROR_H
+#define __ALSA_ERROR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Error Error handling
+ * Error handling macros and functions.
+ * \{
+ */
+
+#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
+#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
+#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */
+
+const char *snd_strerror(int errnum);
+
+/**
+ * \brief Error handler callback.
+ * \param file Source file name.
+ * \param line Line number.
+ * \param function Function name.
+ * \param err Value of \c errno, or 0 if not relevant.
+ * \param fmt \c printf(3) format.
+ * \param ... \c printf(3) arguments.
+ *
+ * A function of this type is called by the ALSA library when an error occurs.
+ * This function usually shows the message on the screen, and/or logs it.
+ */
+typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
+extern snd_lib_error_handler_t snd_lib_error;
+extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
+#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */
+#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
+#else
+#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, ##args) /**< Shows a sound error message. */
+#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args) /**< Shows a system error message (related to \c errno). */
+#endif
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_ERROR_H */
+
diff --git a/alsa-lib/include/global.h b/alsa-lib/include/global.h
new file mode 100644
index 0000000..3e3680f
--- /dev/null
+++ b/alsa-lib/include/global.h
@@ -0,0 +1,159 @@
+/**
+ * \file include/global.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_GLOBAL_H_
+#define __ALSA_GLOBAL_H_
+
+/* for timeval and timespec */
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Global Global defines and functions
+ * Global defines and functions.
+ * \par
+ * The ALSA library implementation uses these macros and functions.
+ * Most applications probably do not need them.
+ * \{
+ */
+
+const char *snd_asoundlib_version(void);
+
+#ifndef ATTRIBUTE_UNUSED
+/** do not print warning (gcc) when function parameter is not used */
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+#ifdef PIC /* dynamic build */
+
+/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
+#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
+/**
+ * \hideinitializer
+ * \brief Appends the build version to the name of a versioned dynamic symbol.
+ */
+#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
+
+#else /* static build */
+
+struct snd_dlsym_link {
+ struct snd_dlsym_link *next;
+ const char *dlsym_name;
+ const void *dlsym_ptr;
+};
+
+extern struct snd_dlsym_link *snd_dlsym_start;
+
+/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
+#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
+/**
+ * \hideinitializer
+ * \brief Appends the build version to the name of a versioned dynamic symbol.
+ */
+#define SND_DLSYM_BUILD_VERSION(name, version) \
+ static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
+ void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
+ snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
+ }
+
+#endif
+
+#ifndef __STRING
+/** \brief Return 'x' argument as string */
+#define __STRING(x) #x
+#endif
+
+/** \brief Returns the version of a dynamic symbol as a string. */
+#define SND_DLSYM_VERSION(version) __STRING(version)
+
+void *snd_dlopen(const char *file, int mode);
+void *snd_dlsym(void *handle, const char *name, const char *version);
+int snd_dlclose(void *handle);
+
+
+/** \brief alloca helper macro. */
+#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
+
+/**
+ * \brief Internal structure for an async notification client handler.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an async
+ * notification object. Applications don't access its contents directly.
+ */
+typedef struct _snd_async_handler snd_async_handler_t;
+
+/**
+ * \brief Async notification callback.
+ *
+ * See the #snd_async_add_handler function for details.
+ */
+typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
+
+int snd_async_add_handler(snd_async_handler_t **handler, int fd,
+ snd_async_callback_t callback, void *private_data);
+int snd_async_del_handler(snd_async_handler_t *handler);
+int snd_async_handler_get_fd(snd_async_handler_t *handler);
+int snd_async_handler_get_signo(snd_async_handler_t *handler);
+void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
+
+struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
+struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
+int snd_shm_area_destroy(struct snd_shm_area *area);
+
+int snd_user_file(const char *file, char **result);
+
+#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
+struct timeval {
+ time_t tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+#endif
+
+/** Timestamp */
+typedef struct timeval snd_timestamp_t;
+/** Hi-res timestamp */
+typedef struct timespec snd_htimestamp_t;
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_GLOBAL_H */
diff --git a/alsa-lib/include/hwdep.h b/alsa-lib/include/hwdep.h
new file mode 100644
index 0000000..ab12822
--- /dev/null
+++ b/alsa-lib/include/hwdep.h
@@ -0,0 +1,160 @@
+/**
+ * \file include/hwdep.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_HWDEP_H
+#define __ALSA_HWDEP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup HwDep Hardware Dependant Interface
+ * The Hardware Dependant Interface.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
+
+/** HwDep information container */
+typedef struct _snd_hwdep_info snd_hwdep_info_t;
+
+/** HwDep DSP status container */
+typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
+
+/** HwDep DSP image container */
+typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
+
+/** HwDep interface */
+typedef enum _snd_hwdep_iface {
+ SND_HWDEP_IFACE_OPL2 = 0, /**< OPL2 raw driver */
+ SND_HWDEP_IFACE_OPL3, /**< OPL3 raw driver */
+ SND_HWDEP_IFACE_OPL4, /**< OPL4 raw driver */
+ SND_HWDEP_IFACE_SB16CSP, /**< SB16CSP driver */
+ SND_HWDEP_IFACE_EMU10K1, /**< EMU10K1 driver */
+ SND_HWDEP_IFACE_YSS225, /**< YSS225 driver */
+ SND_HWDEP_IFACE_ICS2115, /**< ICS2115 driver */
+ SND_HWDEP_IFACE_SSCAPE, /**< Ensoniq SoundScape ISA card (MC68EC000) */
+ SND_HWDEP_IFACE_VX, /**< Digigram VX cards */
+ SND_HWDEP_IFACE_MIXART, /**< Digigram miXart cards */
+ SND_HWDEP_IFACE_USX2Y, /**< Tascam US122, US224 & US428 usb */
+ SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
+ SND_HWDEP_IFACE_BLUETOOTH, /**< Bluetooth audio */
+ SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */
+ SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */
+ SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */
+
+ SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_SB_RC /**< last known hwdep interface */
+} snd_hwdep_iface_t;
+
+/** open for reading */
+#define SND_HWDEP_OPEN_READ (O_RDONLY)
+/** open for writing */
+#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
+/** open for reading and writing */
+#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
+/** open mode flag: open in nonblock mode */
+#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
+
+/** HwDep handle type */
+typedef enum _snd_hwdep_type {
+ /** Kernel level HwDep */
+ SND_HWDEP_TYPE_HW,
+ /** Shared memory client HwDep (not yet implemented) */
+ SND_HWDEP_TYPE_SHM,
+ /** INET client HwDep (not yet implemented) */
+ SND_HWDEP_TYPE_INET
+} snd_hwdep_type_t;
+
+/** HwDep handle */
+typedef struct _snd_hwdep snd_hwdep_t;
+
+int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
+int snd_hwdep_close(snd_hwdep_t *hwdep);
+int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
+int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
+int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
+int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
+int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
+int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
+ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
+ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
+
+size_t snd_hwdep_info_sizeof(void);
+/** allocate #snd_hwdep_info_t container on stack */
+#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
+int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
+void snd_hwdep_info_free(snd_hwdep_info_t *obj);
+void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
+
+unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
+int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
+const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
+const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
+snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
+void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);
+
+size_t snd_hwdep_dsp_status_sizeof(void);
+/** allocate #snd_hwdep_dsp_status_t container on stack */
+#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
+int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
+void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
+void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
+
+unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
+const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
+unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);
+
+size_t snd_hwdep_dsp_image_sizeof(void);
+/** allocate #snd_hwdep_dsp_image_t container on stack */
+#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
+int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
+void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
+void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
+
+unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
+const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
+const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
+size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);
+
+void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
+void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
+void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
+void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_HWDEP_H */
+
diff --git a/alsa-lib/include/iatomic.h b/alsa-lib/include/iatomic.h
new file mode 100644
index 0000000..8f6ec22
--- /dev/null
+++ b/alsa-lib/include/iatomic.h
@@ -0,0 +1,1175 @@
+#ifndef __ALSA_IATOMIC_H
+#define __ALSA_IATOMIC_H
+
+#if defined(__i386__) || defined(__x86_64__)
+
+/*
+ * Atomic operations that C can't guarantee us. Useful for
+ * resource counting etc..
+ */
+
+#define ATOMIC_SMP_LOCK "lock ; "
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+/**
+ * atomic_read - read atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically reads the value of @v. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_read(v) ((v)->counter)
+
+/**
+ * atomic_set - set atomic variable
+ * @v: pointer of type atomic_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/**
+ * atomic_add - add integer to atomic variable
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v. Note that the guaranteed useful range
+ * of an atomic_t is only 24 bits.
+ */
+static __inline__ void atomic_add(int i, atomic_t *v)
+{
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "addl %1,%0"
+ :"=m" (v->counter)
+ :"ir" (i), "m" (v->counter));
+}
+
+/**
+ * atomic_sub - subtract the atomic variable
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ void atomic_sub(int i, atomic_t *v)
+{
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "subl %1,%0"
+ :"=m" (v->counter)
+ :"ir" (i), "m" (v->counter));
+}
+
+/**
+ * atomic_sub_and_test - subtract value from variable and test result
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "subl %2,%0; sete %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"ir" (i), "m" (v->counter) : "memory");
+ return c;
+}
+
+/**
+ * atomic_inc - increment atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ void atomic_inc(atomic_t *v)
+{
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "incl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
+}
+
+/**
+ * atomic_dec - decrement atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ void atomic_dec(atomic_t *v)
+{
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "decl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
+}
+
+/**
+ * atomic_dec_and_test - decrement and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ int atomic_dec_and_test(atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "decl %0; sete %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"m" (v->counter) : "memory");
+ return c != 0;
+}
+
+/**
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ int atomic_inc_and_test(atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "incl %0; sete %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"m" (v->counter) : "memory");
+ return c != 0;
+}
+
+/**
+ * atomic_add_negative - add and test if negative
+ * @v: pointer of type atomic_t
+ * @i: integer value to add
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static __inline__ int atomic_add_negative(int i, atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ ATOMIC_SMP_LOCK "addl %2,%0; sets %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"ir" (i), "m" (v->counter) : "memory");
+ return c;
+}
+
+/* These are x86-specific, used by some header files */
+#define atomic_clear_mask(mask, addr) \
+__asm__ __volatile__(ATOMIC_SMP_LOCK "andl %0,%1" \
+: : "r" (~(mask)),"m" (*addr) : "memory")
+
+#define atomic_set_mask(mask, addr) \
+__asm__ __volatile__(ATOMIC_SMP_LOCK "orl %0,%1" \
+: : "r" (mask),"m" (*addr) : "memory")
+
+/*
+ * Force strict CPU ordering.
+ * And yes, this is required on UP too when we're talking
+ * to devices.
+ *
+ * For now, "wmb()" doesn't actually do anything, as all
+ * Intel CPU's follow what Intel calls a *Processor Order*,
+ * in which all writes are seen in the program order even
+ * outside the CPU.
+ *
+ * I expect future Intel CPU's to have a weaker ordering,
+ * but I'd also expect them to finally get their act together
+ * and add some real memory barriers if so.
+ */
+
+#ifdef __i386__
+#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
+#define rmb() mb()
+#define wmb() __asm__ __volatile__ ("": : :"memory")
+#else
+#define mb() asm volatile("mfence":::"memory")
+#define rmb() asm volatile("lfence":::"memory")
+#define wmb() asm volatile("sfence":::"memory")
+#endif
+
+#undef ATOMIC_SMP_LOCK
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __i386__ */
+
+#ifdef __ia64__
+
+/*
+ * On IA-64, counter must always be volatile to ensure that that the
+ * memory accesses are ordered.
+ */
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) ((atomic_t) { (i) })
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/* stripped version - we need only 4byte version */
+#define ia64_cmpxchg(sem,ptr,old,new,size) \
+({ \
+ __typeof__(ptr) _p_ = (ptr); \
+ __typeof__(new) _n_ = (new); \
+ unsigned long _o_, _r_; \
+ _o_ = (unsigned int) (long) (old); \
+ __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \
+ __asm__ __volatile__ ("cmpxchg4."sem" %0=[%1],%2,ar.ccv" \
+ : "=r"(_r_) : "r"(_p_), "r"(_n_) : "memory"); \
+ (__typeof__(old)) _r_; \
+})
+
+static __inline__ int
+ia64_atomic_add (int i, atomic_t *v)
+{
+ int old, new;
+ // CMPXCHG_BUGCHECK_DECL
+
+ do {
+ // CMPXCHG_BUGCHECK(v);
+ old = atomic_read(v);
+ new = old + i;
+ } while (ia64_cmpxchg("acq", v, old, old + i, sizeof(atomic_t)) != old);
+ return new;
+}
+
+static __inline__ int
+ia64_atomic_sub (int i, atomic_t *v)
+{
+ int old, new;
+ // CMPXCHG_BUGCHECK_DECL
+
+ do {
+ // CMPXCHG_BUGCHECK(v);
+ old = atomic_read(v);
+ new = old - i;
+ } while (ia64_cmpxchg("acq", v, old, new, sizeof(atomic_t)) != old);
+ return new;
+}
+
+#define IA64_FETCHADD(tmp,v,n,sz) \
+({ \
+ switch (sz) { \
+ case 4: \
+ __asm__ __volatile__ ("fetchadd4.rel %0=[%1],%2" \
+ : "=r"(tmp) : "r"(v), "i"(n) : "memory"); \
+ break; \
+ \
+ case 8: \
+ __asm__ __volatile__ ("fetchadd8.rel %0=[%1],%2" \
+ : "=r"(tmp) : "r"(v), "i"(n) : "memory"); \
+ break; \
+ } \
+})
+
+#define ia64_fetch_and_add(i,v) \
+({ \
+ unsigned long _tmp; \
+ volatile __typeof__(*(v)) *_v = (v); \
+ switch (i) { \
+ case -16: IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v))); break; \
+ case -8: IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v))); break; \
+ case -4: IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v))); break; \
+ case -1: IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v))); break; \
+ case 1: IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v))); break; \
+ case 4: IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v))); break; \
+ case 8: IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v))); break; \
+ case 16: IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v))); break; \
+ } \
+ (__typeof__(*v)) (_tmp + (i)); /* return new value */ \
+})
+
+/*
+ * Atomically add I to V and return TRUE if the resulting value is
+ * negative.
+ */
+static __inline__ int
+atomic_add_negative (int i, atomic_t *v)
+{
+ return ia64_atomic_add(i, v) < 0;
+}
+
+#define atomic_add_return(i,v) \
+ ((__builtin_constant_p(i) && \
+ ( (i == 1) || (i == 4) || (i == 8) || (i == 16) \
+ || (i == -1) || (i == -4) || (i == -8) || (i == -16))) \
+ ? ia64_fetch_and_add(i, &(v)->counter) \
+ : ia64_atomic_add(i, v))
+
+#define atomic_sub_return(i,v) \
+ ((__builtin_constant_p(i) && \
+ ( (i == 1) || (i == 4) || (i == 8) || (i == 16) \
+ || (i == -1) || (i == -4) || (i == -8) || (i == -16))) \
+ ? ia64_fetch_and_add(-(i), &(v)->counter) \
+ : ia64_atomic_sub(i, v))
+
+#define atomic_dec_return(v) atomic_sub_return(1, (v))
+#define atomic_inc_return(v) atomic_add_return(1, (v))
+
+#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) != 0)
+
+#define atomic_add(i,v) atomic_add_return((i), (v))
+#define atomic_sub(i,v) atomic_sub_return((i), (v))
+#define atomic_inc(v) atomic_add(1, (v))
+#define atomic_dec(v) atomic_sub(1, (v))
+
+/*
+ * Macros to force memory ordering. In these descriptions, "previous"
+ * and "subsequent" refer to program order; "visible" means that all
+ * architecturally visible effects of a memory access have occurred
+ * (at a minimum, this means the memory has been read or written).
+ *
+ * wmb(): Guarantees that all preceding stores to memory-
+ * like regions are visible before any subsequent
+ * stores and that all following stores will be
+ * visible only after all previous stores.
+ * rmb(): Like wmb(), but for reads.
+ * mb(): wmb()/rmb() combo, i.e., all previous memory
+ * accesses are visible before all subsequent
+ * accesses and vice versa. This is also known as
+ * a "fence."
+ *
+ * Note: "mb()" and its variants cannot be used as a fence to order
+ * accesses to memory mapped I/O registers. For that, mf.a needs to
+ * be used. However, we don't want to always use mf.a because (a)
+ * it's (presumably) much slower than mf and (b) mf.a is supported for
+ * sequential memory pages only.
+ */
+#define mb() __asm__ __volatile__ ("mf" ::: "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __ia64__ */
+
+#ifdef __alpha__
+
+/*
+ * Atomic operations that C can't guarantee us. Useful for
+ * resource counting etc...
+ *
+ * But use these as seldom as possible since they are much slower
+ * than regular operations.
+ */
+
+
+/*
+ * Counter is volatile to make sure gcc doesn't try to be clever
+ * and move things around on us. We need to use _exactly_ the address
+ * the user gave us, not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) ((v)->counter = (i))
+
+/*
+ * To get proper branch prediction for the main line, we must branch
+ * forward to code at the end of this object's .text section, then
+ * branch back to restart the operation.
+ */
+
+static __inline__ void atomic_add(int i, atomic_t * v)
+{
+ unsigned long temp;
+ __asm__ __volatile__(
+ "1: ldl_l %0,%1\n"
+ " addl %0,%2,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,2f\n"
+ ".subsection 2\n"
+ "2: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (v->counter)
+ :"Ir" (i), "m" (v->counter));
+}
+
+static __inline__ void atomic_sub(int i, atomic_t * v)
+{
+ unsigned long temp;
+ __asm__ __volatile__(
+ "1: ldl_l %0,%1\n"
+ " subl %0,%2,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,2f\n"
+ ".subsection 2\n"
+ "2: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (v->counter)
+ :"Ir" (i), "m" (v->counter));
+}
+
+/*
+ * Same as above, but return the result value
+ */
+static __inline__ long atomic_add_return(int i, atomic_t * v)
+{
+ long temp, result;
+ __asm__ __volatile__(
+ "1: ldl_l %0,%1\n"
+ " addl %0,%3,%2\n"
+ " addl %0,%3,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,2f\n"
+ " mb\n"
+ ".subsection 2\n"
+ "2: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (v->counter), "=&r" (result)
+ :"Ir" (i), "m" (v->counter) : "memory");
+ return result;
+}
+
+static __inline__ long atomic_sub_return(int i, atomic_t * v)
+{
+ long temp, result;
+ __asm__ __volatile__(
+ "1: ldl_l %0,%1\n"
+ " subl %0,%3,%2\n"
+ " subl %0,%3,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,2f\n"
+ " mb\n"
+ ".subsection 2\n"
+ "2: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (v->counter), "=&r" (result)
+ :"Ir" (i), "m" (v->counter) : "memory");
+ return result;
+}
+
+#define atomic_dec_return(v) atomic_sub_return(1,(v))
+#define atomic_inc_return(v) atomic_add_return(1,(v))
+
+#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+
+#define atomic_inc(v) atomic_add(1,(v))
+#define atomic_dec(v) atomic_sub(1,(v))
+
+#define mb() \
+__asm__ __volatile__("mb": : :"memory")
+
+#define rmb() \
+__asm__ __volatile__("mb": : :"memory")
+
+#define wmb() \
+__asm__ __volatile__("wmb": : :"memory")
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __alpha__ */
+
+#ifdef __powerpc__
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+extern void atomic_clear_mask(unsigned long mask, unsigned long *addr);
+extern void atomic_set_mask(unsigned long mask, unsigned long *addr);
+
+#define SMP_ISYNC "\n\tisync"
+
+static __inline__ void atomic_add(int a, atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%3 # atomic_add\n\
+ add %0,%2,%0\n\
+ stwcx. %0,0,%3\n\
+ bne- 1b"
+ : "=&r" (t), "=m" (v->counter)
+ : "r" (a), "r" (&v->counter), "m" (v->counter)
+ : "cc");
+}
+
+static __inline__ int atomic_add_return(int a, atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%2 # atomic_add_return\n\
+ add %0,%1,%0\n\
+ stwcx. %0,0,%2\n\
+ bne- 1b"
+ SMP_ISYNC
+ : "=&r" (t)
+ : "r" (a), "r" (&v->counter)
+ : "cc", "memory");
+
+ return t;
+}
+
+static __inline__ void atomic_sub(int a, atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%3 # atomic_sub\n\
+ subf %0,%2,%0\n\
+ stwcx. %0,0,%3\n\
+ bne- 1b"
+ : "=&r" (t), "=m" (v->counter)
+ : "r" (a), "r" (&v->counter), "m" (v->counter)
+ : "cc");
+}
+
+static __inline__ int atomic_sub_return(int a, atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%2 # atomic_sub_return\n\
+ subf %0,%1,%0\n\
+ stwcx. %0,0,%2\n\
+ bne- 1b"
+ SMP_ISYNC
+ : "=&r" (t)
+ : "r" (a), "r" (&v->counter)
+ : "cc", "memory");
+
+ return t;
+}
+
+static __inline__ void atomic_inc(atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%2 # atomic_inc\n\
+ addic %0,%0,1\n\
+ stwcx. %0,0,%2\n\
+ bne- 1b"
+ : "=&r" (t), "=m" (v->counter)
+ : "r" (&v->counter), "m" (v->counter)
+ : "cc");
+}
+
+static __inline__ int atomic_inc_return(atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%1 # atomic_inc_return\n\
+ addic %0,%0,1\n\
+ stwcx. %0,0,%1\n\
+ bne- 1b"
+ SMP_ISYNC
+ : "=&r" (t)
+ : "r" (&v->counter)
+ : "cc", "memory");
+
+ return t;
+}
+
+static __inline__ void atomic_dec(atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%2 # atomic_dec\n\
+ addic %0,%0,-1\n\
+ stwcx. %0,0,%2\n\
+ bne- 1b"
+ : "=&r" (t), "=m" (v->counter)
+ : "r" (&v->counter), "m" (v->counter)
+ : "cc");
+}
+
+static __inline__ int atomic_dec_return(atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%1 # atomic_dec_return\n\
+ addic %0,%0,-1\n\
+ stwcx. %0,0,%1\n\
+ bne- 1b"
+ SMP_ISYNC
+ : "=&r" (t)
+ : "r" (&v->counter)
+ : "cc", "memory");
+
+ return t;
+}
+
+#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_dec_return((v)) == 0)
+
+/*
+ * Atomically test *v and decrement if it is greater than 0.
+ * The function returns the old value of *v minus 1.
+ */
+static __inline__ int atomic_dec_if_positive(atomic_t *v)
+{
+ int t;
+
+ __asm__ __volatile__(
+"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\
+ addic. %0,%0,-1\n\
+ blt- 2f\n\
+ stwcx. %0,0,%1\n\
+ bne- 1b"
+ SMP_ISYNC
+ "\n\
+2:" : "=&r" (t)
+ : "r" (&v->counter)
+ : "cc", "memory");
+
+ return t;
+}
+
+/*
+ * Memory barrier.
+ * The sync instruction guarantees that all memory accesses initiated
+ * by this processor have been performed (with respect to all other
+ * mechanisms that access memory). The eieio instruction is a barrier
+ * providing an ordering (separately) for (a) cacheable stores and (b)
+ * loads and stores to non-cacheable memory (e.g. I/O devices).
+ *
+ * mb() prevents loads and stores being reordered across this point.
+ * rmb() prevents loads being reordered across this point.
+ * wmb() prevents stores being reordered across this point.
+ *
+ * We can use the eieio instruction for wmb, but since it doesn't
+ * give any ordering guarantees about loads, we have to use the
+ * stronger but slower sync instruction for mb and rmb.
+ */
+#define mb() __asm__ __volatile__ ("sync" : : : "memory")
+#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
+#define wmb() __asm__ __volatile__ ("eieio" : : : "memory")
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __powerpc__ */
+
+#ifdef __mips__
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+/*
+ * atomic_read - read atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically reads the value of @v. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_read(v) ((v)->counter)
+
+/*
+ * atomic_set - set atomic variable
+ * @v: pointer of type atomic_t
+ * @i: required value
+ *
+ * Atomically sets the value of @v to @i. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_set(v,i) ((v)->counter = (i))
+
+/*
+ * for MIPS II and better we can use ll/sc instruction, and kernel 2.4.3+
+ * will emulate it on MIPS I.
+ */
+
+/*
+ * atomic_add - add integer to atomic variable
+ * @i: integer value to add
+ * @v: pointer of type atomic_t
+ *
+ * Atomically adds @i to @v. Note that the guaranteed useful range
+ * of an atomic_t is only 24 bits.
+ */
+extern __inline__ void atomic_add(int i, atomic_t * v)
+{
+ unsigned long temp;
+
+ __asm__ __volatile__(
+ ".set push \n"
+ ".set mips2 \n"
+ "1: ll %0, %1 # atomic_add\n"
+ " addu %0, %2 \n"
+ " sc %0, %1 \n"
+ " beqz %0, 1b \n"
+ ".set pop \n"
+ : "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter));
+}
+
+/*
+ * atomic_sub - subtract the atomic variable
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+extern __inline__ void atomic_sub(int i, atomic_t * v)
+{
+ unsigned long temp;
+
+ __asm__ __volatile__(
+ ".set push \n"
+ ".set mips2 \n"
+ "1: ll %0, %1 # atomic_sub\n"
+ " subu %0, %2 \n"
+ " sc %0, %1 \n"
+ " beqz %0, 1b \n"
+ ".set pop \n"
+ : "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter));
+}
+
+/*
+ * Same as above, but return the result value
+ */
+extern __inline__ int atomic_add_return(int i, atomic_t * v)
+{
+ unsigned long temp, result;
+
+ __asm__ __volatile__(
+ ".set push # atomic_add_return\n"
+ ".set noreorder \n"
+ ".set mips2 \n"
+ "1: ll %1, %2 \n"
+ " addu %0, %1, %3 \n"
+ " sc %0, %2 \n"
+ " beqz %0, 1b \n"
+ " addu %0, %1, %3 \n"
+ ".set pop \n"
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter)
+ : "memory");
+
+ return result;
+}
+
+extern __inline__ int atomic_sub_return(int i, atomic_t * v)
+{
+ unsigned long temp, result;
+
+ __asm__ __volatile__(
+ ".set push \n"
+ ".set mips2 \n"
+ ".set noreorder # atomic_sub_return\n"
+ "1: ll %1, %2 \n"
+ " subu %0, %1, %3 \n"
+ " sc %0, %2 \n"
+ " beqz %0, 1b \n"
+ " subu %0, %1, %3 \n"
+ ".set pop \n"
+ : "=&r" (result), "=&r" (temp), "=m" (v->counter)
+ : "Ir" (i), "m" (v->counter)
+ : "memory");
+
+ return result;
+}
+
+#define atomic_dec_return(v) atomic_sub_return(1,(v))
+#define atomic_inc_return(v) atomic_add_return(1,(v))
+
+/*
+ * atomic_sub_and_test - subtract value from variable and test result
+ * @i: integer value to subtract
+ * @v: pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(1, (v)) == 0)
+
+/*
+ * atomic_dec_and_test - decrement by 1 and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+
+/*
+ * atomic_inc - increment atomic variable
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_inc(v) atomic_add(1,(v))
+
+/*
+ * atomic_dec - decrement and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+#define atomic_dec(v) atomic_sub(1,(v))
+
+/*
+ * atomic_add_negative - add and test if negative
+ * @v: pointer of type atomic_t
+ * @i: integer value to add
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero. Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ *
+ * Currently not implemented for MIPS.
+ */
+
+#define mb() \
+__asm__ __volatile__( \
+ "# prevent instructions being moved around\n\t" \
+ ".set\tnoreorder\n\t" \
+ "# 8 nops to fool the R4400 pipeline\n\t" \
+ "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \
+ ".set\treorder" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __mips__ */
+
+#ifdef __arm__
+
+/*
+ * FIXME: bellow code is valid only for SA11xx
+ */
+
+/*
+ * Save the current interrupt enable state & disable IRQs
+ */
+#define local_irq_save(x) \
+ ({ \
+ unsigned long temp; \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ local_irq_save\n" \
+" orr %1, %0, #128\n" \
+" msr cpsr_c, %1" \
+ : "=r" (x), "=r" (temp) \
+ : \
+ : "memory"); \
+ })
+
+/*
+ * restore saved IRQ & FIQ state
+ */
+#define local_irq_restore(x) \
+ __asm__ __volatile__( \
+ "msr cpsr_c, %0 @ local_irq_restore\n" \
+ : \
+ : "r" (x) \
+ : "memory")
+
+#define __save_flags_cli(x) local_irq_save(x)
+#define __restore_flags(x) local_irq_restore(x)
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+static __inline__ void atomic_add(int i, volatile atomic_t *v)
+{
+ unsigned long flags;
+
+ __save_flags_cli(flags);
+ v->counter += i;
+ __restore_flags(flags);
+}
+
+static __inline__ void atomic_sub(int i, volatile atomic_t *v)
+{
+ unsigned long flags;
+
+ __save_flags_cli(flags);
+ v->counter -= i;
+ __restore_flags(flags);
+}
+
+static __inline__ void atomic_inc(volatile atomic_t *v)
+{
+ unsigned long flags;
+
+ __save_flags_cli(flags);
+ v->counter += 1;
+ __restore_flags(flags);
+}
+
+static __inline__ void atomic_dec(volatile atomic_t *v)
+{
+ unsigned long flags;
+
+ __save_flags_cli(flags);
+ v->counter -= 1;
+ __restore_flags(flags);
+}
+
+static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
+{
+ unsigned long flags;
+ int result;
+
+ __save_flags_cli(flags);
+ v->counter -= 1;
+ result = (v->counter == 0);
+ __restore_flags(flags);
+
+ return result;
+}
+
+static inline int atomic_add_negative(int i, volatile atomic_t *v)
+{
+ unsigned long flags;
+ int result;
+
+ __save_flags_cli(flags);
+ v->counter += i;
+ result = (v->counter < 0);
+ __restore_flags(flags);
+
+ return result;
+}
+
+static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+{
+ unsigned long flags;
+
+ __save_flags_cli(flags);
+ *addr &= ~mask;
+ __restore_flags(flags);
+}
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __arm__ */
+
+#ifdef __sh__
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+#define atomic_dec_return(v) atomic_sub_return(1,(v))
+#define atomic_inc_return(v) atomic_add_return(1,(v))
+
+#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) != 0)
+
+#define atomic_add(i,v) atomic_add_return((i),(v))
+#define atomic_sub(i,v) atomic_sub_return((i),(v))
+#define atomic_inc(v) atomic_add(1,(v))
+#define atomic_dec(v) atomic_sub(1,(v))
+
+static __inline__ int atomic_add_return(int i, volatile atomic_t *v)
+{
+ int result;
+
+ asm volatile (
+ " .align 2\n"
+ " mova 99f, r0\n"
+ " mov r15, r1\n"
+ " mov #-6, r15\n"
+ " mov.l @%2, %0\n"
+ " add %1, %0\n"
+ " mov.l %0, @%2\n"
+ "99: mov r1, r15"
+ : "=&r"(result)
+ : "r"(i), "r"(v)
+ : "r0", "r1");
+
+ return result;
+}
+
+static __inline__ int atomic_sub_return(int i, volatile atomic_t *v)
+{
+ int result;
+
+ asm volatile (
+ " .align 2\n"
+ " mova 99f, r0\n"
+ " mov r15, r1\n"
+ " mov #-6, r15\n"
+ " mov.l @%2, %0\n"
+ " sub %1, %0\n"
+ " mov.l %0, @%2\n"
+ "99: mov r1, r15"
+ : "=&r"(result)
+ : "r"(i), "r"(v)
+ : "r0", "r1");
+
+ return result;
+}
+
+#define mb() __asm__ __volatile__ ("" : : : "memory")
+#define rmb() mb()
+#define wmb() mb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* __sh__ */
+
+#ifndef IATOMIC_DEFINED
+/*
+ * non supported architecture.
+ */
+#warning "Atomic operations are not supported on this architecture."
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+#define atomic_add(i,v) (((v)->counter) += (i))
+#define atomic_sub(i,v) (((v)->counter) -= (i))
+#define atomic_inc(v) (((v)->counter)++)
+#define atomic_dec(v) (((v)->counter)--)
+
+#define mb()
+#define rmb()
+#define wmb()
+
+#define IATOMIC_DEFINED 1
+
+#endif /* IATOMIC_DEFINED */
+
+/*
+ * Atomic read/write
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ */
+
+/* Max number of times we must spin on a spin-lock calling sched_yield().
+ After MAX_SPIN_COUNT iterations, we put the calling thread to sleep. */
+
+#ifndef MAX_SPIN_COUNT
+#define MAX_SPIN_COUNT 50
+#endif
+
+/* Duration of sleep (in nanoseconds) when we can't acquire a spin-lock
+ after MAX_SPIN_COUNT iterations of sched_yield().
+ This MUST BE > 2ms.
+ (Otherwise the kernel does busy-waiting for real-time threads,
+ giving other threads no chance to run.) */
+
+#ifndef SPIN_SLEEP_DURATION
+#define SPIN_SLEEP_DURATION 2000001
+#endif
+
+typedef struct {
+ unsigned int begin, end;
+} snd_atomic_write_t;
+
+typedef struct {
+ volatile const snd_atomic_write_t *write;
+ unsigned int end;
+} snd_atomic_read_t;
+
+void snd_atomic_read_wait(snd_atomic_read_t *t);
+
+static inline void snd_atomic_write_init(snd_atomic_write_t *w)
+{
+ w->begin = 0;
+ w->end = 0;
+}
+
+static inline void snd_atomic_write_begin(snd_atomic_write_t *w)
+{
+ w->begin++;
+ wmb();
+}
+
+static inline void snd_atomic_write_end(snd_atomic_write_t *w)
+{
+ wmb();
+ w->end++;
+}
+
+static inline void snd_atomic_read_init(snd_atomic_read_t *r, snd_atomic_write_t *w)
+{
+ r->write = w;
+}
+
+static inline void snd_atomic_read_begin(snd_atomic_read_t *r)
+{
+ r->end = r->write->end;
+ rmb();
+}
+
+static inline int snd_atomic_read_ok(snd_atomic_read_t *r)
+{
+ rmb();
+ return r->end == r->write->begin;
+}
+
+#endif /* __ALSA_IATOMIC_H */
diff --git a/alsa-lib/include/input.h b/alsa-lib/include/input.h
new file mode 100644
index 0000000..fc5d0e6
--- /dev/null
+++ b/alsa-lib/include/input.h
@@ -0,0 +1,83 @@
+/**
+ * \file include/input.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_INPUT_H
+#define __ALSA_INPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Input Input Interface
+ *
+ * The input functions present an interface similar to the stdio functions
+ * on top of different underlying input sources.
+ *
+ * The #snd_config_load function uses such an input handle to be able to
+ * load configurations not only from standard files but also from other
+ * sources, e.g. from memory buffers.
+ *
+ * \{
+ */
+
+/**
+ * \brief Internal structure for an input object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an
+ * input object. Applications don't access its contents directly.
+ */
+typedef struct _snd_input snd_input_t;
+
+/** Input type. */
+typedef enum _snd_input_type {
+ /** Input from a stdio stream. */
+ SND_INPUT_STDIO,
+ /** Input from a memory buffer. */
+ SND_INPUT_BUFFER
+} snd_input_type_t;
+
+int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode);
+int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close);
+int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, ssize_t size);
+int snd_input_close(snd_input_t *input);
+int snd_input_scanf(snd_input_t *input, const char *format, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (scanf, 2, 3)))
+#endif
+ ;
+char *snd_input_gets(snd_input_t *input, char *str, size_t size);
+int snd_input_getc(snd_input_t *input);
+int snd_input_ungetc(snd_input_t *input, int c);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_INPUT_H */
diff --git a/alsa-lib/include/list.h b/alsa-lib/include/list.h
new file mode 100644
index 0000000..5b3f1bf
--- /dev/null
+++ b/alsa-lib/include/list.h
@@ -0,0 +1,166 @@
+#ifndef _LIST_H
+#define _LIST_H
+
+/*
+ * This code was taken from the Linux 2.4.0 kernel. [jaroslav]
+ */
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+#ifndef LIST_HEAD_IS_DEFINED
+struct list_head {
+ struct list_head *next, *prev;
+};
+#endif
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+ struct list_head name = LIST_HEAD_INIT(name)
+
+#define INIT_LIST_HEAD(ptr) do { \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+} while (0)
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __inline__ void __list_add(struct list_head * _new,
+ struct list_head * prev,
+ struct list_head * next)
+{
+ next->prev = _new;
+ _new->next = next;
+ _new->prev = prev;
+ prev->next = _new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static __inline__ void list_add(struct list_head *_new, struct list_head *head)
+{
+ __list_add(_new, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static __inline__ void list_add_tail(struct list_head *_new, struct list_head *head)
+{
+ __list_add(_new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __inline__ void __list_del(struct list_head * prev,
+ struct list_head * next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
+ */
+static __inline__ void list_del(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.n
+ */
+static __inline__ void list_del_init(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static __inline__ int list_empty(struct list_head *head)
+{
+ return head->next == head;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static __inline__ void list_splice(struct list_head *list, struct list_head *head)
+{
+ struct list_head *first = list->next;
+
+ if (first != list) {
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
+
+ first->prev = head;
+ head->next = first;
+
+ last->next = at;
+ at->prev = last;
+ }
+}
+
+/**
+ * list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define list_for_each(pos, head) \
+ for (pos = (head)->next ; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_safe - iterate over a list safely (actual pointer can be invalidated)
+ * @pos: the &struct list_head to use as a loop counter.
+ * @next: the &struct list_head to use to save next.
+ * @head: the head for your list.
+ */
+#define list_for_each_safe(pos, npos, head) \
+ for (pos = (head)->next, npos = pos->next ; pos != (head); pos = npos, npos = pos->next)
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+
+#endif /* _LIST_H */
diff --git a/alsa-lib/include/local.h b/alsa-lib/include/local.h
new file mode 100644
index 0000000..b5a1c45
--- /dev/null
+++ b/alsa-lib/include/local.h
@@ -0,0 +1,278 @@
+/*
+ * ALSA lib - local header file
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __LOCAL_H
+#define __LOCAL_H
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <endian.h>
+#include <stdarg.h>
+#include <sys/poll.h>
+#include <errno.h>
+
+#include "config.h"
+#ifdef SUPPORT_RESMGR
+#include <resmgr.h>
+#endif
+#ifdef HAVE_LIBDL
+#include <dlfcn.h>
+#else
+#define RTLD_NOW 0
+#endif
+
+#define _snd_config_iterator list_head
+#define _snd_interval sndrv_interval
+#define _snd_pcm_info sndrv_pcm_info
+#define _snd_pcm_hw_params sndrv_pcm_hw_params
+#define _snd_pcm_sw_params sndrv_pcm_sw_params
+#define _snd_pcm_status sndrv_pcm_status
+
+#define _snd_ctl_card_info sndrv_ctl_card_info
+#define _snd_ctl_elem_id sndrv_ctl_elem_id
+#define _snd_ctl_elem_list sndrv_ctl_elem_list
+#define _snd_ctl_elem_info sndrv_ctl_elem_info
+#define _snd_ctl_elem_value sndrv_ctl_elem_value
+#define _snd_ctl_event sndrv_ctl_event
+
+#define _snd_rawmidi_info sndrv_rawmidi_info
+#define _snd_rawmidi_params sndrv_rawmidi_params
+#define _snd_rawmidi_status sndrv_rawmidi_status
+
+#define _snd_hwdep_info sndrv_hwdep_info
+#define _snd_hwdep_dsp_status sndrv_hwdep_dsp_status
+#define _snd_hwdep_dsp_image sndrv_hwdep_dsp_image
+
+#define _snd_seq_queue_tempo sndrv_seq_queue_tempo
+#define _snd_seq_client_info sndrv_seq_client_info
+#define _snd_seq_port_info sndrv_seq_port_info
+#define _snd_seq_system_info sndrv_seq_system_info
+#define _snd_seq_queue_info sndrv_seq_queue_info
+#define _snd_seq_queue_status sndrv_seq_queue_status
+#define _snd_seq_queue_timer sndrv_seq_queue_timer
+#define _snd_seq_port_subscribe sndrv_seq_port_subscribe
+#define _snd_seq_query_subscribe sndrv_seq_query_subs
+#define _snd_seq_client_pool sndrv_seq_client_pool
+#define _snd_seq_remove_events sndrv_seq_remove_events
+
+#define sndrv_seq_addr snd_seq_addr
+#define sndrv_seq_tick_time_t snd_seq_tick_time_t
+#define sndrv_seq_real_time snd_seq_real_time
+#define sndrv_seq_timestamp snd_seq_timestamp
+#define sndrv_seq_event snd_seq_event
+
+#if 0
+typedef struct sndrv_seq_addr snd_seq_addr_t;
+#define snd_seq_tick_time_t sndrv_seq_tick_time_t
+typedef struct sndrv_seq_real_time snd_seq_real_time_t;
+typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
+typedef struct sndrv_seq_event snd_seq_event_t;
+#endif
+
+#define _snd_timer_id sndrv_timer_id
+#define _snd_timer_ginfo sndrv_timer_ginfo
+#define _snd_timer_gparams sndrv_timer_gparams
+#define _snd_timer_gstatus sndrv_timer_gstatus
+#define _snd_timer_select sndrv_timer_select
+#define _snd_timer_info sndrv_timer_info
+#define _snd_timer_params sndrv_timer_params
+#define _snd_timer_status sndrv_timer_status
+
+#define ALSA_LIBRARY_BUILD
+
+#include <sound/asound.h>
+#include <sound/asoundef.h>
+#include "alsa-symbols.h"
+#include "version.h"
+#include "global.h"
+#include "input.h"
+#include "output.h"
+#include "error.h"
+#include "conf.h"
+#include "pcm.h"
+#include "pcm_plugin.h"
+#include "rawmidi.h"
+#include "timer.h"
+#include "hwdep.h"
+#include "control.h"
+#include "mixer.h"
+#include "seq_event.h"
+#include "seq.h"
+#include <sound/asequencer.h>
+#include "seqmid.h"
+#include "seq_midi_event.h"
+#include "list.h"
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define SND_LITTLE_ENDIAN
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define SND_BIG_ENDIAN
+#endif
+
+struct _snd_async_handler {
+ enum {
+ SND_ASYNC_HANDLER_GENERIC,
+ SND_ASYNC_HANDLER_CTL,
+ SND_ASYNC_HANDLER_PCM,
+ SND_ASYNC_HANDLER_TIMER,
+ } type;
+ int fd;
+ union {
+ snd_ctl_t *ctl;
+ snd_pcm_t *pcm;
+ snd_timer_t *timer;
+ } u;
+ snd_async_callback_t callback;
+ void *private_data;
+ struct list_head glist;
+ struct list_head hlist;
+};
+
+typedef enum _snd_set_mode {
+ SND_CHANGE,
+ SND_TRY,
+ SND_TEST,
+} snd_set_mode_t;
+
+size_t page_align(size_t size);
+size_t page_size(void);
+size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t *mmap_offset);
+
+int safe_strtol(const char *str, long *val);
+
+int snd_send_fd(int sock, void *data, size_t len, int fd);
+int snd_receive_fd(int sock, void *data, size_t len, int *fd);
+
+/*
+ * error messages
+ */
+#ifndef NDEBUG
+#define CHECK_SANITY(x) x
+extern snd_lib_error_handler_t snd_err_msg;
+#define SNDMSG(args...) snd_err_msg(__FILE__, __LINE__, __FUNCTION__, 0, ##args)
+#define SYSMSG(args...) snd_err_msg(__FILE__, __LINE__, __FUNCTION__, errno, ##args)
+#else
+#define CHECK_SANITY(x) 0 /* not evaluated */
+#define SNDMSG(args...) /* nop */
+#define SYSMSG(args...) /* nop */
+#endif
+
+/*
+ */
+#define HAVE_GNU_LD
+#define HAVE_ELF
+#define HAVE_ASM_PREVIOUS_DIRECTIVE
+
+/* Stolen from libc-symbols.h in GNU glibc */
+
+/* When a reference to SYMBOL is encountered, the linker will emit a
+ warning message MSG. */
+
+#define ASM_NAME(name) __SYMBOL_PREFIX name
+
+#ifdef HAVE_GNU_LD
+# ifdef HAVE_ELF
+
+/* We want the .gnu.warning.SYMBOL section to be unallocated. */
+# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
+# define __make_section_unallocated(section_string) \
+ asm (".section " section_string "\n\t.previous");
+# elif defined HAVE_ASM_POPSECTION_DIRECTIVE
+# define __make_section_unallocated(section_string) \
+ asm (".pushsection " section_string "\n\t.popsection");
+# else
+# define __make_section_unallocated(section_string)
+# endif
+
+/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
+ section attributes on what looks like a comment to the assembler. */
+# ifdef HAVE_SECTION_QUOTES
+# define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
+ static const char __evoke_link_warning_##symbol[] \
+ __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\"\n\t#\""))) = msg;
+# else
+# define link_warning(symbol, msg) \
+ __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
+ static const char __evoke_link_warning_##symbol[] \
+ __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\n\t#"))) = msg;
+# endif
+# else
+# define link_warning(symbol, msg) \
+ asm (".stabs \"" msg "\",30,0,0,0\n\t" \
+ ".stabs \"" ASM_NAME(#symbol) "\",1,0,0,0\n");
+# endif
+#else
+/* We will never be heard; they will all die horribly. */
+# define link_warning(symbol, msg)
+#endif
+
+/* open with resmgr */
+#ifdef SUPPORT_RESMGR
+static inline int snd_open_device(const char *filename, int fmode)
+{
+ int fd = open(filename, fmode);
+ if (fd >= 0)
+ return fd;
+ if (errno == EAGAIN || errno == EBUSY)
+ return fd;
+ if (! access(filename, F_OK))
+ return rsm_open_device(filename, fmode);
+ return -1;
+}
+#else
+#define snd_open_device(filename, fmode) open(filename, fmode);
+#endif
+
+/* make local functions really local */
+#define snd_dlobj_cache_lookup \
+ snd1_dlobj_cache_lookup
+#define snd_dlobj_cache_add \
+ snd1_dlobj_cache_add
+#define snd_dlobj_cache_cleanup \
+ snd1_dlobj_cache_cleanup
+#define snd_config_set_hop \
+ snd1_config_set_hop
+#define snd_config_check_hop \
+ snd1_config_check_hop
+#define snd_config_search_alias_hooks \
+ snd1_config_search_alias_hooks
+
+/* dlobj cache */
+void *snd_dlobj_cache_lookup(const char *name);
+int snd_dlobj_cache_add(const char *name, void *dlobj, void *open_func);
+void snd_dlobj_cache_cleanup(void);
+
+/* for recursive checks */
+void snd_config_set_hop(snd_config_t *conf, int hop);
+int snd_config_check_hop(snd_config_t *conf);
+#define SND_CONF_MAX_HOPS 64
+
+int snd_config_search_alias_hooks(snd_config_t *config,
+ const char *base, const char *key,
+ snd_config_t **result);
+
+#endif
diff --git a/alsa-lib/include/mixer.h b/alsa-lib/include/mixer.h
new file mode 100644
index 0000000..df92164
--- /dev/null
+++ b/alsa-lib/include/mixer.h
@@ -0,0 +1,319 @@
+/**
+ * \file include/mixer.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_MIXER_H
+#define __ALSA_MIXER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Mixer Mixer Interface
+ * The mixer interface.
+ * \{
+ */
+
+/** Mixer handle */
+typedef struct _snd_mixer snd_mixer_t;
+/** Mixer elements class handle */
+typedef struct _snd_mixer_class snd_mixer_class_t;
+/** Mixer element handle */
+typedef struct _snd_mixer_elem snd_mixer_elem_t;
+
+/**
+ * \brief Mixer callback function
+ * \param mixer Mixer handle
+ * \param mask event mask
+ * \param elem related mixer element (if any)
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
+ unsigned int mask,
+ snd_mixer_elem_t *elem);
+
+/**
+ * \brief Mixer element callback function
+ * \param elem Mixer element
+ * \param mask event mask
+ * \return 0 on success otherwise a negative error code
+ */
+typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
+ unsigned int mask);
+
+/**
+ * \brief Compare function for sorting mixer elements
+ * \param e1 First element
+ * \param e2 Second element
+ * \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
+ */
+typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
+ const snd_mixer_elem_t *e2);
+
+/**
+ * \brief Event callback for the mixer class
+ * \param class_ Mixer class
+ * \param mask Event mask (SND_CTL_EVENT_*)
+ * \param helem HCTL element which invoked the event
+ * \param melem Mixer element associated to HCTL element
+ * \return zero if success, otherwise a negative error value
+ */
+typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
+
+
+/** Mixer element type */
+typedef enum _snd_mixer_elem_type {
+ /* Simple mixer elements */
+ SND_MIXER_ELEM_SIMPLE,
+ SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
+} snd_mixer_elem_type_t;
+
+int snd_mixer_open(snd_mixer_t **mixer, int mode);
+int snd_mixer_close(snd_mixer_t *mixer);
+snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
+snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
+int snd_mixer_handle_events(snd_mixer_t *mixer);
+int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
+int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
+int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
+int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
+int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
+int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
+int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
+int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_mixer_load(snd_mixer_t *mixer);
+void snd_mixer_free(snd_mixer_t *mixer);
+int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
+int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
+void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
+void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
+void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
+unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
+int snd_mixer_class_unregister(snd_mixer_class_t *clss);
+
+snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
+snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
+void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
+void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
+void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
+snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
+
+int snd_mixer_class_register(snd_mixer_class_t *class_, snd_mixer_t *mixer);
+int snd_mixer_add_elem(snd_mixer_t *mixer, snd_mixer_elem_t *elem);
+int snd_mixer_remove_elem(snd_mixer_t *mixer, snd_mixer_elem_t *elem);
+int snd_mixer_elem_new(snd_mixer_elem_t **elem,
+ snd_mixer_elem_type_t type,
+ int compare_weight,
+ void *private_data,
+ void (*private_free)(snd_mixer_elem_t *elem));
+int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class_);
+int snd_mixer_elem_remove(snd_mixer_elem_t *elem);
+void snd_mixer_elem_free(snd_mixer_elem_t *elem);
+int snd_mixer_elem_info(snd_mixer_elem_t *elem);
+int snd_mixer_elem_value(snd_mixer_elem_t *elem);
+int snd_mixer_elem_attach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
+int snd_mixer_elem_detach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
+int snd_mixer_elem_empty(snd_mixer_elem_t *melem);
+void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
+
+size_t snd_mixer_class_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_mixer_class_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
+int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
+void snd_mixer_class_free(snd_mixer_class_t *obj);
+void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
+snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *class_);
+snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *class_);
+void *snd_mixer_class_get_private(const snd_mixer_class_t *class_);
+snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *class_);
+int snd_mixer_class_set_event(snd_mixer_class_t *class_, snd_mixer_event_t event);
+int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
+int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *class_));
+int snd_mixer_class_set_compare(snd_mixer_class_t *class_, snd_mixer_compare_t compare);
+
+/**
+ * \defgroup SimpleMixer Simple Mixer Interface
+ * \ingroup Mixer
+ * The simple mixer interface.
+ * \{
+ */
+
+/* Simple mixer elements API */
+
+/** Mixer simple element channel identifier */
+typedef enum _snd_mixer_selem_channel_id {
+ /** Unknown */
+ SND_MIXER_SCHN_UNKNOWN = -1,
+ /** Front left */
+ SND_MIXER_SCHN_FRONT_LEFT = 0,
+ /** Front right */
+ SND_MIXER_SCHN_FRONT_RIGHT,
+ /** Rear left */
+ SND_MIXER_SCHN_REAR_LEFT,
+ /** Rear right */
+ SND_MIXER_SCHN_REAR_RIGHT,
+ /** Front center */
+ SND_MIXER_SCHN_FRONT_CENTER,
+ /** Woofer */
+ SND_MIXER_SCHN_WOOFER,
+ /** Side Left */
+ SND_MIXER_SCHN_SIDE_LEFT,
+ /** Side Right */
+ SND_MIXER_SCHN_SIDE_RIGHT,
+ /** Rear Center */
+ SND_MIXER_SCHN_REAR_CENTER,
+ SND_MIXER_SCHN_LAST = 31,
+ /** Mono (Front left alias) */
+ SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
+} snd_mixer_selem_channel_id_t;
+
+/** Mixer simple element - register options - abstraction level */
+enum snd_mixer_selem_regopt_abstract {
+ /** no abstraction - try use all universal controls from driver */
+ SND_MIXER_SABSTRACT_NONE = 0,
+ /** basic abstraction - Master,PCM,CD,Aux,Record-Gain etc. */
+ SND_MIXER_SABSTRACT_BASIC,
+};
+
+/** Mixer simple element - register options */
+struct snd_mixer_selem_regopt {
+ /** structure version */
+ int ver;
+ /** v1: abstract layer selection */
+ enum snd_mixer_selem_regopt_abstract abstract;
+ /** v1: device name (must be NULL when playback_pcm or capture_pcm != NULL) */
+ const char *device;
+ /** v1: playback PCM connected to mixer device (NULL == none) */
+ snd_pcm_t *playback_pcm;
+ /** v1: capture PCM connected to mixer device (NULL == none) */
+ snd_pcm_t *capture_pcm;
+};
+
+/** Mixer simple element identifier */
+typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
+
+const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
+
+int snd_mixer_selem_register(snd_mixer_t *mixer,
+ struct snd_mixer_selem_regopt *options,
+ snd_mixer_class_t **classp);
+void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
+ snd_mixer_selem_id_t *id);
+const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
+unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
+snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
+ const snd_mixer_selem_id_t *id);
+
+int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
+int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
+int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
+int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
+
+int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
+int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
+int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
+int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
+int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
+int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
+int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
+int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
+int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
+int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
+int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
+int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
+int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
+int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
+int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
+int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
+int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
+int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
+int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
+int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
+ long min, long max);
+int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max);
+int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
+ long min, long max);
+
+int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem);
+int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem);
+int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem);
+int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
+int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
+int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx);
+
+size_t snd_mixer_selem_id_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
+int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
+void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
+void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
+const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
+unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
+void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
+void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
+
+/** \} */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_MIXER_H */
+
diff --git a/alsa-lib/include/mixer_abst.h b/alsa-lib/include/mixer_abst.h
new file mode 100644
index 0000000..7844b19
--- /dev/null
+++ b/alsa-lib/include/mixer_abst.h
@@ -0,0 +1,112 @@
+/**
+ * \file include/mixer_abst.h
+ * \brief Mixer abstract implementation interface library for the ALSA library
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2005
+ *
+ * Mixer abstact implementation interface library for the ALSA library
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_MIXER_ABST_H
+#define __ALSA_MIXER_ABST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Mixer_Abstract Mixer Abstact Module Interface
+ * The mixer abstact module interface.
+ * \{
+ */
+
+#define SM_PLAY 0
+#define SM_CAPT 1
+
+#define SM_CAP_GVOLUME (1<<1)
+#define SM_CAP_GSWITCH (1<<2)
+#define SM_CAP_PVOLUME (1<<3)
+#define SM_CAP_PVOLUME_JOIN (1<<4)
+#define SM_CAP_PSWITCH (1<<5)
+#define SM_CAP_PSWITCH_JOIN (1<<6)
+#define SM_CAP_CVOLUME (1<<7)
+#define SM_CAP_CVOLUME_JOIN (1<<8)
+#define SM_CAP_CSWITCH (1<<9)
+#define SM_CAP_CSWITCH_JOIN (1<<10)
+#define SM_CAP_CSWITCH_EXCL (1<<11)
+#define SM_CAP_PENUM (1<<12)
+#define SM_CAP_CENUM (1<<13)
+/* SM_CAP_* 24-31 => private for module use */
+
+#define SM_OPS_IS_ACTIVE 0
+#define SM_OPS_IS_MONO 1
+#define SM_OPS_IS_CHANNEL 2
+#define SM_OPS_IS_ENUMERATED 3
+#define SM_OPS_IS_ENUMCNT 4
+
+#define sm_selem(x) ((sm_selem_t *)((x)->private_data))
+#define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
+
+typedef struct _sm_selem {
+ snd_mixer_selem_id_t *id;
+ struct sm_elem_ops *ops;
+ unsigned int caps;
+ unsigned int capture_group;
+} sm_selem_t;
+
+typedef struct _sm_class_basic {
+ char *device;
+ snd_ctl_t *ctl;
+ snd_hctl_t *hctl;
+ snd_ctl_card_info_t *info;
+} sm_class_basic_t;
+
+struct sm_elem_ops {
+ int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
+ int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
+ int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);
+ int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
+ int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue);
+ int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir);
+ int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
+ int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
+ int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value);
+ int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir);
+ int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value);
+ int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value);
+ int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf);
+ int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp);
+ int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item);
+};
+
+int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
+
+int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info);
+void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
+void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
+void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_MIXER_ABST_H */
+
diff --git a/alsa-lib/include/output.h b/alsa-lib/include/output.h
new file mode 100644
index 0000000..5279aa2
--- /dev/null
+++ b/alsa-lib/include/output.h
@@ -0,0 +1,86 @@
+/**
+ * \file include/output.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_OUTPUT_H
+#define __ALSA_OUTPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Output Output Interface
+ *
+ * The output functions present an interface similar to the stdio functions
+ * on top of different underlying output destinations.
+ *
+ * Many PCM debugging functions (\c snd_pcm_xxx_dump_xxx) use such an output
+ * handle to be able to write not only to the screen but also to other
+ * destinations, e.g. to files or to memory buffers.
+ *
+ * \{
+ */
+
+/**
+ * \brief Internal structure for an output object.
+ *
+ * The ALSA library uses a pointer to this structure as a handle to an
+ * output object. Applications don't access its contents directly.
+ */
+typedef struct _snd_output snd_output_t;
+
+/** Output type. */
+typedef enum _snd_output_type {
+ /** Output to a stdio stream. */
+ SND_OUTPUT_STDIO,
+ /** Output to a memory buffer. */
+ SND_OUTPUT_BUFFER
+} snd_output_type_t;
+
+int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode);
+int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close);
+int snd_output_buffer_open(snd_output_t **outputp);
+size_t snd_output_buffer_string(snd_output_t *output, char **buf);
+int snd_output_close(snd_output_t *output);
+int snd_output_printf(snd_output_t *output, const char *format, ...)
+#ifndef DOC_HIDDEN
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
+int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
+int snd_output_puts(snd_output_t *output, const char *str);
+int snd_output_putc(snd_output_t *output, int c);
+int snd_output_flush(snd_output_t *output);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_OUTPUT_H */
+
diff --git a/alsa-lib/include/pcm.h b/alsa-lib/include/pcm.h
new file mode 100644
index 0000000..15e9cb2
--- /dev/null
+++ b/alsa-lib/include/pcm.h
@@ -0,0 +1,1140 @@
+/**
+ * \file include/pcm.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver.
+ * See the \ref pcm page for more details.
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_H
+#define __ALSA_PCM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup PCM PCM Interface
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_PCM_DLSYM_VERSION _dlsym_pcm_001
+
+/** PCM generic info container */
+typedef struct _snd_pcm_info snd_pcm_info_t;
+/** PCM hardware configuration space container */
+typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
+/** PCM software configuration container */
+typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
+/** PCM status container */
+ typedef struct _snd_pcm_status snd_pcm_status_t;
+/** PCM access types mask */
+typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;
+/** PCM formats mask */
+typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;
+/** PCM subformats mask */
+typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;
+
+/** PCM class */
+typedef enum _snd_pcm_class {
+ /** standard device */
+
+ SND_PCM_CLASS_GENERIC = 0,
+ /** multichannel device */
+ SND_PCM_CLASS_MULTI,
+ /** software modem device */
+ SND_PCM_CLASS_MODEM,
+ /** digitizer device */
+ SND_PCM_CLASS_DIGITIZER,
+ SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
+} snd_pcm_class_t;
+
+/** PCM subclass */
+typedef enum _snd_pcm_subclass {
+ /** subdevices are mixed together */
+ SND_PCM_SUBCLASS_GENERIC_MIX = 0,
+ /** multichannel subdevices are mixed together */
+ SND_PCM_SUBCLASS_MULTI_MIX,
+ SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX
+} snd_pcm_subclass_t;
+
+/** PCM stream (direction) */
+typedef enum _snd_pcm_stream {
+ /** Playback stream */
+ SND_PCM_STREAM_PLAYBACK = 0,
+ /** Capture stream */
+ SND_PCM_STREAM_CAPTURE,
+ SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE
+} snd_pcm_stream_t;
+
+/** PCM access type */
+typedef enum _snd_pcm_access {
+ /** mmap access with simple interleaved channels */
+ SND_PCM_ACCESS_MMAP_INTERLEAVED = 0,
+ /** mmap access with simple non interleaved channels */
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
+ /** mmap access with complex placement */
+ SND_PCM_ACCESS_MMAP_COMPLEX,
+ /** snd_pcm_readi/snd_pcm_writei access */
+ SND_PCM_ACCESS_RW_INTERLEAVED,
+ /** snd_pcm_readn/snd_pcm_writen access */
+ SND_PCM_ACCESS_RW_NONINTERLEAVED,
+ SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
+} snd_pcm_access_t;
+
+/** PCM sample format */
+typedef enum _snd_pcm_format {
+ /** Unknown */
+ SND_PCM_FORMAT_UNKNOWN = -1,
+ /** Signed 8 bit */
+ SND_PCM_FORMAT_S8 = 0,
+ /** Unsigned 8 bit */
+ SND_PCM_FORMAT_U8,
+ /** Signed 16 bit Little Endian */
+ SND_PCM_FORMAT_S16_LE,
+ /** Signed 16 bit Big Endian */
+ SND_PCM_FORMAT_S16_BE,
+ /** Unsigned 16 bit Little Endian */
+ SND_PCM_FORMAT_U16_LE,
+ /** Unsigned 16 bit Big Endian */
+ SND_PCM_FORMAT_U16_BE,
+ /** Signed 24 bit Little Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_S24_LE,
+ /** Signed 24 bit Big Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_S24_BE,
+ /** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_U24_LE,
+ /** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
+ SND_PCM_FORMAT_U24_BE,
+ /** Signed 32 bit Little Endian */
+ SND_PCM_FORMAT_S32_LE,
+ /** Signed 32 bit Big Endian */
+ SND_PCM_FORMAT_S32_BE,
+ /** Unsigned 32 bit Little Endian */
+ SND_PCM_FORMAT_U32_LE,
+ /** Unsigned 32 bit Big Endian */
+ SND_PCM_FORMAT_U32_BE,
+ /** Float 32 bit Little Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT_LE,
+ /** Float 32 bit Big Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT_BE,
+ /** Float 64 bit Little Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT64_LE,
+ /** Float 64 bit Big Endian, Range -1.0 to 1.0 */
+ SND_PCM_FORMAT_FLOAT64_BE,
+ /** IEC-958 Little Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
+ /** IEC-958 Big Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
+ /** Mu-Law */
+ SND_PCM_FORMAT_MU_LAW,
+ /** A-Law */
+ SND_PCM_FORMAT_A_LAW,
+ /** Ima-ADPCM */
+ SND_PCM_FORMAT_IMA_ADPCM,
+ /** MPEG */
+ SND_PCM_FORMAT_MPEG,
+ /** GSM */
+ SND_PCM_FORMAT_GSM,
+ /** Special */
+ SND_PCM_FORMAT_SPECIAL = 31,
+ /** Signed 24bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S24_3LE = 32,
+ /** Signed 24bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S24_3BE,
+ /** Unsigned 24bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U24_3LE,
+ /** Unsigned 24bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U24_3BE,
+ /** Signed 20bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S20_3LE,
+ /** Signed 20bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S20_3BE,
+ /** Unsigned 20bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U20_3LE,
+ /** Unsigned 20bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U20_3BE,
+ /** Signed 18bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_S18_3LE,
+ /** Signed 18bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_S18_3BE,
+ /** Unsigned 18bit Little Endian in 3bytes format */
+ SND_PCM_FORMAT_U18_3LE,
+ /** Unsigned 18bit Big Endian in 3bytes format */
+ SND_PCM_FORMAT_U18_3BE,
+ SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE,
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /** Signed 16 bit CPU endian */
+ SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,
+ /** Unsigned 16 bit CPU endian */
+ SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,
+ /** Signed 24 bit CPU endian */
+ SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,
+ /** Unsigned 24 bit CPU endian */
+ SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
+ /** Signed 32 bit CPU endian */
+ SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,
+ /** Unsigned 32 bit CPU endian */
+ SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,
+ /** Float 32 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,
+ /** Float 64 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
+ /** IEC-958 CPU Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ /** Signed 16 bit CPU endian */
+ SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,
+ /** Unsigned 16 bit CPU endian */
+ SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,
+ /** Signed 24 bit CPU endian */
+ SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,
+ /** Unsigned 24 bit CPU endian */
+ SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,
+ /** Signed 32 bit CPU endian */
+ SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,
+ /** Unsigned 32 bit CPU endian */
+ SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,
+ /** Float 32 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,
+ /** Float 64 bit CPU endian */
+ SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,
+ /** IEC-958 CPU Endian */
+ SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE
+#else
+#error "Unknown endian"
+#endif
+} snd_pcm_format_t;
+
+/** PCM sample subformat */
+typedef enum _snd_pcm_subformat {
+ /** Standard */
+ SND_PCM_SUBFORMAT_STD = 0,
+ SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
+} snd_pcm_subformat_t;
+
+/** PCM state */
+typedef enum _snd_pcm_state {
+ /** Open */
+ SND_PCM_STATE_OPEN = 0,
+ /** Setup installed */
+ SND_PCM_STATE_SETUP,
+ /** Ready to start */
+ SND_PCM_STATE_PREPARED,
+ /** Running */
+ SND_PCM_STATE_RUNNING,
+ /** Stopped: underrun (playback) or overrun (capture) detected */
+ SND_PCM_STATE_XRUN,
+ /** Draining: running (playback) or stopped (capture) */
+ SND_PCM_STATE_DRAINING,
+ /** Paused */
+ SND_PCM_STATE_PAUSED,
+ /** Hardware is suspended */
+ SND_PCM_STATE_SUSPENDED,
+ /** Hardware is disconnected */
+ SND_PCM_STATE_DISCONNECTED,
+ SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
+} snd_pcm_state_t;
+
+/** PCM start mode */
+typedef enum _snd_pcm_start {
+ /** Automatic start on data read/write */
+ SND_PCM_START_DATA = 0,
+ /** Explicit start */
+ SND_PCM_START_EXPLICIT,
+ SND_PCM_START_LAST = SND_PCM_START_EXPLICIT
+} snd_pcm_start_t;
+
+/** PCM xrun mode */
+typedef enum _snd_pcm_xrun {
+ /** Xrun detection disabled */
+ SND_PCM_XRUN_NONE = 0,
+ /** Stop on xrun detection */
+ SND_PCM_XRUN_STOP,
+ SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP
+} snd_pcm_xrun_t;
+
+/** PCM timestamp mode */
+typedef enum _snd_pcm_tstamp {
+ /** No timestamp */
+ SND_PCM_TSTAMP_NONE = 0,
+ /** Update timestamp at every hardware position update */
+ SND_PCM_TSTAMP_ENABLE,
+ /** Equivalent with #SND_PCM_TSTAMP_ENABLE,
+ * just for compatibility with older versions
+ */
+ SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE,
+ SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
+} snd_pcm_tstamp_t;
+
+/** Unsigned frames quantity */
+typedef unsigned long snd_pcm_uframes_t;
+/** Signed frames quantity */
+typedef long snd_pcm_sframes_t;
+
+/** Non blocking mode (flag for open mode) \hideinitializer */
+#define SND_PCM_NONBLOCK 0x00000001
+/** Async notification (flag for open mode) \hideinitializer */
+#define SND_PCM_ASYNC 0x00000002
+/** Disable automatic (but not forced!) rate resamplinig */
+#define SND_PCM_NO_AUTO_RESAMPLE 0x00010000
+/** Disable automatic (but not forced!) channel conversion */
+#define SND_PCM_NO_AUTO_CHANNELS 0x00020000
+/** Disable automatic (but not forced!) format conversion */
+#define SND_PCM_NO_AUTO_FORMAT 0x00040000
+/** Disable soft volume control */
+#define SND_PCM_NO_SOFTVOL 0x00080000
+
+/** PCM handle */
+typedef struct _snd_pcm snd_pcm_t;
+
+/** PCM type */
+enum _snd_pcm_type {
+ /** Kernel level PCM */
+ SND_PCM_TYPE_HW = 0,
+ /** Hooked PCM */
+ SND_PCM_TYPE_HOOKS,
+ /** One or more linked PCM with exclusive access to selected
+ channels */
+ SND_PCM_TYPE_MULTI,
+ /** File writing plugin */
+ SND_PCM_TYPE_FILE,
+ /** Null endpoint PCM */
+ SND_PCM_TYPE_NULL,
+ /** Shared memory client PCM */
+ SND_PCM_TYPE_SHM,
+ /** INET client PCM (not yet implemented) */
+ SND_PCM_TYPE_INET,
+ /** Copying plugin */
+ SND_PCM_TYPE_COPY,
+ /** Linear format conversion PCM */
+ SND_PCM_TYPE_LINEAR,
+ /** A-Law format conversion PCM */
+ SND_PCM_TYPE_ALAW,
+ /** Mu-Law format conversion PCM */
+ SND_PCM_TYPE_MULAW,
+ /** IMA-ADPCM format conversion PCM */
+ SND_PCM_TYPE_ADPCM,
+ /** Rate conversion PCM */
+ SND_PCM_TYPE_RATE,
+ /** Attenuated static route PCM */
+ SND_PCM_TYPE_ROUTE,
+ /** Format adjusted PCM */
+ SND_PCM_TYPE_PLUG,
+ /** Sharing PCM */
+ SND_PCM_TYPE_SHARE,
+ /** Meter plugin */
+ SND_PCM_TYPE_METER,
+ /** Mixing PCM */
+ SND_PCM_TYPE_MIX,
+ /** Attenuated dynamic route PCM (not yet implemented) */
+ SND_PCM_TYPE_DROUTE,
+ /** Loopback server plugin (not yet implemented) */
+ SND_PCM_TYPE_LBSERVER,
+ /** Linear Integer <-> Linear Float format conversion PCM */
+ SND_PCM_TYPE_LINEAR_FLOAT,
+ /** LADSPA integration plugin */
+ SND_PCM_TYPE_LADSPA,
+ /** Direct Mixing plugin */
+ SND_PCM_TYPE_DMIX,
+ /** Jack Audio Connection Kit plugin */
+ SND_PCM_TYPE_JACK,
+ /** Direct Snooping plugin */
+ SND_PCM_TYPE_DSNOOP,
+ /** Direct Sharing plugin */
+ SND_PCM_TYPE_DSHARE,
+ /** IEC958 subframe plugin */
+ SND_PCM_TYPE_IEC958,
+ /** Soft volume plugin */
+ SND_PCM_TYPE_SOFTVOL,
+ /** External I/O plugin */
+ SND_PCM_TYPE_IOPLUG,
+ /** External filter plugin */
+ SND_PCM_TYPE_EXTPLUG,
+ /** Mmap-emulation plugin */
+ SND_PCM_TYPE_MMAP_EMUL,
+ SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL
+};
+
+/** PCM type */
+typedef enum _snd_pcm_type snd_pcm_type_t;
+
+/** PCM area specification */
+typedef struct _snd_pcm_channel_area {
+ /** base address of channel samples */
+ void *addr;
+ /** offset to first sample in bits */
+ unsigned int first;
+ /** samples distance in bits */
+ unsigned int step;
+} snd_pcm_channel_area_t;
+
+/** PCM synchronization ID */
+typedef union _snd_pcm_sync_id {
+ /** 8-bit ID */
+ unsigned char id[16];
+ /** 16-bit ID */
+ unsigned short id16[8];
+ /** 32-bit ID */
+ unsigned int id32[4];
+} snd_pcm_sync_id_t;
+
+/** #SND_PCM_TYPE_METER scope handle */
+typedef struct _snd_pcm_scope snd_pcm_scope_t;
+
+int snd_pcm_open(snd_pcm_t **pcm, const char *name,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name,
+ snd_pcm_stream_t stream, int mode,
+ snd_config_t *lconf);
+
+int snd_pcm_close(snd_pcm_t *pcm);
+const char *snd_pcm_name(snd_pcm_t *pcm);
+snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
+snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);
+int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);
+int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
+int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
+int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
+ snd_async_callback_t callback, void *private_data);
+snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);
+int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);
+int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_free(snd_pcm_t *pcm);
+int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+int snd_pcm_prepare(snd_pcm_t *pcm);
+int snd_pcm_reset(snd_pcm_t *pcm);
+int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
+int snd_pcm_start(snd_pcm_t *pcm);
+int snd_pcm_drop(snd_pcm_t *pcm);
+int snd_pcm_drain(snd_pcm_t *pcm);
+int snd_pcm_pause(snd_pcm_t *pcm, int enable);
+snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm);
+int snd_pcm_hwsync(snd_pcm_t *pcm);
+int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
+int snd_pcm_resume(snd_pcm_t *pcm);
+int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
+snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
+int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp);
+snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
+
+int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
+int snd_pcm_unlink(snd_pcm_t *pcm);
+
+//int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem);
+
+/*
+ * application helpers - these functions are implemented on top
+ * of the basic API
+ */
+
+int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
+int snd_pcm_set_params(snd_pcm_t *pcm,
+ snd_pcm_format_t format,
+ snd_pcm_access_t access,
+ unsigned int channels,
+ unsigned int rate,
+ int soft_resample,
+ unsigned int latency);
+int snd_pcm_get_params(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Info Stream Information
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info)
+int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
+void snd_pcm_info_free(snd_pcm_info_t *obj);
+void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
+unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
+snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
+int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);
+const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
+snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);
+snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
+unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
+snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj);
+void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
+void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
+void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_HW_Params Hardware Parameters
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_forward(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_rewind(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
+ unsigned int *rate_num,
+ unsigned int *rate_den);
+int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);
+
+#if 0
+typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
+
+/* choices need to be sorted on ascending badness */
+typedef struct _snd_pcm_hw_strategy_simple_choices_list {
+ unsigned int value;
+ unsigned int badness;
+} snd_pcm_hw_strategy_simple_choices_list_t;
+
+int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_strategy_t *strategy,
+ unsigned int badness_min,
+ unsigned int badness_max);
+
+void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);
+int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
+ unsigned int badness_min,
+ unsigned int badness_max);
+int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *fail,
+ snd_pcm_hw_params_t *success,
+ unsigned int depth,
+ snd_output_t *out);
+
+#endif
+
+size_t snd_pcm_hw_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
+int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);
+void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);
+void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
+
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
+
+int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);
+int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+
+int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val);
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+
+int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+
+int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
+int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
+int snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
+int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
+
+int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_SW_Params Software Parameters
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_sw_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params)
+int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
+void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
+void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
+int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
+
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
+int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val);
+int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val);
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
+
+/** \} */
+
+/* include old API */
+#ifndef ALSA_LIBRARY_BUILD
+#if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API)
+#include "pcm_old.h"
+#endif
+#endif
+
+/**
+ * \defgroup PCM_Access Access Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_access_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_access_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask)
+int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);
+void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);
+void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);
+void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask);
+void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask);
+int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask);
+void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Format Format Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_format_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_format_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask)
+int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
+void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
+void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
+void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask);
+void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask);
+int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask);
+void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_SubFormat Subformat Mask Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_subformat_mask_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask)
+int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);
+void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);
+void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);
+void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask);
+void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask);
+int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask);
+void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Status Status Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+size_t snd_pcm_status_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_pcm_status_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status)
+int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
+void snd_pcm_status_free(snd_pcm_status_t *obj);
+void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
+snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
+void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
+void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);
+snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
+snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Description Description Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+const char *snd_pcm_type_name(snd_pcm_type_t type);
+const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);
+const char *snd_pcm_access_name(const snd_pcm_access_t _access);
+const char *snd_pcm_format_name(const snd_pcm_format_t format);
+const char *snd_pcm_format_description(const snd_pcm_format_t format);
+const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
+const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
+snd_pcm_format_t snd_pcm_format_value(const char* name);
+const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
+const char *snd_pcm_state_name(const snd_pcm_state_t state);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Dump Debug Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);
+int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);
+int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);
+int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Direct Direct Access (MMAP) Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_mmap_begin(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t **areas,
+ snd_pcm_uframes_t *offset,
+ snd_pcm_uframes_t *frames);
+snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Helpers Helper Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+int snd_pcm_format_signed(snd_pcm_format_t format);
+int snd_pcm_format_unsigned(snd_pcm_format_t format);
+int snd_pcm_format_linear(snd_pcm_format_t format);
+int snd_pcm_format_float(snd_pcm_format_t format);
+int snd_pcm_format_little_endian(snd_pcm_format_t format);
+int snd_pcm_format_big_endian(snd_pcm_format_t format);
+int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
+int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
+int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
+snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
+ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
+u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
+u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
+u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
+u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
+int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
+
+snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
+ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
+long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);
+ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);
+
+int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
+ unsigned int samples, snd_pcm_format_t format);
+int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
+int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
+ unsigned int samples, snd_pcm_format_t format);
+int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Hook Hook Extension
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** type of pcm hook */
+typedef enum _snd_pcm_hook_type {
+ SND_PCM_HOOK_TYPE_HW_PARAMS = 0,
+ SND_PCM_HOOK_TYPE_HW_FREE,
+ SND_PCM_HOOK_TYPE_CLOSE,
+ SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE
+} snd_pcm_hook_type_t;
+
+/** PCM hook container */
+typedef struct _snd_pcm_hook snd_pcm_hook_t;
+/** PCM hook callback function */
+typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);
+snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook);
+void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook);
+void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);
+int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,
+ snd_pcm_hook_type_t type,
+ snd_pcm_hook_func_t func, void *private_data);
+int snd_pcm_hook_remove(snd_pcm_hook_t *hook);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Scope Scope Plugin Extension
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** #SND_PCM_TYPE_METER scope functions */
+typedef struct _snd_pcm_scope_ops {
+ /** \brief Enable and prepare it using current params
+ * \param scope scope handle
+ */
+ int (*enable)(snd_pcm_scope_t *scope);
+ /** \brief Disable
+ * \param scope scope handle
+ */
+ void (*disable)(snd_pcm_scope_t *scope);
+ /** \brief PCM has been started
+ * \param scope scope handle
+ */
+ void (*start)(snd_pcm_scope_t *scope);
+ /** \brief PCM has been stopped
+ * \param scope scope handle
+ */
+ void (*stop)(snd_pcm_scope_t *scope);
+ /** \brief New frames are present
+ * \param scope scope handle
+ */
+ void (*update)(snd_pcm_scope_t *scope);
+ /** \brief Reset status
+ * \param scope scope handle
+ */
+ void (*reset)(snd_pcm_scope_t *scope);
+ /** \brief PCM is closing
+ * \param scope scope handle
+ */
+ void (*close)(snd_pcm_scope_t *scope);
+} snd_pcm_scope_ops_t;
+
+snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);
+unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);
+unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);
+snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);
+snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);
+int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);
+snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
+int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val);
+void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
+const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
+void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);
+void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);
+int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
+ snd_pcm_scope_t **scopep);
+int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
+ unsigned int channel);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Simple Simple setup functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** Simple PCM latency type */
+typedef enum _snd_spcm_latency {
+ /** standard latency - for standard playback or capture
+ (estimated latency in one direction 350ms) */
+ SND_SPCM_LATENCY_STANDARD = 0,
+ /** medium latency - software phones etc.
+ (estimated latency in one direction maximally 25ms */
+ SND_SPCM_LATENCY_MEDIUM,
+ /** realtime latency - realtime applications (effect processors etc.)
+ (estimated latency in one direction 5ms and better) */
+ SND_SPCM_LATENCY_REALTIME
+} snd_spcm_latency_t;
+
+/** Simple PCM xrun type */
+typedef enum _snd_spcm_xrun_type {
+ /** driver / library will ignore all xruns, the stream runs forever */
+ SND_SPCM_XRUN_IGNORE = 0,
+ /** driver / library stops the stream when an xrun occurs */
+ SND_SPCM_XRUN_STOP
+} snd_spcm_xrun_type_t;
+
+/** Simple PCM duplex type */
+typedef enum _snd_spcm_duplex_type {
+ /** liberal duplex - the buffer and period sizes might not match */
+ SND_SPCM_DUPLEX_LIBERAL = 0,
+ /** pedantic duplex - the buffer and period sizes MUST match */
+ SND_SPCM_DUPLEX_PEDANTIC
+} snd_spcm_duplex_type_t;
+
+int snd_spcm_init(snd_pcm_t *pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t _access,
+ snd_spcm_xrun_type_t xrun_type);
+
+int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
+ snd_pcm_t *capture_pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t _access,
+ snd_spcm_xrun_type_t xrun_type,
+ snd_spcm_duplex_type_t duplex_type);
+
+int snd_spcm_init_get_params(snd_pcm_t *pcm,
+ unsigned int *rate,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size);
+
+/** \} */
+
+/**
+ * \defgroup PCM_Deprecated Deprecated Functions
+ * \ingroup PCM
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/* Deprecated functions, for compatibility */
+const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated));
+const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated));
+int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val) __attribute__((deprecated));
+snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated));
+snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated));
+int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated));
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
+#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
+#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_H */
diff --git a/alsa-lib/include/pcm_external.h b/alsa-lib/include/pcm_external.h
new file mode 100644
index 0000000..5750418
--- /dev/null
+++ b/alsa-lib/include/pcm_external.h
@@ -0,0 +1,70 @@
+/**
+ * \file include/pcm_external.h
+ * \brief External PCM plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * Extern PCM plugin SDK.
+ */
+
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __ALSA_PCM_EXTERNAL_H
+#define __ALSA_PCM_EXTERNAL_H
+
+#include "pcm.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Plugin_SDK External PCM plugin SDK
+ * \{
+ */
+
+/**
+ * Define the object entry for external PCM plugins
+ */
+#define SND_PCM_PLUGIN_ENTRY(name) _snd_pcm_##name##_open
+
+/**
+ * Define the symbols of the given plugin with versions
+ */
+#define SND_PCM_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_PCM_PLUGIN_ENTRY(name), SND_PCM_DLSYM_VERSION);
+
+/**
+ * Define the plugin
+ */
+#define SND_PCM_PLUGIN_DEFINE_FUNC(plugin) \
+int SND_PCM_PLUGIN_ENTRY(plugin) (snd_pcm_t **pcmp, const char *name,\
+ snd_config_t *root, snd_config_t *conf, \
+ snd_pcm_stream_t stream, int mode)
+
+#include "pcm_ioplug.h"
+#include "pcm_extplug.h"
+
+int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
+ int *cchannelsp, int *hwctlp);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_EXTERNAL_H */
diff --git a/alsa-lib/include/pcm_extplug.h b/alsa-lib/include/pcm_extplug.h
new file mode 100644
index 0000000..b14c5be
--- /dev/null
+++ b/alsa-lib/include/pcm_extplug.h
@@ -0,0 +1,189 @@
+/**
+ * \file include/pcm_extplug.h
+ * \brief External Filter-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External Filter-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM plugin SDK (draft version)
+ *
+ * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_EXTPLUG_H
+#define __ALSA_PCM_EXTPLUG_H
+
+/**
+ * \defgroup PCM_ExtPlug External Filter plugin SDK
+ * \ingroup Plugin_SDK
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** hw constraints for extplug */
+enum {
+ SND_PCM_EXTPLUG_HW_FORMAT, /**< format */
+ SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */
+ SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */
+};
+
+/** Handle of external filter plugin */
+typedef struct snd_pcm_extplug snd_pcm_extplug_t;
+/** Callback table of extplug */
+typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
+
+/*
+ * Protocol version
+ */
+#define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_PCM_EXTPLUG_VERSION_TINY 1 /**< Protocol tiny version */
+/**
+ * Filter-plugin protocol version
+ */
+#define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
+ (SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
+ (SND_PCM_EXTPLUG_VERSION_TINY))
+
+/** Handle of extplug */
+struct snd_pcm_extplug {
+ /**
+ * protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here
+ * before calling #snd_pcm_extplug_create()
+ */
+ unsigned int version;
+ /**
+ * name of this plugin; must be filled before calling #snd_pcm_extplug_create()
+ */
+ const char *name;
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create()
+ */
+ const snd_pcm_extplug_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * PCM handle filled by #snd_pcm_extplug_create()
+ */
+ snd_pcm_t *pcm;
+ /**
+ * stream direction; read-only status
+ */
+ snd_pcm_stream_t stream;
+ /**
+ * format hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_format_t format;
+ /**
+ * subformat hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_subformat_t subformat;
+ /**
+ * channels hw parameter; filled after hw_params is caled
+ */
+ unsigned int channels;
+ /**
+ * rate hw parameter; filled after hw_params is caled
+ */
+ unsigned int rate;
+ /**
+ * slave_format hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_format_t slave_format;
+ /**
+ * slave_subformat hw parameter; filled after hw_params is caled
+ */
+ snd_pcm_subformat_t slave_subformat;
+ /**
+ * slave_channels hw parameter; filled after hw_params is caled
+ */
+ unsigned int slave_channels;
+};
+
+/** Callback table of extplug */
+struct snd_pcm_extplug_callback {
+ /**
+ * transfer between source and destination; this is a required callback
+ */
+ snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ snd_pcm_uframes_t size);
+ /**
+ * close the PCM; optional
+ */
+ int (*close)(snd_pcm_extplug_t *ext);
+ /**
+ * hw_params; optional
+ */
+ int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
+ /**
+ * hw_free; optional
+ */
+ int (*hw_free)(snd_pcm_extplug_t *ext);
+ /**
+ * dump; optional
+ */
+ void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
+ /**
+ * init; optional initialization called at prepare or reset
+ */
+ int (*init)(snd_pcm_extplug_t *ext);
+};
+
+
+int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
+ snd_config_t *root, snd_config_t *slave_conf,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
+
+/* clear hw_parameter setting */
+void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
+
+/* hw_parameter setting */
+int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
+int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
+int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
+int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
+
+/**
+ * set the parameter constraint with a single value
+ */
+static inline int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
+{
+ return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
+}
+
+/**
+ * set the parameter constraint for slave PCM with a single value
+ */
+static inline int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
+{
+ return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
+}
+
+/** \} */
+
+#endif /* __ALSA_PCM_EXTPLUG_H */
diff --git a/alsa-lib/include/pcm_ioplug.h b/alsa-lib/include/pcm_ioplug.h
new file mode 100644
index 0000000..b5968f1
--- /dev/null
+++ b/alsa-lib/include/pcm_ioplug.h
@@ -0,0 +1,217 @@
+/**
+ * \file include/pcm_ioplug.h
+ * \brief External I/O-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ *
+ * External I/O-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM plugin SDK
+ *
+ * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_IOPLUG_H
+#define __ALSA_PCM_IOPLUG_H
+
+/**
+ * \defgroup PCM_IOPlug External I/O plugin SDK
+ * \ingroup Plugin_SDK
+ * See the \ref pcm page for more details.
+ * \{
+ */
+
+/** hw constraints for ioplug */
+enum {
+ SND_PCM_IOPLUG_HW_ACCESS = 0, /**< access type */
+ SND_PCM_IOPLUG_HW_FORMAT, /**< format */
+ SND_PCM_IOPLUG_HW_CHANNELS, /**< channels */
+ SND_PCM_IOPLUG_HW_RATE, /**< rate */
+ SND_PCM_IOPLUG_HW_PERIOD_BYTES, /**< period bytes */
+ SND_PCM_IOPLUG_HW_BUFFER_BYTES, /**< buffer bytes */
+ SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */
+ SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */
+};
+
+/** I/O plugin handle */
+typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
+/** Callback table of ioplug */
+typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
+
+/**
+ * bit flags for additional conditions
+ */
+#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0) /* list up this PCM */
+#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1) /* monotonic timestamps */
+
+/*
+ * Protocol version
+ */
+#define SND_PCM_IOPLUG_VERSION_MAJOR 1 /**< Protocol major version */
+#define SND_PCM_IOPLUG_VERSION_MINOR 0 /**< Protocol minor version */
+#define SND_PCM_IOPLUG_VERSION_TINY 1 /**< Protocol tiny version */
+/**
+ * IO-plugin protocol version
+ */
+#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
+ (SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
+ (SND_PCM_IOPLUG_VERSION_TINY))
+
+/** Handle of ioplug */
+struct snd_pcm_ioplug {
+ /**
+ * protocol version; #SND_PCM_IOPLUG_VERSION must be filled here
+ * before calling #snd_pcm_ioplug_create()
+ */
+ unsigned int version;
+ /**
+ * name of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const char *name;
+ unsigned int flags; /**< SND_PCM_IOPLUG_FLAG_XXX */
+ int poll_fd; /**< poll file descriptor */
+ unsigned int poll_events; /**< poll events */
+ unsigned int mmap_rw; /**< pseudo mmap mode */
+ /**
+ * callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
+ */
+ const snd_pcm_ioplug_callback_t *callback;
+ /**
+ * private data, which can be used freely in the driver callbacks
+ */
+ void *private_data;
+ /**
+ * PCM handle filled by #snd_pcm_extplug_create()
+ */
+ snd_pcm_t *pcm;
+
+ snd_pcm_stream_t stream; /**< stream direcion; read-only */
+ snd_pcm_state_t state; /**< current PCM state; read-only */
+ volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */
+ volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */
+ int nonblock; /**< non-block mode; read-only */
+
+ snd_pcm_access_t access; /**< access type; filled after hw_params is called */
+ snd_pcm_format_t format; /**< PCM format; filled after hw_params is called */
+ unsigned int channels; /**< number of channels; filled after hw_params is called */
+ unsigned int rate; /**< rate; filled after hw_params is called */
+ snd_pcm_uframes_t period_size; /**< period size; filled after hw_params is called */
+ snd_pcm_uframes_t buffer_size; /**< buffer size; filled after hw_params is called */
+};
+
+/** Callback table of ioplug */
+struct snd_pcm_ioplug_callback {
+ /**
+ * start the PCM; required
+ */
+ int (*start)(snd_pcm_ioplug_t *io);
+ /**
+ * stop the PCM; required
+ */
+ int (*stop)(snd_pcm_ioplug_t *io);
+ /**
+ * get the current DMA position; required
+ */
+ snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
+ /**
+ * transfer the data; optional
+ */
+ snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+ /**
+ * close the PCM; optional
+ */
+ int (*close)(snd_pcm_ioplug_t *io);
+ /**
+ * hw_params; optional
+ */
+ int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
+ /**
+ * hw_free; optional
+ */
+ int (*hw_free)(snd_pcm_ioplug_t *io);
+ /**
+ * sw_params; optional
+ */
+ int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
+ /**
+ * prepare; optional
+ */
+ int (*prepare)(snd_pcm_ioplug_t *io);
+ /**
+ * drain; optional
+ */
+ int (*drain)(snd_pcm_ioplug_t *io);
+ /**
+ * toggle pause; optional
+ */
+ int (*pause)(snd_pcm_ioplug_t *io, int enable);
+ /**
+ * resume; optional
+ */
+ int (*resume)(snd_pcm_ioplug_t *io);
+ /**
+ * poll descriptors count; optional
+ */
+ int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
+ /**
+ * poll descriptors; optional
+ */
+ int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
+ /**
+ * mangle poll events; optional
+ */
+ int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
+ /**
+ * dump; optional
+ */
+ void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
+ /**
+ * get the delay for the running PCM; optional
+ */
+ int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
+};
+
+
+int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
+
+/* update poll_fd and mmap_rw */
+int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
+
+/* get a mmap area (for mmap_rw only) */
+const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
+
+/* clear hw_parameter setting */
+void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
+
+/* hw_parameter setting */
+int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
+int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
+
+/* change PCM status */
+int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
+
+/** \} */
+
+#endif /* __ALSA_PCM_IOPLUG_H */
diff --git a/alsa-lib/include/pcm_old.h b/alsa-lib/include/pcm_old.h
new file mode 100644
index 0000000..f0de4c3
--- /dev/null
+++ b/alsa-lib/include/pcm_old.h
@@ -0,0 +1,230 @@
+/*
+ * Old ALSA 0.9.x API
+ */
+
+#ifdef ALSA_PCM_OLD_HW_PARAMS_API
+
+asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
+snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9");
+
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
+int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
+snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+
+asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
+unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9");
+
+snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9");
+
+snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9");
+asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9");
+
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
+unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
+
+#endif /* ALSA_PCM_OLD_HW_PARAMS_API */
+
+
+#ifdef ALSA_PCM_OLD_SW_PARAMS_API
+
+asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_set_stop_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9");
+asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9");
+
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
+snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
+unsigned int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params);
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
+
+#endif /* ALSA_PCM_OLD_SW_PARAMS_API */
diff --git a/alsa-lib/include/pcm_plugin.h b/alsa-lib/include/pcm_plugin.h
new file mode 100644
index 0000000..eea1d82
--- /dev/null
+++ b/alsa-lib/include/pcm_plugin.h
@@ -0,0 +1,202 @@
+/**
+ * \file include/pcm_plugin.h
+ * \brief Common PCM plugin code
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ *
+ * Application interface library for the ALSA driver.
+ * See the \ref pcm_plugins page for more details.
+ *
+ * \warning Using of contents of this header file might be dangerous
+ * in the sense of compatibility reasons. The contents might be
+ * freely changed in future.
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_PLUGIN_H
+
+/**
+ * \defgroup PCM_Plugins PCM Plugins
+ * \ingroup PCM
+ * See the \ref pcm_plugins page for more details.
+ * \{
+ */
+
+#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
+#define SND_PCM_PLUGIN_RATE_MAX 192000 /**< maximal rate for the rate plugin */
+
+/* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
+#ifdef HAVE_SOFT_FLOAT
+#define SND_PCM_PLUGIN_ROUTE_FLOAT 0 /**< use integers for route plugin */
+#else
+#define SND_PCM_PLUGIN_ROUTE_FLOAT 1 /**< use floats for route plugin */
+#endif
+
+#define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
+
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+/** route ttable entry type */
+typedef float snd_pcm_route_ttable_entry_t;
+#define SND_PCM_PLUGIN_ROUTE_HALF 0.5 /**< half value */
+#define SND_PCM_PLUGIN_ROUTE_FULL 1.0 /**< full value */
+#else
+/** route ttable entry type */
+typedef int snd_pcm_route_ttable_entry_t;
+#define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2) /**< half value */
+#define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION /**< full value */
+#endif
+
+/*
+ * Hardware plugin
+ */
+int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ int card, int device, int subdevice,
+ snd_pcm_stream_t stream, int mode,
+ int mmap_emulation, int sync_ptr_ioctl);
+int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Copy plugin
+ */
+int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear conversion plugin
+ */
+int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->Float conversion plugin
+ */
+int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->mu-Law conversion plugin
+ */
+int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->a-Law conversion plugin
+ */
+int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Linear<->Ima-ADPCM conversion plugin
+ */
+int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, snd_pcm_t *slave,
+ int close_slave);
+int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Route plugin for linear formats
+ */
+int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_csize, unsigned int tt_ssize,
+ unsigned int *tt_cused, unsigned int *tt_sused,
+ int schannels);
+int snd_pcm_route_determine_ttable(snd_config_t *tt,
+ unsigned int *tt_csize,
+ unsigned int *tt_ssize);
+int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, int schannels,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_ssize,
+ unsigned int tt_cused, unsigned int tt_sused,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Rate plugin for linear formats
+ */
+int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, unsigned int srate,
+ const snd_config_t *converter,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Hooks plugin
+ */
+int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * LADSPA plugin
+ */
+int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ const char *ladspa_path,
+ unsigned int channels,
+ snd_config_t *ladspa_pplugins,
+ snd_config_t *ladspa_cplugins,
+ snd_pcm_t *slave, int close_slave);
+int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+/*
+ * Jack plugin
+ */
+int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *playback_conf,
+ snd_config_t *capture_conf,
+ snd_pcm_stream_t stream, int mode);
+int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode);
+
+
+/** \} */
+
+#endif /* __ALSA_PCM_PLUGIN_H */
diff --git a/alsa-lib/include/pcm_rate.h b/alsa-lib/include/pcm_rate.h
new file mode 100644
index 0000000..d211e09
--- /dev/null
+++ b/alsa-lib/include/pcm_rate.h
@@ -0,0 +1,117 @@
+/**
+ * \file include/pcm_rate.h
+ * \brief External Rate-Converter-Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2006
+ *
+ * External Rate-Converter-Plugin SDK
+ */
+
+/*
+ * ALSA external PCM rate-converter plugin SDK (draft version)
+ *
+ * Copyright (c) 2006 Takashi Iwai <tiwai@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_PCM_RATE_H
+#define __ALSA_PCM_RATE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Protocol version
+ */
+#define SND_PCM_RATE_PLUGIN_VERSION 0x010001
+
+/** hw_params information for a single side */
+typedef struct snd_pcm_rate_side_info {
+ snd_pcm_format_t format;
+ unsigned int rate;
+ snd_pcm_uframes_t buffer_size;
+ snd_pcm_uframes_t period_size;
+} snd_pcm_rate_side_info_t;
+
+/** hw_params information */
+typedef struct snd_pcm_rate_info {
+ struct snd_pcm_rate_side_info in;
+ struct snd_pcm_rate_side_info out;
+ unsigned int channels;
+} snd_pcm_rate_info_t;
+
+/** Callback table of rate-converter */
+typedef struct snd_pcm_rate_ops {
+ /**
+ * close the converter; optional
+ */
+ void (*close)(void *obj);
+ /**
+ * initialize the converter, called at hw_params
+ */
+ int (*init)(void *obj, snd_pcm_rate_info_t *info);
+ /**
+ * free the converter; optional
+ */
+ void (*free)(void *obj);
+ /**
+ * reset the converter, called at prepare; optional
+ */
+ void (*reset)(void *obj);
+ /**
+ * adjust the pitch, called at sw_params; optional
+ */
+ int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
+ /**
+ * convert the data
+ */
+ void (*convert)(void *obj,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames);
+ /**
+ * convert an s16 interleaved-data array; exclusive with convert
+ */
+ void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
+ const int16_t *src, unsigned int src_frames);
+ /**
+ * compute the frame size for input
+ */
+ snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
+ /**
+ * compute the frame size for output
+ */
+ snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
+} snd_pcm_rate_ops_t;
+
+/** open function type */
+typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,
+ snd_pcm_rate_ops_t *opsp);
+
+/**
+ * Define the object entry for external PCM rate-converter plugins
+ */
+#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_PCM_RATE_H */
diff --git a/alsa-lib/include/rawmidi.h b/alsa-lib/include/rawmidi.h
new file mode 100644
index 0000000..1d8fd56
--- /dev/null
+++ b/alsa-lib/include/rawmidi.h
@@ -0,0 +1,159 @@
+/**
+ * \file include/rawmidi.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_RAWMIDI_H
+#define __ALSA_RAWMIDI_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup RawMidi RawMidi Interface
+ * The RawMidi Interface. See \ref rawmidi page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
+
+/** RawMidi information container */
+typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
+/** RawMidi settings container */
+typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
+/** RawMidi status container */
+typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
+
+/** RawMidi stream (direction) */
+typedef enum _snd_rawmidi_stream {
+ /** Output stream */
+ SND_RAWMIDI_STREAM_OUTPUT = 0,
+ /** Input stream */
+ SND_RAWMIDI_STREAM_INPUT,
+ SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
+} snd_rawmidi_stream_t;
+
+/** Append (flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_APPEND 0x0001
+/** Non blocking mode (flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_NONBLOCK 0x0002
+/** Write sync mode (Flag to open mode) \hideinitializer */
+#define SND_RAWMIDI_SYNC 0x0004
+
+/** RawMidi handle */
+typedef struct _snd_rawmidi snd_rawmidi_t;
+
+/** RawMidi type */
+typedef enum _snd_rawmidi_type {
+ /** Kernel level RawMidi */
+ SND_RAWMIDI_TYPE_HW,
+ /** Shared memory client RawMidi (not yet implemented) */
+ SND_RAWMIDI_TYPE_SHM,
+ /** INET client RawMidi (not yet implemented) */
+ SND_RAWMIDI_TYPE_INET,
+ /** Virtual (sequencer) RawMidi */
+ SND_RAWMIDI_TYPE_VIRTUAL
+} snd_rawmidi_type_t;
+
+int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
+ const char *name, int mode);
+int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
+ const char *name, int mode, snd_config_t *lconf);
+int snd_rawmidi_close(snd_rawmidi_t *rmidi);
+int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
+int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
+int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
+int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
+size_t snd_rawmidi_info_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
+int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
+void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
+void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
+unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
+snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
+int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
+const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
+unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
+void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
+void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
+void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
+int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
+size_t snd_rawmidi_params_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
+int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
+void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
+void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
+int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
+size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
+size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
+int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
+int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
+int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
+size_t snd_rawmidi_status_sizeof(void);
+/** \hideinitializer
+ * \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
+ * \param ptr returned pointer
+ */
+#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
+int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
+void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
+void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
+void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
+size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
+size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
+int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
+int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
+int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
+ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
+ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
+const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
+snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
+snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __RAWMIDI_H */
+
diff --git a/alsa-lib/include/search.h b/alsa-lib/include/search.h
new file mode 100644
index 0000000..91e6210
--- /dev/null
+++ b/alsa-lib/include/search.h
@@ -0,0 +1,177 @@
+/* Declarations for System V style searching functions.
+ Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SEARCH_H
+#define _SEARCH_H 1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
+/* Prototype structure for a linked-list data structure.
+ This is the type used by the `insque' and `remque' functions. */
+
+# ifdef __USE_GNU
+struct qelem
+ {
+ struct qelem *q_forw;
+ struct qelem *q_back;
+ char q_data[1];
+ };
+# endif
+
+
+/* Insert ELEM into a doubly-linked list, after PREV. */
+extern void insque __P ((void *__elem, void *__prev));
+
+/* Unlink ELEM from the doubly-linked list that it is in. */
+extern void remque __P ((void *__elem));
+#endif
+
+
+/* For use with hsearch(3). */
+#ifndef __COMPAR_FN_T
+# define __COMPAR_FN_T
+typedef int (*__compar_fn_t) __PMT ((__const __ptr_t, __const __ptr_t));
+
+# ifdef __USE_GNU
+typedef __compar_fn_t comparison_fn_t;
+# endif
+#endif
+
+/* Action which shall be performed in the call the hsearch. */
+typedef enum
+ {
+ FIND,
+ ENTER
+ }
+ACTION;
+
+typedef struct entry
+ {
+ char *key;
+ void *data;
+ }
+ENTRY;
+
+/* Opaque type for internal use. */
+struct _ENTRY;
+
+/* Family of hash table handling functions. The functions also
+ have reentrant counterparts ending with _r. The non-reentrant
+ functions all work on a single internal hashing table. */
+
+/* Search for entry matching ITEM.key in internal hash table. If
+ ACTION is `FIND' return found entry or signal error by returning
+ NULL. If ACTION is `ENTER' replace existing data (if any) with
+ ITEM.data. */
+extern ENTRY *hsearch __P ((ENTRY __item, ACTION __action));
+
+/* Create a new hashing table which will at most contain NEL elements. */
+extern int hcreate __P ((size_t __nel));
+
+/* Destroy current internal hashing table. */
+extern void hdestroy __P ((void));
+
+#ifdef __USE_GNU
+/* Data type for reentrant functions. */
+struct hsearch_data
+ {
+ struct _ENTRY *table;
+ unsigned int size;
+ unsigned int filled;
+ };
+
+/* Reentrant versions which can handle multiple hashing tables at the
+ same time. */
+extern int hsearch_r __P ((ENTRY __item, ACTION __action, ENTRY **__retval,
+ struct hsearch_data *__htab));
+extern int hcreate_r __P ((size_t __nel, struct hsearch_data *__htab));
+extern void hdestroy_r __P ((struct hsearch_data *__htab));
+#endif
+
+
+/* The tsearch routines are very interesting. They make many
+ assumptions about the compiler. It assumes that the first field
+ in node must be the "key" field, which points to the datum.
+ Everything depends on that. */
+/* For tsearch */
+typedef enum
+{
+ preorder,
+ postorder,
+ endorder,
+ leaf
+}
+VISIT;
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP and insert a new element if not found. */
+extern void *tsearch __PMT ((__const void *__key, void **__rootp,
+ __compar_fn_t __compar));
+
+/* Search for an entry matching the given KEY in the tree pointed to
+ by *ROOTP. If no matching entry is available return NULL. */
+extern void *tfind __PMT ((__const void *__key, void *__const *__rootp,
+ __compar_fn_t __compar));
+
+/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
+extern void *tdelete __PMT ((__const void *__key, void **__rootp,
+ __compar_fn_t __compar));
+
+#ifndef __ACTION_FN_T
+# define __ACTION_FN_T
+typedef void (*__action_fn_t) __PMT ((__const void *__nodep,
+ VISIT __value,
+ int __level));
+#endif
+
+/* Walk through the whole tree and call the ACTION callback for every node
+ or leaf. */
+extern void twalk __PMT ((__const void *__root, __action_fn_t __action));
+
+#ifdef __USE_GNU
+/* Callback type for function to free a tree node. If the keys are atomic
+ data this function should do nothing. */
+typedef void (*__free_fn_t) __PMT ((void *__nodep));
+
+/* Destroy the whole tree, call FREEFCT for each node or leaf. */
+extern void tdestroy __PMT ((void *__root, __free_fn_t __freefct));
+#endif
+
+
+/* Perform linear search for KEY by comparing by COMPAR in an array
+ [BASE,BASE+NMEMB*SIZE). */
+extern void *lfind __PMT ((__const void *__key, __const void *__base,
+ size_t *__nmemb, size_t __size,
+ __compar_fn_t __compar));
+
+/* Perform linear search for KEY by comparing by COMPAR function in
+ array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
+extern void *lsearch __PMT ((__const void *__key, void *__base,
+ size_t *__nmemb, size_t __size,
+ __compar_fn_t __compar));
+
+__END_DECLS
+
+#endif /* search.h */
diff --git a/alsa-lib/include/seq.h b/alsa-lib/include/seq.h
new file mode 100644
index 0000000..9576822
--- /dev/null
+++ b/alsa-lib/include/seq.h
@@ -0,0 +1,737 @@
+/**
+ * \file include/seq.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ */
+/*
+ * Application interface library for the ALSA driver
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_H
+#define __ALSA_SEQ_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Sequencer MIDI Sequencer
+ * MIDI Sequencer Interface.
+ * See \ref seq page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
+
+/** Sequencer handle */
+typedef struct _snd_seq snd_seq_t;
+
+/**
+ * sequencer opening stream types
+ */
+#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */
+#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */
+#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */
+
+/**
+ * sequencer opening mode
+ */
+#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) */
+
+/** sequencer handle type */
+typedef enum _snd_seq_type {
+ SND_SEQ_TYPE_HW, /**< hardware */
+ SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */
+ SND_SEQ_TYPE_INET /**< network (NYI) */
+} snd_seq_type_t;
+
+/** special client (port) ids */
+#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */
+#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */
+#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */
+
+/** known client numbers */
+#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */
+
+/*
+ */
+int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
+int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);
+const char *snd_seq_name(snd_seq_t *seq);
+snd_seq_type_t snd_seq_type(snd_seq_t *seq);
+int snd_seq_close(snd_seq_t *handle);
+int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
+int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
+int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
+int snd_seq_client_id(snd_seq_t *handle);
+
+size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
+size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
+int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
+int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
+
+/** system information container */
+typedef struct _snd_seq_system_info snd_seq_system_info_t;
+
+size_t snd_seq_system_info_sizeof(void);
+/** allocate a #snd_seq_system_info_t container on stack */
+#define snd_seq_system_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_system_info)
+int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
+void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
+void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
+
+int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);
+int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);
+
+int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqClient Sequencer Client Interface
+ * Sequencer Client Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** client information container */
+typedef struct _snd_seq_client_info snd_seq_client_info_t;
+
+/** client types */
+typedef enum snd_seq_client_type {
+ SND_SEQ_USER_CLIENT = 1, /**< user client */
+ SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
+} snd_seq_client_type_t;
+
+size_t snd_seq_client_info_sizeof(void);
+/** allocate a #snd_seq_client_info_t container on stack */
+#define snd_seq_client_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_client_info)
+int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
+void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
+void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
+
+int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
+snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
+const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
+int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
+const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
+int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
+
+void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
+void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
+void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
+void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
+void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
+
+void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
+void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
+void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
+int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
+
+int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
+int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
+int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
+
+/*
+ */
+
+/** client pool information container */
+typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
+
+size_t snd_seq_client_pool_sizeof(void);
+/** allocate a #snd_seq_client_pool_t container on stack */
+#define snd_seq_client_pool_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_client_pool)
+int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
+void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
+void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
+
+int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
+size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
+void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
+void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
+void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
+
+int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
+int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
+
+
+/** \} */
+
+
+/**
+ * \defgroup SeqPort Sequencer Port Interface
+ * Sequencer Port Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** port information container */
+typedef struct _snd_seq_port_info snd_seq_port_info_t;
+
+/** known port numbers */
+#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */
+#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port */
+
+/** port capabilities (32 bits) */
+#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */
+#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */
+
+#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */
+#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */
+
+#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */
+
+#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
+#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
+#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
+
+/* port type */
+/** Messages sent from/to this port have device-specific semantics. */
+#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)
+/** This port understands MIDI messages. */
+#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
+/** This port is compatible with the General MIDI specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)
+/** This port is compatible with the Roland GS standard. */
+#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)
+/** This port is compatible with the Yamaha XG specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)
+/** This port is compatible with the Roland MT-32. */
+#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
+/** This port is compatible with the General MIDI 2 specification. */
+#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
+/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
+ (these are not MIDI messages). */
+#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)
+/** Instruments can be downloaded to this port
+ (with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
+#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
+/** Instruments can be downloaded to this port
+ (with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */
+#define SND_SEQ_PORT_TYPE_SAMPLE (1<<12)
+/** This port is implemented in hardware. */
+#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)
+/** This port is implemented in software. */
+#define SND_SEQ_PORT_TYPE_SOFTWARE (1<<17)
+/** Messages sent to this port will generate sounds. */
+#define SND_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)
+/** This port may connect to other devices
+ (whose characteristics are not known). */
+#define SND_SEQ_PORT_TYPE_PORT (1<<19)
+/** This port belongs to an application, such as a sequencer or editor. */
+#define SND_SEQ_PORT_TYPE_APPLICATION (1<<20)
+
+
+size_t snd_seq_port_info_sizeof(void);
+/** allocate a #snd_seq_port_info_t container on stack */
+#define snd_seq_port_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_port_info)
+int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
+void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
+void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
+
+int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
+const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
+const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
+unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
+unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
+
+void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
+void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
+void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
+void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
+void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
+void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
+void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
+void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
+void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
+void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
+void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
+void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
+
+int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+int snd_seq_delete_port(snd_seq_t *handle, int port);
+int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
+int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
+int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqSubscribe Sequencer Port Subscription
+ * Sequencer Port Subscription
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** port subscription container */
+typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
+
+size_t snd_seq_port_subscribe_sizeof(void);
+/** allocate a #snd_seq_port_subscribe_t container on stack */
+#define snd_seq_port_subscribe_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_port_subscribe)
+int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
+void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
+void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
+
+const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
+int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
+
+void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
+void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
+void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
+void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
+
+int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
+
+/*
+ */
+
+/** subscription query container */
+typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
+
+/** type of query subscription */
+typedef enum {
+ SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */
+ SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */
+} snd_seq_query_subs_type_t;
+
+size_t snd_seq_query_subscribe_sizeof(void);
+/** allocate a #snd_seq_query_subscribe_t container on stack */
+#define snd_seq_query_subscribe_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_query_subscribe)
+int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
+void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
+void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
+
+int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
+snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
+const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
+int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
+
+void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
+void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
+void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
+void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
+void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);
+
+int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqQueue Sequencer Queue Interface
+ * Sequencer Queue Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/** queue information container */
+typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
+/** queue status container */
+typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
+/** queue tempo container */
+typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
+/** queue timer information container */
+typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
+
+/** special queue ids */
+#define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */
+
+size_t snd_seq_queue_info_sizeof(void);
+/** allocate a #snd_seq_queue_info_t container on stack */
+#define snd_seq_queue_info_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_info)
+int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
+void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
+void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
+
+int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
+const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
+int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
+int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
+unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
+
+void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
+void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
+void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
+void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
+
+int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
+int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
+int snd_seq_alloc_queue(snd_seq_t *handle);
+int snd_seq_free_queue(snd_seq_t *handle, int q);
+int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
+int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
+int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
+
+int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
+int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
+
+/*
+ */
+size_t snd_seq_queue_status_sizeof(void);
+/** allocate a #snd_seq_queue_status_t container on stack */
+#define snd_seq_queue_status_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_status)
+int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
+void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
+void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
+
+int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
+int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
+snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
+const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
+unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
+
+int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
+
+/*
+ */
+size_t snd_seq_queue_tempo_sizeof(void);
+/** allocate a #snd_seq_queue_tempo_t container on stack */
+#define snd_seq_queue_tempo_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_tempo)
+int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
+void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
+void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
+
+int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
+int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
+unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
+void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
+void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
+void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
+void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
+
+int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
+
+/*
+ */
+
+/** sequencer timer sources */
+typedef enum {
+ SND_SEQ_TIMER_ALSA = 0, /* ALSA timer */
+ SND_SEQ_TIMER_MIDI_CLOCK = 1, /* Midi Clock (CLOCK event) */
+ SND_SEQ_TIMER_MIDI_TICK = 2 /* Midi Timer Tick (TICK event */
+} snd_seq_queue_timer_type_t;
+
+size_t snd_seq_queue_timer_sizeof(void);
+/** allocate a #snd_seq_queue_timer_t container on stack */
+#define snd_seq_queue_timer_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_queue_timer)
+int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
+void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
+void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
+
+int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
+snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
+const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
+unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
+
+void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);
+void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
+void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
+
+int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
+
+/** \} */
+
+/**
+ * \defgroup SeqEvent Sequencer Event API
+ * Sequencer Event API
+ * \ingroup Sequencer
+ * \{
+ */
+
+int snd_seq_free_event(snd_seq_event_t *ev);
+ssize_t snd_seq_event_length(snd_seq_event_t *ev);
+int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
+int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
+int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
+int snd_seq_drain_output(snd_seq_t *handle);
+int snd_seq_event_output_pending(snd_seq_t *seq);
+int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
+int snd_seq_drop_output(snd_seq_t *handle);
+int snd_seq_drop_output_buffer(snd_seq_t *handle);
+int snd_seq_drop_input(snd_seq_t *handle);
+int snd_seq_drop_input_buffer(snd_seq_t *handle);
+
+/** event removal conditionals */
+typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
+
+/** Remove conditional flags */
+#define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */
+#define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */
+#define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */
+#define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */
+#define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */
+#define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */
+#define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */
+#define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */
+#define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */
+#define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */
+
+size_t snd_seq_remove_events_sizeof(void);
+/** allocate a #snd_seq_remove_events_t container on stack */
+#define snd_seq_remove_events_alloca(ptr) \
+ __snd_alloca(ptr, snd_seq_remove_events)
+int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
+void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
+void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
+
+unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
+const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
+const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
+int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
+
+void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
+void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
+void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
+void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
+void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
+void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
+void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
+
+int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
+
+/** \} */
+
+/**
+ * \defgroup SeqMisc Sequencer Miscellaneous
+ * Sequencer Miscellaneous
+ * \ingroup Sequencer
+ * \{
+ */
+
+void snd_seq_set_bit(int nr, void *array);
+void snd_seq_unset_bit(int nr, void *array);
+int snd_seq_change_bit(int nr, void *array);
+int snd_seq_get_bit(int nr, void *array);
+
+/** \} */
+
+
+/**
+ * \defgroup SeqEvType Sequencer Event Type Checks
+ * Sequencer Event Type Checks
+ * \ingroup Sequencer
+ * \{
+ */
+
+/* event type macros */
+enum {
+ SND_SEQ_EVFLG_RESULT,
+ SND_SEQ_EVFLG_NOTE,
+ SND_SEQ_EVFLG_CONTROL,
+ SND_SEQ_EVFLG_QUEUE,
+ SND_SEQ_EVFLG_SYSTEM,
+ SND_SEQ_EVFLG_MESSAGE,
+ SND_SEQ_EVFLG_CONNECTION,
+ SND_SEQ_EVFLG_SAMPLE,
+ SND_SEQ_EVFLG_USERS,
+ SND_SEQ_EVFLG_INSTR,
+ SND_SEQ_EVFLG_QUOTE,
+ SND_SEQ_EVFLG_NONE,
+ SND_SEQ_EVFLG_RAW,
+ SND_SEQ_EVFLG_FIXED,
+ SND_SEQ_EVFLG_VARIABLE,
+ SND_SEQ_EVFLG_VARUSR
+};
+
+enum {
+ SND_SEQ_EVFLG_NOTE_ONEARG,
+ SND_SEQ_EVFLG_NOTE_TWOARG
+};
+
+enum {
+ SND_SEQ_EVFLG_QUEUE_NOARG,
+ SND_SEQ_EVFLG_QUEUE_TICK,
+ SND_SEQ_EVFLG_QUEUE_TIME,
+ SND_SEQ_EVFLG_QUEUE_VALUE
+};
+
+/**
+ * Exported event type table
+ *
+ * This table is referred by snd_seq_ev_is_xxx.
+ */
+extern const unsigned int snd_seq_event_types[];
+
+#define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
+#define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
+
+/** check the event type */
+#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
+
+/** event type check: result events */
+#define snd_seq_ev_is_result_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
+/** event type check: note events */
+#define snd_seq_ev_is_note_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
+/** event type check: control events */
+#define snd_seq_ev_is_control_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
+/** event type check: channel specific events */
+#define snd_seq_ev_is_channel_type(ev) \
+ (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
+
+/** event type check: queue control events */
+#define snd_seq_ev_is_queue_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
+/** event type check: system status messages */
+#define snd_seq_ev_is_message_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
+/** event type check: system status messages */
+#define snd_seq_ev_is_subscribe_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
+/** event type check: sample messages */
+#define snd_seq_ev_is_sample_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
+/** event type check: user-defined messages */
+#define snd_seq_ev_is_user_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
+/** event type check: instrument layer events */
+#define snd_seq_ev_is_instr_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
+/** event type check: fixed length events */
+#define snd_seq_ev_is_fixed_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
+/** event type check: variable length events */
+#define snd_seq_ev_is_variable_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
+/** event type check: user pointer events */
+#define snd_seq_ev_is_varusr_type(ev) \
+ snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
+/** event type check: reserved for kernel */
+#define snd_seq_ev_is_reserved(ev) \
+ (! snd_seq_event_types[(ev)->type])
+
+/**
+ * macros to check event flags
+ */
+/** prior events */
+#define snd_seq_ev_is_prior(ev) \
+ (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
+
+/** get the data length type */
+#define snd_seq_ev_length_type(ev) \
+ ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
+/** fixed length events */
+#define snd_seq_ev_is_fixed(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
+/** variable length events */
+#define snd_seq_ev_is_variable(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
+/** variable length on user-space */
+#define snd_seq_ev_is_varusr(ev) \
+ (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
+
+/** time-stamp type */
+#define snd_seq_ev_timestamp_type(ev) \
+ ((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
+/** event is in tick time */
+#define snd_seq_ev_is_tick(ev) \
+ (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
+/** event is in real-time */
+#define snd_seq_ev_is_real(ev) \
+ (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
+
+/** time-mode type */
+#define snd_seq_ev_timemode_type(ev) \
+ ((ev)->flags & SND_SEQ_TIME_MODE_MASK)
+/** scheduled in absolute time */
+#define snd_seq_ev_is_abstime(ev) \
+ (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
+/** scheduled in relative time */
+#define snd_seq_ev_is_reltime(ev) \
+ (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
+
+/** direct dispatched events */
+#define snd_seq_ev_is_direct(ev) \
+ ((ev)->queue == SND_SEQ_QUEUE_DIRECT)
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQ_H */
+
diff --git a/alsa-lib/include/seq_event.h b/alsa-lib/include/seq_event.h
new file mode 100644
index 0000000..583f1d0
--- /dev/null
+++ b/alsa-lib/include/seq_event.h
@@ -0,0 +1,319 @@
+/**
+ * \file include/seq_event.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_EVENT_H
+#define __ALSA_SEQ_EVENT_H
+
+/**
+ * \defgroup SeqEvents Sequencer Event Definitions
+ * Sequencer Event Definitions
+ * \ingroup Sequencer
+ * \{
+ */
+
+/**
+ * Sequencer event data type
+ */
+typedef unsigned char snd_seq_event_type_t;
+
+/** Sequencer event type */
+enum snd_seq_event_type {
+ /** system status; event data type = #snd_seq_result_t */
+ SND_SEQ_EVENT_SYSTEM = 0,
+ /** returned result status; event data type = #snd_seq_result_t */
+ SND_SEQ_EVENT_RESULT,
+
+ /** note on and off with duration; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTE = 5,
+ /** note on; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTEON,
+ /** note off; event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_NOTEOFF,
+ /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
+ SND_SEQ_EVENT_KEYPRESS,
+
+ /** controller; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CONTROLLER = 10,
+ /** program change; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_PGMCHANGE,
+ /** channel pressure; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CHANPRESS,
+ /** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
+ SND_SEQ_EVENT_PITCHBEND,
+ /** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_CONTROL14,
+ /** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_NONREGPARAM,
+ /** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_REGPARAM,
+
+ /** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_SONGPOS = 20,
+ /** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_SONGSEL,
+ /** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_QFRAME,
+ /** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_TIMESIGN,
+ /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
+ SND_SEQ_EVENT_KEYSIGN,
+
+ /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_START = 30,
+ /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_CONTINUE,
+ /** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_STOP,
+ /** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SETPOS_TICK,
+ /** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SETPOS_TIME,
+ /** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_TEMPO,
+ /** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_CLOCK,
+ /** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_TICK,
+ /** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_QUEUE_SKEW,
+ /** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
+ SND_SEQ_EVENT_SYNC_POS,
+
+ /** Tune request; event data type = none */
+ SND_SEQ_EVENT_TUNE_REQUEST = 40,
+ /** Reset to power-on state; event data type = none */
+ SND_SEQ_EVENT_RESET,
+ /** Active sensing event; event data type = none */
+ SND_SEQ_EVENT_SENSING,
+
+ /** Echo-back event; event data type = any type */
+ SND_SEQ_EVENT_ECHO = 50,
+ /** OSS emulation raw event; event data type = any type */
+ SND_SEQ_EVENT_OSS,
+
+ /** New client has connected; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_START = 60,
+ /** Client has left the system; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_EXIT,
+ /** Client status/info has changed; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_CLIENT_CHANGE,
+ /** New port was created; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_START,
+ /** Port was deleted from system; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_EXIT,
+ /** Port status/info has changed; event data type = #snd_seq_addr_t */
+ SND_SEQ_EVENT_PORT_CHANGE,
+
+ /** Ports connected; event data type = #snd_seq_connect_t */
+ SND_SEQ_EVENT_PORT_SUBSCRIBED,
+ /** Ports disconnected; event data type = #snd_seq_connect_t */
+ SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
+
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR0 = 90,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR1,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR2,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR3,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR4,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR5,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR6,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR7,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR8,
+ /** user-defined event; event data type = any (fixed size) */
+ SND_SEQ_EVENT_USR9,
+
+ /** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_SYSEX = 130,
+ /** error event; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_BOUNCE,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR0 = 135,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR1,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR2,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR3,
+ /** reserved for user apps; event data type = #snd_seq_ev_ext_t */
+ SND_SEQ_EVENT_USR_VAR4,
+
+ /** NOP; ignored in any case */
+ SND_SEQ_EVENT_NONE = 255
+};
+
+
+/** Sequencer event address */
+typedef struct snd_seq_addr {
+ unsigned char client; /**< Client id */
+ unsigned char port; /**< Port id */
+} snd_seq_addr_t;
+
+/** Connection (subscription) between ports */
+typedef struct snd_seq_connect {
+ snd_seq_addr_t sender; /**< sender address */
+ snd_seq_addr_t dest; /**< destination address */
+} snd_seq_connect_t;
+
+
+/** Real-time data record */
+typedef struct snd_seq_real_time {
+ unsigned int tv_sec; /**< seconds */
+ unsigned int tv_nsec; /**< nanoseconds */
+} snd_seq_real_time_t;
+
+/** (MIDI) Tick-time data record */
+typedef unsigned int snd_seq_tick_time_t;
+
+/** unioned time stamp */
+typedef union snd_seq_timestamp {
+ snd_seq_tick_time_t tick; /**< tick-time */
+ struct snd_seq_real_time time; /**< real-time */
+} snd_seq_timestamp_t;
+
+
+/**
+ * Event mode flags
+ *
+ * NOTE: only 8 bits available!
+ */
+#define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */
+#define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */
+#define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */
+
+#define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */
+#define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */
+#define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */
+
+#define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */
+#define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */
+#define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */
+#define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */
+
+#define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */
+#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
+#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
+
+
+/** Note event */
+typedef struct snd_seq_ev_note {
+ unsigned char channel; /**< channel number */
+ unsigned char note; /**< note */
+ unsigned char velocity; /**< velocity */
+ unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
+ unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
+} snd_seq_ev_note_t;
+
+/** Controller event */
+typedef struct snd_seq_ev_ctrl {
+ unsigned char channel; /**< channel number */
+ unsigned char unused[3]; /**< reserved */
+ unsigned int param; /**< control parameter */
+ signed int value; /**< control value */
+} snd_seq_ev_ctrl_t;
+
+/** generic set of bytes (12x8 bit) */
+typedef struct snd_seq_ev_raw8 {
+ unsigned char d[12]; /**< 8 bit value */
+} snd_seq_ev_raw8_t;
+
+/** generic set of integers (3x32 bit) */
+typedef struct snd_seq_ev_raw32 {
+ unsigned int d[3]; /**< 32 bit value */
+} snd_seq_ev_raw32_t;
+
+/** external stored data */
+typedef struct snd_seq_ev_ext {
+ unsigned int len; /**< length of data */
+ void *ptr; /**< pointer to data (note: can be 64-bit) */
+} __attribute__((packed)) snd_seq_ev_ext_t;
+
+/** Result events */
+typedef struct snd_seq_result {
+ int event; /**< processed event type */
+ int result; /**< status */
+} snd_seq_result_t;
+
+/** Queue skew values */
+typedef struct snd_seq_queue_skew {
+ unsigned int value; /**< skew value */
+ unsigned int base; /**< skew base */
+} snd_seq_queue_skew_t;
+
+/** queue timer control */
+typedef struct snd_seq_ev_queue_control {
+ unsigned char queue; /**< affected queue */
+ unsigned char unused[3]; /**< reserved */
+ union {
+ signed int value; /**< affected value (e.g. tempo) */
+ snd_seq_timestamp_t time; /**< time */
+ unsigned int position; /**< sync position */
+ snd_seq_queue_skew_t skew; /**< queue skew */
+ unsigned int d32[2]; /**< any data */
+ unsigned char d8[8]; /**< any data */
+ } param; /**< data value union */
+} snd_seq_ev_queue_control_t;
+
+
+/** Sequencer event */
+typedef struct snd_seq_event {
+ snd_seq_event_type_t type; /**< event type */
+ unsigned char flags; /**< event flags */
+ unsigned char tag; /**< tag */
+
+ unsigned char queue; /**< schedule queue */
+ snd_seq_timestamp_t time; /**< schedule time */
+
+ snd_seq_addr_t source; /**< source address */
+ snd_seq_addr_t dest; /**< destination address */
+
+ union {
+ snd_seq_ev_note_t note; /**< note information */
+ snd_seq_ev_ctrl_t control; /**< MIDI control information */
+ snd_seq_ev_raw8_t raw8; /**< raw8 data */
+ snd_seq_ev_raw32_t raw32; /**< raw32 data */
+ snd_seq_ev_ext_t ext; /**< external data */
+ snd_seq_ev_queue_control_t queue; /**< queue control */
+ snd_seq_timestamp_t time; /**< timestamp */
+ snd_seq_addr_t addr; /**< address */
+ snd_seq_connect_t connect; /**< connect information */
+ snd_seq_result_t result; /**< operation result code */
+ } data; /**< event data... */
+} snd_seq_event_t;
+
+
+/** \} */
+
+#endif /* __ALSA_SEQ_EVENT_H */
+
diff --git a/alsa-lib/include/seq_midi_event.h b/alsa-lib/include/seq_midi_event.h
new file mode 100644
index 0000000..9b8ee59
--- /dev/null
+++ b/alsa-lib/include/seq_midi_event.h
@@ -0,0 +1,65 @@
+/**
+ * \file include/seq_midi_event.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQ_MIDI_EVENT_H
+#define __ALSA_SEQ_MIDI_EVENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup MIDI_Event Sequencer event <-> MIDI byte stream coder
+ * \ingroup Sequencer
+ * Sequencer event <-> MIDI byte stream coder
+ * \{
+ */
+
+/** container for sequencer midi event parsers */
+typedef struct snd_midi_event snd_midi_event_t;
+
+int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev);
+int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize);
+void snd_midi_event_free(snd_midi_event_t *dev);
+void snd_midi_event_init(snd_midi_event_t *dev);
+void snd_midi_event_reset_encode(snd_midi_event_t *dev);
+void snd_midi_event_reset_decode(snd_midi_event_t *dev);
+void snd_midi_event_no_status(snd_midi_event_t *dev, int on);
+/* encode from byte stream - return number of written bytes if success */
+long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev);
+int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
+/* decode from event to bytes - return number of written bytes if success */
+long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQ_MIDI_EVENT_H */
+
diff --git a/alsa-lib/include/seqmid.h b/alsa-lib/include/seqmid.h
new file mode 100644
index 0000000..68069b2
--- /dev/null
+++ b/alsa-lib/include/seqmid.h
@@ -0,0 +1,490 @@
+/**
+ * \file include/seqmid.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_SEQMID_H
+#define __ALSA_SEQMID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup SeqMiddle Sequencer Middle Level Interface
+ * Sequencer Middle Level Interface
+ * \ingroup Sequencer
+ * \{
+ */
+
+/**
+ * \brief initialize event record
+ * \param ev event record pointer
+ *
+ * This macro clears the given event record pointer to the default status.
+ */
+#define snd_seq_ev_clear(ev) \
+ memset(ev, 0, sizeof(snd_seq_event_t))
+
+/**
+ * \brief set the tag for given event
+ * \param ev event record
+ * \param t event tag
+ *
+ * This macro sets the tag to the given event record.
+ */
+#define snd_seq_ev_set_tag(ev,t) \
+ ((ev)->tag = (t))
+
+/**
+ * \brief set the explicit destination
+ * \param ev event record
+ * \param c destination client id
+ * \param p destination port id
+ *
+ * This macro sets the client and port id numbers to the given event record.
+ *
+ * \sa snd_seq_ev_set_subs()
+ */
+#define snd_seq_ev_set_dest(ev,c,p) \
+ ((ev)->dest.client = (c), (ev)->dest.port = (p))
+
+/**
+ * \brief set broadcasting to subscribers
+ * \param ev event record
+ *
+ * This macro sets the destination as the subscribers.
+ *
+ * \sa snd_seq_ev_set_dest()
+ */
+#define snd_seq_ev_set_subs(ev) \
+ ((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
+ (ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
+
+/**
+ * \brief set broadcasting to all clients/ports
+ * \param ev event record
+ *
+ * This macro sets the destination as the broadcasting.
+ *
+ * \sa snd_seq_ev_set_dest()
+ */
+#define snd_seq_ev_set_broadcast(ev) \
+ ((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
+ (ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
+
+/**
+ * \brief set the source port
+ * \param ev event record
+ * \param p source port id
+ *
+ * This macro sets the source port id number.
+ */
+#define snd_seq_ev_set_source(ev,p) \
+ ((ev)->source.port = (p))
+
+/**
+ * \brief set direct passing mode (without queued)
+ * \param ev event instance
+ *
+ * This macro sets the event to the direct passing mode
+ * to be delivered immediately without queueing.
+ *
+ * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
+ */
+#define snd_seq_ev_set_direct(ev) \
+ ((ev)->queue = SND_SEQ_QUEUE_DIRECT)
+
+/**
+ * \brief set tick-scheduling mode on queue
+ * \param ev event instance
+ * \param q queue id to schedule
+ * \param relative relative time-stamp if non-zero
+ * \param ttick tick time-stamp to be delivered
+ *
+ * This macro sets the scheduling of the event in the
+ * MIDI tick mode.
+ *
+ * \sa snd_seq_ev_schedule_real(), snd_seq_ev_set_direct()
+ */
+#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
+ ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
+ (ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
+ (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
+ (ev)->time.tick = (ttick),\
+ (ev)->queue = (q))
+
+/**
+ * \brief set real-time-scheduling mode on queue
+ * \param ev event instance
+ * \param q queue id to schedule
+ * \param relative relative time-stamp if non-zero
+ * \param rtime time-stamp to be delivered
+ *
+ * This macro sets the scheduling of the event in the
+ * realtime mode.
+ *
+ * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_set_direct()
+ */
+#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
+ ((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
+ (ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
+ (ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
+ (ev)->time.time = *(rtime),\
+ (ev)->queue = (q))
+
+/**
+ * \brief set event priority
+ * \param ev event instance
+ * \param high_prior 1 for high priority mode
+ */
+#define snd_seq_ev_set_priority(ev, high_prior) \
+ ((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
+ (ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
+
+/**
+ * \brief set fixed data
+ * \param ev event instance
+ *
+ * Sets the event length mode as fixed size.
+ *
+ * \sa snd_seq_ev_set_variable(), snd_seq_ev_set_varusr()
+ */
+#define snd_seq_ev_set_fixed(ev) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
+
+/**
+ * \brief set variable data
+ * \param ev event instance
+ * \param datalen length of the external data
+ * \param dataptr pointer of the external data
+ *
+ * Sets the event length mode as variable length and stores the data.
+ *
+ * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_varusr()
+ */
+#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
+ (ev)->data.ext.len = (datalen),\
+ (ev)->data.ext.ptr = (dataptr))
+
+/**
+ * \brief set varusr data
+ * \param ev event instance
+ * \param datalen length of the external data
+ * \param dataptr pointer of the external data
+ *
+ * Sets the event length mode as variable user-space data and stores the data.
+ *
+ * \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_variable()
+ */
+#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
+ ((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
+ (ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
+ (ev)->data.ext.len = (datalen),\
+ (ev)->data.ext.ptr = (dataptr))
+
+/**
+ * \brief set queue controls
+ * \param ev event record
+ * \param typ event type
+ * \param q queue id
+ * \param val control value
+ */
+#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
+ ((ev)->type = (typ),\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.value = (val))
+
+/**
+ * \brief set the start queue event
+ * \param ev event record
+ * \param q queue id to start
+ *
+ * \sa snd_seq_ev_set_queue_stop(), snd_seq_ev_set_queue_continue()
+ */
+#define snd_seq_ev_set_queue_start(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to stop
+ *
+ * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_continue()
+ */
+#define snd_seq_ev_set_queue_stop(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to continue
+ *
+ * \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_stop()
+ */
+#define snd_seq_ev_set_queue_continue(ev, q) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
+
+/**
+ * \brief set the stop queue event
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param val the new tempo value
+ */
+#define snd_seq_ev_set_queue_tempo(ev, q, val) \
+ snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
+
+/**
+ * \brief set the real-time position of a queue
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param rtime the new real-time pointer
+ */
+#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
+ ((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.time.time = *(rtime))
+
+/**
+ * \brief set the tick-time position of a queue
+ * \param ev event record
+ * \param q queue id to change tempo
+ * \param ttime the new tick-time
+ */
+#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
+ ((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
+ snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
+ (ev)->data.queue.queue = (q),\
+ (ev)->data.queue.param.time.tick = (ttime))
+
+/* set and send a queue control event */
+int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
+
+/**
+ * \brief start the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to start
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_start_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
+
+/**
+ * \brief stop the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to stop
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_stop_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
+
+/**
+ * \brief continue the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to continue
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_continue_queue(seq, q, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
+
+/**
+ * \brief change the tempo of the specified queue
+ * \param seq sequencer handle
+ * \param q queue id
+ * \param tempo the new tempo value
+ * \param ev optional event record (see #snd_seq_control_queue)
+ */
+#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
+ snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
+
+/* create a port - simple version - return the port number */
+int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
+ unsigned int caps, unsigned int type);
+/* delete the port */
+int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
+
+/* simple subscription between this port and another port
+ (w/o exclusive & time conversion)
+ */
+int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
+int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
+int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
+int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
+
+/*
+ * set client information
+ */
+int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
+int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
+int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
+int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
+int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
+/* sync output queue */
+int snd_seq_sync_output_queue(snd_seq_t *seq);
+
+/*
+ * parse the given string and get the sequencer address
+ */
+int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
+
+/*
+ * reset client input/output pool
+ */
+int snd_seq_reset_pool_output(snd_seq_t *seq);
+int snd_seq_reset_pool_input(snd_seq_t *seq);
+
+/**
+ * \brief set note event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ * \param dur duration (in tick or msec)
+ */
+#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
+ ((ev)->type = SND_SEQ_EVENT_NOTE,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel),\
+ (ev)->data.note.duration = (dur))
+
+/**
+ * \brief set note-on event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
+ ((ev)->type = SND_SEQ_EVENT_NOTEON,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set note-off event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
+ ((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set key-pressure event
+ * \param ev event record
+ * \param ch channel number
+ * \param key note key
+ * \param vel velocity
+ */
+#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
+ ((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.note.channel = (ch),\
+ (ev)->data.note.note = (key),\
+ (ev)->data.note.velocity = (vel))
+
+/**
+ * \brief set MIDI controller event
+ * \param ev event record
+ * \param ch channel number
+ * \param cc controller number
+ * \param val control value
+ */
+#define snd_seq_ev_set_controller(ev,ch,cc,val) \
+ ((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.param = (cc),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set program change event
+ * \param ev event record
+ * \param ch channel number
+ * \param val program number
+ */
+#define snd_seq_ev_set_pgmchange(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set pitch-bend event
+ * \param ev event record
+ * \param ch channel number
+ * \param val pitch bend; zero centered from -8192 to 8191
+ */
+#define snd_seq_ev_set_pitchbend(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set channel pressure event
+ * \param ev event record
+ * \param ch channel number
+ * \param val channel pressure value
+ */
+#define snd_seq_ev_set_chanpress(ev,ch,val) \
+ ((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
+ snd_seq_ev_set_fixed(ev),\
+ (ev)->data.control.channel = (ch),\
+ (ev)->data.control.value = (val))
+
+/**
+ * \brief set sysex event
+ * \param ev event record
+ * \param datalen length of sysex data
+ * \param dataptr sysex data pointer
+ *
+ * the sysex data must contain the start byte 0xf0 and the end byte 0xf7.
+ */
+#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
+ ((ev)->type = SND_SEQ_EVENT_SYSEX,\
+ snd_seq_ev_set_variable(ev, datalen, dataptr))
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ALSA_SEQMID_H */
+
diff --git a/alsa-lib/include/sound/Makefile.am b/alsa-lib/include/sound/Makefile.am
new file mode 100644
index 0000000..67d4447
--- /dev/null
+++ b/alsa-lib/include/sound/Makefile.am
@@ -0,0 +1,6 @@
+alsasoundincludedir = ${includedir}/alsa/sound
+
+alsasoundinclude_HEADERS = asound_fm.h hdsp.h sb16_csp.h sscape_ioctl.h emu10k1.h \
+ type_compat.h
+
+noinst_HEADERS = asound.h asoundef.h asequencer.h
diff --git a/alsa-lib/include/sound/Makefile.in b/alsa-lib/include/sound/Makefile.in
new file mode 100644
index 0000000..12a0c5d
--- /dev/null
+++ b/alsa-lib/include/sound/Makefile.in
@@ -0,0 +1,497 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include/sound
+DIST_COMMON = $(alsasoundinclude_HEADERS) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsasoundincludedir)"
+alsasoundincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(alsasoundinclude_HEADERS) $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+alsasoundincludedir = ${includedir}/alsa/sound
+alsasoundinclude_HEADERS = asound_fm.h hdsp.h sb16_csp.h sscape_ioctl.h emu10k1.h \
+ type_compat.h
+
+noinst_HEADERS = asound.h asoundef.h asequencer.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/sound/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/sound/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-alsasoundincludeHEADERS: $(alsasoundinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsasoundincludedir)" || $(mkdir_p) "$(DESTDIR)$(alsasoundincludedir)"
+ @list='$(alsasoundinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsasoundincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(alsasoundincludedir)/$$f'"; \
+ $(alsasoundincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(alsasoundincludedir)/$$f"; \
+ done
+
+uninstall-alsasoundincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsasoundinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsasoundincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsasoundincludedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(alsasoundincludedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-alsasoundincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-alsasoundincludeHEADERS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-alsasoundincludeHEADERS \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-alsasoundincludeHEADERS uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/include/sound/asequencer.h b/alsa-lib/include/sound/asequencer.h
new file mode 100644
index 0000000..6d14fb1
--- /dev/null
+++ b/alsa-lib/include/sound/asequencer.h
@@ -0,0 +1,678 @@
+/*
+ * Main header file for the ALSA sequencer
+ * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
+ * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __SOUND_ASEQUENCER_H
+#define __SOUND_ASEQUENCER_H
+
+#ifdef __KERNEL__
+#include <linux/ioctl.h>
+#endif
+
+#include <sound/asound.h>
+
+/** version of the sequencer */
+#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
+
+#ifdef __KERNEL__
+/**
+ * definition of sequencer event types
+ */
+
+/** system messages
+ * event data type = #sndrv_seq_result_t
+ */
+#define SNDRV_SEQ_EVENT_SYSTEM 0
+#define SNDRV_SEQ_EVENT_RESULT 1
+
+/** note messages (channel specific)
+ * event data type = #sndrv_seq_ev_note
+ */
+#define SNDRV_SEQ_EVENT_NOTE 5
+#define SNDRV_SEQ_EVENT_NOTEON 6
+#define SNDRV_SEQ_EVENT_NOTEOFF 7
+#define SNDRV_SEQ_EVENT_KEYPRESS 8
+
+/** control messages (channel specific)
+ * event data type = #sndrv_seq_ev_ctrl
+ */
+#define SNDRV_SEQ_EVENT_CONTROLLER 10
+#define SNDRV_SEQ_EVENT_PGMCHANGE 11
+#define SNDRV_SEQ_EVENT_CHANPRESS 12
+#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
+#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
+#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
+#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
+
+/** synchronisation messages
+ * event data type = #sndrv_seq_ev_ctrl
+ */
+#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
+#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
+#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
+#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
+#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
+
+/** timer messages
+ * event data type = sndrv_seq_ev_queue_control_t
+ */
+#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
+#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
+#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
+#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
+#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
+#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
+#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
+#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
+#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
+
+/** others
+ * event data type = none
+ */
+#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
+#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
+#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
+
+/** echo back, kernel private messages
+ * event data type = any type
+ */
+#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
+#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
+
+/** system status messages (broadcast for subscribers)
+ * event data type = sndrv_seq_addr_t
+ */
+#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
+#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
+#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
+#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
+#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
+#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
+
+/** port connection changes
+ * event data type = sndrv_seq_connect_t
+ */
+#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
+#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
+
+/* 70-89: synthesizer events - obsoleted */
+
+/** user-defined events with fixed length
+ * event data type = any
+ */
+#define SNDRV_SEQ_EVENT_USR0 90
+#define SNDRV_SEQ_EVENT_USR1 91
+#define SNDRV_SEQ_EVENT_USR2 92
+#define SNDRV_SEQ_EVENT_USR3 93
+#define SNDRV_SEQ_EVENT_USR4 94
+#define SNDRV_SEQ_EVENT_USR5 95
+#define SNDRV_SEQ_EVENT_USR6 96
+#define SNDRV_SEQ_EVENT_USR7 97
+#define SNDRV_SEQ_EVENT_USR8 98
+#define SNDRV_SEQ_EVENT_USR9 99
+
+/* 100-118: instrument layer - obsoleted */
+/* 119-129: reserved */
+
+/* 130-139: variable length events
+ * event data type = sndrv_seq_ev_ext
+ * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
+ */
+#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
+#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
+/* 132-134: reserved */
+#define SNDRV_SEQ_EVENT_USR_VAR0 135
+#define SNDRV_SEQ_EVENT_USR_VAR1 136
+#define SNDRV_SEQ_EVENT_USR_VAR2 137
+#define SNDRV_SEQ_EVENT_USR_VAR3 138
+#define SNDRV_SEQ_EVENT_USR_VAR4 139
+
+/* 150-151: kernel events with quote - DO NOT use in user clients */
+#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
+#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
+
+/* 152-191: reserved */
+
+/* 192-254: hardware specific events */
+
+/* 255: special event */
+#define SNDRV_SEQ_EVENT_NONE 255
+
+
+typedef unsigned char sndrv_seq_event_type_t;
+
+/** event address */
+struct sndrv_seq_addr {
+ unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
+ unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
+};
+
+/** port connection */
+struct sndrv_seq_connect {
+ struct sndrv_seq_addr sender;
+ struct sndrv_seq_addr dest;
+};
+
+
+#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
+#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
+#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
+#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
+
+ /* event mode flag - NOTE: only 8 bits available! */
+#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
+#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
+#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
+
+#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
+#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
+#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
+
+#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
+#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
+#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
+#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
+
+#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
+#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
+#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
+
+
+ /* note event */
+struct sndrv_seq_ev_note {
+ unsigned char channel;
+ unsigned char note;
+ unsigned char velocity;
+ unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
+ unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
+};
+
+ /* controller event */
+struct sndrv_seq_ev_ctrl {
+ unsigned char channel;
+ unsigned char unused1, unused2, unused3; /* pad */
+ unsigned int param;
+ signed int value;
+};
+
+ /* generic set of bytes (12x8 bit) */
+struct sndrv_seq_ev_raw8 {
+ unsigned char d[12]; /* 8 bit value */
+};
+
+ /* generic set of integers (3x32 bit) */
+struct sndrv_seq_ev_raw32 {
+ unsigned int d[3]; /* 32 bit value */
+};
+
+ /* external stored data */
+struct sndrv_seq_ev_ext {
+ unsigned int len; /* length of data */
+ void *ptr; /* pointer to data (note: maybe 64-bit) */
+} __attribute__((packed));
+
+struct sndrv_seq_result {
+ int event; /* processed event type */
+ int result;
+};
+
+
+struct sndrv_seq_real_time {
+ unsigned int tv_sec; /* seconds */
+ unsigned int tv_nsec; /* nanoseconds */
+};
+
+typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */
+
+union sndrv_seq_timestamp {
+ sndrv_seq_tick_time_t tick;
+ struct sndrv_seq_real_time time;
+};
+
+struct sndrv_seq_queue_skew {
+ unsigned int value;
+ unsigned int base;
+};
+
+ /* queue timer control */
+struct sndrv_seq_ev_queue_control {
+ unsigned char queue; /* affected queue */
+ unsigned char pad[3]; /* reserved */
+ union {
+ signed int value; /* affected value (e.g. tempo) */
+ union sndrv_seq_timestamp time; /* time */
+ unsigned int position; /* sync position */
+ struct sndrv_seq_queue_skew skew;
+ unsigned int d32[2];
+ unsigned char d8[8];
+ } param;
+};
+
+ /* quoted event - inside the kernel only */
+struct sndrv_seq_ev_quote {
+ struct sndrv_seq_addr origin; /* original sender */
+ unsigned short value; /* optional data */
+ struct sndrv_seq_event *event; /* quoted event */
+} __attribute__((packed));
+
+
+ /* sequencer event */
+struct sndrv_seq_event {
+ sndrv_seq_event_type_t type; /* event type */
+ unsigned char flags; /* event flags */
+ char tag;
+
+ unsigned char queue; /* schedule queue */
+ union sndrv_seq_timestamp time; /* schedule time */
+
+
+ struct sndrv_seq_addr source; /* source address */
+ struct sndrv_seq_addr dest; /* destination address */
+
+ union { /* event data... */
+ struct sndrv_seq_ev_note note;
+ struct sndrv_seq_ev_ctrl control;
+ struct sndrv_seq_ev_raw8 raw8;
+ struct sndrv_seq_ev_raw32 raw32;
+ struct sndrv_seq_ev_ext ext;
+ struct sndrv_seq_ev_queue_control queue;
+ union sndrv_seq_timestamp time;
+ struct sndrv_seq_addr addr;
+ struct sndrv_seq_connect connect;
+ struct sndrv_seq_result result;
+ struct sndrv_seq_ev_quote quote;
+ } data;
+};
+
+
+/*
+ * bounce event - stored as variable size data
+ */
+struct sndrv_seq_event_bounce {
+ int err;
+ struct sndrv_seq_event event;
+ /* external data follows here. */
+};
+
+#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t)))
+
+/*
+ * type check macros
+ */
+/* result events: 0-4 */
+#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5)
+/* channel specific events: 5-19 */
+#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
+/* note events: 5-9 */
+#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
+/* control events: 10-19 */
+#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
+/* queue control events: 30-39 */
+#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
+/* system status messages */
+#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
+/* sample messages */
+#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
+/* user-defined messages */
+#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
+/* fixed length events: 0-99 */
+#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
+/* variable length events: 130-139 */
+#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
+/* reserved for kernel */
+#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150)
+
+/* direct dispatched events */
+#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
+
+/*
+ * macros to check event flags
+ */
+/* prior events */
+#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
+
+/* event length type */
+#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
+#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
+#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
+#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
+
+/* time-stamp type */
+#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
+#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
+#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
+
+/* time-mode type */
+#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
+#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
+#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
+
+/* queue sync port */
+#define sndrv_seq_queue_sync_port(q) ((q) + 16)
+
+#endif /* __KERNEL__ */
+
+ /* system information */
+struct sndrv_seq_system_info {
+ int queues; /* maximum queues count */
+ int clients; /* maximum clients count */
+ int ports; /* maximum ports per client */
+ int channels; /* maximum channels per port */
+ int cur_clients; /* current clients */
+ int cur_queues; /* current queues */
+ char reserved[24];
+};
+
+
+ /* system running information */
+struct sndrv_seq_running_info {
+ unsigned char client; /* client id */
+ unsigned char big_endian; /* 1 = big-endian */
+ unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
+ unsigned char pad; /* reserved */
+ unsigned char reserved[12];
+};
+
+
+ /* known client numbers */
+#define SNDRV_SEQ_CLIENT_SYSTEM 0
+ /* internal client numbers */
+#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
+#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
+
+
+ /* client types */
+enum sndrv_seq_client_type {
+ NO_CLIENT = 0,
+ USER_CLIENT = 1,
+ KERNEL_CLIENT = 2
+};
+
+ /* event filter flags */
+#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
+#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
+#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
+#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
+
+struct sndrv_seq_client_info {
+ int client; /* client number to inquire */
+ int type; /* client type */
+ char name[64]; /* client name */
+ unsigned int filter; /* filter flags */
+ unsigned char multicast_filter[8]; /* multicast filter bitmap */
+ unsigned char event_filter[32]; /* event filter bitmap */
+ int num_ports; /* RO: number of ports */
+ int event_lost; /* number of lost events */
+ char reserved[64]; /* for future use */
+};
+
+
+/* client pool size */
+struct sndrv_seq_client_pool {
+ int client; /* client number to inquire */
+ int output_pool; /* outgoing (write) pool size */
+ int input_pool; /* incoming (read) pool size */
+ int output_room; /* minimum free pool size for select/blocking mode */
+ int output_free; /* unused size */
+ int input_free; /* unused size */
+ char reserved[64];
+};
+
+
+/* Remove events by specified criteria */
+
+#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
+#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
+#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
+#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
+#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
+#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
+#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
+#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
+#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
+#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
+
+struct sndrv_seq_remove_events {
+ unsigned int remove_mode; /* Flags that determine what gets removed */
+
+ union sndrv_seq_timestamp time;
+
+ unsigned char queue; /* Queue for REMOVE_DEST */
+ struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */
+ unsigned char channel; /* Channel for REMOVE_DEST */
+
+ int type; /* For REMOVE_EVENT_TYPE */
+ char tag; /* Tag for REMOVE_TAG */
+
+ int reserved[10]; /* To allow for future binary compatibility */
+
+};
+
+
+ /* known port numbers */
+#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
+#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
+
+ /* port capabilities (32 bits) */
+#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
+#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
+
+#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
+#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
+
+#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
+
+#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
+#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
+#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
+
+ /* port type */
+#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
+#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
+
+/* other standards...*/
+#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
+#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
+#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
+/*...*/
+#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
+#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
+#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
+#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
+#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
+
+/* misc. conditioning flags */
+#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
+#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
+#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
+
+struct sndrv_seq_port_info {
+ struct sndrv_seq_addr addr; /* client/port numbers */
+ char name[64]; /* port name */
+
+ unsigned int capability; /* port capability bits */
+ unsigned int type; /* port type bits */
+ int midi_channels; /* channels per MIDI port */
+ int midi_voices; /* voices per MIDI port */
+ int synth_voices; /* voices per SYNTH port */
+
+ int read_use; /* R/O: subscribers for output (from this port) */
+ int write_use; /* R/O: subscribers for input (to this port) */
+
+ void *kernel; /* reserved for kernel use (must be NULL) */
+ unsigned int flags; /* misc. conditioning */
+ unsigned char time_queue; /* queue # for timestamping */
+ char reserved[59]; /* for future use */
+};
+
+
+/* queue flags */
+#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
+
+/* queue information */
+struct sndrv_seq_queue_info {
+ int queue; /* queue id */
+
+ /*
+ * security settings, only owner of this queue can start/stop timer
+ * etc. if the queue is locked for other clients
+ */
+ int owner; /* client id for owner of the queue */
+ int locked:1; /* timing queue locked for other queues */
+ char name[64]; /* name of this queue */
+ unsigned int flags; /* flags */
+ char reserved[60]; /* for future use */
+
+};
+
+/* queue info/status */
+struct sndrv_seq_queue_status {
+ int queue; /* queue id */
+ int events; /* read-only - queue size */
+ sndrv_seq_tick_time_t tick; /* current tick */
+ struct sndrv_seq_real_time time; /* current time */
+ int running; /* running state of queue */
+ int flags; /* various flags */
+ char reserved[64]; /* for the future */
+};
+
+
+/* queue tempo */
+struct sndrv_seq_queue_tempo {
+ int queue; /* sequencer queue */
+ unsigned int tempo; /* current tempo, us/tick */
+ int ppq; /* time resolution, ticks/quarter */
+ unsigned int skew_value; /* queue skew */
+ unsigned int skew_base; /* queue skew base */
+ char reserved[24]; /* for the future */
+};
+
+
+/* sequencer timer sources */
+#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
+#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
+#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
+
+/* queue timer info */
+struct sndrv_seq_queue_timer {
+ int queue; /* sequencer queue */
+ int type; /* source timer type */
+ union {
+ struct {
+ struct sndrv_timer_id id; /* ALSA's timer ID */
+ unsigned int resolution; /* resolution in Hz */
+ } alsa;
+ } u;
+ char reserved[64]; /* for the future use */
+};
+
+
+struct sndrv_seq_queue_client {
+ int queue; /* sequencer queue */
+ int client; /* sequencer client */
+ int used; /* queue is used with this client
+ (must be set for accepting events) */
+ /* per client watermarks */
+ char reserved[64]; /* for future use */
+};
+
+
+#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
+#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
+#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
+
+struct sndrv_seq_port_subscribe {
+ struct sndrv_seq_addr sender; /* sender address */
+ struct sndrv_seq_addr dest; /* destination address */
+ unsigned int voices; /* number of voices to be allocated (0 = don't care) */
+ unsigned int flags; /* modes */
+ unsigned char queue; /* input time-stamp queue (optional) */
+ unsigned char pad[3]; /* reserved */
+ char reserved[64];
+};
+
+/* type of query subscription */
+#define SNDRV_SEQ_QUERY_SUBS_READ 0
+#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
+
+struct sndrv_seq_query_subs {
+ struct sndrv_seq_addr root; /* client/port id to be searched */
+ int type; /* READ or WRITE */
+ int index; /* 0..N-1 */
+ int num_subs; /* R/O: number of subscriptions on this port */
+ struct sndrv_seq_addr addr; /* R/O: result */
+ unsigned char queue; /* R/O: result */
+ unsigned int flags; /* R/O: result */
+ char reserved[64]; /* for future use */
+};
+
+
+/*
+ * IOCTL commands
+ */
+
+#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
+#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
+#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info)
+#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info)
+
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info)
+
+#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info)
+#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info)
+#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info)
+#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info)
+
+#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe)
+
+#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner)
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer)
+/* XXX
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync)
+*/
+#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client)
+#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool)
+#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events)
+#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs)
+#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info)
+#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info)
+
+#endif /* __SOUND_ASEQUENCER_H */
diff --git a/alsa-lib/include/sound/asound.h b/alsa-lib/include/sound/asound.h
new file mode 100644
index 0000000..977b2d6
--- /dev/null
+++ b/alsa-lib/include/sound/asound.h
@@ -0,0 +1,954 @@
+/*
+ * Advanced Linux Sound Architecture - ALSA - Driver
+ * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
+ * Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __SOUND_ASOUND_H
+#define __SOUND_ASOUND_H
+
+#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
+
+#include <linux/ioctl.h>
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <linux/time.h>
+#include <asm/byteorder.h>
+
+#if __LITTLE_ENDIAN == 1234
+#define SNDRV_LITTLE_ENDIAN
+#elif __BIG_ENDIAN == 4321
+#define SNDRV_BIG_ENDIAN
+#else
+#error "Unsupported endian..."
+#endif
+
+#else /* !__KERNEL__ */
+
+#include <endian.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define SNDRV_LITTLE_ENDIAN
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define SNDRV_BIG_ENDIAN
+#else
+#error "Unsupported endian..."
+#endif
+
+#endif /* __KERNEL **/
+
+#endif /* LINUX */
+
+#ifndef __KERNEL__
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#endif
+
+/*
+ * protocol version
+ */
+
+#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
+#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
+#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
+#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
+#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
+ (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
+ (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
+ SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
+
+/****************************************************************************
+ * *
+ * Digital audio interface *
+ * *
+ ****************************************************************************/
+
+struct sndrv_aes_iec958 {
+ unsigned char status[24]; /* AES/IEC958 channel status bits */
+ unsigned char subcode[147]; /* AES/IEC958 subcode bits */
+ unsigned char pad; /* nothing */
+ unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
+};
+
+/****************************************************************************
+ * *
+ * Section for driver hardware dependent interface - /dev/snd/hw? *
+ * *
+ ****************************************************************************/
+
+#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
+enum sndrv_hwdep_iface {
+ SNDRV_HWDEP_IFACE_OPL2 = 0,
+ SNDRV_HWDEP_IFACE_OPL3,
+ SNDRV_HWDEP_IFACE_OPL4,
+ SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
+ SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
+ SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
+ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
+ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
+ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
+ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
+ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
+ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
+ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
+ SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
+
+ /* Don't forget to change the following: */
+ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC
+};
+
+struct sndrv_hwdep_info {
+ unsigned int device; /* WR: device number */
+ int card; /* R: card number */
+ unsigned char id[64]; /* ID (user selectable) */
+ unsigned char name[80]; /* hwdep name */
+ int iface; /* hwdep interface */
+ unsigned char reserved[64]; /* reserved for future */
+};
+
+/* generic DSP loader */
+struct sndrv_hwdep_dsp_status {
+ unsigned int version; /* R: driver-specific version */
+ unsigned char id[32]; /* R: driver-specific ID string */
+ unsigned int num_dsps; /* R: number of DSP images to transfer */
+ unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */
+ unsigned int chip_ready; /* R: 1 = initialization finished */
+ unsigned char reserved[16]; /* reserved for future use */
+};
+
+struct sndrv_hwdep_dsp_image {
+ unsigned int index; /* W: DSP index */
+ unsigned char name[64]; /* W: ID (e.g. file name) */
+ unsigned char *image; /* W: binary image */
+ size_t length; /* W: size of image in bytes */
+ unsigned long driver_data; /* W: driver-specific data */
+};
+
+enum {
+ SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
+ SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info),
+ SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status),
+ SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image)
+};
+
+/*****************************************************************************
+ * *
+ * Digital Audio (PCM) interface - /dev/snd/pcm?? *
+ * *
+ *****************************************************************************/
+
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
+
+typedef unsigned long sndrv_pcm_uframes_t;
+typedef long sndrv_pcm_sframes_t;
+
+enum sndrv_pcm_class {
+ SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
+ SNDRV_PCM_CLASS_MULTI, /* multichannel device */
+ SNDRV_PCM_CLASS_MODEM, /* software modem class */
+ SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
+ /* Don't forget to change the following: */
+ SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
+};
+
+enum sndrv_pcm_subclass {
+ SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
+ SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
+ /* Don't forget to change the following: */
+ SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
+};
+
+enum sndrv_pcm_stream {
+ SNDRV_PCM_STREAM_PLAYBACK = 0,
+ SNDRV_PCM_STREAM_CAPTURE,
+ SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
+};
+
+enum sndrv_pcm_access {
+ SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */
+ SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */
+ SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */
+ SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */
+ SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */
+ SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED,
+};
+
+enum sndrv_pcm_format {
+ SNDRV_PCM_FORMAT_S8 = 0,
+ SNDRV_PCM_FORMAT_U8,
+ SNDRV_PCM_FORMAT_S16_LE,
+ SNDRV_PCM_FORMAT_S16_BE,
+ SNDRV_PCM_FORMAT_U16_LE,
+ SNDRV_PCM_FORMAT_U16_BE,
+ SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */
+ SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */
+ SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */
+ SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */
+ SNDRV_PCM_FORMAT_S32_LE,
+ SNDRV_PCM_FORMAT_S32_BE,
+ SNDRV_PCM_FORMAT_U32_LE,
+ SNDRV_PCM_FORMAT_U32_BE,
+ SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+ SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+ SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+ SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+ SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */
+ SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */
+ SNDRV_PCM_FORMAT_MU_LAW,
+ SNDRV_PCM_FORMAT_A_LAW,
+ SNDRV_PCM_FORMAT_IMA_ADPCM,
+ SNDRV_PCM_FORMAT_MPEG,
+ SNDRV_PCM_FORMAT_GSM,
+ SNDRV_PCM_FORMAT_SPECIAL = 31,
+ SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */
+ SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */
+ SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */
+ SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */
+ SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */
+ SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
+
+#ifdef SNDRV_LITTLE_ENDIAN
+ SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE,
+ SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE,
+ SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE,
+ SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE,
+ SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE,
+ SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE,
+ SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE,
+ SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE,
+ SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE,
+#endif
+#ifdef SNDRV_BIG_ENDIAN
+ SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE,
+ SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE,
+ SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE,
+ SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE,
+ SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE,
+ SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE,
+ SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE,
+ SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE,
+ SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,
+#endif
+};
+
+enum sndrv_pcm_subformat {
+ SNDRV_PCM_SUBFORMAT_STD = 0,
+ SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD,
+};
+
+#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
+#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
+#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
+#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
+#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
+#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
+#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
+#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
+#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
+#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
+#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
+#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
+#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
+#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
+
+enum sndrv_pcm_state {
+ SNDRV_PCM_STATE_OPEN = 0, /* stream is open */
+ SNDRV_PCM_STATE_SETUP, /* stream has a setup */
+ SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */
+ SNDRV_PCM_STATE_RUNNING, /* stream is running */
+ SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */
+ SNDRV_PCM_STATE_DRAINING, /* stream is draining */
+ SNDRV_PCM_STATE_PAUSED, /* stream is paused */
+ SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */
+ SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */
+ SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED,
+};
+
+enum {
+ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
+ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
+ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
+};
+
+union sndrv_pcm_sync_id {
+ unsigned char id[16];
+ unsigned short id16[8];
+ unsigned int id32[4];
+};
+
+struct sndrv_pcm_info {
+ unsigned int device; /* RO/WR (control): device number */
+ unsigned int subdevice; /* RO/WR (control): subdevice number */
+ int stream; /* RO/WR (control): stream number */
+ int card; /* R: card number */
+ unsigned char id[64]; /* ID (user selectable) */
+ unsigned char name[80]; /* name of this device */
+ unsigned char subname[32]; /* subdevice name */
+ int dev_class; /* SNDRV_PCM_CLASS_* */
+ int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
+ unsigned int subdevices_count;
+ unsigned int subdevices_avail;
+ union sndrv_pcm_sync_id sync; /* hardware synchronization ID */
+ unsigned char reserved[64]; /* reserved for future... */
+};
+
+enum sndrv_pcm_hw_param {
+ SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */
+ SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS,
+ SNDRV_PCM_HW_PARAM_FORMAT, /* Format */
+ SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */
+ SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT,
+
+ SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */
+ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
+ SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */
+ SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */
+ SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */
+ SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts
+ in us */
+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */
+ SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */
+ SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */
+ SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */
+ SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */
+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */
+ SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */
+ SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
+};
+
+#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
+#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
+
+struct sndrv_interval {
+ unsigned int min, max;
+ unsigned int openmin:1,
+ openmax:1,
+ integer:1,
+ empty:1;
+};
+
+#define SNDRV_MASK_MAX 256
+
+struct sndrv_mask {
+ u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
+};
+
+struct sndrv_pcm_hw_params {
+ unsigned int flags;
+ struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
+ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+ struct sndrv_mask mres[5]; /* reserved masks */
+ struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
+ SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
+ struct sndrv_interval ires[9]; /* reserved intervals */
+ unsigned int rmask; /* W: requested masks */
+ unsigned int cmask; /* R: changed masks */
+ unsigned int info; /* R: Info flags for returned setup */
+ unsigned int msbits; /* R: used most significant bits */
+ unsigned int rate_num; /* R: rate numerator */
+ unsigned int rate_den; /* R: rate denominator */
+ sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
+ unsigned char reserved[64]; /* reserved for future */
+};
+
+enum sndrv_pcm_tstamp {
+ SNDRV_PCM_TSTAMP_NONE = 0,
+ SNDRV_PCM_TSTAMP_ENABLE,
+ SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE,
+};
+
+struct sndrv_pcm_sw_params {
+ int tstamp_mode; /* timestamp mode */
+ unsigned int period_step;
+ unsigned int sleep_min; /* min ticks to sleep */
+ sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */
+ sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
+ sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
+ sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
+ sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
+ sndrv_pcm_uframes_t silence_size; /* silence block size */
+ sndrv_pcm_uframes_t boundary; /* pointers wrap point */
+ unsigned char reserved[60]; /* reserved for future */
+ unsigned int period_event; /* for alsa-lib implementation */
+};
+
+struct sndrv_pcm_channel_info {
+ unsigned int channel;
+ off_t offset; /* mmap offset */
+ unsigned int first; /* offset to first sample in bits */
+ unsigned int step; /* samples distance in bits */
+};
+
+struct sndrv_pcm_status {
+ int state; /* stream state */
+ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
+ struct timespec tstamp; /* reference timestamp */
+ sndrv_pcm_uframes_t appl_ptr; /* appl ptr */
+ sndrv_pcm_uframes_t hw_ptr; /* hw ptr */
+ sndrv_pcm_sframes_t delay; /* current delay in frames */
+ sndrv_pcm_uframes_t avail; /* number of frames available */
+ sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */
+ sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
+ int suspended_state; /* suspended stream state */
+ unsigned char reserved[60]; /* must be filled with zero */
+};
+
+struct sndrv_pcm_mmap_status {
+ int state; /* RO: state - SNDRV_PCM_STATE_XXXX */
+ int pad1; /* Needed for 64 bit alignment */
+ sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
+ struct timespec tstamp; /* Timestamp */
+ int suspended_state; /* RO: suspended stream state */
+};
+
+struct sndrv_pcm_mmap_control {
+ sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
+ sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
+};
+
+#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
+#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
+
+struct sndrv_pcm_sync_ptr {
+ unsigned int flags;
+ union {
+ struct sndrv_pcm_mmap_status status;
+ unsigned char reserved[64];
+ } s;
+ union {
+ struct sndrv_pcm_mmap_control control;
+ unsigned char reserved[64];
+ } c;
+};
+
+struct sndrv_xferi {
+ sndrv_pcm_sframes_t result;
+ void *buf;
+ sndrv_pcm_uframes_t frames;
+};
+
+struct sndrv_xfern {
+ sndrv_pcm_sframes_t result;
+ void **bufs;
+ sndrv_pcm_uframes_t frames;
+};
+
+
+enum {
+ SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
+ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
+};
+
+enum {
+ SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
+ SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info),
+ SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
+ SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int),
+ SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params),
+ SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params),
+ SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
+ SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params),
+ SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status),
+ SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t),
+ SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
+ SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr),
+ SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info),
+ SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
+ SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
+ SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
+ SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
+ SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
+ SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
+ SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t),
+ SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
+ SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
+ SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t),
+ SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi),
+ SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi),
+ SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern),
+ SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern),
+ SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
+ SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
+};
+
+/* Trick to make alsa-lib/acinclude.m4 happy */
+#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
+
+/*****************************************************************************
+ * *
+ * MIDI v1.0 interface *
+ * *
+ *****************************************************************************/
+
+/*
+ * Raw MIDI section - /dev/snd/midi??
+ */
+
+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
+
+enum sndrv_rawmidi_stream {
+ SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
+ SNDRV_RAWMIDI_STREAM_INPUT,
+ SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
+};
+
+#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
+#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
+#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
+
+struct sndrv_rawmidi_info {
+ unsigned int device; /* RO/WR (control): device number */
+ unsigned int subdevice; /* RO/WR (control): subdevice number */
+ int stream; /* WR: stream */
+ int card; /* R: card number */
+ unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
+ unsigned char id[64]; /* ID (user selectable) */
+ unsigned char name[80]; /* name of device */
+ unsigned char subname[32]; /* name of active or selected subdevice */
+ unsigned int subdevices_count;
+ unsigned int subdevices_avail;
+ unsigned char reserved[64]; /* reserved for future use */
+};
+
+struct sndrv_rawmidi_params {
+ int stream;
+ size_t buffer_size; /* queue size in bytes */
+ size_t avail_min; /* minimum avail bytes for wakeup */
+ unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
+ unsigned char reserved[16]; /* reserved for future use */
+};
+
+struct sndrv_rawmidi_status {
+ int stream;
+ struct timespec tstamp; /* Timestamp */
+ size_t avail; /* available bytes */
+ size_t xruns; /* count of overruns since last status (in bytes) */
+ unsigned char reserved[16]; /* reserved for future use */
+};
+
+enum {
+ SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
+ SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info),
+ SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params),
+ SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status),
+ SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
+ SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
+};
+
+/*
+ * Timer section - /dev/snd/timer
+ */
+
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
+
+enum sndrv_timer_class {
+ SNDRV_TIMER_CLASS_NONE = -1,
+ SNDRV_TIMER_CLASS_SLAVE = 0,
+ SNDRV_TIMER_CLASS_GLOBAL,
+ SNDRV_TIMER_CLASS_CARD,
+ SNDRV_TIMER_CLASS_PCM,
+ SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
+};
+
+/* slave timer classes */
+enum sndrv_timer_slave_class {
+ SNDRV_TIMER_SCLASS_NONE = 0,
+ SNDRV_TIMER_SCLASS_APPLICATION,
+ SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
+ SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
+ SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
+};
+
+/* global timers (device member) */
+#define SNDRV_TIMER_GLOBAL_SYSTEM 0
+#define SNDRV_TIMER_GLOBAL_RTC 1
+#define SNDRV_TIMER_GLOBAL_HPET 2
+
+/* info flags */
+#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
+
+struct sndrv_timer_id {
+ int dev_class;
+ int dev_sclass;
+ int card;
+ int device;
+ int subdevice;
+};
+
+struct sndrv_timer_ginfo {
+ struct sndrv_timer_id tid; /* requested timer ID */
+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
+ int card; /* card number */
+ unsigned char id[64]; /* timer identification */
+ unsigned char name[80]; /* timer name */
+ unsigned long reserved0; /* reserved for future use */
+ unsigned long resolution; /* average period resolution in ns */
+ unsigned long resolution_min; /* minimal period resolution in ns */
+ unsigned long resolution_max; /* maximal period resolution in ns */
+ unsigned int clients; /* active timer clients */
+ unsigned char reserved[32];
+};
+
+struct sndrv_timer_gparams {
+ struct sndrv_timer_id tid; /* requested timer ID */
+ unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
+ unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
+ unsigned char reserved[32];
+};
+
+struct sndrv_timer_gstatus {
+ struct sndrv_timer_id tid; /* requested timer ID */
+ unsigned long resolution; /* current period resolution in ns */
+ unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
+ unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
+ unsigned char reserved[32];
+};
+
+struct sndrv_timer_select {
+ struct sndrv_timer_id id; /* bind to timer ID */
+ unsigned char reserved[32]; /* reserved */
+};
+
+struct sndrv_timer_info {
+ unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
+ int card; /* card number */
+ unsigned char id[64]; /* timer identificator */
+ unsigned char name[80]; /* timer name */
+ unsigned long reserved0; /* reserved for future use */
+ unsigned long resolution; /* average period resolution in ns */
+ unsigned char reserved[64]; /* reserved */
+};
+
+#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */
+#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
+#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
+
+struct sndrv_timer_params {
+ unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
+ unsigned int ticks; /* requested resolution in ticks */
+ unsigned int queue_size; /* total size of queue (32-1024) */
+ unsigned int reserved0; /* reserved, was: failure locations */
+ unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */
+ unsigned char reserved[60]; /* reserved */
+};
+
+struct sndrv_timer_status {
+ struct timespec tstamp; /* Timestamp - last update */
+ unsigned int resolution; /* current period resolution in ns */
+ unsigned int lost; /* counter of master tick lost */
+ unsigned int overrun; /* count of read queue overruns */
+ unsigned int queue; /* used queue size */
+ unsigned char reserved[64]; /* reserved */
+};
+
+enum {
+ SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
+ SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id),
+ SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
+ SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo),
+ SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams),
+ SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus),
+ SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select),
+ SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info),
+ SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params),
+ SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status),
+ /* The following four ioctls are changed since 1.0.9 due to confliction */
+ SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
+ SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
+ SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2),
+ SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
+};
+
+struct sndrv_timer_read {
+ unsigned int resolution;
+ unsigned int ticks;
+};
+
+enum sndrv_timer_event {
+ SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
+ SNDRV_TIMER_EVENT_TICK, /* val = ticks */
+ SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
+ SNDRV_TIMER_EVENT_STOP, /* val = 0 */
+ SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
+ SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */
+ SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */
+ SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */
+ SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */
+ /* master timer events for slave timer instances */
+ SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
+ SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
+ SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10,
+ SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10,
+ SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10,
+ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
+};
+
+struct sndrv_timer_tread {
+ int event;
+ struct timespec tstamp;
+ unsigned int val;
+};
+
+/****************************************************************************
+ * *
+ * Section for driver control interface - /dev/snd/control? *
+ * *
+ ****************************************************************************/
+
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
+
+struct sndrv_ctl_card_info {
+ int card; /* card number */
+ int pad; /* reserved for future (was type) */
+ unsigned char id[16]; /* ID of card (user selectable) */
+ unsigned char driver[16]; /* Driver name */
+ unsigned char name[32]; /* Short name of soundcard */
+ unsigned char longname[80]; /* name + info text about soundcard */
+ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
+ unsigned char mixername[80]; /* visual mixer identification */
+ unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
+};
+
+enum sndrv_ctl_elem_type {
+ SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */
+ SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */
+ SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */
+ SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */
+ SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */
+ SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */
+ SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */
+ SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64,
+};
+
+enum sndrv_ctl_elem_iface {
+ SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */
+ SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */
+ SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */
+ SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */
+ SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */
+ SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */
+ SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */
+ SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
+};
+
+#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
+#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
+#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is supported */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is supported */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
+#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
+#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
+#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
+#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* flag only for kernel */
+#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
+/* bits 30 and 31 are obsoleted (for indirect access) */
+
+/* for further details see the ACPI and PCI power management specification */
+#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
+#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
+#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
+#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
+#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
+#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
+
+struct sndrv_ctl_elem_id {
+ unsigned int numid; /* numeric identifier, zero = invalid */
+ int iface; /* interface identifier */
+ unsigned int device; /* device/client number */
+ unsigned int subdevice; /* subdevice (substream) number */
+ unsigned char name[44]; /* ASCII name of item */
+ unsigned int index; /* index of item */
+};
+
+struct sndrv_ctl_elem_list {
+ unsigned int offset; /* W: first element ID to get */
+ unsigned int space; /* W: count of element IDs to get */
+ unsigned int used; /* R: count of element IDs set */
+ unsigned int count; /* R: count of all elements */
+ struct sndrv_ctl_elem_id *pids; /* R: IDs */
+ unsigned char reserved[50];
+};
+
+struct sndrv_ctl_elem_info {
+ struct sndrv_ctl_elem_id id; /* W: element ID */
+ int type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
+ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
+ unsigned int count; /* count of values */
+ pid_t owner; /* owner's PID of this control */
+ union {
+ struct {
+ long min; /* R: minimum value */
+ long max; /* R: maximum value */
+ long step; /* R: step (0 variable) */
+ } integer;
+ struct {
+ long long min; /* R: minimum value */
+ long long max; /* R: maximum value */
+ long long step; /* R: step (0 variable) */
+ } integer64;
+ struct {
+ unsigned int items; /* R: number of items */
+ unsigned int item; /* W: item number */
+ char name[64]; /* R: value name */
+ } enumerated;
+ unsigned char reserved[128];
+ } value;
+ union {
+ unsigned short d[4]; /* dimensions */
+ unsigned short *d_ptr; /* (obsolete) indirect */
+ } dimen;
+ unsigned char reserved[64-4*sizeof(unsigned short)];
+};
+
+struct sndrv_ctl_elem_value {
+ struct sndrv_ctl_elem_id id; /* W: element ID */
+ unsigned int indirect: 1; /* (obsolete) W: use indirect pointer (xxx_ptr member) */
+ union {
+ union {
+ long value[128];
+ long *value_ptr; /* obsolete */
+ } integer;
+ union {
+ long long value[64];
+ long long *value_ptr; /* obsolete */
+ } integer64;
+ union {
+ unsigned int item[128];
+ unsigned int *item_ptr; /* obsolete */
+ } enumerated;
+ union {
+ unsigned char data[512];
+ unsigned char *data_ptr; /* obsolete */
+ } bytes;
+ struct sndrv_aes_iec958 iec958;
+ } value; /* RO */
+ struct timespec tstamp;
+ unsigned char reserved[128-sizeof(struct timespec)];
+};
+
+struct sndrv_ctl_tlv {
+ unsigned int numid; /* control element numeric identification */
+ unsigned int length; /* in bytes aligned to 4 */
+ unsigned int tlv[0]; /* first TLV */
+};
+
+enum {
+ SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
+ SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info),
+ SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list),
+ SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info),
+ SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value),
+ SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value),
+ SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id),
+ SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id),
+ SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
+ SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info),
+ SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info),
+ SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id),
+ SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct sndrv_ctl_tlv),
+ SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct sndrv_ctl_tlv),
+ SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct sndrv_ctl_tlv),
+ SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
+ SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info),
+ SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
+ SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info),
+ SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
+ SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
+ SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info),
+ SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
+ SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
+ SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
+};
+
+/*
+ * Read interface.
+ */
+
+enum sndrv_ctl_event_type {
+ SNDRV_CTL_EVENT_ELEM = 0,
+ SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
+};
+
+#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
+#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
+#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
+#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
+
+struct sndrv_ctl_event {
+ int type; /* event type - SNDRV_CTL_EVENT_* */
+ union {
+ struct {
+ unsigned int mask;
+ struct sndrv_ctl_elem_id id;
+ } elem;
+ unsigned char data8[60];
+ } data;
+};
+
+/*
+ * Control names
+ */
+
+#define SNDRV_CTL_NAME_NONE ""
+#define SNDRV_CTL_NAME_PLAYBACK "Playback "
+#define SNDRV_CTL_NAME_CAPTURE "Capture "
+
+#define SNDRV_CTL_NAME_IEC958_NONE ""
+#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
+#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
+#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
+#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
+#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
+#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
+#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
+#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
+
+/*
+ *
+ */
+
+struct sndrv_xferv {
+ const struct iovec *vector;
+ unsigned long count;
+};
+
+enum {
+ SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv),
+ SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv),
+};
+
+#endif /* __SOUND_ASOUND_H */
diff --git a/alsa-lib/include/sound/asound_fm.h b/alsa-lib/include/sound/asound_fm.h
new file mode 100644
index 0000000..c2a4b96
--- /dev/null
+++ b/alsa-lib/include/sound/asound_fm.h
@@ -0,0 +1,134 @@
+#ifndef __SOUND_ASOUND_FM_H
+#define __SOUND_ASOUND_FM_H
+
+/*
+ * Advanced Linux Sound Architecture - ALSA
+ *
+ * Interface file between ALSA driver & user space
+ * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
+ * 4Front Technologies
+ *
+ * Direct FM control
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define SNDRV_DM_FM_MODE_OPL2 0x00
+#define SNDRV_DM_FM_MODE_OPL3 0x01
+
+struct snd_dm_fm_info {
+ unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
+ unsigned char rhythm; /* percussion mode flag */
+};
+
+/*
+ * Data structure composing an FM "note" or sound event.
+ */
+
+struct snd_dm_fm_voice {
+ unsigned char op; /* operator cell (0 or 1) */
+ unsigned char voice; /* FM voice (0 to 17) */
+
+ unsigned char am; /* amplitude modulation */
+ unsigned char vibrato; /* vibrato effect */
+ unsigned char do_sustain; /* sustain phase */
+ unsigned char kbd_scale; /* keyboard scaling */
+ unsigned char harmonic; /* 4 bits: harmonic and multiplier */
+ unsigned char scale_level; /* 2 bits: decrease output freq rises */
+ unsigned char volume; /* 6 bits: volume */
+
+ unsigned char attack; /* 4 bits: attack rate */
+ unsigned char decay; /* 4 bits: decay rate */
+ unsigned char sustain; /* 4 bits: sustain level */
+ unsigned char release; /* 4 bits: release rate */
+
+ unsigned char feedback; /* 3 bits: feedback for op0 */
+ unsigned char connection; /* 0 for serial, 1 for parallel */
+ unsigned char left; /* stereo left */
+ unsigned char right; /* stereo right */
+ unsigned char waveform; /* 3 bits: waveform shape */
+};
+
+/*
+ * This describes an FM note by its voice, octave, frequency number (10bit)
+ * and key on/off.
+ */
+
+struct snd_dm_fm_note {
+ unsigned char voice; /* 0-17 voice channel */
+ unsigned char octave; /* 3 bits: what octave to play */
+ unsigned int fnum; /* 10 bits: frequency number */
+ unsigned char key_on; /* set for active, clear for silent */
+};
+
+/*
+ * FM parameters that apply globally to all voices, and thus are not "notes"
+ */
+
+struct snd_dm_fm_params {
+ unsigned char am_depth; /* amplitude modulation depth (1=hi) */
+ unsigned char vib_depth; /* vibrato depth (1=hi) */
+ unsigned char kbd_split; /* keyboard split */
+ unsigned char rhythm; /* percussion mode select */
+
+ /* This block is the percussion instrument data */
+ unsigned char bass;
+ unsigned char snare;
+ unsigned char tomtom;
+ unsigned char cymbal;
+ unsigned char hihat;
+};
+
+/*
+ * FM mode ioctl settings
+ */
+
+#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
+#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
+#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
+#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
+#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
+#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
+/* for OPL3 only */
+#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
+/* SBI patch management */
+#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
+
+#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
+#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
+#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
+#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
+#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
+#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
+
+/*
+ * Patch Record - fixed size for write
+ */
+
+#define FM_KEY_SBI "SBI\032"
+#define FM_KEY_2OP "2OP\032"
+#define FM_KEY_4OP "4OP\032"
+
+struct sbi_patch {
+ unsigned char prog;
+ unsigned char bank;
+ char key[4];
+ char name[25];
+ char extension[7];
+ unsigned char data[32];
+};
+
+#endif /* __SOUND_ASOUND_FM_H */
diff --git a/alsa-lib/include/sound/asoundef.h b/alsa-lib/include/sound/asoundef.h
new file mode 100644
index 0000000..f962c5a
--- /dev/null
+++ b/alsa-lib/include/sound/asoundef.h
@@ -0,0 +1,227 @@
+#ifndef __SOUND_ASOUNDEF_H
+#define __SOUND_ASOUNDEF_H
+
+/*
+ * Advanced Linux Sound Architecture - ALSA - Driver
+ * Copyright (c) 1994-2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/****************************************************************************
+ * *
+ * Digital audio interface *
+ * *
+ ****************************************************************************/
+
+/* AES/IEC958 channel status bits */
+#define IEC958_AES0_PROFESSIONAL (1<<0) /* 0 = consumer, 1 = professional */
+#define IEC958_AES0_NONAUDIO (1<<1) /* 0 = audio, 1 = non-audio */
+#define IEC958_AES0_PRO_EMPHASIS (7<<2) /* mask - emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /* emphasis not indicated */
+#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /* none emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /* 50/15us emphasis */
+#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /* CCITT J.17 emphasis */
+#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /* source sample frequency: 0 = locked, 1 = unlocked */
+#define IEC958_AES0_PRO_FS (3<<6) /* mask - sample frequency */
+#define IEC958_AES0_PRO_FS_NOTID (0<<6) /* fs not indicated */
+#define IEC958_AES0_PRO_FS_44100 (1<<6) /* 44.1kHz */
+#define IEC958_AES0_PRO_FS_48000 (2<<6) /* 48kHz */
+#define IEC958_AES0_PRO_FS_32000 (3<<6) /* 32kHz */
+#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /* 0 = copyright, 1 = not copyright */
+#define IEC958_AES0_CON_EMPHASIS (7<<3) /* mask - emphasis */
+#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /* none emphasis */
+#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /* 50/15us emphasis */
+#define IEC958_AES0_CON_MODE (3<<6) /* mask - mode */
+#define IEC958_AES1_PRO_MODE (15<<0) /* mask - channel mode */
+#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /* not indicated */
+#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /* stereophonic - ch A is left */
+#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /* single channel */
+#define IEC958_AES1_PRO_MODE_TWO (8<<0) /* two channels */
+#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /* primary/secondary */
+#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /* vector to byte 3 */
+#define IEC958_AES1_PRO_USERBITS (15<<4) /* mask - user bits */
+#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /* not indicated */
+#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /* 192-bit structure */
+#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */
+#define IEC958_AES1_CON_CATEGORY 0x7f
+#define IEC958_AES1_CON_GENERAL 0x00
+#define IEC958_AES1_CON_EXPERIMENTAL 0x40
+#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
+#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
+#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
+#define IEC958_AES1_CON_BROADCAST1_ID 0x04
+#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
+#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
+#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
+#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x06
+#define IEC958_AES1_CON_ADC_MASK 0x1f
+#define IEC958_AES1_CON_ADC_ID 0x16
+#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
+#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
+#define IEC958_AES1_CON_LASEROPT_MASK 0x07
+#define IEC958_AES1_CON_LASEROPT_ID 0x01
+#define IEC958_AES1_CON_MUSICAL_MASK 0x07
+#define IEC958_AES1_CON_MUSICAL_ID 0x05
+#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
+#define IEC958_AES1_CON_MAGNETIC_ID 0x03
+#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00)
+#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08)
+#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00)
+#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
+#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10)
+#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18)
+#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00)
+#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08)
+#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00)
+#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08)
+#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */
+#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */
+#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */
+#define IEC958_AES2_PRO_SBITS_24 (4<<0) /* 24-bit - main audio */
+#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /* user defined application */
+#define IEC958_AES2_PRO_WORDLEN (7<<3) /* mask - source word length */
+#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /* not indicated */
+#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /* 22-bit or 18-bit */
+#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /* 23-bit or 19-bit */
+#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /* 24-bit or 20-bit */
+#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /* 20-bit or 16-bit */
+#define IEC958_AES2_CON_SOURCE (15<<0) /* mask - source number */
+#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /* unspecified */
+#define IEC958_AES2_CON_CHANNEL (15<<4) /* mask - channel number */
+#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */
+#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */
+#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */
+#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */
+#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */
+#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */
+#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */
+#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */
+#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /* variable pitch */
+
+/*****************************************************************************
+ * *
+ * MIDI v1.0 interface *
+ * *
+ *****************************************************************************/
+
+#define MIDI_CHANNELS 16
+#define MIDI_GM_DRUM_CHANNEL (10-1)
+
+/*
+ * MIDI commands
+ */
+
+#define MIDI_CMD_NOTE_OFF 0x80
+#define MIDI_CMD_NOTE_ON 0x90
+#define MIDI_CMD_NOTE_PRESSURE 0xa0
+#define MIDI_CMD_CONTROL 0xb0
+#define MIDI_CMD_PGM_CHANGE 0xc0
+#define MIDI_CMD_CHANNEL_PRESSURE 0xd0
+#define MIDI_CMD_BENDER 0xe0
+
+#define MIDI_CMD_COMMON_SYSEX 0xf0
+#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1
+#define MIDI_CMD_COMMON_SONG_POS 0xf2
+#define MIDI_CMD_COMMON_SONG_SELECT 0xf3
+#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6
+#define MIDI_CMD_COMMON_SYSEX_END 0xf7
+#define MIDI_CMD_COMMON_CLOCK 0xf8
+#define MIDI_CMD_COMMON_START 0xfa
+#define MIDI_CMD_COMMON_CONTINUE 0xfb
+#define MIDI_CMD_COMMON_STOP 0xfc
+#define MIDI_CMD_COMMON_SENSING 0xfe
+#define MIDI_CMD_COMMON_RESET 0xff
+
+/*
+ * MIDI controllers
+ */
+
+#define MIDI_CTL_MSB_BANK 0x00
+#define MIDI_CTL_MSB_MODWHEEL 0x01
+#define MIDI_CTL_MSB_BREATH 0x02
+#define MIDI_CTL_MSB_FOOT 0x04
+#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05
+#define MIDI_CTL_MSB_DATA_ENTRY 0x06
+#define MIDI_CTL_MSB_MAIN_VOLUME 0x07
+#define MIDI_CTL_MSB_BALANCE 0x08
+#define MIDI_CTL_MSB_PAN 0x0a
+#define MIDI_CTL_MSB_EXPRESSION 0x0b
+#define MIDI_CTL_MSB_EFFECT1 0x0c
+#define MIDI_CTL_MSB_EFFECT2 0x0d
+#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10
+#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11
+#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12
+#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13
+#define MIDI_CTL_LSB_BANK 0x20
+#define MIDI_CTL_LSB_MODWHEEL 0x21
+#define MIDI_CTL_LSB_BREATH 0x22
+#define MIDI_CTL_LSB_FOOT 0x24
+#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25
+#define MIDI_CTL_LSB_DATA_ENTRY 0x26
+#define MIDI_CTL_LSB_MAIN_VOLUME 0x27
+#define MIDI_CTL_LSB_BALANCE 0x28
+#define MIDI_CTL_LSB_PAN 0x2a
+#define MIDI_CTL_LSB_EXPRESSION 0x2b
+#define MIDI_CTL_LSB_EFFECT1 0x2c
+#define MIDI_CTL_LSB_EFFECT2 0x2d
+#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30
+#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31
+#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32
+#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33
+#define MIDI_CTL_SUSTAIN 0x40
+#define MIDI_CTL_PORTAMENTO 0x41
+#define MIDI_CTL_SUSTENUTO 0x42
+#define MIDI_CTL_SOFT_PEDAL 0x43
+#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44
+#define MIDI_CTL_HOLD2 0x45
+#define MIDI_CTL_SC1_SOUND_VARIATION 0x46
+#define MIDI_CTL_SC2_TIMBRE 0x47
+#define MIDI_CTL_SC3_RELEASE_TIME 0x48
+#define MIDI_CTL_SC4_ATTACK_TIME 0x49
+#define MIDI_CTL_SC5_BRIGHTNESS 0x4a
+#define MIDI_CTL_SC6 0x4b
+#define MIDI_CTL_SC7 0x4c
+#define MIDI_CTL_SC8 0x4d
+#define MIDI_CTL_SC9 0x4e
+#define MIDI_CTL_SC10 0x4f
+#define MIDI_CTL_GENERAL_PURPOSE5 0x50
+#define MIDI_CTL_GENERAL_PURPOSE6 0x51
+#define MIDI_CTL_GENERAL_PURPOSE7 0x52
+#define MIDI_CTL_GENERAL_PURPOSE8 0x53
+#define MIDI_CTL_PORTAMENTO_CONTROL 0x54
+#define MIDI_CTL_E1_REVERB_DEPTH 0x5b
+#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c
+#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d
+#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e
+#define MIDI_CTL_E5_PHASER_DEPTH 0x5f
+#define MIDI_CTL_DATA_INCREMENT 0x60
+#define MIDI_CTL_DATA_DECREMENT 0x61
+#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62
+#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63
+#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64
+#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65
+#define MIDI_CTL_ALL_SOUNDS_OFF 0x78
+#define MIDI_CTL_RESET_CONTROLLERS 0x79
+#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a
+#define MIDI_CTL_ALL_NOTES_OFF 0x7b
+#define MIDI_CTL_OMNI_OFF 0x7c
+#define MIDI_CTL_OMNI_ON 0x7d
+#define MIDI_CTL_MONO1 0x7e
+#define MIDI_CTL_MONO2 0x7f
+
+#endif /* __SOUND_ASOUNDEF_H */
diff --git a/alsa-lib/include/sound/emu10k1.h b/alsa-lib/include/sound/emu10k1.h
new file mode 100644
index 0000000..94018b7
--- /dev/null
+++ b/alsa-lib/include/sound/emu10k1.h
@@ -0,0 +1,349 @@
+#ifndef __SOUND_EMU10K1_H
+#define __SOUND_EMU10K1_H
+
+/*
+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
+ * Creative Labs, Inc.
+ * Definitions for EMU10K1 (SB Live!) chips
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdint.h>
+
+/*
+ * ---- FX8010 ----
+ */
+
+#define EMU10K1_CARD_CREATIVE 0x00000000
+#define EMU10K1_CARD_EMUAPS 0x00000001
+
+#define EMU10K1_FX8010_PCM_COUNT 8
+
+/* instruction set */
+#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
+#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
+#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
+#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
+#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
+#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
+#define iACC3 0x06 /* R = A + X + Y ; saturation */
+#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
+#define iANDXOR 0x08 /* R = (A & X) ^ Y */
+#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
+#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
+#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
+#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
+#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
+#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
+#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
+
+/* GPRs */
+#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
+#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
+#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f */
+#define C_00000000 0x40
+#define C_00000001 0x41
+#define C_00000002 0x42
+#define C_00000003 0x43
+#define C_00000004 0x44
+#define C_00000008 0x45
+#define C_00000010 0x46
+#define C_00000020 0x47
+#define C_00000100 0x48
+#define C_00010000 0x49
+#define C_00080000 0x4a
+#define C_10000000 0x4b
+#define C_20000000 0x4c
+#define C_40000000 0x4d
+#define C_80000000 0x4e
+#define C_7fffffff 0x4f
+#define C_ffffffff 0x50
+#define C_fffffffe 0x51
+#define C_c0000000 0x52
+#define C_4f1bbcdc 0x53
+#define C_5a7ef9db 0x54
+#define C_00100000 0x55 /* ?? */
+#define GPR_ACCU 0x56 /* ACCUM, accumulator */
+#define GPR_COND 0x57 /* CCR, condition register */
+#define GPR_NOISE0 0x58 /* noise source */
+#define GPR_NOISE1 0x59 /* noise source */
+#define GPR_IRQ 0x5a /* IRQ register */
+#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
+#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
+#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
+#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
+
+#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f? */
+#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x1f? */
+#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f? */
+#define A_GPR(x) (A_FXGPREGBASE + (x))
+
+/* cc_reg constants */
+#define CC_REG_NORMALIZED C_00000001
+#define CC_REG_BORROW C_00000002
+#define CC_REG_MINUS C_00000004
+#define CC_REG_ZERO C_00000008
+#define CC_REG_SATURATE C_00000010
+#define CC_REG_NONZERO C_00000100
+
+/* FX buses */
+#define FXBUS_PCM_LEFT 0x00
+#define FXBUS_PCM_RIGHT 0x01
+#define FXBUS_PCM_LEFT_REAR 0x02
+#define FXBUS_PCM_RIGHT_REAR 0x03
+#define FXBUS_MIDI_LEFT 0x04
+#define FXBUS_MIDI_RIGHT 0x05
+#define FXBUS_PCM_CENTER 0x06
+#define FXBUS_PCM_LFE 0x07
+#define FXBUS_PCM_LEFT_FRONT 0x08
+#define FXBUS_PCM_RIGHT_FRONT 0x09
+#define FXBUS_MIDI_REVERB 0x0c
+#define FXBUS_MIDI_CHORUS 0x0d
+#define FXBUS_PCM_LEFT_SIDE 0x0e
+#define FXBUS_PCM_RIGHT_SIDE 0x0f
+#define FXBUS_PT_LEFT 0x14
+#define FXBUS_PT_RIGHT 0x15
+
+/* Inputs */
+#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
+#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
+#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
+#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
+#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
+#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
+#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
+#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
+#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
+#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
+#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
+#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
+#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
+#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
+
+/* Outputs */
+#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
+#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
+#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
+#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
+#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
+#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
+#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
+#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
+#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
+#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
+#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
+#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
+#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
+#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
+#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
+#define EXTOUT_ACENTER 0x11 /* Analog Center */
+#define EXTOUT_ALFE 0x12 /* Analog LFE */
+
+/* Audigy Inputs */
+#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
+#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
+#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
+#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
+#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
+#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
+#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
+#define A_EXTIN_LINE2_R 0x09 /* right */
+#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
+#define A_EXTIN_ADC_R 0x0b /* right */
+#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
+#define A_EXTIN_AUX2_R 0x0d /* - right */
+
+/* Audigiy Outputs */
+#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
+#define A_EXTOUT_FRONT_R 0x01 /* right */
+#define A_EXTOUT_CENTER 0x02 /* digital front center */
+#define A_EXTOUT_LFE 0x03 /* digital front lfe */
+#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
+#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
+#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
+#define A_EXTOUT_REAR_R 0x07 /* right */
+#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
+#define A_EXTOUT_AFRONT_R 0x09 /* right */
+#define A_EXTOUT_ACENTER 0x0a /* analog center */
+#define A_EXTOUT_ALFE 0x0b /* analog LFE */
+#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
+#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
+#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
+#define A_EXTOUT_AREAR_R 0x0f /* right */
+#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
+#define A_EXTOUT_AC97_R 0x11 /* right */
+#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
+#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
+#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
+
+/* Audigy constants */
+#define A_C_00000000 0xc0
+#define A_C_00000001 0xc1
+#define A_C_00000002 0xc2
+#define A_C_00000003 0xc3
+#define A_C_00000004 0xc4
+#define A_C_00000008 0xc5
+#define A_C_00000010 0xc6
+#define A_C_00000020 0xc7
+#define A_C_00000100 0xc8
+#define A_C_00010000 0xc9
+#define A_C_00000800 0xca
+#define A_C_10000000 0xcb
+#define A_C_20000000 0xcc
+#define A_C_40000000 0xcd
+#define A_C_80000000 0xce
+#define A_C_7fffffff 0xcf
+#define A_C_ffffffff 0xd0
+#define A_C_fffffffe 0xd1
+#define A_C_c0000000 0xd2
+#define A_C_4f1bbcdc 0xd3
+#define A_C_5a7ef9db 0xd4
+#define A_C_00100000 0xd5
+#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
+#define A_GPR_COND 0xd7 /* CCR, condition register */
+#define A_GPR_NOISE0 0xd8 /* noise source */
+#define A_GPR_NOISE1 0xd9 /* noise source */
+#define A_GPR_IRQ 0xda /* IRQ register */
+#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
+#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
+
+/* definitions for debug register */
+#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
+#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
+#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
+#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
+#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
+#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
+#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
+
+/* tank memory address line */
+#ifndef __KERNEL__
+#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
+#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
+#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
+#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
+#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
+#endif
+
+typedef struct {
+ unsigned int internal_tram_size; /* in samples */
+ unsigned int external_tram_size; /* in samples */
+ char fxbus_names[16][32]; /* names of FXBUSes */
+ char extin_names[16][32]; /* names of external inputs */
+ char extout_names[32][32]; /* names of external outputs */
+ unsigned int gpr_controls; /* count of GPR controls */
+} emu10k1_fx8010_info_t;
+
+#define EMU10K1_GPR_TRANSLATION_NONE 0
+#define EMU10K1_GPR_TRANSLATION_TABLE100 1
+#define EMU10K1_GPR_TRANSLATION_BASS 2
+#define EMU10K1_GPR_TRANSLATION_TREBLE 3
+#define EMU10K1_GPR_TRANSLATION_ONOFF 4
+
+enum emu10k1_ctl_elem_iface {
+ EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
+ EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
+};
+
+typedef struct {
+ unsigned int pad; /* don't use */
+ int iface; /* interface identifier */
+ unsigned int device; /* device/client number */
+ unsigned int subdevice; /* subdevice (substream) number */
+ unsigned char name[44]; /* ASCII name of item */
+ unsigned int index; /* index of item */
+} emu10k1_ctl_elem_id_t;
+
+typedef struct {
+ emu10k1_ctl_elem_id_t id; /* full control ID definition */
+ unsigned int vcount; /* visible count */
+ unsigned int count; /* count of GPR (1..16) */
+ unsigned short gpr[32]; /* GPR number(s) */
+ unsigned int value[32]; /* initial values */
+ unsigned int min; /* minimum range */
+ unsigned int max; /* maximum range */
+ unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
+ unsigned int *tlv;
+} emu10k1_fx8010_control_gpr_t;
+
+typedef struct {
+ char name[128];
+
+ unsigned long gpr_valid[0x200/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
+ uint32_t *gpr_map; /* initializers */
+
+ unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
+ emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */
+
+ unsigned int gpr_del_control_count; /* count of GPR controls to remove */
+ emu10k1_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */
+
+ unsigned int gpr_list_control_count; /* count of GPR controls to list */
+ unsigned int gpr_list_control_total; /* total count of GPR controls */
+ emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */
+
+ unsigned long tram_valid[0x100/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
+ uint32_t *tram_data_map; /* data initializers */
+ uint32_t *tram_addr_map; /* map initializers */
+
+ unsigned long code_valid[1024/(sizeof(unsigned long)*8)]; /* bitmask of valid instructions */
+ uint32_t *code; /* one instruction - 64 bits */
+} emu10k1_fx8010_code_t;
+
+typedef struct {
+ unsigned int address; /* 31.bit == 1 -> external TRAM */
+ unsigned int size; /* size in samples (4 bytes) */
+ unsigned int *samples; /* pointer to samples (20-bit) */
+ /* NULL->clear memory */
+} emu10k1_fx8010_tram_t;
+
+typedef struct {
+ unsigned int substream; /* substream number */
+ unsigned int res1; /* reserved */
+ unsigned int channels; /* 16-bit channels count, zero = remove this substream */
+ unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
+ unsigned int buffer_size; /* count of buffered samples */
+ unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
+ unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
+ unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
+ unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
+ unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
+ unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
+ unsigned char pad; /* reserved */
+ unsigned char etram[32]; /* external TRAM address & data (one per channel) */
+ unsigned int res2; /* reserved */
+} emu10k1_fx8010_pcm_t;
+
+#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t)
+#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t)
+#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t)
+#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
+#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t)
+#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t)
+#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t)
+#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t)
+#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
+#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
+#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
+#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
+#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
+#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
+
+#endif /* __SOUND_EMU10K1_H */
diff --git a/alsa-lib/include/sound/hdsp.h b/alsa-lib/include/sound/hdsp.h
new file mode 100644
index 0000000..0fc9e98
--- /dev/null
+++ b/alsa-lib/include/sound/hdsp.h
@@ -0,0 +1,112 @@
+#ifndef __SOUND_HDSP_H
+#define __SOUND_HDSP_H
+
+/*
+ * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdint.h>
+
+#define HDSP_MATRIX_MIXER_SIZE 2048
+
+typedef enum {
+ Digiface,
+ Multiface,
+ H9652,
+ H9632,
+ Undefined,
+} HDSP_IO_Type;
+
+typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
+
+struct _snd_hdsp_peak_rms {
+ uint32_t input_peaks[26];
+ uint32_t playback_peaks[26];
+ uint32_t output_peaks[28];
+ uint64_t input_rms[26];
+ uint64_t playback_rms[26];
+ /* These are only used for H96xx cards */
+ uint64_t output_rms[26];
+};
+
+#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t)
+
+typedef struct _snd_hdsp_config_info hdsp_config_info_t;
+
+struct _snd_hdsp_config_info {
+ unsigned char pref_sync_ref;
+ unsigned char wordclock_sync_check;
+ unsigned char spdif_sync_check;
+ unsigned char adatsync_sync_check;
+ unsigned char adat_sync_check[3];
+ unsigned char spdif_in;
+ unsigned char spdif_out;
+ unsigned char spdif_professional;
+ unsigned char spdif_emphasis;
+ unsigned char spdif_nonaudio;
+ unsigned int spdif_sample_rate;
+ unsigned int system_sample_rate;
+ unsigned int autosync_sample_rate;
+ unsigned char system_clock_mode;
+ unsigned char clock_source;
+ unsigned char autosync_ref;
+ unsigned char line_out;
+ unsigned char passthru;
+ unsigned char da_gain;
+ unsigned char ad_gain;
+ unsigned char phone_gain;
+ unsigned char xlr_breakout_cable;
+ unsigned char analog_extension_board;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t)
+
+typedef struct _snd_hdsp_firmware hdsp_firmware_t;
+
+struct _snd_hdsp_firmware {
+ void *firmware_data; /* 24413 x 4 bytes */
+};
+
+#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
+
+typedef struct _snd_hdsp_version hdsp_version_t;
+
+struct _snd_hdsp_version {
+ HDSP_IO_Type io_type;
+ unsigned short firmware_rev;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t)
+
+typedef struct _snd_hdsp_mixer hdsp_mixer_t;
+
+struct _snd_hdsp_mixer {
+ unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
+};
+
+#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t)
+
+typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t;
+
+struct _snd_hdsp_9632_aeb {
+ int aebi;
+ int aebo;
+};
+
+#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t)
+
+#endif /* __SOUND_HDSP_H */
diff --git a/alsa-lib/include/sound/sb16_csp.h b/alsa-lib/include/sound/sb16_csp.h
new file mode 100644
index 0000000..78817b4
--- /dev/null
+++ b/alsa-lib/include/sound/sb16_csp.h
@@ -0,0 +1,115 @@
+#ifndef __SOUND_SB16_CSP_H
+#define __SOUND_SB16_CSP_H
+
+/*
+ * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
+ * Takashi Iwai <tiwai@suse.de>
+ *
+ * SB16ASP/AWE32 CSP control
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/* CSP modes */
+#define SNDRV_SB_CSP_MODE_NONE 0x00
+#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
+#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
+#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
+
+/* CSP load flags */
+#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
+#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
+
+/* CSP sample width */
+#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
+#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
+
+/* CSP channels */
+#define SNDRV_SB_CSP_MONO 0x01
+#define SNDRV_SB_CSP_STEREO 0x02
+
+/* CSP rates */
+#define SNDRV_SB_CSP_RATE_8000 0x01
+#define SNDRV_SB_CSP_RATE_11025 0x02
+#define SNDRV_SB_CSP_RATE_22050 0x04
+#define SNDRV_SB_CSP_RATE_44100 0x08
+#define SNDRV_SB_CSP_RATE_ALL 0x0f
+
+/* CSP running state */
+#define SNDRV_SB_CSP_ST_IDLE 0x00
+#define SNDRV_SB_CSP_ST_LOADED 0x01
+#define SNDRV_SB_CSP_ST_RUNNING 0x02
+#define SNDRV_SB_CSP_ST_PAUSED 0x04
+#define SNDRV_SB_CSP_ST_AUTO 0x08
+#define SNDRV_SB_CSP_ST_QSOUND 0x10
+
+/* maximum QSound value (180 degrees right) */
+#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
+
+/* maximum microcode RIFF file size */
+#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
+
+/* microcode header */
+typedef struct snd_sb_csp_mc_header {
+ char codec_name[16]; /* id name of codec */
+ unsigned short func_req; /* requested function */
+} snd_sb_csp_mc_header_t;
+
+/* microcode to be loaded */
+typedef struct snd_sb_csp_microcode {
+ snd_sb_csp_mc_header_t info;
+ unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
+} snd_sb_csp_microcode_t;
+
+/* start CSP with sample_width in mono/stereo */
+typedef struct snd_sb_csp_start {
+ int sample_width; /* sample width, look above */
+ int channels; /* channels, look above */
+} snd_sb_csp_start_t;
+
+/* CSP information */
+typedef struct snd_sb_csp_info {
+ char codec_name[16]; /* id name of codec */
+ unsigned short func_nr; /* function number */
+ unsigned int acc_format; /* accepted PCM formats */
+ unsigned short acc_channels; /* accepted channels */
+ unsigned short acc_width; /* accepted sample width */
+ unsigned short acc_rates; /* accepted sample rates */
+ unsigned short csp_mode; /* CSP mode, see above */
+ unsigned short run_channels; /* current channels */
+ unsigned short run_width; /* current sample width */
+ unsigned short version; /* version id: 0x10 - 0x1f */
+ unsigned short state; /* state bits */
+} snd_sb_csp_info_t;
+
+/* HWDEP controls */
+/* get CSP information */
+#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t)
+/* load microcode to CSP */
+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t)
+/* unload microcode from CSP */
+#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
+/* start CSP */
+#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t)
+/* stop CSP */
+#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
+/* pause CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
+/* restart CSP and DMA transfer */
+#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
+
+
+#endif /* __SOUND_SB16_CSP */
diff --git a/alsa-lib/include/sound/sscape_ioctl.h b/alsa-lib/include/sound/sscape_ioctl.h
new file mode 100644
index 0000000..c6653eb
--- /dev/null
+++ b/alsa-lib/include/sound/sscape_ioctl.h
@@ -0,0 +1,21 @@
+#ifndef SSCAPE_IOCTL_H
+#define SSCAPE_IOCTL_H
+
+
+struct sscape_bootblock
+{
+ unsigned char code[256];
+ unsigned version;
+};
+
+#define SSCAPE_MICROCODE_SIZE 65536
+
+struct sscape_microcode
+{
+ unsigned char *code;
+};
+
+#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
+#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
+
+#endif
diff --git a/alsa-lib/include/sound/type_compat.h b/alsa-lib/include/sound/type_compat.h
new file mode 100644
index 0000000..eec86e4
--- /dev/null
+++ b/alsa-lib/include/sound/type_compat.h
@@ -0,0 +1,40 @@
+#ifndef __TYPE_COMPAT_H
+#define __TYPE_COMPAT_H
+
+#ifndef DOC_HIDDEN
+#include <stdint.h>
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+
+#include <endian.h>
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define __cpu_to_le32(x) (x)
+#define __cpu_to_be32(x) bswap_32(x)
+#define __cpu_to_le16(x) (x)
+#define __cpu_to_be16(x) bswap_16(x)
+#else
+#define __cpu_to_le32(x) bswap_32(x)
+#define __cpu_to_be32(x) (x)
+#define __cpu_to_le16(x) bswap_16(x)
+#define __cpu_to_be16(x) (x)
+#endif
+
+#define __le32_to_cpu __cpu_to_le32
+#define __be32_to_cpu __cpu_to_be32
+#define __le16_to_cpu __cpu_to_le16
+#define __be16_to_cpu __cpu_to_be16
+
+#define __le64 __u64
+#define __le32 __u32
+#define __le16 __u16
+#define __be64 __u64
+#define __be32 __u32
+#define __be16 __u16
+#endif /* DOC_HIDDEN */
+
+#endif /* __TYPE_COMPAT_H */
diff --git a/alsa-lib/include/sys.h b/alsa-lib/include/sys.h
new file mode 100644
index 0000000..47f587c
--- /dev/null
+++ b/alsa-lib/include/sys.h
@@ -0,0 +1,2 @@
+#warning This header is deprecated, use <alsa/asoundlib.h> instead.
+#include <alsa/asoundlib.h>
diff --git a/alsa-lib/include/timer.h b/alsa-lib/include/timer.h
new file mode 100644
index 0000000..4d06e31
--- /dev/null
+++ b/alsa-lib/include/timer.h
@@ -0,0 +1,257 @@
+/**
+ * \file include/timer.h
+ * \brief Application interface library for the ALSA driver
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 1998-2001
+ *
+ * Application interface library for the ALSA driver
+ */
+/*
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ALSA_TIMER_H
+#define __ALSA_TIMER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup Timer Timer Interface
+ * Timer Interface. See \ref timer page for more details.
+ * \{
+ */
+
+/** dlsym version for interface entry callback */
+#define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
+/** dlsym version for interface entry callback */
+#define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
+
+/** timer identification structure */
+typedef struct _snd_timer_id snd_timer_id_t;
+/** timer global info structure */
+typedef struct _snd_timer_ginfo snd_timer_ginfo_t;
+/** timer global params structure */
+typedef struct _snd_timer_gparams snd_timer_gparams_t;
+/** timer global status structure */
+typedef struct _snd_timer_gstatus snd_timer_gstatus_t;
+/** timer info structure */
+typedef struct _snd_timer_info snd_timer_info_t;
+/** timer params structure */
+typedef struct _snd_timer_params snd_timer_params_t;
+/** timer status structure */
+typedef struct _snd_timer_status snd_timer_status_t;
+/** timer master class */
+typedef enum _snd_timer_class {
+ SND_TIMER_CLASS_NONE = -1, /**< invalid */
+ SND_TIMER_CLASS_SLAVE = 0, /**< slave timer */
+ SND_TIMER_CLASS_GLOBAL, /**< global timer */
+ SND_TIMER_CLASS_CARD, /**< card timer */
+ SND_TIMER_CLASS_PCM, /**< PCM timer */
+ SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM /**< last timer */
+} snd_timer_class_t;
+
+/** timer slave class */
+typedef enum _snd_timer_slave_class {
+ SND_TIMER_SCLASS_NONE = 0, /**< none */
+ SND_TIMER_SCLASS_APPLICATION, /**< for internal use */
+ SND_TIMER_SCLASS_SEQUENCER, /**< sequencer timer */
+ SND_TIMER_SCLASS_OSS_SEQUENCER, /**< OSS sequencer timer */
+ SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER /**< last slave timer */
+} snd_timer_slave_class_t;
+
+/** timer read event identification */
+typedef enum _snd_timer_event {
+ SND_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
+ SND_TIMER_EVENT_TICK, /* val = ticks */
+ SND_TIMER_EVENT_START, /* val = resolution in ns */
+ SND_TIMER_EVENT_STOP, /* val = 0 */
+ SND_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
+ SND_TIMER_EVENT_PAUSE, /* val = 0 */
+ SND_TIMER_EVENT_EARLY, /* val = 0 */
+ SND_TIMER_EVENT_SUSPEND, /* val = 0 */
+ SND_TIMER_EVENT_RESUME, /* val = resolution in ns */
+ /* master timer events for slave timer instances */
+ SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
+ SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
+ SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
+ SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
+ SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
+ SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
+} snd_timer_event_t;
+
+/** timer read structure */
+typedef struct _snd_timer_read {
+ unsigned int resolution; /**< tick resolution in nanoseconds */
+ unsigned int ticks; /**< count of happened ticks */
+} snd_timer_read_t;
+
+/** timer tstamp + event read structure */
+typedef struct _snd_timer_tread {
+ snd_timer_event_t event; /**< Timer event */
+ snd_htimestamp_t tstamp; /**< Time stamp of each event */
+ unsigned int val; /**< Event value */
+} snd_timer_tread_t;
+
+/** global timer - system */
+#define SND_TIMER_GLOBAL_SYSTEM 0
+/** global timer - RTC */
+#define SND_TIMER_GLOBAL_RTC 1
+/** global timer - HPET */
+#define SND_TIMER_GLOBAL_HPET 2
+
+/** timer open mode flag - non-blocking behaviour */
+#define SND_TIMER_OPEN_NONBLOCK (1<<0)
+/** use timestamps and event notification - enhanced read */
+#define SND_TIMER_OPEN_TREAD (1<<1)
+
+/** timer handle type */
+typedef enum _snd_timer_type {
+ /** Kernel level HwDep */
+ SND_TIMER_TYPE_HW = 0,
+ /** Shared memory client timer (not yet implemented) */
+ SND_TIMER_TYPE_SHM,
+ /** INET client timer (not yet implemented) */
+ SND_TIMER_TYPE_INET
+} snd_timer_type_t;
+
+/** timer query handle */
+typedef struct _snd_timer_query snd_timer_query_t;
+/** timer handle */
+typedef struct _snd_timer snd_timer_t;
+
+
+int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode);
+int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf);
+int snd_timer_query_close(snd_timer_query_t *handle);
+int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid);
+int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info);
+int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params);
+int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status);
+
+int snd_timer_open(snd_timer_t **handle, const char *name, int mode);
+int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf);
+int snd_timer_close(snd_timer_t *handle);
+int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
+ snd_async_callback_t callback, void *private_data);
+snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler);
+int snd_timer_poll_descriptors_count(snd_timer_t *handle);
+int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space);
+int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
+int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
+int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
+int snd_timer_start(snd_timer_t *handle);
+int snd_timer_stop(snd_timer_t *handle);
+int snd_timer_continue(snd_timer_t *handle);
+ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
+
+size_t snd_timer_id_sizeof(void);
+/** allocate #snd_timer_id_t container on stack */
+#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
+int snd_timer_id_malloc(snd_timer_id_t **ptr);
+void snd_timer_id_free(snd_timer_id_t *obj);
+void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
+
+void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class);
+int snd_timer_id_get_class(snd_timer_id_t *id);
+void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass);
+int snd_timer_id_get_sclass(snd_timer_id_t *id);
+void snd_timer_id_set_card(snd_timer_id_t *id, int card);
+int snd_timer_id_get_card(snd_timer_id_t *id);
+void snd_timer_id_set_device(snd_timer_id_t *id, int device);
+int snd_timer_id_get_device(snd_timer_id_t *id);
+void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
+int snd_timer_id_get_subdevice(snd_timer_id_t *id);
+
+size_t snd_timer_ginfo_sizeof(void);
+/** allocate #snd_timer_ginfo_t container on stack */
+#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
+int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
+void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
+void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
+
+int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid);
+snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj);
+unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj);
+int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj);
+char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj);
+char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj);
+unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj);
+unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj);
+
+size_t snd_timer_info_sizeof(void);
+/** allocate #snd_timer_info_t container on stack */
+#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
+int snd_timer_info_malloc(snd_timer_info_t **ptr);
+void snd_timer_info_free(snd_timer_info_t *obj);
+void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
+
+int snd_timer_info_is_slave(snd_timer_info_t * info);
+int snd_timer_info_get_card(snd_timer_info_t * info);
+const char *snd_timer_info_get_id(snd_timer_info_t * info);
+const char *snd_timer_info_get_name(snd_timer_info_t * info);
+long snd_timer_info_get_resolution(snd_timer_info_t * info);
+
+size_t snd_timer_params_sizeof(void);
+/** allocate #snd_timer_params_t container on stack */
+#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
+int snd_timer_params_malloc(snd_timer_params_t **ptr);
+void snd_timer_params_free(snd_timer_params_t *obj);
+void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
+
+int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
+int snd_timer_params_get_auto_start(snd_timer_params_t * params);
+int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive);
+int snd_timer_params_get_exclusive(snd_timer_params_t * params);
+int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event);
+int snd_timer_params_get_early_event(snd_timer_params_t * params);
+void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
+long snd_timer_params_get_ticks(snd_timer_params_t * params);
+void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
+long snd_timer_params_get_queue_size(snd_timer_params_t * params);
+void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter);
+unsigned int snd_timer_params_get_filter(snd_timer_params_t * params);
+
+size_t snd_timer_status_sizeof(void);
+/** allocate #snd_timer_status_t container on stack */
+#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
+int snd_timer_status_malloc(snd_timer_status_t **ptr);
+void snd_timer_status_free(snd_timer_status_t *obj);
+void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
+
+snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status);
+long snd_timer_status_get_resolution(snd_timer_status_t * status);
+long snd_timer_status_get_lost(snd_timer_status_t * status);
+long snd_timer_status_get_overrun(snd_timer_status_t * status);
+long snd_timer_status_get_queue(snd_timer_status_t * status);
+
+/* deprecated functions, for compatibility */
+long snd_timer_info_get_ticks(snd_timer_info_t * info);
+
+/** \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __ALSA_TIMER_H */
+
diff --git a/alsa-lib/include/version.h b/alsa-lib/include/version.h
new file mode 100644
index 0000000..6ac5880
--- /dev/null
+++ b/alsa-lib/include/version.h
@@ -0,0 +1,15 @@
+/*
+ * version.h
+ */
+
+#define SND_LIB_MAJOR 1 /**< major number of library version */
+#define SND_LIB_MINOR 0 /**< minor number of library version */
+#define SND_LIB_SUBMINOR 19 /**< subminor number of library version */
+#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
+/** library version */
+#define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\
+ (SND_LIB_MINOR<<8)|\
+ SND_LIB_SUBMINOR)
+/** library version (string) */
+#define SND_LIB_VERSION_STR "1.0.19"
+
diff --git a/alsa-lib/install-sh b/alsa-lib/install-sh
new file mode 100644
index 0000000..4d4a951
--- /dev/null
+++ b/alsa-lib/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-lib/libtool b/alsa-lib/libtool
new file mode 100644
index 0000000..c3cd4aa
--- /dev/null
+++ b/alsa-lib/libtool
@@ -0,0 +1,7520 @@
+#! /bin/sh
+
+# libtoolT - Provide generalized library-building support services.
+# Generated automatically by (GNU alsa-lib 1.0.19)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed program that does not truncate output.
+SED="/usr/bin/sed"
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="/usr/bin/sed -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=" CXX"
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host alsa0:
+
+# Shell to use when invoking shell scripts.
+SHELL="/bin/sh"
+
+# Whether or not to build shared libraries.
+build_libtool_libs=yes
+
+# Whether or not to build static libraries.
+build_old_libs=no
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=no
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=no
+
+# Whether or not to optimize for fast installation.
+fast_install=yes
+
+# The host system.
+host_alias=
+host=x86_64-suse-linux-gnu
+host_os=linux-gnu
+
+# The build system.
+build_alias=
+build=x86_64-suse-linux-gnu
+build_os=linux-gnu
+
+# An echo program that does not interpret backslashes.
+echo="echo"
+
+# The archiver.
+AR="ar"
+AR_FLAGS="cru"
+
+# A C compiler.
+LTCC="gcc"
+
+# LTCC compiler flags.
+LTCFLAGS="-O2 -fomit-frame-pointer -Wall -pipe"
+
+# A language-specific compiler.
+CC="gcc"
+
+# Is the compiler the GNU C compiler?
+with_gcc=yes
+
+# An ERE matcher.
+EGREP="/usr/bin/grep -E"
+
+# The linker used to build libraries.
+LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
+
+# Whether we need hard or soft links.
+LN_S="ln -s"
+
+# A BSD-compatible nm program.
+NM="/usr/bin/nm -B"
+
+# A symbol stripping program
+STRIP="strip"
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=file
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="dlltool"
+
+# Used on cygwin: object dumper.
+OBJDUMP="objdump"
+
+# Used on cygwin: assembler.
+AS="as"
+
+# The name of the directory that contains temporary libtool files.
+objdir=.libs
+
+# How to create reloadable object files.
+reload_flag=" -r"
+reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
+
+# How to pass a linker flag through the compiler.
+wl="-Wl,"
+
+# Object file suffix (normally "o").
+objext="o"
+
+# Old archive suffix (normally "a").
+libext="a"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='.so'
+
+# Executable file suffix (normally "").
+exeext=""
+
+# Additional compiler flags for building library objects.
+pic_flag=" -fPIC -DPIC"
+pic_mode=default
+
+# What is the maximum length of a command?
+max_cmd_len=32768
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o="yes"
+
+# Must we lock files when doing compilation?
+need_locks="no"
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=no
+
+# Do we need a version for libraries?
+need_version=no
+
+# Whether dlopen is supported.
+dlopen_support=yes
+
+# Whether dlopen of programs is supported.
+dlopen_self=yes
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=no
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag="-static"
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=" -fno-builtin"
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec="\${wl}--export-dynamic"
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=""
+
+# Library versioning type.
+version_type=linux
+
+# Format of library name prefix.
+libname_spec="lib\$name"
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
+
+# The coded name of the library, if different from the real name.
+soname_spec="\${libname}\${release}\${shared_ext}\$major"
+
+# Commands used to build and install an old-style archive.
+RANLIB="ranlib"
+old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
+old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
+old_postuninstall_cmds=""
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=""
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=""
+
+# Commands used to build and install a shared archive.
+archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
+archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
+ cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
+ \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
+ \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib"
+postinstall_cmds=""
+postuninstall_cmds=""
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=""
+module_expsym_cmds=""
+
+# Commands to strip libraries.
+old_striplib="strip --strip-debug"
+striplib="strip --strip-unneeded"
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=""
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=""
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=""
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=""
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=""
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method="pass_all"
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd="\$MAGIC_CMD"
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=""
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=""
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=""
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
+
+# This is the shared library runtime path variable.
+runpath_var=LD_RUN_PATH
+
+# This is the shared library path variable.
+shlibpath_var=LD_LIBRARY_PATH
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=no
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=immediate
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=yes
+
+# Flag to hardcode $libdir into a binary during linking.
+# This must work even if $libdir does not exist.
+hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+
+# If ld is used when linking, flag to hardcode $libdir into
+# a binary during linking. This must work even if $libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=""
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=""
+
+# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=no
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=no
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=unsupported
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=no
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=unknown
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=" /usr/lib64/gcc/x86_64-suse-linux/4.1.2/ /usr/lib/gcc/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib/ /usr/lib/"
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/lib/Xaw3d /usr/x86_64-suse-linux/lib /usr/local/lib /opt/kde3/lib /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /opt/kde3/lib64 /opt/gnome/lib64 "
+
+# Fix the shell variable $srcfile for the compiler.
+fix_srcfile_path=""
+
+# Set to yes if exported symbols are required.
+always_export_symbols=no
+
+# The commands to list exported symbols.
+export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=""
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+
+# Symbols that must always be exported.
+include_expsyms=""
+
+# ### END LIBTOOL CONFIG
+
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case "$@ " in
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit $EXIT_FAILURE
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xdir="$my_gentop/$my_xlib"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+ preserve_args="${preserve_args}=$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ $echo
+ $echo "Copyright (C) 2005 Free Software Foundation, Inc."
+ $echo "This is free software; see the source for copying conditions. There is NO"
+ $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+ exit $?
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+ done
+ exit $?
+ ;;
+
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit $?
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ arg_mode=target
+ continue
+ ;;
+
+ -static | -prefer-pic | -prefer-non-pic)
+ later="$later $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ base_compile="$base_compile $lastarg"
+ continue
+ ;;
+
+ * )
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit $EXIT_FAILURE
+ ;;
+ target)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *)
+ # Get the name of the library object.
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
+ lobj=${xdir}$objdir/$objname
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+ $echo "$srcfile" > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
+
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
+
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ $show "$mv $output_obj $lobj"
+ if $run $mv $output_obj $lobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+ else
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+ fi
+
+ $run $mv "${libobj}T" "${libobj}"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ base_compile="$nonopt $@"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ xcclinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit $EXIT_FAILURE
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ deplibs="$deplibs -framework System"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -pg pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+ -t[45]*|-txscale*|@*)
+
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.$objext)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplications in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags $deplib"
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if (${SED} -e '2q' $lib |
+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ library_names=
+ old_library=
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ $echo
+ $echo "*** Warning: Trying to link with static lib archive $deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because the file extensions .$libext of this argument makes me believe"
+ $echo "*** that it is just a static archive that I should not used here."
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the"
+ $echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on
+ # some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
+ if test "$linkmode" = prog; then
+ $echo "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $echo "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$extract_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$old_archive_from_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a module then we can not link against
+ # it, someone is ignoring the new warnings I added
+ if /usr/bin/file -L $add 2> /dev/null |
+ $EGREP ": [^:]* bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs,
+ # but need to link against shared
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
+ fi
+ # do not add paths which are already there
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path";;
+ esac
+ fi
+ path=""
+ ;;
+ *)
+ path="-L$path"
+ ;;
+ esac
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
+ *) continue ;;
+ esac
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ tmp_libs="$tmp_libs $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit $EXIT_FAILURE
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the non-libtool"
+ $echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$2"
+ number_minor="$3"
+ number_revision="$4"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ darwin|linux|osf|windows)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ current=`expr $number_major + $number_minor - 1`
+ age="$number_minor"
+ revision="$number_minor"
+ ;;
+ esac
+ ;;
+ no)
+ current="$2"
+ revision="$3"
+ age="$4"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ major=`expr $current - $age + 1`
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$echo "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ removelist="$removelist $p"
+ ;;
+ *) ;;
+ esac
+ done
+ if test -n "$removelist"; then
+ $show "${rm}r $removelist"
+ $run ${rm}r $removelist
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ for path in $notinst_path; do
+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+ deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+ done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" -ne "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
+ $LTCC $LTCFLAGS -o conftest conftest.c $i
+ # Did it work?
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+ done
+ fi
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ $echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$output_la-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadable object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~\$rm $delfiles\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $run eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ else
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ exit_status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+ ;;
+ esac
+
+ cat >> $cwrappersource <<"EOF"
+ return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
+
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit $EXIT_FAILURE
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ eval cmd=\"$cmd\"
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlfiles="$newdlfiles $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlprefiles="$newdlprefiles $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ cmds=$postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir=`func_mktempdir`
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ cmds=$old_postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ cmds=$finish_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit $EXIT_SUCCESS
+
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit $EXIT_FAILURE
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ rmdirs=
+
+ origobjdir="$objdir"
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
+ else
+ objdir="$dir/$origobjdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ cmds=$postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ cmds=$old_postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+ # Read the .lo file
+ . $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ rmfiles="$rmfiles $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+ objdir="$origobjdir"
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit $EXIT_SUCCESS
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# Libtool was configured on host alsa0:
+
+# Shell to use when invoking shell scripts.
+SHELL="/bin/sh"
+
+# Whether or not to build shared libraries.
+build_libtool_libs=yes
+
+# Whether or not to build static libraries.
+build_old_libs=no
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=no
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=no
+
+# Whether or not to optimize for fast installation.
+fast_install=yes
+
+# The host system.
+host_alias=
+host=x86_64-suse-linux-gnu
+host_os=linux-gnu
+
+# The build system.
+build_alias=
+build=x86_64-suse-linux-gnu
+build_os=linux-gnu
+
+# An echo program that does not interpret backslashes.
+echo="echo"
+
+# The archiver.
+AR="ar"
+AR_FLAGS="cru"
+
+# A C compiler.
+LTCC="gcc"
+
+# LTCC compiler flags.
+LTCFLAGS="-O2 -fomit-frame-pointer -Wall -pipe"
+
+# A language-specific compiler.
+CC="g++"
+
+# Is the compiler the GNU C compiler?
+with_gcc=yes
+
+# An ERE matcher.
+EGREP="/usr/bin/grep -E"
+
+# The linker used to build libraries.
+LD="/usr/x86_64-suse-linux/bin/ld -m elf_x86_64"
+
+# Whether we need hard or soft links.
+LN_S="ln -s"
+
+# A BSD-compatible nm program.
+NM="/usr/bin/nm -B"
+
+# A symbol stripping program
+STRIP="strip"
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=file
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="dlltool"
+
+# Used on cygwin: object dumper.
+OBJDUMP="objdump"
+
+# Used on cygwin: assembler.
+AS="as"
+
+# The name of the directory that contains temporary libtool files.
+objdir=.libs
+
+# How to create reloadable object files.
+reload_flag=" -r"
+reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
+
+# How to pass a linker flag through the compiler.
+wl="-Wl,"
+
+# Object file suffix (normally "o").
+objext="o"
+
+# Old archive suffix (normally "a").
+libext="a"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='.so'
+
+# Executable file suffix (normally "").
+exeext=""
+
+# Additional compiler flags for building library objects.
+pic_flag=" -fPIC -DPIC"
+pic_mode=default
+
+# What is the maximum length of a command?
+max_cmd_len=32768
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o="yes"
+
+# Must we lock files when doing compilation?
+need_locks="no"
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=no
+
+# Do we need a version for libraries?
+need_version=no
+
+# Whether dlopen is supported.
+dlopen_support=yes
+
+# Whether dlopen of programs is supported.
+dlopen_self=yes
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=no
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag="-static"
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=" -fno-builtin"
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec="\${wl}--export-dynamic"
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=""
+
+# Library versioning type.
+version_type=linux
+
+# Format of library name prefix.
+libname_spec="lib\$name"
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
+
+# The coded name of the library, if different from the real name.
+soname_spec="\${libname}\${release}\${shared_ext}\$major"
+
+# Commands used to build and install an old-style archive.
+RANLIB="ranlib"
+old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib"
+old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
+old_postuninstall_cmds=""
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=""
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=""
+
+# Commands used to build and install a shared archive.
+archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
+archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
+postinstall_cmds=""
+postuninstall_cmds=""
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=""
+module_expsym_cmds=""
+
+# Commands to strip libraries.
+old_striplib="strip --strip-debug"
+striplib="strip --strip-unneeded"
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtbeginS.o"
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects="/usr/lib64/gcc/x86_64-suse-linux/4.1.2/crtendS.o /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/crtn.o"
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=""
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path="-L/usr/lib64/gcc/x86_64-suse-linux/4.1.2 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../.."
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method="pass_all"
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd="\$MAGIC_CMD"
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=""
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=""
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=""
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
+
+# This is the shared library runtime path variable.
+runpath_var=LD_RUN_PATH
+
+# This is the shared library path variable.
+shlibpath_var=LD_LIBRARY_PATH
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=no
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=immediate
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=yes
+
+# Flag to hardcode $libdir into a binary during linking.
+# This must work even if $libdir does not exist.
+hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+
+# If ld is used when linking, flag to hardcode $libdir into
+# a binary during linking. This must work even if $libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=""
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=""
+
+# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=no
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=no
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=unsupported
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=no
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=unknown
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=" /usr/lib64/gcc/x86_64-suse-linux/4.1.2/ /usr/lib/gcc/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../x86_64-suse-linux/4.1.2/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib/ /usr/lib/"
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/lib/Xaw3d /usr/x86_64-suse-linux/lib /usr/local/lib /opt/kde3/lib /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /opt/kde3/lib64 /opt/gnome/lib64 "
+
+# Fix the shell variable $srcfile for the compiler.
+fix_srcfile_path=""
+
+# Set to yes if exported symbols are required.
+always_export_symbols=no
+
+# The commands to list exported symbols.
+export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=""
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=""
+
+# Symbols that must always be exported.
+include_expsyms=""
+
+# ### END LIBTOOL TAG CONFIG: CXX
+
diff --git a/alsa-lib/ltmain.sh b/alsa-lib/ltmain.sh
new file mode 100644
index 0000000..06823e0
--- /dev/null
+++ b/alsa-lib/ltmain.sh
@@ -0,0 +1,6863 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case "$@ " in
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit $EXIT_FAILURE
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xdir="$my_gentop/$my_xlib"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+ preserve_args="${preserve_args}=$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ $echo
+ $echo "Copyright (C) 2005 Free Software Foundation, Inc."
+ $echo "This is free software; see the source for copying conditions. There is NO"
+ $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+ exit $?
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+ done
+ exit $?
+ ;;
+
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit $?
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ arg_mode=target
+ continue
+ ;;
+
+ -static | -prefer-pic | -prefer-non-pic)
+ later="$later $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ base_compile="$base_compile $lastarg"
+ continue
+ ;;
+
+ * )
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit $EXIT_FAILURE
+ ;;
+ target)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *)
+ # Get the name of the library object.
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
+ lobj=${xdir}$objdir/$objname
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+ $echo "$srcfile" > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
+
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
+
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ $show "$mv $output_obj $lobj"
+ if $run $mv $output_obj $lobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+ else
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+ fi
+
+ $run $mv "${libobj}T" "${libobj}"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ base_compile="$nonopt $@"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ xcclinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit $EXIT_FAILURE
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ deplibs="$deplibs -framework System"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -pg pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+ -t[45]*|-txscale*|@*)
+
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.$objext)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplications in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags $deplib"
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if (${SED} -e '2q' $lib |
+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ library_names=
+ old_library=
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ $echo
+ $echo "*** Warning: Trying to link with static lib archive $deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because the file extensions .$libext of this argument makes me believe"
+ $echo "*** that it is just a static archive that I should not used here."
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the"
+ $echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on
+ # some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
+ if test "$linkmode" = prog; then
+ $echo "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $echo "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$extract_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$old_archive_from_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a module then we can not link against
+ # it, someone is ignoring the new warnings I added
+ if /usr/bin/file -L $add 2> /dev/null |
+ $EGREP ": [^:]* bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs,
+ # but need to link against shared
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
+ fi
+ # do not add paths which are already there
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path";;
+ esac
+ fi
+ path=""
+ ;;
+ *)
+ path="-L$path"
+ ;;
+ esac
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
+ *) continue ;;
+ esac
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ tmp_libs="$tmp_libs $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit $EXIT_FAILURE
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the non-libtool"
+ $echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$2"
+ number_minor="$3"
+ number_revision="$4"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ darwin|linux|osf|windows)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ current=`expr $number_major + $number_minor - 1`
+ age="$number_minor"
+ revision="$number_minor"
+ ;;
+ esac
+ ;;
+ no)
+ current="$2"
+ revision="$3"
+ age="$4"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ major=`expr $current - $age + 1`
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$echo "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ removelist="$removelist $p"
+ ;;
+ *) ;;
+ esac
+ done
+ if test -n "$removelist"; then
+ $show "${rm}r $removelist"
+ $run ${rm}r $removelist
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ for path in $notinst_path; do
+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+ deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+ done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" -ne "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
+ $LTCC $LTCFLAGS -o conftest conftest.c $i
+ # Did it work?
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+ done
+ fi
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ $echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$output_la-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadable object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~\$rm $delfiles\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $run eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ else
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ else
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ esac
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ exit_status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+ ;;
+ esac
+
+ cat >> $cwrappersource <<"EOF"
+ return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
+
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit $EXIT_FAILURE
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ eval cmd=\"$cmd\"
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlfiles="$newdlfiles $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlprefiles="$newdlprefiles $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ cmds=$postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir=`func_mktempdir`
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ cmds=$old_postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ cmds=$finish_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit $EXIT_SUCCESS
+
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit $EXIT_FAILURE
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ rmdirs=
+
+ origobjdir="$objdir"
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
+ else
+ objdir="$dir/$origobjdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ cmds=$postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ cmds=$old_postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+ # Read the .lo file
+ . $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ rmfiles="$rmfiles $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+ objdir="$origobjdir"
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit $EXIT_SUCCESS
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/alsa-lib/m4/attributes.m4 b/alsa-lib/m4/attributes.m4
new file mode 100644
index 0000000..e86456a
--- /dev/null
+++ b/alsa-lib/m4/attributes.m4
@@ -0,0 +1,311 @@
+dnl Macros to check the presence of generic (non-typed) symbols.
+dnl Copyright (c) 2006-2007 Diego Pettenò <flameeyes@gmail.com>
+dnl Copyright (c) 2006-2007 xine project
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
+dnl
+dnl As a special exception, the copyright owners of the
+dnl macro gives unlimited permission to copy, distribute and modify the
+dnl configure scripts that are the output of Autoconf when processing the
+dnl Macro. You need not follow the terms of the GNU General Public
+dnl License when using or distributing such scripts, even though portions
+dnl of the text of the Macro appear in them. The GNU General Public
+dnl License (GPL) does govern all other use of the material that
+dnl constitutes the Autoconf Macro.
+dnl
+dnl This special exception to the GPL applies to versions of the
+dnl Autoconf Macro released by this project. When you make and
+dnl distribute a modified version of the Autoconf Macro, you may extend
+dnl this special exception to the GPL to apply to your modified version as
+dnl well.
+
+dnl Check if the flag is supported by compiler
+dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
+ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([int a;],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl Check if the flag is supported by compiler (cacheable)
+dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_CFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
+dnl Check for CFLAG and appends them to CFLAGS if supported
+AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [CFLAGS="$CFLAGS $1"; $2], [$3])
+])
+
+dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
+AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
+ for flag in $1; do
+ CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
+ done
+])
+
+dnl Check if the flag is supported by linker (cacheable)
+dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_LDFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_ldflags_$1]),
+ [ac_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+ AC_LINK_IFELSE([int main() { return 1; }],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
+ LDFLAGS="$ac_save_LDFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
+dnl the current linker to avoid undefined references in a shared object.
+AC_DEFUN([CC_NOUNDEFINED], [
+ dnl We check $host for which systems to enable this for.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ case $host in
+ dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
+ dnl are requested, as different implementations are present; to avoid problems
+ dnl use -Wl,-z,defs only for those platform not behaving this way.
+ *-freebsd*) ;;
+ *)
+ dnl First of all check for the --no-undefined variant of GNU ld. This allows
+ dnl for a much more readable commandline, so that people can understand what
+ dnl it does without going to look for what the heck -z defs does.
+ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
+ CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
+ break
+ done
+ ;;
+ esac
+
+ AC_SUBST([LDFLAGS_NOUNDEFINED])
+])
+
+dnl Check for a -Werror flag or equivalent. -Werror is the GCC
+dnl and ICC flag that tells the compiler to treat all the warnings
+dnl as fatal. We usually need this option to make sure that some
+dnl constructs (like attributes) are not simply ignored.
+dnl
+dnl Other compilers don't support -Werror per se, but they support
+dnl an equivalent flag:
+dnl - Sun Studio compiler supports -errwarn=%all
+AC_DEFUN([CC_CHECK_WERROR], [
+ AC_CACHE_CHECK(
+ [for $CC way to treat warnings as errors],
+ [cc_cv_werror],
+ [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
+ [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
+ ])
+])
+
+AC_DEFUN([CC_CHECK_ATTRIBUTE], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
+ AS_TR_SH([cc_cv_attribute_$1]),
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_COMPILE_IFELSE([$3],
+ [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
+ [AC_DEFINE(
+ AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
+ [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
+ )
+ $4],
+ [$5])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
+ CC_CHECK_ATTRIBUTE(
+ [constructor],,
+ [void __attribute__((constructor)) ctor() { int a; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
+ CC_CHECK_ATTRIBUTE(
+ [format], [format(printf, n, n)],
+ [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
+ CC_CHECK_ATTRIBUTE(
+ [format_arg], [format_arg(printf)],
+ [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
+ CC_CHECK_ATTRIBUTE(
+ [visibility_$1], [visibility("$1")],
+ [void __attribute__((visibility("$1"))) $1_function() { }],
+ [$2], [$3])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
+ CC_CHECK_ATTRIBUTE(
+ [nonnull], [nonnull()],
+ [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
+ CC_CHECK_ATTRIBUTE(
+ [unused], ,
+ [void some_function(void *foo, __attribute__((unused)) void *bar);],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
+ CC_CHECK_ATTRIBUTE(
+ [sentinel], ,
+ [void some_function(void *foo, ...) __attribute__((sentinel));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
+ CC_CHECK_ATTRIBUTE(
+ [deprecated], ,
+ [void some_function(void *foo, ...) __attribute__((deprecated));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
+ CC_CHECK_ATTRIBUTE(
+ [alias], [weak, alias],
+ [void other_function(void *foo) { }
+ void some_function(void *foo) __attribute__((weak, alias("other_function")));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
+ CC_CHECK_ATTRIBUTE(
+ [malloc], ,
+ [void * __attribute__((malloc)) my_alloc(int n);],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_PACKED], [
+ CC_CHECK_ATTRIBUTE(
+ [packed], ,
+ [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONST], [
+ CC_CHECK_ATTRIBUTE(
+ [const], ,
+ [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_FLAG_VISIBILITY], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
+ [cc_cv_flag_visibility],
+ [cc_flag_visibility_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
+ cc_cv_flag_visibility='yes',
+ cc_cv_flag_visibility='no')
+ CFLAGS="$cc_flag_visibility_save_CFLAGS"])
+
+ AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
+ [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
+ [Define this if the compiler supports the -fvisibility flag])
+ $1],
+ [$2])
+])
+
+AC_DEFUN([CC_FUNC_EXPECT], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if compiler has __builtin_expect function],
+ [cc_cv_func_expect],
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_COMPILE_IFELSE(
+ [int some_function() {
+ int a = 3;
+ return (int)__builtin_expect(a, 3);
+ }],
+ [cc_cv_func_expect=yes],
+ [cc_cv_func_expect=no])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([test "x$cc_cv_func_expect" = "xyes"],
+ [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
+ [Define this if the compiler supports __builtin_expect() function])
+ $1],
+ [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
+ [cc_cv_attribute_aligned],
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ for cc_attribute_align_try in 64 32 16 8 4 2; do
+ AC_COMPILE_IFELSE([
+ int main() {
+ static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
+ return c;
+ }], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
+ done
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ if test "x$cc_cv_attribute_aligned" != "x"; then
+ AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
+ [Define the highest alignment supported])
+ fi
+])
diff --git a/alsa-lib/missing b/alsa-lib/missing
new file mode 100644
index 0000000..894e786
--- /dev/null
+++ b/alsa-lib/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-lib/modules/Makefile.am b/alsa-lib/modules/Makefile.am
new file mode 100644
index 0000000..bf9543e
--- /dev/null
+++ b/alsa-lib/modules/Makefile.am
@@ -0,0 +1,3 @@
+if BUILD_MIXER
+SUBDIRS=mixer
+endif
diff --git a/alsa-lib/modules/Makefile.in b/alsa-lib/modules/Makefile.in
new file mode 100644
index 0000000..c673602
--- /dev/null
+++ b/alsa-lib/modules/Makefile.in
@@ -0,0 +1,572 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = modules
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = mixer
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@BUILD_MIXER_TRUE@SUBDIRS = mixer
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign modules/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/modules/mixer/Makefile.am b/alsa-lib/modules/mixer/Makefile.am
new file mode 100644
index 0000000..9f5917f
--- /dev/null
+++ b/alsa-lib/modules/mixer/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=simple
diff --git a/alsa-lib/modules/mixer/Makefile.in b/alsa-lib/modules/mixer/Makefile.in
new file mode 100644
index 0000000..96d7fc7
--- /dev/null
+++ b/alsa-lib/modules/mixer/Makefile.in
@@ -0,0 +1,572 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = modules/mixer
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = simple
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/mixer/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign modules/mixer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/modules/mixer/simple/Makefile.am b/alsa-lib/modules/mixer/simple/Makefile.am
new file mode 100644
index 0000000..f73871f
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/Makefile.am
@@ -0,0 +1,35 @@
+alsaplugindir = @ALSA_PLUGIN_DIR@
+pkglibdir = $(alsaplugindir)/smixer
+
+AM_CFLAGS = -g -O2 -W -Wall
+
+INCLUDES=-I$(top_srcdir)/include
+
+pkglib_LTLIBRARIES = smixer-sbase.la \
+ smixer-ac97.la \
+ smixer-hda.la
+
+if BUILD_PYTHON
+pkglib_LTLIBRARIES += smixer-python.la
+endif
+
+noinst_HEADERS = sbase.h
+
+smixer_sbase_la_SOURCES = sbase.c
+smixer_sbase_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_sbase_la_LIBADD = ../../../src/libasound.la
+
+smixer_ac97_la_SOURCES = ac97.c sbasedl.c
+smixer_ac97_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_ac97_la_LIBADD = ../../../src/libasound.la
+
+smixer_hda_la_SOURCES = hda.c sbasedl.c
+smixer_hda_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_hda_la_LIBADD = ../../../src/libasound.la
+
+if BUILD_PYTHON
+smixer_python_la_SOURCES = python.c
+smixer_python_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_python_la_CFLAGS = $(PYTHON_INCLUDES)
+smixer_python_la_LIBADD = ../../../src/libasound.la $(PYTHON_LIBS)
+endif
diff --git a/alsa-lib/modules/mixer/simple/Makefile.in b/alsa-lib/modules/mixer/simple/Makefile.in
new file mode 100644
index 0000000..63234cb
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/Makefile.in
@@ -0,0 +1,610 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_PYTHON_TRUE@am__append_1 = smixer-python.la
+subdir = modules/mixer/simple
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkglibdir)"
+pkglibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(pkglib_LTLIBRARIES)
+smixer_ac97_la_DEPENDENCIES = ../../../src/libasound.la
+am_smixer_ac97_la_OBJECTS = ac97.lo sbasedl.lo
+smixer_ac97_la_OBJECTS = $(am_smixer_ac97_la_OBJECTS)
+smixer_hda_la_DEPENDENCIES = ../../../src/libasound.la
+am_smixer_hda_la_OBJECTS = hda.lo sbasedl.lo
+smixer_hda_la_OBJECTS = $(am_smixer_hda_la_OBJECTS)
+am__DEPENDENCIES_1 =
+@BUILD_PYTHON_TRUE@smixer_python_la_DEPENDENCIES = \
+@BUILD_PYTHON_TRUE@ ../../../src/libasound.la \
+@BUILD_PYTHON_TRUE@ $(am__DEPENDENCIES_1)
+am__smixer_python_la_SOURCES_DIST = python.c
+@BUILD_PYTHON_TRUE@am_smixer_python_la_OBJECTS = \
+@BUILD_PYTHON_TRUE@ smixer_python_la-python.lo
+smixer_python_la_OBJECTS = $(am_smixer_python_la_OBJECTS)
+@BUILD_PYTHON_TRUE@am_smixer_python_la_rpath = -rpath $(pkglibdir)
+smixer_sbase_la_DEPENDENCIES = ../../../src/libasound.la
+am_smixer_sbase_la_OBJECTS = sbase.lo
+smixer_sbase_la_OBJECTS = $(am_smixer_sbase_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(smixer_ac97_la_SOURCES) $(smixer_hda_la_SOURCES) \
+ $(smixer_python_la_SOURCES) $(smixer_sbase_la_SOURCES)
+DIST_SOURCES = $(smixer_ac97_la_SOURCES) $(smixer_hda_la_SOURCES) \
+ $(am__smixer_python_la_SOURCES_DIST) \
+ $(smixer_sbase_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkglibdir = $(alsaplugindir)/smixer
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+alsaplugindir = @ALSA_PLUGIN_DIR@
+AM_CFLAGS = -g -O2 -W -Wall
+INCLUDES = -I$(top_srcdir)/include
+pkglib_LTLIBRARIES = smixer-sbase.la smixer-ac97.la smixer-hda.la \
+ $(am__append_1)
+noinst_HEADERS = sbase.h
+smixer_sbase_la_SOURCES = sbase.c
+smixer_sbase_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_sbase_la_LIBADD = ../../../src/libasound.la
+smixer_ac97_la_SOURCES = ac97.c sbasedl.c
+smixer_ac97_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_ac97_la_LIBADD = ../../../src/libasound.la
+smixer_hda_la_SOURCES = hda.c sbasedl.c
+smixer_hda_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+smixer_hda_la_LIBADD = ../../../src/libasound.la
+@BUILD_PYTHON_TRUE@smixer_python_la_SOURCES = python.c
+@BUILD_PYTHON_TRUE@smixer_python_la_LDFLAGS = -module -avoid-version $(LDFLAGS_NOUNDEFINED)
+@BUILD_PYTHON_TRUE@smixer_python_la_CFLAGS = $(PYTHON_INCLUDES)
+@BUILD_PYTHON_TRUE@smixer_python_la_LIBADD = ../../../src/libasound.la $(PYTHON_LIBS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign modules/mixer/simple/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign modules/mixer/simple/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-pkglibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ done
+
+clean-pkglibLTLIBRARIES:
+ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+smixer-ac97.la: $(smixer_ac97_la_OBJECTS) $(smixer_ac97_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(smixer_ac97_la_LDFLAGS) $(smixer_ac97_la_OBJECTS) $(smixer_ac97_la_LIBADD) $(LIBS)
+smixer-hda.la: $(smixer_hda_la_OBJECTS) $(smixer_hda_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(smixer_hda_la_LDFLAGS) $(smixer_hda_la_OBJECTS) $(smixer_hda_la_LIBADD) $(LIBS)
+smixer-python.la: $(smixer_python_la_OBJECTS) $(smixer_python_la_DEPENDENCIES)
+ $(LINK) $(am_smixer_python_la_rpath) $(smixer_python_la_LDFLAGS) $(smixer_python_la_OBJECTS) $(smixer_python_la_LIBADD) $(LIBS)
+smixer-sbase.la: $(smixer_sbase_la_OBJECTS) $(smixer_sbase_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(smixer_sbase_la_LDFLAGS) $(smixer_sbase_la_OBJECTS) $(smixer_sbase_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ac97.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hda.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbase.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbasedl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smixer_python_la-python.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+smixer_python_la-python.lo: python.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(smixer_python_la_CFLAGS) $(CFLAGS) -MT smixer_python_la-python.lo -MD -MP -MF "$(DEPDIR)/smixer_python_la-python.Tpo" -c -o smixer_python_la-python.lo `test -f 'python.c' || echo '$(srcdir)/'`python.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/smixer_python_la-python.Tpo" "$(DEPDIR)/smixer_python_la-python.Plo"; else rm -f "$(DEPDIR)/smixer_python_la-python.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='python.c' object='smixer_python_la-python.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(smixer_python_la_CFLAGS) $(CFLAGS) -c -o smixer_python_la-python.lo `test -f 'python.c' || echo '$(srcdir)/'`python.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-pkglibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-pkglibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-pkglibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/modules/mixer/simple/ac97.c b/alsa-lib/modules/mixer/simple/ac97.c
new file mode 100644
index 0000000..ddb6143
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/ac97.c
@@ -0,0 +1,89 @@
+/*
+ * Mixer Interface - AC97 simple abstact module
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include "asoundlib.h"
+#include "mixer_abst.h"
+#include "sbase.h"
+
+static struct sm_elem_ops simple_ac97_ops;
+
+struct melem_sids sids[] = {
+ {
+ .sid = SID_MASTER,
+ .sname = "Master",
+ .sindex = 0,
+ .weight = 1,
+ .chanmap = { 3, 0 },
+ .sops = &simple_ac97_ops,
+ }
+};
+
+#define SELECTORS (sizeof(selectors)/sizeof(selectors[0]))
+
+struct helem_selector selectors[] = {
+ {
+ .iface = SND_CTL_ELEM_IFACE_MIXER,
+ .name = "Master Playback Volume",
+ .index = 0,
+ .sid = SID_MASTER,
+ .purpose = PURPOSE_VOLUME,
+ .caps = SM_CAP_PVOLUME,
+ },
+ {
+ .iface = SND_CTL_ELEM_IFACE_MIXER,
+ .name = "Master Playback Switch",
+ .index = 0,
+ .sid = SID_MASTER,
+ .purpose = PURPOSE_SWITCH,
+ .caps = SM_CAP_PSWITCH,
+ }
+};
+
+int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ return priv->ops.event(class, mask, helem, melem);
+}
+
+int alsa_mixer_simple_init(snd_mixer_class_t *class)
+{
+ struct bclass_base_ops *ops;
+ int err;
+
+ err = mixer_simple_basic_dlopen(class, &ops);
+ if (err < 0)
+ return 0;
+ err = ops->selreg(class, selectors, SELECTORS);
+ if (err < 0)
+ return err;
+ err = ops->sidreg(class, sids, SELECTORS);
+ if (err < 0)
+ return err;
+ return 0;
+}
diff --git a/alsa-lib/modules/mixer/simple/hda.c b/alsa-lib/modules/mixer/simple/hda.c
new file mode 100644
index 0000000..13c931a
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/hda.c
@@ -0,0 +1,90 @@
+/*
+ * Mixer Interface - HDA simple abstact module
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include "asoundlib.h"
+#include "mixer_abst.h"
+#include "sbase.h"
+
+static struct sm_elem_ops simple_hda_ops;
+
+struct melem_sids sids[] = {
+ {
+ .sid = SID_FRONT,
+ .sname = "Front",
+ .sindex = 0,
+ .weight = 1,
+ .chanmap = { 3, 0 },
+ .sops = &simple_hda_ops,
+ }
+};
+
+#define SELECTORS (sizeof(selectors)/sizeof(selectors[0]))
+
+struct helem_selector selectors[] = {
+ {
+ .iface = SND_CTL_ELEM_IFACE_MIXER,
+ .name = "Front Playback Volume",
+ .index = 0,
+ .sid = SID_FRONT,
+ .purpose = PURPOSE_VOLUME,
+ .caps = SM_CAP_PVOLUME,
+ },
+ {
+ .iface = SND_CTL_ELEM_IFACE_MIXER,
+ .name = "Front Playback Switch",
+ .index = 0,
+ .sid = SID_FRONT,
+ .purpose = PURPOSE_SWITCH,
+ .caps = SM_CAP_PSWITCH,
+ }
+};
+
+int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ return priv->ops.event(class, mask, helem, melem);
+}
+
+int alsa_mixer_simple_init(snd_mixer_class_t *class)
+{
+ struct bclass_base_ops *ops;
+ int err;
+
+ err = mixer_simple_basic_dlopen(class, &ops);
+ if (err < 0)
+ return 0;
+ err = ops->selreg(class, selectors, SELECTORS);
+ if (err < 0)
+ return err;
+ err = ops->sidreg(class, sids, SELECTORS);
+ if (err < 0)
+ return err;
+ return 0;
+}
diff --git a/alsa-lib/modules/mixer/simple/python.c b/alsa-lib/modules/mixer/simple/python.c
new file mode 100644
index 0000000..c822c52
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/python.c
@@ -0,0 +1,1046 @@
+/*
+ * Mixer Interface - python binding simple abstact module
+ * Copyright (c) 2007 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "Python.h"
+#include <stddef.h>
+#include "config.h"
+#include "asoundlib.h"
+#include "mixer_abst.h"
+
+struct python_priv {
+ int py_initialized;
+ PyObject *py_event_func;
+ PyObject *py_mdict;
+ PyObject *py_mixer;
+};
+
+#define SCRIPT ALSA_PLUGIN_DIR "/smixer/python/main.py"
+
+struct pymelem {
+ PyObject_HEAD
+ sm_selem_t selem;
+ PyObject *py_mixer;
+ snd_mixer_elem_t *melem;
+};
+
+struct pymixer {
+ PyObject_HEAD
+ snd_mixer_class_t *class;
+ snd_mixer_t *mixer;
+ PyObject *mdict;
+ int hctl_count;
+ void **hctl;
+ int helem_count;
+ void **helem;
+ int melem_count;
+ void **melem;
+};
+
+static PyInterpreterState *main_interpreter;
+
+static void *get_C_ptr(PyObject *obj, const char *attr)
+{
+ PyObject *o;
+
+ o = PyObject_GetAttr(obj, PyString_InternFromString(attr));
+ if (!o) {
+ PyErr_Format(PyExc_TypeError, "missing '%s' attribute", attr);
+ return NULL;
+ }
+ if (!PyInt_Check(o)) {
+ PyErr_Format(PyExc_TypeError, "'%s' attribute is not integer", attr);
+ return NULL;
+ }
+ return (void *)PyInt_AsLong(o);
+}
+
+static struct pymelem *melem_to_pymelem(snd_mixer_elem_t *elem)
+{
+ return (struct pymelem *)((char *)snd_mixer_elem_get_private(elem) - offsetof(struct pymelem, selem));
+}
+
+static int pcall(struct pymelem *pymelem, const char *attr, PyObject *args, PyObject **_res)
+{
+ PyObject *obj = (PyObject *)pymelem, *res;
+ int xres = 0;
+
+ if (_res)
+ *_res = NULL;
+ obj = PyObject_GetAttr(obj, PyString_InternFromString(attr));
+ if (!obj) {
+ PyErr_Format(PyExc_TypeError, "missing '%s' attribute", attr);
+ PyErr_Print();
+ PyErr_Clear();
+ Py_DECREF(args);
+ return -EIO;
+ }
+ res = PyObject_CallObject(obj, args);
+ Py_XDECREF(args);
+ if (res == NULL) {
+ PyErr_Print();
+ PyErr_Clear();
+ return -EIO;
+ }
+ if (_res && PyTuple_Check(res)) {
+ *_res = res;
+ res = PyTuple_GetItem(res, 0);
+ }
+ if (PyInt_Check(res)) {
+ xres = PyInt_AsLong(res);
+ } else if (res == Py_None) {
+ xres = 0;
+ } else if (PyBool_Check(res)) {
+ xres = res == Py_True;
+ } else {
+ PyErr_Format(PyExc_TypeError, "wrong result from '%s'!", attr);
+ PyErr_Print();
+ PyErr_Clear();
+ Py_DECREF(res);
+ if (_res)
+ *_res = NULL;
+ return -EIO;
+ }
+ if (_res && *_res)
+ return xres;
+ Py_DECREF(res);
+ return xres;
+}
+
+static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ char *s, fcn[32] = "opsIs";
+ int res, xdir = 1, xval = 0;
+
+ switch (cmd) {
+ case SM_OPS_IS_ACTIVE: s = "Active"; xdir = 0; break;
+ case SM_OPS_IS_MONO: s = "Mono"; break;
+ case SM_OPS_IS_CHANNEL: s = "Channel"; xval = 1; break;
+ case SM_OPS_IS_ENUMERATED: s = "Enumerated"; xdir = val == 1; break;
+ case SM_OPS_IS_ENUMCNT: s = "EnumCnt"; break;
+ default:
+ return 1;
+ }
+ strcat(fcn, s);
+
+ obj1 = PyTuple_New(xdir + xval);
+ if (xdir) {
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ if (xval)
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(val));
+ }
+ res = pcall(pymelem, fcn, obj1, NULL);
+ return res < 0 ? 0 : res;
+}
+
+static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max, const char *attr)
+{
+ PyObject *obj1, *res;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ int err;
+
+ obj1 = PyTuple_New(1);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ err = pcall(pymelem, attr, obj1, &res);
+ if (err >= 0) {
+ err = !PyInt_Check(PyTuple_GetItem(res, 1)) || !PyInt_Check(PyTuple_GetItem(res, 2));
+ if (err) {
+ err = !PyLong_Check(PyTuple_GetItem(res, 1)) || !PyLong_Check(PyTuple_GetItem(res, 2));
+ if (err) {
+ PyErr_Format(PyExc_TypeError, "wrong result (invalid tuple)");
+ PyErr_Print();
+ PyErr_Clear();
+ err = -EIO;
+ } else {
+ *min = PyLong_AsLong(PyTuple_GetItem(res, 1));
+ *max = PyLong_AsLong(PyTuple_GetItem(res, 2));
+ }
+ } else {
+ *min = PyInt_AsLong(PyTuple_GetItem(res, 1));
+ *max = PyInt_AsLong(PyTuple_GetItem(res, 2));
+ }
+ }
+ Py_XDECREF(res);
+ return err;
+}
+
+static int get_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max)
+{
+ return get_x_range_ops(elem, dir, min, max, "opsGetRange");
+}
+
+static int set_range_ops(snd_mixer_elem_t *elem, int dir,
+ long min, long max)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+
+ obj1 = PyTuple_New(3);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(min));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(max));
+ return pcall(pymelem, "opsGetRange", obj1, NULL);
+}
+
+static int get_x_ops(snd_mixer_elem_t *elem, int dir,
+ long channel, long *value,
+ const char *attr)
+{
+ PyObject *obj1, *res;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ int err;
+
+ obj1 = PyTuple_New(2);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
+ err = pcall(pymelem, attr, obj1, &res);
+ if (err >= 0) {
+ err = !PyInt_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ err = !PyLong_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ PyErr_Format(PyExc_TypeError, "wrong result (invalid tuple)");
+ PyErr_Print();
+ PyErr_Clear();
+ err = -EIO;
+ } else {
+ *value = PyLong_AsLong(PyTuple_GetItem(res, 1));
+ }
+ } else {
+ *value = PyInt_AsLong(PyTuple_GetItem(res, 1));
+ }
+ }
+ Py_XDECREF(res);
+ return err;
+}
+
+static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, long *value)
+{
+ return get_x_ops(elem, dir, channel, value, "opsGetVolume");
+}
+
+static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, int *value)
+{
+ long value1;
+ int res;
+ res = get_x_ops(elem, dir, channel, &value1, "opsGetSwitch");
+ *value = value1;
+ return res;
+}
+
+static int ask_vol_dB_ops(snd_mixer_elem_t *elem,
+ int dir,
+ long value,
+ long *dbValue)
+{
+ return get_x_ops(elem, dir, value, dbValue, "opsGetVolDB");
+}
+
+static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
+ int dir,
+ long value,
+ long *dbValue,
+ int xdir)
+{
+ PyObject *obj1, *res;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ int err;
+
+ obj1 = PyTuple_New(3);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(value));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(xdir));
+ err = pcall(pymelem, "opsGetDBVol", obj1, &res);
+ if (err >= 0) {
+ err = !PyInt_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ err = !PyLong_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ PyErr_Format(PyExc_TypeError, "wrong result (invalid tuple)");
+ PyErr_Print();
+ PyErr_Clear();
+ err = -EIO;
+ } else {
+ *dbValue = PyLong_AsLong(PyTuple_GetItem(res, 1));
+ }
+ } else {
+ *dbValue = PyInt_AsLong(PyTuple_GetItem(res, 1));
+ }
+ }
+ Py_XDECREF(res);
+ return err;
+}
+
+static int get_dB_ops(snd_mixer_elem_t *elem,
+ int dir,
+ snd_mixer_selem_channel_id_t channel,
+ long *value)
+{
+ return get_x_ops(elem, dir, channel, value, "opsGetDB");
+}
+
+static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max)
+{
+ return get_x_range_ops(elem, dir, min, max, "opsGetDBRange");
+}
+
+static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, long value)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+
+ obj1 = PyTuple_New(3);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(value));
+ return pcall(pymelem, "opsSetVolume", obj1, NULL);
+}
+
+static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, int value)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+
+ obj1 = PyTuple_New(3);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(value));
+ return pcall(pymelem, "opsSetSwitch", obj1, NULL);
+}
+
+static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel,
+ long db_gain, int xdir)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+
+ obj1 = PyTuple_New(4);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(db_gain));
+ PyTuple_SET_ITEM(obj1, 3, PyInt_FromLong(xdir));
+ return pcall(pymelem, "opsSetDB", obj1, NULL);
+}
+
+static int enum_item_name_ops(snd_mixer_elem_t *elem,
+ unsigned int item,
+ size_t maxlen, char *buf)
+{
+ PyObject *obj1, *res;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ int err;
+ unsigned int len;
+ char *s;
+
+ obj1 = PyTuple_New(1);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(item));
+ err = pcall(pymelem, "opsGetEnumItemName", obj1, &res);
+ if (err >= 0) {
+ err = !PyString_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ PyErr_Format(PyExc_TypeError, "wrong result (invalid tuple)");
+ PyErr_Print();
+ PyErr_Clear();
+ err = -EIO;
+ } else {
+ s = PyString_AsString(PyTuple_GetItem(res, 1));
+ len = strlen(s);
+ if (maxlen - 1 > len)
+ len = maxlen - 1;
+ memcpy(buf, s, len);
+ buf[len] = '\0';
+ }
+ }
+ Py_XDECREF(res);
+ return err;
+}
+
+static int get_enum_item_ops(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int *itemp)
+{
+ PyObject *obj1, *res;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+ int err;
+
+ obj1 = PyTuple_New(1);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel));
+ err = pcall(pymelem, "opsGetEnumItem", obj1, &res);
+ if (err >= 0) {
+ err = !PyInt_Check(PyTuple_GetItem(res, 1));
+ if (err) {
+ PyErr_Format(PyExc_TypeError, "wrong result (invalid tuple)");
+ PyErr_Print();
+ PyErr_Clear();
+ err = -EIO;
+ } else {
+ *itemp = PyInt_AsLong(PyTuple_GetItem(res, 1));
+ }
+ }
+ Py_XDECREF(res);
+ return err;
+}
+
+static int set_enum_item_ops(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int item)
+{
+ PyObject *obj1;
+ struct pymelem *pymelem = melem_to_pymelem(elem);
+
+ obj1 = PyTuple_New(2);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(item));
+ return pcall(pymelem, "opsSetEnumItem", obj1, NULL);
+}
+
+static struct sm_elem_ops simple_python_ops = {
+ .is = is_ops,
+ .get_range = get_range_ops,
+ .get_dB_range = get_dB_range_ops,
+ .set_range = set_range_ops,
+ .ask_vol_dB = ask_vol_dB_ops,
+ .ask_dB_vol = ask_dB_vol_ops,
+ .get_volume = get_volume_ops,
+ .get_dB = get_dB_ops,
+ .set_volume = set_volume_ops,
+ .set_dB = set_dB_ops,
+ .get_switch = get_switch_ops,
+ .set_switch = set_switch_ops,
+ .enum_item_name = enum_item_name_ops,
+ .get_enum_item = get_enum_item_ops,
+ .set_enum_item = set_enum_item_ops
+};
+
+static void selem_free(snd_mixer_elem_t *elem)
+{
+ sm_selem_t *simple = snd_mixer_elem_get_private(elem);
+
+ if (simple->id) {
+ snd_mixer_selem_id_free(simple->id);
+ simple->id = NULL;
+ }
+}
+
+static PyObject *
+pymelem_cap(struct pymelem *pymelem ATTRIBUTE_UNUSED, void *priv)
+{
+ return PyInt_FromLong((long)priv);
+}
+
+static PyObject *
+pymelem_get_caps(struct pymelem *pymelem, void *priv ATTRIBUTE_UNUSED)
+{
+ return PyInt_FromLong(pymelem->selem.caps);
+}
+
+static PyObject *
+pymelem_get_name(struct pymelem *pymelem, void *priv ATTRIBUTE_UNUSED)
+{
+ return PyString_FromString(snd_mixer_selem_id_get_name(pymelem->selem.id));
+}
+
+static PyObject *
+pymelem_get_index(struct pymelem *pymelem, void *priv ATTRIBUTE_UNUSED)
+{
+ return PyInt_FromLong(snd_mixer_selem_id_get_index(pymelem->selem.id));
+}
+
+static int
+pymelem_set_caps(struct pymelem *pymelem, PyObject *val, void *priv ATTRIBUTE_UNUSED)
+{
+ if (!PyInt_Check(val)) {
+ PyErr_SetString(PyExc_TypeError, "The last attribute value must be an integer");
+ return -1;
+ }
+ pymelem->selem.caps = PyInt_AsLong(val);
+ return 0;
+}
+
+static PyObject *
+pymelem_ignore(struct pymelem *pymelem ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
+{
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pymelem_ignore1(struct pymelem *pymelem ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
+{
+ Py_RETURN_TRUE;
+}
+
+static PyObject *
+pymelem_error(struct pymelem *pymelem ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED)
+{
+ return PyInt_FromLong(-EIO);
+}
+
+static PyObject *
+pymelem_attach(struct pymelem *pymelem, PyObject *args)
+{
+ PyObject *obj;
+ snd_hctl_elem_t *helem;
+ int err;
+
+ if (!PyArg_ParseTuple(args, "O", &obj))
+ return NULL;
+ helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
+ if (helem == NULL)
+ return NULL;
+ err = snd_mixer_elem_attach(pymelem->melem, helem);
+ if (err < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Cannot attach hcontrol element to mixer element: %s", snd_strerror(err));
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pymelem_detach(struct pymelem *pymelem, PyObject *args)
+{
+ PyObject *obj;
+ snd_hctl_elem_t *helem;
+ int err;
+
+ if (!PyArg_ParseTuple(args, "O", &obj))
+ return NULL;
+ helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
+ if (helem == NULL)
+ return NULL;
+ err = snd_mixer_elem_detach(pymelem->melem, helem);
+ if (err < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Cannot detach hcontrol element to mixer element: %s", snd_strerror(err));
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pymelem_event_info(struct pymelem *pymelem, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ return PyInt_FromLong(snd_mixer_elem_info(pymelem->melem));
+}
+
+static PyObject *
+pymelem_event_value(struct pymelem *pymelem, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ return PyInt_FromLong(snd_mixer_elem_value(pymelem->melem));
+}
+
+static int
+pymelem_init(struct pymelem *pymelem, PyObject *args, PyObject *kwds ATTRIBUTE_UNUSED)
+{
+ char *name;
+ long index, weight;
+ snd_mixer_selem_id_t *id;
+ int err;
+
+ if (!PyArg_ParseTuple(args, "Osii", &pymelem->py_mixer, &name, &index, &weight))
+ return -1;
+ memset(&pymelem->selem, 0, sizeof(pymelem->selem));
+ if (snd_mixer_selem_id_malloc(&id))
+ return -1;
+ snd_mixer_selem_id_set_name(id, name);
+ snd_mixer_selem_id_set_index(id, index);
+ pymelem->selem.id = id;
+ pymelem->selem.ops = &simple_python_ops;
+ err = snd_mixer_elem_new(&pymelem->melem, SND_MIXER_ELEM_SIMPLE,
+ weight, &pymelem->selem, selem_free);
+ if (err < 0) {
+ snd_mixer_selem_id_free(id);
+ return -1;
+ }
+ return 0;
+}
+
+static void
+pymelem_dealloc(struct pymelem *self)
+{
+ selem_free(self->melem);
+ self->ob_type->tp_free(self);
+}
+
+static PyGetSetDef pymelem_getseters[] = {
+ {"CAP_GVOLUME", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_GVOLUME},
+ {"CAP_GSWITCH", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_GSWITCH},
+ {"CAP_PVOLUME", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_PVOLUME},
+ {"CAP_PVOLUME_JOIN", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_PVOLUME_JOIN},
+ {"CAP_PSWITCH", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_PSWITCH},
+ {"CAP_PSWITCH_JOIN", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_PSWITCH_JOIN},
+ {"CAP_CVOLUME", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CVOLUME},
+ {"CAP_CVOLUME_JOIN", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CVOLUME_JOIN},
+ {"CAP_CSWITCH", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CSWITCH},
+ {"CAP_CSWITCH_JOIN", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CSWITCH_JOIN},
+ {"CAP_CSWITCH_EXCL", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CSWITCH_EXCL},
+ {"CAP_PENUM", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_PENUM},
+ {"CAP_CENUM", (getter)pymelem_cap, NULL, NULL, (void *)SM_CAP_CENUM},
+
+ {"caps", (getter)pymelem_get_caps, (setter)pymelem_set_caps, NULL, NULL},
+
+ {"name", (getter)pymelem_get_name, NULL, NULL, NULL},
+ {"index", (getter)pymelem_get_index, NULL, NULL, NULL},
+
+ {NULL,NULL,NULL,NULL,NULL}
+};
+
+static PyMethodDef pymelem_methods[] = {
+ {"attach", (PyCFunction)pymelem_attach, METH_VARARGS, NULL},
+ {"detach", (PyCFunction)pymelem_detach, METH_VARARGS, NULL},
+
+ /* "default" functions - no functionality */
+ {"opsIsActive", (PyCFunction)pymelem_ignore1, METH_VARARGS, NULL},
+ {"opsIsMono", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
+ {"opsIsChannel", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
+ {"opsIsEnumerated", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
+ {"opsIsEnumCnt", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
+
+ {"opsGetDB", (PyCFunction)pymelem_error, METH_VARARGS, NULL},
+
+ {"eventInfo", (PyCFunction)pymelem_event_info, METH_VARARGS, NULL},
+ {"eventValue", (PyCFunction)pymelem_event_value, METH_VARARGS, NULL},
+
+ {NULL,NULL,0,NULL}
+};
+
+static PyTypeObject pymelem_type = {
+ PyObject_HEAD_INIT(0)
+ tp_name: "smixer_python.InternalMElement",
+ tp_basicsize: sizeof(struct pymelem),
+ tp_dealloc: (destructor)pymelem_dealloc,
+ tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ tp_doc: NULL /* mixerinit__doc__ */,
+ tp_getset: pymelem_getseters,
+ tp_init: (initproc)pymelem_init,
+ tp_alloc: PyType_GenericAlloc,
+ tp_new: PyType_GenericNew,
+ tp_free: PyObject_Del,
+ tp_methods: pymelem_methods,
+};
+
+static PyObject *
+pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args)
+{
+ PyObject *obj;
+ snd_hctl_t *hctl;
+ void **hctls;
+ int err;
+
+ if (!PyArg_ParseTuple(args, "O", &obj))
+ return NULL;
+ hctl = (snd_hctl_t *)get_C_ptr(obj, "get_C_hctl");
+ if (hctl == NULL)
+ return NULL;
+ err = snd_mixer_attach_hctl(pymixer->mixer, hctl);
+ if (err < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Cannot attach hctl: %s", snd_strerror(err));
+ return NULL;
+ }
+ hctls = realloc(pymixer->hctl, sizeof(void *) * (pymixer->hctl_count+1) * 2);
+ if (hctls == NULL) {
+ PyErr_SetString(PyExc_RuntimeError, "No enough memory");
+ return NULL;
+ }
+ pymixer->hctl = hctls;
+ pymixer->hctl[pymixer->hctl_count*2] = (void *)hctl;
+ pymixer->hctl[pymixer->hctl_count*2+1] = (void *)obj;
+ pymixer->hctl_count++;
+ Py_INCREF(obj);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pymixer_register(struct pymixer *pymixer, PyObject *args)
+{
+ int err;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ err = snd_mixer_class_register(pymixer->class, pymixer->mixer);
+ if (err < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Cannot register mixer: %s", snd_strerror(err));
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pymixer_melement_new(struct pymixer *pymixer, PyObject *args)
+{
+ PyObject *obj, *obj1, *obj2;
+ char *class, *name;
+ long index, weight;
+
+ if (!PyArg_ParseTuple(args, "ssii", &class, &name, &index, &weight))
+ return NULL;
+ obj = PyDict_GetItemString(pymixer->mdict, class);
+ if (obj) {
+ obj1 = PyTuple_New(4);
+ if (PyTuple_SET_ITEM(obj1, 0, (PyObject *)pymixer))
+ Py_INCREF((PyObject *)pymixer);
+ PyTuple_SET_ITEM(obj1, 1, PyString_FromString(name));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(index));
+ PyTuple_SET_ITEM(obj1, 3, PyInt_FromLong(weight));
+ obj2 = PyObject_CallObject(obj, obj1);
+ Py_XDECREF(obj1);
+ if (obj2) {
+ struct pymelem *pymelem = (struct pymelem *)obj2;
+ void **melems = realloc(pymixer->melem, sizeof(void *) * (pymixer->melem_count + 1) * 2);
+ if (melems == NULL) {
+ Py_DECREF(obj2);
+ return NULL;
+ }
+ melems[pymixer->melem_count*2] = pymelem->melem;
+ melems[pymixer->melem_count*2+1] = obj2;
+ Py_INCREF(obj2);
+ pymixer->melem = melems;
+ pymixer->melem_count++;
+ }
+ } else {
+ PyErr_Format(PyExc_RuntimeError, "Cannot find class '%s'", class);
+ return NULL;
+ }
+ return obj2;
+}
+
+static PyObject *
+pymixer_melement_add(struct pymixer *pymixer, PyObject *args)
+{
+ PyObject *obj;
+ struct pymelem *pymelem;
+ int err;
+
+ if (!PyArg_ParseTuple(args, "O", &obj))
+ return NULL;
+ pymelem = (struct pymelem *)obj;
+ err = snd_mixer_elem_add(pymelem->melem, pymixer->class);
+ if (err < 0) {
+ PyErr_Format(PyExc_RuntimeError, "Cannot add mixer element: %s", snd_strerror(err));
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static int
+pymixer_init(struct pymixer *pymixer, PyObject *args, PyObject *kwds ATTRIBUTE_UNUSED)
+{
+ long class, mixer;
+
+ if (!PyArg_ParseTuple(args, "iiO", &class, &mixer, &pymixer->mdict))
+ return -1;
+ pymixer->class = (snd_mixer_class_t *)class;
+ pymixer->mixer = (snd_mixer_t *)mixer;
+ pymixer->hctl_count = 0;
+ pymixer->hctl = NULL;
+ pymixer->helem_count = 0;
+ pymixer->helem = NULL;
+ pymixer->melem_count = 0;
+ pymixer->melem = NULL;
+ return 0;
+}
+
+static void
+pymixer_free(struct pymixer *self)
+{
+ int idx;
+
+ for (idx = 0; idx < self->hctl_count; idx++) {
+ snd_mixer_detach_hctl(self->mixer, self->hctl[idx*2]);
+ Py_DECREF((PyObject *)self->hctl[idx*2+1]);
+ }
+ if (self->hctl)
+ free(self->hctl);
+ self->hctl_count = 0;
+ self->hctl = NULL;
+ for (idx = 0; idx < self->helem_count; idx++)
+ Py_DECREF((PyObject *)self->helem[idx*2+1]);
+ if (self->helem)
+ free(self->helem);
+ self->helem_count = 0;
+ self->helem = NULL;
+ for (idx = 0; idx < self->melem_count; idx++)
+ Py_DECREF((PyObject *)self->melem[idx*2+1]);
+ if (self->melem)
+ free(self->melem);
+ self->melem_count = 0;
+ self->melem = NULL;
+}
+
+static void
+pymixer_dealloc(struct pymixer *self)
+{
+ pymixer_free(self);
+ self->ob_type->tp_free(self);
+}
+
+static PyGetSetDef pymixer_getseters[] = {
+ {NULL,NULL,NULL,NULL,NULL}
+};
+
+static PyMethodDef pymixer_methods[] = {
+ {"attachHCtl", (PyCFunction)pymixer_attach_hctl, METH_VARARGS, NULL},
+ {"register", (PyCFunction)pymixer_register, METH_VARARGS, NULL},
+ {"newMElement", (PyCFunction)pymixer_melement_new, METH_VARARGS, NULL},
+ {"addMElement", (PyCFunction)pymixer_melement_add, METH_VARARGS, NULL},
+ {NULL,NULL,0,NULL}
+};
+
+static PyTypeObject pymixer_type = {
+ PyObject_HEAD_INIT(0)
+ tp_name: "smixer_python.InternalMixer",
+ tp_basicsize: sizeof(struct pymixer),
+ tp_dealloc: (destructor)pymixer_dealloc,
+ tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ tp_doc: NULL /* mixerinit__doc__ */,
+ tp_getset: pymixer_getseters,
+ tp_init: (initproc)pymixer_init,
+ tp_alloc: PyType_GenericAlloc,
+ tp_new: PyType_GenericNew,
+ tp_free: PyObject_Del,
+ tp_methods: pymixer_methods,
+};
+
+static PyMethodDef python_methods[] = {
+ {NULL, NULL, 0, NULL}
+};
+
+static PyObject *new_helem(struct python_priv *priv, snd_hctl_elem_t *helem)
+{
+ PyObject *obj, *py_hctl = NULL, *obj1, *obj2;
+ snd_hctl_t *hctl = snd_hctl_elem_get_hctl(helem);
+ struct pymixer *pymixer = (struct pymixer *)priv->py_mixer;
+ int idx;
+
+ for (idx = 0; idx < pymixer->hctl_count; idx++) {
+ if (pymixer->hctl[idx] == hctl) {
+ py_hctl = pymixer->hctl[idx*2+1];
+ break;
+ }
+ }
+ if (py_hctl == NULL)
+ return NULL;
+ obj = PyDict_GetItemString(priv->py_mdict, "HElement");
+ if (obj) {
+ obj1 = PyTuple_New(3);
+ if (PyTuple_SET_ITEM(obj1, 0, py_hctl))
+ Py_INCREF(py_hctl);
+ PyTuple_SET_ITEM(obj1, 1, PyFloat_FromDouble(1));
+ PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong((long)helem));
+ obj2 = PyObject_CallObject(obj, obj1);
+ if (obj2 == NULL) {
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ Py_XDECREF(obj1);
+ } else {
+ SNDERR("Unable to create InternalMixer object");
+ return NULL;
+ }
+ if (obj2) {
+ struct pymixer *pymixer = (struct pymixer *)priv->py_mixer;
+ void **helems = realloc(pymixer->helem, sizeof(void *) * (pymixer->helem_count + 1) * 2);
+ if (helems == NULL) {
+ Py_DECREF(obj2);
+ return NULL;
+ }
+ helems[pymixer->helem_count*2] = helem;
+ helems[pymixer->helem_count*2+1] = obj2;
+ Py_INCREF(obj2);
+ pymixer->helem = helems;
+ pymixer->helem_count++;
+ }
+ return obj2;
+}
+
+static PyObject *find_helem(struct python_priv *priv, snd_hctl_elem_t *helem)
+{
+ struct pymixer *pymixer = (struct pymixer *)priv->py_mixer;
+ int idx;
+
+ for (idx = 0; idx < pymixer->helem_count; idx++) {
+ if (pymixer->helem[idx*2] == helem)
+ return (PyObject *)pymixer->helem[idx*2+1];
+ }
+ return NULL;
+}
+
+static PyObject *find_melem(struct python_priv *priv, snd_mixer_elem_t *melem)
+{
+ struct pymixer *pymixer = (struct pymixer *)priv->py_mixer;
+ int idx;
+
+ for (idx = 0; idx < pymixer->melem_count; idx++) {
+ if (pymixer->melem[idx*2] == melem)
+ return (PyObject *)pymixer->melem[idx*2+1];
+ }
+ return NULL;
+}
+
+int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+{
+ struct python_priv *priv = snd_mixer_sbasic_get_private(class);
+ PyThreadState *tstate, *origstate;
+ PyObject *t, *o, *r;
+ int res = -ENOMEM;
+
+ tstate = PyThreadState_New(main_interpreter);
+ origstate = PyThreadState_Swap(tstate);
+
+ t = PyTuple_New(3);
+ if (t) {
+ PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
+ o = find_helem(priv, helem);
+ if (mask & SND_CTL_EVENT_MASK_ADD) {
+ if (o == NULL)
+ o = new_helem(priv, helem);
+ }
+ if (o == NULL)
+ return 0;
+ if (PyTuple_SET_ITEM(t, 1, o))
+ Py_INCREF(o);
+ o = melem ? find_melem(priv, melem) : Py_None;
+ if (PyTuple_SET_ITEM(t, 2, o))
+ Py_INCREF(o);
+ r = PyObject_CallObject(priv->py_event_func, t);
+ Py_DECREF(t);
+ if (r) {
+ if (PyInt_Check(r)) {
+ res = PyInt_AsLong(r);
+ } else if (r == Py_None) {
+ res = 0;
+ }
+ Py_DECREF(r);
+ } else {
+ PyErr_Print();
+ PyErr_Clear();
+ res = -EIO;
+ }
+ }
+
+ return res;
+}
+
+static void alsa_mixer_simple_free(snd_mixer_class_t *class)
+{
+ struct python_priv *priv = snd_mixer_sbasic_get_private(class);
+
+ if (priv->py_mixer) {
+ pymixer_free((struct pymixer *)priv->py_mixer);
+ Py_DECREF(priv->py_mixer);
+ }
+ if (priv->py_initialized) {
+ Py_XDECREF(priv->py_event_func);
+ Py_Finalize();
+ }
+ free(priv);
+}
+
+int alsa_mixer_simple_finit(snd_mixer_class_t *class,
+ snd_mixer_t *mixer,
+ const char *device)
+{
+ struct python_priv *priv;
+ FILE *fp;
+ const char *file;
+ PyObject *obj, *obj1, *obj2, *py_mod, *mdict;
+
+ priv = calloc(1, sizeof(*priv));
+ if (priv == NULL)
+ return -ENOMEM;
+
+ snd_mixer_sbasic_set_private(class, priv);
+ snd_mixer_sbasic_set_private_free(class, alsa_mixer_simple_free);
+
+ file = getenv("ALSA_MIXER_SIMPLE_MPYTHON");
+ if (file == NULL)
+ file = SCRIPT;
+
+ fp = fopen(file, "r");
+ if (fp == NULL) {
+ SNDERR("Unable to find python module '%s'", file);
+ return -ENODEV;
+ }
+
+ Py_Initialize();
+ if (PyType_Ready(&pymelem_type) < 0)
+ return -EIO;
+ if (PyType_Ready(&pymixer_type) < 0)
+ return -EIO;
+ Py_InitModule("smixer_python", python_methods);
+ priv->py_initialized = 1;
+ main_interpreter = PyThreadState_Get()->interp;
+ obj = PyImport_GetModuleDict();
+ py_mod = PyDict_GetItemString(obj, "__main__");
+ if (py_mod) {
+ mdict = priv->py_mdict = PyModule_GetDict(py_mod);
+ obj = PyString_FromString(file);
+ if (obj)
+ PyDict_SetItemString(mdict, "__file__", obj);
+ Py_XDECREF(obj);
+ obj = PyString_FromString(device);
+ if (obj)
+ PyDict_SetItemString(mdict, "device", obj);
+ Py_XDECREF(obj);
+ Py_INCREF(&pymixer_type);
+ PyModule_AddObject(py_mod, "InternalMElement", (PyObject *)&pymelem_type);
+ PyModule_AddObject(py_mod, "InternalMixer", (PyObject *)&pymixer_type);
+ obj = PyDict_GetItemString(mdict, "InternalMixer");
+ if (obj) {
+ obj1 = PyTuple_New(3);
+ PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong((long)class));
+ PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong((long)mixer));
+ if (PyTuple_SET_ITEM(obj1, 2, mdict))
+ Py_INCREF(mdict);
+ obj2 = PyObject_CallObject(obj, obj1);
+ Py_XDECREF(obj1);
+ PyDict_SetItemString(mdict, "mixer", obj2);
+ priv->py_mixer = obj2;
+ } else {
+ SNDERR("Unable to create InternalMixer object");
+ return -EIO;
+ }
+
+
+ obj = PyRun_FileEx(fp, file, Py_file_input, mdict, mdict, 1);
+ if (obj == NULL)
+ PyErr_Print();
+ Py_XDECREF(obj);
+ priv->py_event_func = PyDict_GetItemString(mdict, "event");
+ if (priv->py_event_func == NULL) {
+ SNDERR("Unable to find python function 'event'");
+ return -EIO;
+ }
+ }
+ return 0;
+}
diff --git a/alsa-lib/modules/mixer/simple/sbase.c b/alsa-lib/modules/mixer/simple/sbase.c
new file mode 100644
index 0000000..97feee8
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/sbase.c
@@ -0,0 +1,587 @@
+/*
+ * Mixer Interface - simple abstact module - base library
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include "asoundlib.h"
+#include "mixer_abst.h"
+#include "sbase.h"
+
+/*
+ * Prototypes
+ */
+
+static int selem_read(snd_mixer_elem_t *elem);
+
+/*
+ * Helpers
+ */
+
+static unsigned int chanmap_to_channels(unsigned int chanmap)
+{
+ unsigned int i, res;
+
+ for (i = 0, res = 0; i < MAX_CHANNEL; i++)
+ if (chanmap & (1 << i))
+ res++;
+ return res;
+}
+
+#if 0
+static long to_user(struct selem_base *s, int dir, struct helem_base *c, long value)
+{
+ int64_t n;
+ if (c->max == c->min)
+ return s->dir[dir].min;
+ n = (int64_t) (value - c->min) * (s->dir[dir].max - s->dir[dir].min);
+ return s->dir[dir].min + (n + (c->max - c->min) / 2) / (c->max - c->min);
+}
+
+static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value)
+{
+ int64_t n;
+ if (s->dir[dir].max == s->dir[dir].min)
+ return c->min;
+ n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
+ return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min);
+}
+#endif
+
+static void update_ranges(struct selem_base *s)
+{
+ static unsigned int mask[2] = { SM_CAP_PVOLUME, SM_CAP_CVOLUME };
+ static unsigned int gmask[2] = { SM_CAP_GVOLUME, SM_CAP_GVOLUME };
+ unsigned int dir, ok_flag;
+ struct list_head *pos;
+ struct helem_base *helem;
+
+ for (dir = 0; dir < 2; dir++) {
+ s->dir[dir].min = 0;
+ s->dir[dir].max = 0;
+ ok_flag = 0;
+ list_for_each(pos, &s->helems) {
+ helem = list_entry(pos, struct helem_base, list);
+ printf("min = %li, max = %li\n", helem->min, helem->max);
+ if (helem->caps & mask[dir]) {
+ s->dir[dir].min = helem->min;
+ s->dir[dir].max = helem->max;
+ ok_flag = 1;
+ break;
+ }
+ }
+ if (ok_flag)
+ continue;
+ list_for_each(pos, &s->helems) {
+ helem = list_entry(pos, struct helem_base, list);
+ if (helem->caps & gmask[dir]) {
+ s->dir[dir].min = helem->min;
+ s->dir[dir].max = helem->max;
+ break;
+ }
+ }
+ }
+}
+
+/*
+ * Simple Mixer Operations
+ */
+
+static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
+{
+ struct selem_base *s = snd_mixer_elem_get_private(elem);
+
+ switch (cmd) {
+
+ case SM_OPS_IS_ACTIVE: {
+ struct list_head *pos;
+ struct helem_base *helem;
+ list_for_each(pos, &s->helems) {
+ helem = list_entry(pos, struct helem_base, list);
+ if (helem->inactive)
+ return 0;
+ }
+ return 1;
+ }
+
+ case SM_OPS_IS_MONO:
+ return chanmap_to_channels(s->dir[dir].chanmap) == 1;
+
+ case SM_OPS_IS_CHANNEL:
+ if (val > MAX_CHANNEL)
+ return 0;
+ return !!((1 << val) & s->dir[dir].chanmap);
+
+ case SM_OPS_IS_ENUMERATED: {
+ struct helem_base *helem;
+ helem = list_entry(s->helems.next, struct helem_base, list);
+ return !!(helem->purpose == PURPOSE_ENUMLIST);
+ }
+
+ case SM_OPS_IS_ENUMCNT: {
+ struct helem_base *helem;
+ helem = list_entry(s->helems.next, struct helem_base, list);
+ return helem->max;
+ }
+
+ }
+
+ return 1;
+}
+
+static int get_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max)
+{
+ struct selem_base *s = snd_mixer_elem_get_private(elem);
+
+ *min = s->dir[dir].min;
+ *max = s->dir[dir].max;
+
+ return 0;
+}
+
+static int get_dB_range_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ long *min ATTRIBUTE_UNUSED,
+ long *max ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int set_range_ops(snd_mixer_elem_t *elem, int dir,
+ long min, long max)
+{
+ struct selem_base *s = snd_mixer_elem_get_private(elem);
+ int err;
+
+ s->dir[dir].forced_range = 1;
+ s->dir[dir].min = min;
+ s->dir[dir].max = max;
+
+ if ((err = selem_read(elem)) < 0)
+ return err;
+ return 0;
+}
+
+static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, long *value)
+{
+ struct selem_base *s = snd_mixer_elem_get_private(elem);
+
+ *value = s->dir[dir].vol[channel];
+ return 0;
+}
+
+static int get_dB_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ long *value ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int get_switch_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ int *value)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem); */
+ *value = 0;
+ return 0;
+}
+
+static int set_volume_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ long value ATTRIBUTE_UNUSED)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem); */
+ return 0;
+}
+
+static int set_dB_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ long value ATTRIBUTE_UNUSED,
+ int xdir ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int set_switch_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ int dir ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ int value ATTRIBUTE_UNUSED)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem); */
+ /* int changed; */
+ return 0;
+}
+
+static int enum_item_name_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ unsigned int item ATTRIBUTE_UNUSED,
+ size_t maxlen ATTRIBUTE_UNUSED,
+ char *buf ATTRIBUTE_UNUSED)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem);*/
+ return 0;
+}
+
+static int get_enum_item_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ unsigned int *itemp ATTRIBUTE_UNUSED)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem); */
+ return 0;
+}
+
+static int set_enum_item_ops(snd_mixer_elem_t *elem ATTRIBUTE_UNUSED,
+ snd_mixer_selem_channel_id_t channel ATTRIBUTE_UNUSED,
+ unsigned int item ATTRIBUTE_UNUSED)
+{
+ /* struct selem_base *s = snd_mixer_elem_get_private(elem); */
+ return 0;
+}
+
+static struct sm_elem_ops simple_ac97_ops = {
+ .is = is_ops,
+ .get_range = get_range_ops,
+ .get_dB_range = get_dB_range_ops,
+ .set_range = set_range_ops,
+ .get_volume = get_volume_ops,
+ .get_dB = get_dB_ops,
+ .set_volume = set_volume_ops,
+ .set_dB = set_dB_ops,
+ .get_switch = get_switch_ops,
+ .set_switch = set_switch_ops,
+ .enum_item_name = enum_item_name_ops,
+ .get_enum_item = get_enum_item_ops,
+ .set_enum_item = set_enum_item_ops
+};
+
+/*
+ * event handling
+ */
+
+static int selem_read(snd_mixer_elem_t *elem)
+{
+ printf("elem read: %p\n", elem);
+ return 0;
+}
+
+static int simple_event_remove(snd_hctl_elem_t *helem,
+ snd_mixer_elem_t *melem ATTRIBUTE_UNUSED)
+{
+ printf("event remove: %p\n", helem);
+ return 0;
+}
+
+static void selem_free(snd_mixer_elem_t *elem)
+{
+ struct selem_base *simple = snd_mixer_elem_get_private(elem);
+ struct helem_base *hsimple;
+ struct list_head *pos, *npos;
+
+ if (simple->selem.id)
+ snd_mixer_selem_id_free(simple->selem.id);
+ list_for_each_safe(pos, npos, &simple->helems) {
+ hsimple = list_entry(pos, struct helem_base, list);
+ free(hsimple);
+ }
+ free(simple);
+}
+
+static int simple_event_add1(snd_mixer_class_t *class,
+ snd_hctl_elem_t *helem,
+ struct helem_selector *sel)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ snd_mixer_elem_t *melem;
+ snd_mixer_selem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ struct selem_base *simple;
+ struct helem_base *hsimple;
+ snd_ctl_elem_type_t ctype;
+ unsigned long values;
+ long min, max;
+ int err, new = 0;
+ struct list_head *pos;
+ struct bclass_sid *bsid;
+ struct melem_sids *sid;
+ unsigned int ui;
+
+ list_for_each(pos, &priv->sids) {
+ bsid = list_entry(pos, struct bclass_sid, list);
+ for (ui = 0; ui < bsid->count; ui++) {
+ if (bsid->sids[ui].sid == sel->sid) {
+ sid = &bsid->sids[ui];
+ goto __sid_ok;
+ }
+ }
+ }
+ return 0;
+
+ __sid_ok:
+ snd_ctl_elem_info_alloca(&info);
+ err = snd_hctl_elem_info(helem, info);
+ if (err < 0)
+ return err;
+ ctype = snd_ctl_elem_info_get_type(info);
+ values = snd_ctl_elem_info_get_count(info);
+ switch (ctype) {
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ min = 0;
+ max = snd_ctl_elem_info_get_items(info);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ min = snd_ctl_elem_info_get_min(info);
+ max = snd_ctl_elem_info_get_max(info);
+ break;
+ default:
+ min = max = 0;
+ break;
+ }
+
+ printf("event add: %p, %p (%s)\n", helem, sel, snd_hctl_elem_get_name(helem));
+ if (snd_mixer_selem_id_malloc(&id))
+ return -ENOMEM;
+ hsimple = calloc(1, sizeof(*hsimple));
+ if (hsimple == NULL) {
+ snd_mixer_selem_id_free(id);
+ return -ENOMEM;
+ }
+ switch (sel->purpose) {
+ case PURPOSE_SWITCH:
+ if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) {
+ __invalid_type:
+ snd_mixer_selem_id_free(id);
+ return -EINVAL;
+ }
+ break;
+ case PURPOSE_VOLUME:
+ if (ctype != SND_CTL_ELEM_TYPE_INTEGER)
+ goto __invalid_type;
+ break;
+ }
+ hsimple->purpose = sel->purpose;
+ hsimple->caps = sel->caps;
+ hsimple->min = min;
+ hsimple->max = max;
+ snd_mixer_selem_id_set_name(id, sid->sname);
+ snd_mixer_selem_id_set_index(id, sid->sindex);
+ melem = snd_mixer_find_selem(snd_mixer_class_get_mixer(class), id);
+ if (!melem) {
+ simple = calloc(1, sizeof(*simple));
+ if (!simple) {
+ snd_mixer_selem_id_free(id);
+ free(hsimple);
+ return -ENOMEM;
+ }
+ simple->selem.id = id;
+ simple->selem.ops = &simple_ac97_ops;
+ INIT_LIST_HEAD(&simple->helems);
+ simple->sid = sel->sid;
+ err = snd_mixer_elem_new(&melem, SND_MIXER_ELEM_SIMPLE,
+ sid->weight,
+ simple, selem_free);
+ if (err < 0) {
+ snd_mixer_selem_id_free(id);
+ free(hsimple);
+ free(simple);
+ return err;
+ }
+ new = 1;
+ } else {
+ simple = snd_mixer_elem_get_private(melem);
+ snd_mixer_selem_id_free(id);
+ }
+ list_add_tail(&hsimple->list, &simple->helems);
+ hsimple->inactive = snd_ctl_elem_info_is_inactive(info);
+ err = snd_mixer_elem_attach(melem, helem);
+ if (err < 0)
+ goto __error;
+ simple->dir[0].chanmap |= sid->chanmap[0];
+ simple->dir[1].chanmap |= sid->chanmap[1];
+ simple->selem.caps |= hsimple->caps;
+ update_ranges(simple);
+#if 0
+ err = simple_update(melem);
+ if (err < 0) {
+ if (new)
+ goto __error;
+ return err;
+ }
+#endif
+ if (new)
+ err = snd_mixer_elem_add(melem, class);
+ else
+ err = snd_mixer_elem_info(melem);
+ if (err < 0)
+ return err;
+ err = selem_read(melem);
+ if (err < 0)
+ return err;
+ if (err)
+ err = snd_mixer_elem_value(melem);
+ return err;
+ __error:
+ if (new)
+ snd_mixer_elem_free(melem);
+ return -EINVAL;
+}
+
+static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ struct bclass_selector *sel;
+ struct helem_selector *hsel;
+ struct list_head *pos;
+ snd_ctl_elem_iface_t iface = snd_hctl_elem_get_interface(helem);
+ const char *name = snd_hctl_elem_get_name(helem);
+ unsigned int index = snd_hctl_elem_get_index(helem);
+ unsigned int ui;
+ int err;
+
+ list_for_each(pos, &priv->selectors) {
+ sel = list_entry(pos, struct bclass_selector, list);
+ for (ui = 0; ui < sel->count; ui++) {
+ hsel = &sel->selectors[ui];
+ if (hsel->iface == iface && !strcmp(hsel->name, name) && hsel->index == index) {
+ err = simple_event_add1(class, helem, hsel);
+ if (err < 0)
+ return err; /* early exit? */
+ }
+ }
+ }
+ return 0;
+}
+
+int alsa_mixer_sbasic_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+{
+ int err;
+ if (mask == SND_CTL_EVENT_MASK_REMOVE)
+ return simple_event_remove(helem, melem);
+ if (mask & SND_CTL_EVENT_MASK_ADD) {
+ err = simple_event_add(class, helem);
+ if (err < 0)
+ return err;
+ }
+ if (mask & SND_CTL_EVENT_MASK_INFO) {
+ err = simple_event_remove(helem, melem);
+ if (err < 0)
+ return err;
+ err = simple_event_add(class, helem);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+ if (mask & SND_CTL_EVENT_MASK_VALUE) {
+ err = selem_read(melem);
+ if (err < 0)
+ return err;
+ if (err) {
+ err = snd_mixer_elem_value(melem);
+ if (err < 0)
+ return err;
+ }
+ }
+ return 0;
+}
+
+static void sbasic_cpriv_free(snd_mixer_class_t *class)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ struct bclass_selector *sel;
+ struct bclass_sid *sid;
+ struct list_head *pos, *pos1;
+
+ list_for_each_safe(pos, pos1, &priv->selectors) {
+ sel = list_entry(pos, struct bclass_selector, list);
+ free(sel);
+ }
+ list_for_each_safe(pos, pos1, &priv->sids) {
+ sid = list_entry(pos, struct bclass_sid, list);
+ free(sid);
+ }
+ free(priv);
+}
+
+void alsa_mixer_sbasic_initpriv(snd_mixer_class_t *class,
+ struct bclass_private *priv)
+{
+ INIT_LIST_HEAD(&priv->selectors);
+ INIT_LIST_HEAD(&priv->sids);
+ snd_mixer_sbasic_set_private(class, priv);
+ snd_mixer_sbasic_set_private_free(class, sbasic_cpriv_free);
+}
+
+int alsa_mixer_sbasic_selreg(snd_mixer_class_t *class,
+ struct helem_selector *selectors,
+ unsigned int count)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ struct bclass_selector *sel = calloc(1, sizeof(*sel));
+
+ if (sel == NULL)
+ return -ENOMEM;
+ if (priv == NULL) {
+ priv = calloc(1, sizeof(*priv));
+ if (priv == NULL) {
+ free(sel);
+ return -ENOMEM;
+ }
+ }
+ sel->selectors = selectors;
+ sel->count = count;
+ list_add_tail(&sel->list, &priv->selectors);
+ return 0;
+}
+
+int alsa_mixer_sbasic_sidreg(snd_mixer_class_t *class,
+ struct melem_sids *sids,
+ unsigned int count)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ struct bclass_sid *sid = calloc(1, sizeof(*sid));
+
+ if (sid == NULL)
+ return -ENOMEM;
+ if (priv == NULL) {
+ priv = calloc(1, sizeof(*priv));
+ if (priv == NULL) {
+ free(sid);
+ return -ENOMEM;
+ }
+ INIT_LIST_HEAD(&priv->selectors);
+ INIT_LIST_HEAD(&priv->sids);
+ snd_mixer_sbasic_set_private(class, priv);
+ snd_mixer_sbasic_set_private_free(class, sbasic_cpriv_free);
+ }
+ sid->sids = sids;
+ sid->count = count;
+ list_add(&sid->list, &priv->sids);
+ return 0;
+}
diff --git a/alsa-lib/modules/mixer/simple/sbase.h b/alsa-lib/modules/mixer/simple/sbase.h
new file mode 100644
index 0000000..ee5fe03
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/sbase.h
@@ -0,0 +1,111 @@
+/*
+ * Mixer Interface - simple abstact module - base library
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __SMIXER_BASE_H
+
+#include "list.h"
+
+#define MAX_CHANNEL 6
+
+#define SID_MASTER 0
+#define SID_HEADPHONE 1
+#define SID_FRONT 2
+#define SID_PCM 3
+#define SID_CD 4
+
+struct melem_sids {
+ unsigned short sid;
+ const char *sname;
+ unsigned short sindex;
+ unsigned short weight;
+ unsigned int chanmap[2];
+ struct sm_elem_ops *sops;
+};
+
+#define PURPOSE_VOLUME 0
+#define PURPOSE_SWITCH 1
+#define PURPOSE_ENUMLIST 2
+
+struct helem_selector {
+ snd_ctl_elem_iface_t iface;
+ const char *name;
+ unsigned short index;
+ unsigned short sid;
+ unsigned short purpose;
+ unsigned short caps;
+};
+
+struct helem_base {
+ struct list_head list;
+ snd_hctl_elem_t *helem;
+ unsigned short purpose;
+ unsigned int caps;
+ unsigned int inactive: 1;
+ long min, max;
+ unsigned int count;
+};
+
+struct selem_base {
+ sm_selem_t selem;
+ struct list_head helems;
+ unsigned short sid;
+ struct {
+ unsigned int chanmap;
+ unsigned int forced_range: 1;
+ long min, max;
+ long vol[MAX_CHANNEL];
+ } dir[2];
+};
+
+struct bclass_selector {
+ struct list_head list;
+ struct helem_selector *selectors;
+ unsigned int count;
+};
+
+struct bclass_sid {
+ struct list_head list;
+ struct melem_sids *sids;
+ unsigned int count;
+};
+
+typedef struct bclass_base_ops {
+ int (*event)(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
+ int (*selreg)(snd_mixer_class_t *class,
+ struct helem_selector *selectors,
+ unsigned int count);
+ int (*sidreg)(snd_mixer_class_t *class,
+ struct melem_sids *sids,
+ unsigned int count);
+} bclass_base_ops_t;
+
+struct bclass_private {
+ struct list_head selectors;
+ struct list_head sids;
+ void *dl_sbase;
+ bclass_base_ops_t ops;
+};
+
+int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
+ bclass_base_ops_t **ops);
+
+#endif /* __SMIXER_BASE_H */
diff --git a/alsa-lib/modules/mixer/simple/sbasedl.c b/alsa-lib/modules/mixer/simple/sbasedl.c
new file mode 100644
index 0000000..0137586
--- /dev/null
+++ b/alsa-lib/modules/mixer/simple/sbasedl.c
@@ -0,0 +1,106 @@
+/*
+ * Mixer Interface - simple abstact module - base library (dlopen function)
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include <dlfcn.h>
+#include "config.h"
+#include "asoundlib.h"
+#include "mixer_abst.h"
+#include "sbase.h"
+
+#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
+
+int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
+ bclass_base_ops_t **ops)
+{
+ struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
+ const char *lib = "smixer-sbase.so";
+ void (*initpriv)(snd_mixer_class_t *class, struct bclass_private *priv);
+ char *xlib, *path;
+ void *h;
+ int initflag = 0;
+
+ if (priv == NULL) {
+ priv = calloc(1, sizeof(*priv));
+ if (priv == NULL)
+ return -ENOMEM;
+ initflag = 1;
+ }
+ path = getenv("ALSA_MIXER_SIMPLE_MODULES");
+ if (!path)
+ path = SO_PATH;
+ xlib = malloc(strlen(lib) + strlen(path) + 1 + 1);
+ if (xlib == NULL) {
+ if (initflag)
+ free(priv);
+ return -ENOMEM;
+ }
+ strcpy(xlib, path);
+ strcat(xlib, "/");
+ strcat(xlib, lib);
+ h = snd_dlopen(xlib, RTLD_NOW);
+ if (h == NULL) {
+ SNDERR("Unable to open library '%s'", xlib);
+ goto __error;
+ }
+ initpriv = dlsym(h, "alsa_mixer_sbasic_initpriv");
+ if (initpriv == NULL) {
+ SNDERR("Symbol 'alsa_mixer_sbasic_initpriv' was not found in '%s'", xlib);
+ goto __error;
+ }
+ priv->ops.event = dlsym(h, "alsa_mixer_sbasic_event");
+ if (priv->ops.event == NULL) {
+ SNDERR("Symbol 'alsa_mixer_sbasic_event' was not found in '%s'", xlib);
+ goto __error;
+ }
+ priv->ops.selreg = dlsym(h, "alsa_mixer_sbasic_selreg");
+ if (priv->ops.selreg == NULL) {
+ SNDERR("Symbol 'alsa_mixer_sbasic_selreg' was not found in '%s'", xlib);
+ goto __error;
+ }
+ priv->ops.sidreg = dlsym(h, "alsa_mixer_sbasic_sidreg");
+ if (priv->ops.sidreg == NULL) {
+ SNDERR("Symbol 'alsa_mixer_sbasic_sidreg' was not found in '%s'", xlib);
+ goto __error;
+ }
+ free(xlib);
+ if (initflag)
+ initpriv(class, priv);
+ priv->dl_sbase = h;
+ if (ops)
+ *ops = &priv->ops;
+ return 1;
+
+ __error:
+ if (initflag)
+ free(priv);
+ if (h == NULL)
+ snd_dlclose(h);
+ free(xlib);
+ return -ENXIO;
+}
diff --git a/alsa-lib/src/Makefile.am b/alsa-lib/src/Makefile.am
new file mode 100644
index 0000000..3204fe4
--- /dev/null
+++ b/alsa-lib/src/Makefile.am
@@ -0,0 +1,86 @@
+EXTRA_DIST=Versions
+COMPATNUM=@LIBTOOL_VERSION_INFO@
+
+if VERSIONED_SYMBOLS
+VSYMS = -Wl,--version-script=Versions
+else
+VSYMS =
+endif
+
+if SYMBOLIC_FUNCTIONS
+SYMFUNCS = -Wl,-Bsymbolic-functions
+else
+SYMFUNCS =
+endif
+
+lib_LTLIBRARIES = libasound.la
+libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
+
+SUBDIRS=control
+libasound_la_LIBADD = control/libcontrol.la
+if BUILD_MIXER
+SUBDIRS += mixer
+libasound_la_LIBADD += mixer/libmixer.la
+endif
+if BUILD_PCM
+SUBDIRS += pcm timer
+libasound_la_LIBADD += pcm/libpcm.la timer/libtimer.la
+endif
+if BUILD_RAWMIDI
+SUBDIRS += rawmidi
+libasound_la_LIBADD += rawmidi/librawmidi.la
+endif
+if BUILD_HWDEP
+SUBDIRS += hwdep
+libasound_la_LIBADD += hwdep/libhwdep.la
+endif
+if BUILD_SEQ
+SUBDIRS += seq
+libasound_la_LIBADD += seq/libseq.la
+endif
+if BUILD_ALISP
+SUBDIRS += alisp
+libasound_la_LIBADD += alisp/libalisp.la
+endif
+SUBDIRS += compat conf
+libasound_la_LIBADD += compat/libcompat.la @ALSA_DEPLIBS@
+
+libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
+
+control/libcontrol.la:
+ $(MAKE) -C control libcontrol.la
+
+mixer/libmixer.la:
+ $(MAKE) -C mixer libmixer.la
+
+ordinary_mixer/libordinarymixer.la:
+ $(MAKE) -C ordinary_mixer libordinarymixer.la
+
+pcm/libpcm.la:
+ $(MAKE) -C pcm libpcm.la
+
+ordinary_pcm/libordinarypcm.la:
+ $(MAKE) -C ordinary_pcm libordinarypcm.la
+
+rawmidi/librawmidi.la:
+ $(MAKE) -C rawmidi librawmidi.la
+
+timer/libtimer.la:
+ $(MAKE) -C timer libtimer.la
+
+hwdep/libhwdep.la:
+ $(MAKE) -C hwdep libhwdep.la
+
+seq/libseq.la:
+ $(MAKE) -C seq libseq.la
+
+instr/libinstr.la:
+ $(MAKE) -C instr libinstr.la
+
+compat/libcompat.la:
+ $(MAKE) -C compat libcompat.la
+
+alisp/libalisp.la:
+ $(MAKE) -C alisp libalisp.la
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/Makefile.in b/alsa-lib/src/Makefile.in
new file mode 100644
index 0000000..d793576
--- /dev/null
+++ b/alsa-lib/src/Makefile.in
@@ -0,0 +1,753 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_MIXER_TRUE@am__append_1 = mixer
+@BUILD_MIXER_TRUE@am__append_2 = mixer/libmixer.la
+@BUILD_PCM_TRUE@am__append_3 = pcm timer
+@BUILD_PCM_TRUE@am__append_4 = pcm/libpcm.la timer/libtimer.la
+@BUILD_RAWMIDI_TRUE@am__append_5 = rawmidi
+@BUILD_RAWMIDI_TRUE@am__append_6 = rawmidi/librawmidi.la
+@BUILD_HWDEP_TRUE@am__append_7 = hwdep
+@BUILD_HWDEP_TRUE@am__append_8 = hwdep/libhwdep.la
+@BUILD_SEQ_TRUE@am__append_9 = seq
+@BUILD_SEQ_TRUE@am__append_10 = seq/libseq.la
+@BUILD_ALISP_TRUE@am__append_11 = alisp
+@BUILD_ALISP_TRUE@am__append_12 = alisp/libalisp.la
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/Versions.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES = Versions
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+@BUILD_MIXER_TRUE@am__DEPENDENCIES_1 = mixer/libmixer.la
+@BUILD_PCM_TRUE@am__DEPENDENCIES_2 = pcm/libpcm.la timer/libtimer.la
+@BUILD_RAWMIDI_TRUE@am__DEPENDENCIES_3 = rawmidi/librawmidi.la
+@BUILD_HWDEP_TRUE@am__DEPENDENCIES_4 = hwdep/libhwdep.la
+@BUILD_SEQ_TRUE@am__DEPENDENCIES_5 = seq/libseq.la
+@BUILD_ALISP_TRUE@am__DEPENDENCIES_6 = alisp/libalisp.la
+libasound_la_DEPENDENCIES = control/libcontrol.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) \
+ $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_6) \
+ compat/libcompat.la
+am_libasound_la_OBJECTS = conf.lo confmisc.lo input.lo output.lo \
+ async.lo error.lo dlmisc.lo socket.lo shmarea.lo userfile.lo \
+ names.lo
+libasound_la_OBJECTS = $(am_libasound_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libasound_la_SOURCES)
+DIST_SOURCES = $(libasound_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = control mixer pcm timer rawmidi hwdep seq alisp compat \
+ conf
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = Versions
+COMPATNUM = @LIBTOOL_VERSION_INFO@
+@VERSIONED_SYMBOLS_FALSE@VSYMS =
+@VERSIONED_SYMBOLS_TRUE@VSYMS = -Wl,--version-script=Versions
+@SYMBOLIC_FUNCTIONS_FALSE@SYMFUNCS =
+@SYMBOLIC_FUNCTIONS_TRUE@SYMFUNCS = -Wl,-Bsymbolic-functions
+lib_LTLIBRARIES = libasound.la
+libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
+SUBDIRS = control $(am__append_1) $(am__append_3) $(am__append_5) \
+ $(am__append_7) $(am__append_9) $(am__append_11) compat conf
+libasound_la_LIBADD = control/libcontrol.la $(am__append_2) \
+ $(am__append_4) $(am__append_6) $(am__append_8) \
+ $(am__append_10) $(am__append_12) compat/libcompat.la \
+ @ALSA_DEPLIBS@ $(am__empty)
+libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
+INCLUDES = -I$(top_srcdir)/include
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+Versions: $(top_builddir)/config.status $(srcdir)/Versions.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libasound.la: $(libasound_la_OBJECTS) $(libasound_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libasound_la_LDFLAGS) $(libasound_la_OBJECTS) $(libasound_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/confmisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlmisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/names.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmarea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/userfile.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-libLTLIBRARIES
+
+
+control/libcontrol.la:
+ $(MAKE) -C control libcontrol.la
+
+mixer/libmixer.la:
+ $(MAKE) -C mixer libmixer.la
+
+ordinary_mixer/libordinarymixer.la:
+ $(MAKE) -C ordinary_mixer libordinarymixer.la
+
+pcm/libpcm.la:
+ $(MAKE) -C pcm libpcm.la
+
+ordinary_pcm/libordinarypcm.la:
+ $(MAKE) -C ordinary_pcm libordinarypcm.la
+
+rawmidi/librawmidi.la:
+ $(MAKE) -C rawmidi librawmidi.la
+
+timer/libtimer.la:
+ $(MAKE) -C timer libtimer.la
+
+hwdep/libhwdep.la:
+ $(MAKE) -C hwdep libhwdep.la
+
+seq/libseq.la:
+ $(MAKE) -C seq libseq.la
+
+instr/libinstr.la:
+ $(MAKE) -C instr libinstr.la
+
+compat/libcompat.la:
+ $(MAKE) -C compat libcompat.la
+
+alisp/libalisp.la:
+ $(MAKE) -C alisp libalisp.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/Versions b/alsa-lib/src/Versions
new file mode 100644
index 0000000..013e283
--- /dev/null
+++ b/alsa-lib/src/Versions
@@ -0,0 +1,131 @@
+ALSA_0.9 {
+ global:
+ snd_*;
+
+ _snd_*_open;
+ _snd_*_dlsym_*;
+ _snd_*_poll_descriptor;
+ _snd_pcm_hook_*;
+
+ __snd_pcm_hw_params_*;
+ __snd_pcm_sw_params_*;
+ __snd_*_dlsym_*;
+
+ local:
+ *;
+};
+
+ALSA_0.9.0rc4 {
+ global:
+
+ snd_pcm_hw_params_get_access;
+ snd_pcm_hw_params_set_access_first;
+ snd_pcm_hw_params_set_access_last;
+
+ snd_pcm_hw_params_get_format;
+ snd_pcm_hw_params_set_format_first;
+ snd_pcm_hw_params_set_format_last;
+
+ snd_pcm_hw_params_get_subformat;
+ snd_pcm_hw_params_set_subformat_first;
+ snd_pcm_hw_params_set_subformat_last;
+
+ snd_pcm_hw_params_get_channels;
+ snd_pcm_hw_params_get_channels_min;
+ snd_pcm_hw_params_get_channels_max;
+ snd_pcm_hw_params_set_channels_near;
+ snd_pcm_hw_params_set_channels_first;
+ snd_pcm_hw_params_set_channels_last;
+
+ snd_pcm_hw_params_get_rate;
+ snd_pcm_hw_params_get_rate_min;
+ snd_pcm_hw_params_get_rate_max;
+ snd_pcm_hw_params_set_rate_near;
+ snd_pcm_hw_params_set_rate_first;
+ snd_pcm_hw_params_set_rate_last;
+
+ snd_pcm_hw_params_get_period_time;
+ snd_pcm_hw_params_get_period_time_min;
+ snd_pcm_hw_params_get_period_time_max;
+ snd_pcm_hw_params_set_period_time_near;
+ snd_pcm_hw_params_set_period_time_first;
+ snd_pcm_hw_params_set_period_time_last;
+
+ snd_pcm_hw_params_get_period_size;
+ snd_pcm_hw_params_get_period_size_min;
+ snd_pcm_hw_params_get_period_size_max;
+ snd_pcm_hw_params_set_period_size_near;
+ snd_pcm_hw_params_set_period_size_first;
+ snd_pcm_hw_params_set_period_size_last;
+
+ snd_pcm_hw_params_get_periods;
+ snd_pcm_hw_params_get_periods_min;
+ snd_pcm_hw_params_get_periods_max;
+ snd_pcm_hw_params_set_periods_near;
+ snd_pcm_hw_params_set_periods_first;
+ snd_pcm_hw_params_set_periods_last;
+
+ snd_pcm_hw_params_get_buffer_time;
+ snd_pcm_hw_params_get_buffer_time_min;
+ snd_pcm_hw_params_get_buffer_time_max;
+ snd_pcm_hw_params_set_buffer_time_near;
+ snd_pcm_hw_params_set_buffer_time_first;
+ snd_pcm_hw_params_set_buffer_time_last;
+
+ snd_pcm_hw_params_get_buffer_size;
+ snd_pcm_hw_params_get_buffer_size_min;
+ snd_pcm_hw_params_get_buffer_size_max;
+ snd_pcm_hw_params_set_buffer_size_near;
+ snd_pcm_hw_params_set_buffer_size_first;
+ snd_pcm_hw_params_set_buffer_size_last;
+
+ snd_pcm_hw_params_get_tick_time;
+ snd_pcm_hw_params_get_tick_time_min;
+ snd_pcm_hw_params_get_tick_time_max;
+ snd_pcm_hw_params_set_tick_time_near;
+ snd_pcm_hw_params_set_tick_time_first;
+ snd_pcm_hw_params_set_tick_time_last;
+
+} ALSA_0.9;
+
+ALSA_0.9.0rc8 {
+ global:
+
+ snd_pcm_forward;
+ snd_pcm_status_get_trigger_htstamp;
+ snd_pcm_status_get_htstamp;
+
+} ALSA_0.9.0rc4;
+
+ALSA_0.9.0 {
+ global:
+
+ snd_pcm_type_name;
+ snd_timer_query_info;
+ snd_timer_query_params;
+ snd_timer_query_status;
+ snd_timer_params_set_exclusive;
+ snd_timer_params_get_exclusive;
+ snd_timer_params_set_filter;
+ snd_timer_params_get_filter;
+} ALSA_0.9.0rc8;
+
+ALSA_0.9.3 {
+ global:
+
+ snd_ctl_elem_info_get_dimensions;
+ snd_ctl_elem_info_get_dimension;
+} ALSA_0.9.0;
+
+ALSA_0.9.5 {
+ global:
+
+ alsa_lisp;
+} ALSA_0.9.3;
+
+ALSA_0.9.7 {
+ global:
+
+ alsa_lisp_*;
+} ALSA_0.9.5;
+
diff --git a/alsa-lib/src/Versions.in b/alsa-lib/src/Versions.in
new file mode 100644
index 0000000..8d2dd11
--- /dev/null
+++ b/alsa-lib/src/Versions.in
@@ -0,0 +1,131 @@
+ALSA_0.9 {
+ global:
+ @SYMBOL_PREFIX@snd_*;
+
+ @SYMBOL_PREFIX@_snd_*_open;
+ @SYMBOL_PREFIX@_snd_*_dlsym_*;
+ @SYMBOL_PREFIX@_snd_*_poll_descriptor;
+ @SYMBOL_PREFIX@_snd_pcm_hook_*;
+
+ @SYMBOL_PREFIX@__snd_pcm_hw_params_*;
+ @SYMBOL_PREFIX@__snd_pcm_sw_params_*;
+ @SYMBOL_PREFIX@__snd_*_dlsym_*;
+
+ local:
+ *;
+};
+
+ALSA_0.9.0rc4 {
+ global:
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_access;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_access_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_access_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_format;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_format_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_format_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_subformat;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_channels;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_rate;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_periods;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_last;
+
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_min;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_max;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_near;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_first;
+ @SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_last;
+
+} ALSA_0.9;
+
+ALSA_0.9.0rc8 {
+ global:
+
+ @SYMBOL_PREFIX@snd_pcm_forward;
+ @SYMBOL_PREFIX@snd_pcm_status_get_trigger_htstamp;
+ @SYMBOL_PREFIX@snd_pcm_status_get_htstamp;
+
+} ALSA_0.9.0rc4;
+
+ALSA_0.9.0 {
+ global:
+
+ @SYMBOL_PREFIX@snd_pcm_type_name;
+ @SYMBOL_PREFIX@snd_timer_query_info;
+ @SYMBOL_PREFIX@snd_timer_query_params;
+ @SYMBOL_PREFIX@snd_timer_query_status;
+ @SYMBOL_PREFIX@snd_timer_params_set_exclusive;
+ @SYMBOL_PREFIX@snd_timer_params_get_exclusive;
+ @SYMBOL_PREFIX@snd_timer_params_set_filter;
+ @SYMBOL_PREFIX@snd_timer_params_get_filter;
+} ALSA_0.9.0rc8;
+
+ALSA_0.9.3 {
+ global:
+
+ @SYMBOL_PREFIX@snd_ctl_elem_info_get_dimensions;
+ @SYMBOL_PREFIX@snd_ctl_elem_info_get_dimension;
+} ALSA_0.9.0;
+
+ALSA_0.9.5 {
+ global:
+
+ @SYMBOL_PREFIX@alsa_lisp;
+} ALSA_0.9.3;
+
+ALSA_0.9.7 {
+ global:
+
+ @SYMBOL_PREFIX@alsa_lisp_*;
+} ALSA_0.9.5;
+
diff --git a/alsa-lib/src/alisp/Makefile.am b/alsa-lib/src/alisp/Makefile.am
new file mode 100644
index 0000000..e6d4ac5
--- /dev/null
+++ b/alsa-lib/src/alisp/Makefile.am
@@ -0,0 +1,11 @@
+EXTRA_LTLIBRARIES = libalisp.la
+
+EXTRA_DIST = alisp_snd.c
+
+libalisp_la_SOURCES = alisp.c
+
+noinst_HEADERS = alisp_local.h
+
+all: libalisp.la
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/alisp/Makefile.in b/alsa-lib/src/alisp/Makefile.in
new file mode 100644
index 0000000..3afe2c8
--- /dev/null
+++ b/alsa-lib/src/alisp/Makefile.in
@@ -0,0 +1,519 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/alisp
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libalisp_la_LIBADD =
+am_libalisp_la_OBJECTS = alisp.lo
+libalisp_la_OBJECTS = $(am_libalisp_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libalisp_la_SOURCES)
+DIST_SOURCES = $(libalisp_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libalisp.la
+EXTRA_DIST = alisp_snd.c
+libalisp_la_SOURCES = alisp.c
+noinst_HEADERS = alisp_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/alisp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/alisp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libalisp.la: $(libalisp_la_OBJECTS) $(libalisp_la_DEPENDENCIES)
+ $(LINK) $(libalisp_la_LDFLAGS) $(libalisp_la_OBJECTS) $(libalisp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alisp.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+all: libalisp.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/alisp/alisp.c b/alsa-lib/src/alisp/alisp.c
new file mode 100644
index 0000000..ef86dc9
--- /dev/null
+++ b/alsa-lib/src/alisp/alisp.c
@@ -0,0 +1,3492 @@
+/*
+ * ALSA lisp implementation
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * Based on work of Sandro Sigala (slisp-1.2)
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <assert.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <err.h>
+
+#define alisp_seq_iterator alisp_object
+
+#include "local.h"
+#include "alisp.h"
+#include "alisp_local.h"
+
+struct alisp_object alsa_lisp_nil;
+struct alisp_object alsa_lisp_t;
+
+/* parser prototypes */
+static struct alisp_object * parse_object(struct alisp_instance *instance, int havetoken);
+static void princ_cons(snd_output_t *out, struct alisp_object * p);
+static void princ_object(snd_output_t *out, struct alisp_object * p);
+static struct alisp_object * eval(struct alisp_instance *instance, struct alisp_object * p);
+
+/* functions */
+static struct alisp_object *F_eval(struct alisp_instance *instance, struct alisp_object *);
+static struct alisp_object *F_progn(struct alisp_instance *instance, struct alisp_object *);
+static struct alisp_object *F_funcall(struct alisp_instance *instance, struct alisp_object *);
+
+/* others */
+static int alisp_include_file(struct alisp_instance *instance, const char *filename);
+
+/*
+ * object handling
+ */
+
+static int get_string_hash(const char *s)
+{
+ int val = 0;
+ if (s == NULL)
+ return val;
+ while (*s)
+ val += *s++;
+ return val & ALISP_OBJ_PAIR_HASH_MASK;
+}
+
+static void nomem(void)
+{
+ SNDERR("alisp: no enough memory");
+}
+
+static void lisp_verbose(struct alisp_instance *instance, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!instance->verbose)
+ return;
+ va_start(ap, fmt);
+ snd_output_printf(instance->vout, "alisp: ");
+ snd_output_vprintf(instance->vout, fmt, ap);
+ snd_output_putc(instance->vout, '\n');
+ va_end(ap);
+}
+
+static void lisp_error(struct alisp_instance *instance, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!instance->warning)
+ return;
+ va_start(ap, fmt);
+ snd_output_printf(instance->eout, "alisp error: ");
+ snd_output_vprintf(instance->eout, fmt, ap);
+ snd_output_putc(instance->eout, '\n');
+ va_end(ap);
+}
+
+static void lisp_warn(struct alisp_instance *instance, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!instance->warning)
+ return;
+ va_start(ap, fmt);
+ snd_output_printf(instance->wout, "alisp warning: ");
+ snd_output_vprintf(instance->wout, fmt, ap);
+ snd_output_putc(instance->wout, '\n');
+ va_end(ap);
+}
+
+static void lisp_debug(struct alisp_instance *instance, const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!instance->debug)
+ return;
+ va_start(ap, fmt);
+ snd_output_printf(instance->dout, "alisp debug: ");
+ snd_output_vprintf(instance->dout, fmt, ap);
+ snd_output_putc(instance->dout, '\n');
+ va_end(ap);
+}
+
+static struct alisp_object * new_object(struct alisp_instance *instance, int type)
+{
+ struct alisp_object * p;
+
+ if (list_empty(&instance->free_objs_list)) {
+ p = (struct alisp_object *)malloc(sizeof(struct alisp_object));
+ if (p == NULL) {
+ nomem();
+ return NULL;
+ }
+ lisp_debug(instance, "allocating cons %p", p);
+ } else {
+ p = (struct alisp_object *)instance->free_objs_list.next;
+ list_del(&p->list);
+ instance->free_objs--;
+ lisp_debug(instance, "recycling cons %p", p);
+ }
+
+ instance->used_objs++;
+
+ alisp_set_type(p, type);
+ alisp_set_refs(p, 1);
+ if (type == ALISP_OBJ_CONS) {
+ p->value.c.car = &alsa_lisp_nil;
+ p->value.c.cdr = &alsa_lisp_nil;
+ list_add(&p->list, &instance->used_objs_list[0][ALISP_OBJ_CONS]);
+ }
+
+ if (instance->used_objs + instance->free_objs > instance->max_objs)
+ instance->max_objs = instance->used_objs + instance->free_objs;
+
+ return p;
+}
+
+static void free_object(struct alisp_object * p)
+{
+ switch (alisp_get_type(p)) {
+ case ALISP_OBJ_STRING:
+ case ALISP_OBJ_IDENTIFIER:
+ free(p->value.s);
+ alisp_set_type(p, ALISP_OBJ_INTEGER);
+ break;
+ default:
+ break;
+ }
+}
+
+static void delete_object(struct alisp_instance *instance, struct alisp_object * p)
+{
+ if (p == NULL || p == &alsa_lisp_nil || p == &alsa_lisp_t)
+ return;
+ if (alisp_compare_type(p, ALISP_OBJ_NIL) ||
+ alisp_compare_type(p, ALISP_OBJ_T))
+ return;
+ assert(alisp_get_refs(p) > 0);
+ lisp_debug(instance, "delete cons %p (type = %i, refs = %i) (s = '%s')", p, alisp_get_type(p), alisp_get_refs(p),
+ alisp_compare_type(p, ALISP_OBJ_STRING) ||
+ alisp_compare_type(p, ALISP_OBJ_IDENTIFIER) ? p->value.s : "???");
+ if (alisp_dec_refs(p))
+ return;
+ list_del(&p->list);
+ instance->used_objs--;
+ free_object(p);
+ if (instance->free_objs >= ALISP_FREE_OBJ_POOL) {
+ lisp_debug(instance, "freed cons %p", p);
+ free(p);
+ return;
+ }
+ lisp_debug(instance, "moved cons %p to free list", p);
+ list_add(&p->list, &instance->free_objs_list);
+ instance->free_objs++;
+}
+
+static void delete_tree(struct alisp_instance *instance, struct alisp_object * p)
+{
+ if (p == NULL)
+ return;
+ if (alisp_compare_type(p, ALISP_OBJ_CONS)) {
+ delete_tree(instance, p->value.c.car);
+ delete_tree(instance, p->value.c.cdr);
+ }
+ delete_object(instance, p);
+}
+
+static struct alisp_object * incref_object(struct alisp_instance *instance ATTRIBUTE_UNUSED, struct alisp_object * p)
+{
+ if (p == NULL || p == &alsa_lisp_nil || p == &alsa_lisp_t)
+ return p;
+ if (alisp_get_refs(p) == ALISP_MAX_REFS) {
+ assert(0);
+ fprintf(stderr, "OOPS: alsa lisp: incref fatal error\n");
+ exit(EXIT_FAILURE);
+ }
+ alisp_inc_refs(p);
+ return p;
+}
+
+static struct alisp_object * incref_tree(struct alisp_instance *instance, struct alisp_object * p)
+{
+ if (p == NULL)
+ return NULL;
+ if (alisp_compare_type(p, ALISP_OBJ_CONS)) {
+ incref_tree(instance, p->value.c.car);
+ incref_tree(instance, p->value.c.cdr);
+ }
+ return incref_object(instance, p);
+}
+
+static struct alisp_object * incref_tree_explicit(struct alisp_instance *instance, struct alisp_object * p, struct alisp_object * e)
+{
+ if (p == NULL)
+ return NULL;
+ if (alisp_compare_type(p, ALISP_OBJ_CONS)) {
+ if (e == p) {
+ incref_tree(instance, p->value.c.car);
+ incref_tree(instance, p->value.c.cdr);
+ } else {
+ incref_tree_explicit(instance, p->value.c.car, e);
+ incref_tree_explicit(instance, p->value.c.cdr, e);
+ }
+ }
+ if (e == p)
+ return incref_object(instance, p);
+ return p;
+}
+
+static void free_objects(struct alisp_instance *instance)
+{
+ struct list_head *pos, *pos1;
+ struct alisp_object * p;
+ struct alisp_object_pair * pair;
+ int i, j;
+
+ for (i = 0; i < ALISP_OBJ_PAIR_HASH_SIZE; i++) {
+ list_for_each_safe(pos, pos1, &instance->setobjs_list[i]) {
+ pair = list_entry(pos, struct alisp_object_pair, list);
+ lisp_debug(instance, "freeing pair: '%s' -> %p", pair->name, pair->value);
+ delete_tree(instance, pair->value);
+ free((void *)pair->name);
+ free(pair);
+ }
+ }
+ for (i = 0; i < ALISP_OBJ_PAIR_HASH_SIZE; i++)
+ for (j = 0; j <= ALISP_OBJ_LAST_SEARCH; j++) {
+ list_for_each_safe(pos, pos1, &instance->used_objs_list[i][j]) {
+ p = list_entry(pos, struct alisp_object, list);
+ lisp_warn(instance, "object %p is still referenced %i times!", p, alisp_get_refs(p));
+#if 0
+ snd_output_printf(instance->wout, ">>>> ");
+ princ_object(instance->wout, p);
+ snd_output_printf(instance->wout, " <<<<\n");
+#endif
+ if (alisp_get_refs(p) > 0)
+ alisp_set_refs(p, 1);
+ delete_object(instance, p);
+ }
+ }
+ list_for_each_safe(pos, pos1, &instance->free_objs_list) {
+ p = list_entry(pos, struct alisp_object, list);
+ list_del(&p->list);
+ free(p);
+ lisp_debug(instance, "freed (all) cons %p", p);
+ }
+}
+
+static struct alisp_object * search_object_identifier(struct alisp_instance *instance, const char *s)
+{
+ struct list_head * pos;
+ struct alisp_object * p;
+
+ list_for_each(pos, &instance->used_objs_list[get_string_hash(s)][ALISP_OBJ_IDENTIFIER]) {
+ p = list_entry(pos, struct alisp_object, list);
+ if (alisp_get_refs(p) > ALISP_MAX_REFS_LIMIT)
+ continue;
+ if (!strcmp(p->value.s, s))
+ return incref_object(instance, p);
+ }
+
+ return NULL;
+}
+
+static struct alisp_object * search_object_string(struct alisp_instance *instance, const char *s)
+{
+ struct list_head * pos;
+ struct alisp_object * p;
+
+ list_for_each(pos, &instance->used_objs_list[get_string_hash(s)][ALISP_OBJ_STRING]) {
+ p = list_entry(pos, struct alisp_object, list);
+ if (!strcmp(p->value.s, s)) {
+ if (alisp_get_refs(p) > ALISP_MAX_REFS_LIMIT)
+ continue;
+ return incref_object(instance, p);
+ }
+ }
+
+ return NULL;
+}
+
+static struct alisp_object * search_object_integer(struct alisp_instance *instance, long in)
+{
+ struct list_head * pos;
+ struct alisp_object * p;
+
+ list_for_each(pos, &instance->used_objs_list[in & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_INTEGER]) {
+ p = list_entry(pos, struct alisp_object, list);
+ if (p->value.i == in) {
+ if (alisp_get_refs(p) > ALISP_MAX_REFS_LIMIT)
+ continue;
+ return incref_object(instance, p);
+ }
+ }
+
+ return NULL;
+}
+
+static struct alisp_object * search_object_float(struct alisp_instance *instance, double in)
+{
+ struct list_head * pos;
+ struct alisp_object * p;
+
+ list_for_each(pos, &instance->used_objs_list[(long)in & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_FLOAT]) {
+ p = list_entry(pos, struct alisp_object, list);
+ if (p->value.i == in) {
+ if (alisp_get_refs(p) > ALISP_MAX_REFS_LIMIT)
+ continue;
+ return incref_object(instance, p);
+ }
+ }
+
+ return NULL;
+}
+
+static struct alisp_object * search_object_pointer(struct alisp_instance *instance, const void *ptr)
+{
+ struct list_head * pos;
+ struct alisp_object * p;
+
+ list_for_each(pos, &instance->used_objs_list[(long)ptr & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_POINTER]) {
+ p = list_entry(pos, struct alisp_object, list);
+ if (p->value.ptr == ptr) {
+ if (alisp_get_refs(p) > ALISP_MAX_REFS_LIMIT)
+ continue;
+ return incref_object(instance, p);
+ }
+ }
+
+ return NULL;
+}
+
+static struct alisp_object * new_integer(struct alisp_instance *instance, long value)
+{
+ struct alisp_object * obj;
+
+ obj = search_object_integer(instance, value);
+ if (obj != NULL)
+ return obj;
+ obj = new_object(instance, ALISP_OBJ_INTEGER);
+ if (obj) {
+ list_add(&obj->list, &instance->used_objs_list[value & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_INTEGER]);
+ obj->value.i = value;
+ }
+ return obj;
+}
+
+static struct alisp_object * new_float(struct alisp_instance *instance, double value)
+{
+ struct alisp_object * obj;
+
+ obj = search_object_float(instance, value);
+ if (obj != NULL)
+ return obj;
+ obj = new_object(instance, ALISP_OBJ_FLOAT);
+ if (obj) {
+ list_add(&obj->list, &instance->used_objs_list[(long)value & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_FLOAT]);
+ obj->value.f = value;
+ }
+ return obj;
+}
+
+static struct alisp_object * new_string(struct alisp_instance *instance, const char *str)
+{
+ struct alisp_object * obj;
+
+ obj = search_object_string(instance, str);
+ if (obj != NULL)
+ return obj;
+ obj = new_object(instance, ALISP_OBJ_STRING);
+ if (obj)
+ list_add(&obj->list, &instance->used_objs_list[get_string_hash(str)][ALISP_OBJ_STRING]);
+ if (obj && (obj->value.s = strdup(str)) == NULL) {
+ delete_object(instance, obj);
+ nomem();
+ return NULL;
+ }
+ return obj;
+}
+
+static struct alisp_object * new_identifier(struct alisp_instance *instance, const char *id)
+{
+ struct alisp_object * obj;
+
+ obj = search_object_identifier(instance, id);
+ if (obj != NULL)
+ return obj;
+ obj = new_object(instance, ALISP_OBJ_IDENTIFIER);
+ if (obj)
+ list_add(&obj->list, &instance->used_objs_list[get_string_hash(id)][ALISP_OBJ_IDENTIFIER]);
+ if (obj && (obj->value.s = strdup(id)) == NULL) {
+ delete_object(instance, obj);
+ nomem();
+ return NULL;
+ }
+ return obj;
+}
+
+static struct alisp_object * new_pointer(struct alisp_instance *instance, const void *ptr)
+{
+ struct alisp_object * obj;
+
+ obj = search_object_pointer(instance, ptr);
+ if (obj != NULL)
+ return obj;
+ obj = new_object(instance, ALISP_OBJ_POINTER);
+ if (obj) {
+ list_add(&obj->list, &instance->used_objs_list[(long)ptr & ALISP_OBJ_PAIR_HASH_MASK][ALISP_OBJ_POINTER]);
+ obj->value.ptr = ptr;
+ }
+ return obj;
+}
+
+static struct alisp_object * new_cons_pointer(struct alisp_instance * instance, const char *ptr_id, void *ptr)
+{
+ struct alisp_object * lexpr;
+
+ if (ptr == NULL)
+ return &alsa_lisp_nil;
+ lexpr = new_object(instance, ALISP_OBJ_CONS);
+ if (lexpr == NULL)
+ return NULL;
+ lexpr->value.c.car = new_string(instance, ptr_id);
+ if (lexpr->value.c.car == NULL)
+ goto __end;
+ lexpr->value.c.cdr = new_pointer(instance, ptr);
+ if (lexpr->value.c.cdr == NULL) {
+ delete_object(instance, lexpr->value.c.car);
+ __end:
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+void alsa_lisp_init_objects(void) __attribute__ ((constructor));
+
+void alsa_lisp_init_objects(void)
+{
+ memset(&alsa_lisp_nil, 0, sizeof(alsa_lisp_nil));
+ alisp_set_type(&alsa_lisp_nil, ALISP_OBJ_NIL);
+ INIT_LIST_HEAD(&alsa_lisp_nil.list);
+ memset(&alsa_lisp_t, 0, sizeof(alsa_lisp_t));
+ alisp_set_type(&alsa_lisp_t, ALISP_OBJ_T);
+ INIT_LIST_HEAD(&alsa_lisp_t.list);
+}
+
+/*
+ * lexer
+ */
+
+static int xgetc(struct alisp_instance *instance)
+{
+ instance->charno++;
+ if (instance->lex_bufp > instance->lex_buf)
+ return *--(instance->lex_bufp);
+ return snd_input_getc(instance->in);
+}
+
+static inline void xungetc(struct alisp_instance *instance, int c)
+{
+ *(instance->lex_bufp)++ = c;
+ instance->charno--;
+}
+
+static int init_lex(struct alisp_instance *instance)
+{
+ instance->charno = instance->lineno = 1;
+ instance->token_buffer_max = 10;
+ if ((instance->token_buffer = (char *)malloc(instance->token_buffer_max)) == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ instance->lex_bufp = instance->lex_buf;
+ return 0;
+}
+
+static void done_lex(struct alisp_instance *instance)
+{
+ free(instance->token_buffer);
+}
+
+static char * extend_buf(struct alisp_instance *instance, char *p)
+{
+ int off = p - instance->token_buffer;
+
+ instance->token_buffer_max += 10;
+ instance->token_buffer = (char *)realloc(instance->token_buffer, instance->token_buffer_max);
+ if (instance->token_buffer == NULL) {
+ nomem();
+ return NULL;
+ }
+
+ return instance->token_buffer + off;
+}
+
+static int gettoken(struct alisp_instance *instance)
+{
+ char *p;
+ int c;
+
+ for (;;) {
+ c = xgetc(instance);
+ switch (c) {
+ case '\n':
+ ++instance->lineno;
+ break;
+
+ case ' ': case '\f': case '\t': case '\v': case '\r':
+ break;
+
+ case ';':
+ /* Comment: ";".*"\n" */
+ while ((c = xgetc(instance)) != '\n' && c != EOF)
+ ;
+ if (c != EOF)
+ ++instance->lineno;
+ break;
+
+ case '?':
+ /* Character: "?". */
+ c = xgetc(instance);
+ sprintf(instance->token_buffer, "%d", c);
+ return instance->thistoken = ALISP_INTEGER;
+
+ case '-':
+ /* Minus sign: "-". */
+ c = xgetc(instance);
+ if (!isdigit(c)) {
+ xungetc(instance, c);
+ c = '-';
+ goto got_id;
+ }
+ xungetc(instance, c);
+ c = '-';
+ /* FALLTRHU */
+
+ case '0':
+ case '1': case '2': case '3':
+ case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ /* Integer: [0-9]+ */
+ p = instance->token_buffer;
+ instance->thistoken = ALISP_INTEGER;
+ do {
+ __ok:
+ if (p - instance->token_buffer >= instance->token_buffer_max - 1) {
+ p = extend_buf(instance, p);
+ if (p == NULL)
+ return instance->thistoken = EOF;
+ }
+ *p++ = c;
+ c = xgetc(instance);
+ if (c == '.' && instance->thistoken == ALISP_INTEGER) {
+ c = xgetc(instance);
+ xungetc(instance, c);
+ if (isdigit(c)) {
+ instance->thistoken = ALISP_FLOAT;
+ c = '.';
+ goto __ok;
+ } else {
+ c = '.';
+ }
+ } else if (c == 'e' && instance->thistoken == ALISP_FLOAT) {
+ c = xgetc(instance);
+ if (isdigit(c)) {
+ instance->thistoken = ALISP_FLOATE;
+ goto __ok;
+ }
+ }
+ } while (isdigit(c));
+ xungetc(instance, c);
+ *p = '\0';
+ return instance->thistoken;
+
+ got_id:
+ case '!': case '_': case '+': case '*': case '/': case '%':
+ case '<': case '>': case '=': case '&':
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+ case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+ case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+ case 'y': case 'z':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+ case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+ case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+ case 'Y': case 'Z':
+ /* Identifier: [!-/+*%<>=&a-zA-Z_][-/+*%<>=&a-zA-Z_0-9]* */
+ p = instance->token_buffer;
+ do {
+ if (p - instance->token_buffer >= instance->token_buffer_max - 1) {
+ p = extend_buf(instance, p);
+ if (p == NULL)
+ return instance->thistoken = EOF;
+ }
+ *p++ = c;
+ c = xgetc(instance);
+ } while (isalnum(c) || strchr("!_-+*/%<>=&", c) != NULL);
+ xungetc(instance, c);
+ *p = '\0';
+ return instance->thistoken = ALISP_IDENTIFIER;
+
+ case '"':
+ /* String: "\""([^"]|"\\".)*"\"" */
+ p = instance->token_buffer;
+ while ((c = xgetc(instance)) != '"' && c != EOF) {
+ if (p - instance->token_buffer >= instance->token_buffer_max - 1) {
+ p = extend_buf(instance, p);
+ if (p == NULL)
+ return instance->thistoken = EOF;
+ }
+ if (c == '\\') {
+ c = xgetc(instance);
+ switch (c) {
+ case '\n': ++instance->lineno; break;
+ case 'a': *p++ = '\a'; break;
+ case 'b': *p++ = '\b'; break;
+ case 'f': *p++ = '\f'; break;
+ case 'n': *p++ = '\n'; break;
+ case 'r': *p++ = '\r'; break;
+ case 't': *p++ = '\t'; break;
+ case 'v': *p++ = '\v'; break;
+ default: *p++ = c;
+ }
+ } else {
+ if (c == '\n')
+ ++instance->lineno;
+ *p++ = c;
+ }
+ }
+ *p = '\0';
+ return instance->thistoken = ALISP_STRING;
+
+ default:
+ return instance->thistoken = c;
+ }
+ }
+}
+
+/*
+ * parser
+ */
+
+static struct alisp_object * parse_form(struct alisp_instance *instance)
+{
+ int thistoken;
+ struct alisp_object * p, * first = NULL, * prev = NULL;
+
+ while ((thistoken = gettoken(instance)) != ')' && thistoken != EOF) {
+ /*
+ * Parse a dotted pair notation.
+ */
+ if (thistoken == '.') {
+ gettoken(instance);
+ if (prev == NULL) {
+ lisp_error(instance, "unexpected '.'");
+ __err:
+ delete_tree(instance, first);
+ return NULL;
+ }
+ prev->value.c.cdr = parse_object(instance, 1);
+ if (prev->value.c.cdr == NULL)
+ goto __err;
+ if ((thistoken = gettoken(instance)) != ')') {
+ lisp_error(instance, "expected ')'");
+ goto __err;
+ }
+ break;
+ }
+
+ p = new_object(instance, ALISP_OBJ_CONS);
+ if (p == NULL)
+ goto __err;
+
+ if (first == NULL)
+ first = p;
+ if (prev != NULL)
+ prev->value.c.cdr = p;
+
+ p->value.c.car = parse_object(instance, 1);
+ if (p->value.c.car == NULL)
+ goto __err;
+
+ prev = p;
+ }
+
+ if (first == NULL)
+ return &alsa_lisp_nil;
+ else
+ return first;
+}
+
+static struct alisp_object * quote_object(struct alisp_instance *instance, struct alisp_object * obj)
+{
+ struct alisp_object * p;
+
+ if (obj == NULL)
+ goto __end1;
+
+ p = new_object(instance, ALISP_OBJ_CONS);
+ if (p == NULL)
+ goto __end1;
+
+ p->value.c.car = new_identifier(instance, "quote");
+ if (p->value.c.car == NULL)
+ goto __end;
+ p->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
+ if (p->value.c.cdr == NULL) {
+ delete_object(instance, p->value.c.car);
+ __end:
+ delete_object(instance, p);
+ __end1:
+ delete_tree(instance, obj);
+ return NULL;
+ }
+
+ p->value.c.cdr->value.c.car = obj;
+ return p;
+}
+
+static inline struct alisp_object * parse_quote(struct alisp_instance *instance)
+{
+ return quote_object(instance, parse_object(instance, 0));
+}
+
+static struct alisp_object * parse_object(struct alisp_instance *instance, int havetoken)
+{
+ int thistoken;
+ struct alisp_object * p = NULL;
+
+ if (!havetoken)
+ thistoken = gettoken(instance);
+ else
+ thistoken = instance->thistoken;
+
+ switch (thistoken) {
+ case EOF:
+ break;
+ case '(':
+ p = parse_form(instance);
+ break;
+ case '\'':
+ p = parse_quote(instance);
+ break;
+ case ALISP_IDENTIFIER:
+ if (!strcmp(instance->token_buffer, "t"))
+ p = &alsa_lisp_t;
+ else if (!strcmp(instance->token_buffer, "nil"))
+ p = &alsa_lisp_nil;
+ else {
+ p = new_identifier(instance, instance->token_buffer);
+ }
+ break;
+ case ALISP_INTEGER: {
+ p = new_integer(instance, atol(instance->token_buffer));
+ break;
+ }
+ case ALISP_FLOAT:
+ case ALISP_FLOATE: {
+ p = new_float(instance, atof(instance->token_buffer));
+ break;
+ }
+ case ALISP_STRING:
+ p = new_string(instance, instance->token_buffer);
+ break;
+ default:
+ lisp_warn(instance, "%d:%d: unexpected character `%c'", instance->lineno, instance->charno, thistoken);
+ break;
+ }
+
+ return p;
+}
+
+/*
+ * object manipulation
+ */
+
+static struct alisp_object_pair * set_object_direct(struct alisp_instance *instance, struct alisp_object * name, struct alisp_object * value)
+{
+ struct alisp_object_pair *p;
+ const char *id;
+
+ id = name->value.s;
+ p = (struct alisp_object_pair *)malloc(sizeof(struct alisp_object_pair));
+ if (p == NULL) {
+ nomem();
+ return NULL;
+ }
+ p->name = strdup(id);
+ if (p->name == NULL) {
+ delete_tree(instance, value);
+ free(p);
+ return NULL;
+ }
+ list_add(&p->list, &instance->setobjs_list[get_string_hash(id)]);
+ p->value = value;
+ return p;
+}
+
+static int check_set_object(struct alisp_instance * instance, struct alisp_object * name)
+{
+ if (name == &alsa_lisp_nil) {
+ lisp_warn(instance, "setting the value of a nil object");
+ return 0;
+ }
+ if (name == &alsa_lisp_t) {
+ lisp_warn(instance, "setting the value of a t object");
+ return 0;
+ }
+ if (!alisp_compare_type(name, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(name, ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "setting the value of an object with non-indentifier");
+ return 0;
+ }
+ return 1;
+}
+
+static struct alisp_object_pair * set_object(struct alisp_instance *instance, struct alisp_object * name, struct alisp_object * value)
+{
+ struct list_head *pos;
+ struct alisp_object_pair *p;
+ const char *id;
+
+ if (name == NULL || value == NULL)
+ return NULL;
+
+ id = name->value.s;
+
+ list_for_each(pos, &instance->setobjs_list[get_string_hash(id)]) {
+ p = list_entry(pos, struct alisp_object_pair, list);
+ if (!strcmp(p->name, id)) {
+ delete_tree(instance, p->value);
+ p->value = value;
+ return p;
+ }
+ }
+
+ p = (struct alisp_object_pair *)malloc(sizeof(struct alisp_object_pair));
+ if (p == NULL) {
+ nomem();
+ return NULL;
+ }
+ p->name = strdup(id);
+ if (p->name == NULL) {
+ delete_tree(instance, value);
+ free(p);
+ return NULL;
+ }
+ list_add(&p->list, &instance->setobjs_list[get_string_hash(id)]);
+ p->value = value;
+ return p;
+}
+
+static struct alisp_object * unset_object(struct alisp_instance *instance, struct alisp_object * name)
+{
+ struct list_head *pos;
+ struct alisp_object *res;
+ struct alisp_object_pair *p;
+ const char *id;
+
+ if (!alisp_compare_type(name, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(name, ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "unset object with a non-indentifier");
+ return &alsa_lisp_nil;
+ }
+ id = name->value.s;
+
+ list_for_each(pos, &instance->setobjs_list[get_string_hash(id)]) {
+ p = list_entry(pos, struct alisp_object_pair, list);
+ if (!strcmp(p->name, id)) {
+ list_del(&p->list);
+ res = p->value;
+ free((void *)p->name);
+ free(p);
+ return res;
+ }
+ }
+
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * get_object1(struct alisp_instance *instance, const char *id)
+{
+ struct alisp_object_pair *p;
+ struct list_head *pos;
+
+ list_for_each(pos, &instance->setobjs_list[get_string_hash(id)]) {
+ p = list_entry(pos, struct alisp_object_pair, list);
+ if (!strcmp(p->name, id))
+ return p->value;
+ }
+
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * get_object(struct alisp_instance *instance, struct alisp_object * name)
+{
+ if (!alisp_compare_type(name, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(name, ALISP_OBJ_STRING)) {
+ delete_tree(instance, name);
+ return &alsa_lisp_nil;
+ }
+ return get_object1(instance, name->value.s);
+}
+
+static struct alisp_object * replace_object(struct alisp_instance *instance, struct alisp_object * name, struct alisp_object * onew)
+{
+ struct alisp_object_pair *p;
+ struct alisp_object *r;
+ struct list_head *pos;
+ const char *id;
+
+ if (!alisp_compare_type(name, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(name, ALISP_OBJ_STRING)) {
+ delete_tree(instance, name);
+ return &alsa_lisp_nil;
+ }
+ id = name->value.s;
+ list_for_each(pos, &instance->setobjs_list[get_string_hash(id)]) {
+ p = list_entry(pos, struct alisp_object_pair, list);
+ if (!strcmp(p->name, id)) {
+ r = p->value;
+ p->value = onew;
+ return r;
+ }
+ }
+
+ return NULL;
+}
+
+static void dump_objects(struct alisp_instance *instance, const char *fname)
+{
+ struct alisp_object_pair *p;
+ snd_output_t *out;
+ struct list_head *pos;
+ int i, err;
+
+ if (!strcmp(fname, "-"))
+ err = snd_output_stdio_attach(&out, stdout, 0);
+ else
+ err = snd_output_stdio_open(&out, fname, "w+");
+ if (err < 0) {
+ SNDERR("alisp: cannot open file '%s' for writting (%s)", fname, snd_strerror(errno));
+ return;
+ }
+
+ for (i = 0; i < ALISP_OBJ_PAIR_HASH_SIZE; i++) {
+ list_for_each(pos, &instance->setobjs_list[i]) {
+ p = list_entry(pos, struct alisp_object_pair, list);
+ if (alisp_compare_type(p->value, ALISP_OBJ_CONS) &&
+ alisp_compare_type(p->value->value.c.car, ALISP_OBJ_IDENTIFIER) &&
+ !strcmp(p->value->value.c.car->value.s, "lambda")) {
+ snd_output_printf(out, "(defun %s ", p->name);
+ princ_cons(out, p->value->value.c.cdr);
+ snd_output_printf(out, ")\n");
+ continue;
+ }
+ snd_output_printf(out, "(setq %s '", p->name);
+ princ_object(out, p->value);
+ snd_output_printf(out, ")\n");
+ }
+ }
+ snd_output_close(out);
+}
+
+static const char *obj_type_str(struct alisp_object * p)
+{
+ switch (alisp_get_type(p)) {
+ case ALISP_OBJ_NIL: return "nil";
+ case ALISP_OBJ_T: return "t";
+ case ALISP_OBJ_INTEGER: return "integer";
+ case ALISP_OBJ_FLOAT: return "float";
+ case ALISP_OBJ_IDENTIFIER: return "identifier";
+ case ALISP_OBJ_STRING: return "string";
+ case ALISP_OBJ_POINTER: return "pointer";
+ case ALISP_OBJ_CONS: return "cons";
+ default: assert(0);
+ }
+ return NULL; // Tushar: Non void func should return something
+}
+
+static void print_obj_lists(struct alisp_instance *instance, snd_output_t *out)
+{
+ struct list_head *pos;
+ struct alisp_object * p;
+ int i, j;
+
+ snd_output_printf(out, "** used objects\n");
+ for (i = 0; i < ALISP_OBJ_PAIR_HASH_SIZE; i++)
+ for (j = 0; j <= ALISP_OBJ_LAST_SEARCH; j++)
+ list_for_each(pos, &instance->used_objs_list[i][j]) {
+ p = list_entry(pos, struct alisp_object, list);
+ snd_output_printf(out, "** %p (%s) (", p, obj_type_str(p));
+ if (!alisp_compare_type(p, ALISP_OBJ_CONS))
+ princ_object(out, p);
+ else
+ snd_output_printf(out, "cons");
+ snd_output_printf(out, ") refs=%i\n", alisp_get_refs(p));
+ }
+ snd_output_printf(out, "** free objects\n");
+ list_for_each(pos, &instance->free_objs_list) {
+ p = list_entry(pos, struct alisp_object, list);
+ snd_output_printf(out, "** %p\n", p);
+ }
+}
+
+static void dump_obj_lists(struct alisp_instance *instance, const char *fname)
+{
+ snd_output_t *out;
+ int err;
+
+ if (!strcmp(fname, "-"))
+ err = snd_output_stdio_attach(&out, stdout, 0);
+ else
+ err = snd_output_stdio_open(&out, fname, "w+");
+ if (err < 0) {
+ SNDERR("alisp: cannot open file '%s' for writting (%s)", fname, snd_strerror(errno));
+ return;
+ }
+
+ print_obj_lists(instance, out);
+
+ snd_output_close(out);
+}
+
+/*
+ * functions
+ */
+
+static int count_list(struct alisp_object * p)
+{
+ int i = 0;
+
+ while (p != &alsa_lisp_nil && alisp_compare_type(p, ALISP_OBJ_CONS)) {
+ p = p->value.c.cdr;
+ ++i;
+ }
+
+ return i;
+}
+
+static inline struct alisp_object * car(struct alisp_object * p)
+{
+ if (alisp_compare_type(p, ALISP_OBJ_CONS))
+ return p->value.c.car;
+
+ return &alsa_lisp_nil;
+}
+
+static inline struct alisp_object * cdr(struct alisp_object * p)
+{
+ if (alisp_compare_type(p, ALISP_OBJ_CONS))
+ return p->value.c.cdr;
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (car expr)
+ */
+static struct alisp_object * F_car(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object *p1 = car(args), *p2;
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ p1 = eval(instance, p1);
+ delete_tree(instance, cdr(p1));
+ p2 = car(p1);
+ delete_object(instance, p1);
+ return p2;
+}
+
+/*
+ * Syntax: (cdr expr)
+ */
+static struct alisp_object * F_cdr(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object *p1 = car(args), *p2;
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ p1 = eval(instance, p1);
+ delete_tree(instance, car(p1));
+ p2 = cdr(p1);
+ delete_object(instance, p1);
+ return p2;
+}
+
+/*
+ * Syntax: (+ expr...)
+ */
+static struct alisp_object * F_add(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * n;
+ long v = 0;
+ double f = 0;
+ int type = ALISP_OBJ_INTEGER;
+
+ p1 = eval(instance, car(p));
+ for (;;) {
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ if (type == ALISP_OBJ_FLOAT)
+ f += p1->value.i;
+ else
+ v += p1->value.i;
+ } else if (alisp_compare_type(p1, ALISP_OBJ_FLOAT)) {
+ f += p1->value.f + v;
+ v = 0;
+ type = ALISP_OBJ_FLOAT;
+ } else {
+ lisp_warn(instance, "sum with a non integer or float operand");
+ }
+ delete_tree(instance, p1);
+ p = cdr(n = p);
+ delete_object(instance, n);
+ if (p == &alsa_lisp_nil)
+ break;
+ p1 = eval(instance, car(p));
+ }
+ if (type == ALISP_OBJ_INTEGER) {
+ return new_integer(instance, v);
+ } else {
+ return new_float(instance, f);
+ }
+}
+
+/*
+ * Syntax: (concat expr...)
+ */
+static struct alisp_object * F_concat(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * n;
+ char *str = NULL, *str1;
+
+ p1 = eval(instance, car(p));
+ for (;;) {
+ if (alisp_compare_type(p1, ALISP_OBJ_STRING)) {
+ str1 = realloc(str, (str ? strlen(str) : 0) + strlen(p1->value.s) + 1);
+ if (str1 == NULL) {
+ nomem();
+ free(str);
+ return NULL;
+ }
+ if (str == NULL)
+ strcpy(str1, p1->value.s);
+ else
+ strcat(str1, p1->value.s);
+ str = str1;
+ } else {
+ lisp_warn(instance, "concat with a non string or identifier operand");
+ }
+ delete_tree(instance, p1);
+ p = cdr(n = p);
+ delete_object(instance, n);
+ if (p == &alsa_lisp_nil)
+ break;
+ p1 = eval(instance, car(p));
+ }
+ if (str) {
+ p = new_string(instance, str);
+ free(str);
+ } else {
+ p = &alsa_lisp_nil;
+ }
+ return p;
+}
+
+/*
+ * Syntax: (- expr...)
+ */
+static struct alisp_object * F_sub(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * n;
+ long v = 0;
+ double f = 0;
+ int type = ALISP_OBJ_INTEGER;
+
+ do {
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ if (p == args && cdr(p) != &alsa_lisp_nil) {
+ v = p1->value.i;
+ } else {
+ if (type == ALISP_OBJ_FLOAT)
+ f -= p1->value.i;
+ else
+ v -= p1->value.i;
+ }
+ } else if (alisp_compare_type(p1, ALISP_OBJ_FLOAT)) {
+ if (type == ALISP_OBJ_INTEGER) {
+ f = v;
+ type = ALISP_OBJ_FLOAT;
+ }
+ if (p == args && cdr(p) != &alsa_lisp_nil)
+ f = p1->value.f;
+ else {
+ f -= p1->value.f;
+ }
+ } else
+ lisp_warn(instance, "difference with a non integer or float operand");
+ delete_tree(instance, p1);
+ n = cdr(p);
+ delete_object(instance, p);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ if (type == ALISP_OBJ_INTEGER) {
+ return new_integer(instance, v);
+ } else {
+ return new_float(instance, f);
+ }
+}
+
+/*
+ * Syntax: (* expr...)
+ */
+static struct alisp_object * F_mul(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * n;
+ long v = 1;
+ double f = 1;
+ int type = ALISP_OBJ_INTEGER;
+
+ do {
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ if (type == ALISP_OBJ_FLOAT)
+ f *= p1->value.i;
+ else
+ v *= p1->value.i;
+ } else if (alisp_compare_type(p1, ALISP_OBJ_FLOAT)) {
+ f *= p1->value.f * v; v = 1;
+ type = ALISP_OBJ_FLOAT;
+ } else {
+ lisp_warn(instance, "product with a non integer or float operand");
+ }
+ delete_tree(instance, p1);
+ n = cdr(p);
+ delete_object(instance, p);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ if (type == ALISP_OBJ_INTEGER) {
+ return new_integer(instance, v);
+ } else {
+ return new_float(instance, f);
+ }
+}
+
+/*
+ * Syntax: (/ expr...)
+ */
+static struct alisp_object * F_div(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * n;
+ long v = 0;
+ double f = 0;
+ int type = ALISP_OBJ_INTEGER;
+
+ do {
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ if (p == args && cdr(p) != &alsa_lisp_nil) {
+ v = p1->value.i;
+ } else {
+ if (p1->value.i == 0) {
+ lisp_warn(instance, "division by zero");
+ v = 0;
+ f = 0;
+ break;
+ } else {
+ if (type == ALISP_OBJ_FLOAT)
+ f /= p1->value.i;
+ else
+ v /= p1->value.i;
+ }
+ }
+ } else if (alisp_compare_type(p1, ALISP_OBJ_FLOAT)) {
+ if (type == ALISP_OBJ_INTEGER) {
+ f = v;
+ type = ALISP_OBJ_FLOAT;
+ }
+ if (p == args && cdr(p) != &alsa_lisp_nil) {
+ f = p1->value.f;
+ } else {
+ if (p1->value.f == 0) {
+ lisp_warn(instance, "division by zero");
+ f = 0;
+ break;
+ } else {
+ f /= p1->value.i;
+ }
+ }
+ } else
+ lisp_warn(instance, "quotient with a non integer or float operand");
+ delete_tree(instance, p1);
+ n = cdr(p);
+ delete_object(instance, p);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ if (type == ALISP_OBJ_INTEGER) {
+ return new_integer(instance, v);
+ } else {
+ return new_float(instance, f);
+ }
+}
+
+/*
+ * Syntax: (% expr1 expr2)
+ */
+static struct alisp_object * F_mod(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * p3;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p2->value.i == 0) {
+ lisp_warn(instance, "module by zero");
+ p3 = new_integer(instance, 0);
+ } else {
+ p3 = new_integer(instance, p1->value.i % p2->value.i);
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ f1 = fmod(f1, f2);
+ if (f1 == EDOM) {
+ lisp_warn(instance, "module by zero");
+ p3 = new_float(instance, 0);
+ } else {
+ p3 = new_float(instance, f1);
+ }
+ } else {
+ lisp_warn(instance, "module with a non integer or float operand");
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return p3;
+}
+
+/*
+ * Syntax: (< expr1 expr2)
+ */
+static struct alisp_object * F_lt(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p1->value.i < p2->value.i) {
+ __true:
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ if (f1 < f2)
+ goto __true;
+ } else {
+ lisp_warn(instance, "comparison with a non integer or float operand");
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (> expr1 expr2)
+ */
+static struct alisp_object * F_gt(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p1->value.i > p2->value.i) {
+ __true:
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ if (f1 > f2)
+ goto __true;
+ } else {
+ lisp_warn(instance, "comparison with a non integer or float operand");
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (<= expr1 expr2)
+ */
+static struct alisp_object * F_le(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p1->value.i <= p2->value.i) {
+ __true:
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ if (f1 <= f2)
+ goto __true;
+ } else {
+ lisp_warn(instance, "comparison with a non integer or float operand");
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (>= expr1 expr2)
+ */
+static struct alisp_object * F_ge(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p1->value.i >= p2->value.i) {
+ __true:
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ if (f1 >= f2)
+ goto __true;
+ } else {
+ lisp_warn(instance, "comparison with a non integer or float operand");
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (= expr1 expr2)
+ */
+static struct alisp_object * F_numeq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (alisp_compare_type(p1, ALISP_OBJ_INTEGER) &&
+ alisp_compare_type(p2, ALISP_OBJ_INTEGER)) {
+ if (p1->value.i == p2->value.i) {
+ __true:
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ } else if ((alisp_compare_type(p1, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p1, ALISP_OBJ_FLOAT)) &&
+ (alisp_compare_type(p2, ALISP_OBJ_INTEGER) ||
+ alisp_compare_type(p2, ALISP_OBJ_FLOAT))) {
+ double f1, f2;
+ f1 = alisp_compare_type(p1, ALISP_OBJ_INTEGER) ? p1->value.i : p1->value.f;
+ f2 = alisp_compare_type(p2, ALISP_OBJ_INTEGER) ? p2->value.i : p2->value.f;
+ if (f1 == f2)
+ goto __true;
+ } else {
+ lisp_warn(instance, "comparison with a non integer or float operand");
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (!= expr1 expr2)
+ */
+static struct alisp_object * F_numneq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p;
+
+ p = F_numeq(instance, args);
+ if (p == &alsa_lisp_nil)
+ return &alsa_lisp_t;
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (exfun name)
+ * Test, if a function exists
+ */
+static struct alisp_object * F_exfun(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ p2 = get_object(instance, p1);
+ if (p2 == &alsa_lisp_nil) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ p2 = car(p2);
+ if (alisp_compare_type(p2, ALISP_OBJ_IDENTIFIER) &&
+ !strcmp(p2->value.s, "lambda")) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_t;
+ }
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+static void princ_string(snd_output_t *out, char *s)
+{
+ char *p;
+
+ snd_output_putc(out, '"');
+ for (p = s; *p != '\0'; ++p)
+ switch (*p) {
+ case '\a': snd_output_putc(out, '\\'); snd_output_putc(out, 'a'); break;
+ case '\b': snd_output_putc(out, '\\'); snd_output_putc(out, 'b'); break;
+ case '\f': snd_output_putc(out, '\\'); snd_output_putc(out, 'f'); break;
+ case '\n': snd_output_putc(out, '\\'); snd_output_putc(out, 'n'); break;
+ case '\r': snd_output_putc(out, '\\'); snd_output_putc(out, 'r'); break;
+ case '\t': snd_output_putc(out, '\\'); snd_output_putc(out, 't'); break;
+ case '\v': snd_output_putc(out, '\\'); snd_output_putc(out, 'v'); break;
+ case '"': snd_output_putc(out, '\\'); snd_output_putc(out, '"'); break;
+ default: snd_output_putc(out, *p);
+ }
+ snd_output_putc(out, '"');
+}
+
+static void princ_cons(snd_output_t *out, struct alisp_object * p)
+{
+ do {
+ princ_object(out, p->value.c.car);
+ p = p->value.c.cdr;
+ if (p != &alsa_lisp_nil) {
+ snd_output_putc(out, ' ');
+ if (!alisp_compare_type(p, ALISP_OBJ_CONS)) {
+ snd_output_printf(out, ". ");
+ princ_object(out, p);
+ }
+ }
+ } while (p != &alsa_lisp_nil && alisp_compare_type(p, ALISP_OBJ_CONS));
+}
+
+static void princ_object(snd_output_t *out, struct alisp_object * p)
+{
+ switch (alisp_get_type(p)) {
+ case ALISP_OBJ_NIL:
+ snd_output_printf(out, "nil");
+ break;
+ case ALISP_OBJ_T:
+ snd_output_putc(out, 't');
+ break;
+ case ALISP_OBJ_IDENTIFIER:
+ snd_output_printf(out, "%s", p->value.s);
+ break;
+ case ALISP_OBJ_STRING:
+ princ_string(out, p->value.s);
+ break;
+ case ALISP_OBJ_INTEGER:
+ snd_output_printf(out, "%ld", p->value.i);
+ break;
+ case ALISP_OBJ_FLOAT:
+ snd_output_printf(out, "%f", p->value.f);
+ break;
+ case ALISP_OBJ_POINTER:
+ snd_output_printf(out, "<%p>", p->value.ptr);
+ break;
+ case ALISP_OBJ_CONS:
+ snd_output_putc(out, '(');
+ princ_cons(out, p);
+ snd_output_putc(out, ')');
+ }
+}
+
+/*
+ * Syntax: (princ expr...)
+ */
+static struct alisp_object * F_princ(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1 = NULL, * n;
+
+ do {
+ if (p1)
+ delete_tree(instance, p1);
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_STRING))
+ snd_output_printf(instance->out,"%s", p1->value.s);
+ else
+ princ_object(instance->out, p1);
+ n = cdr(p);
+ delete_object(instance, p);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ return p1;
+}
+
+/*
+ * Syntax: (atom expr)
+ */
+static struct alisp_object * F_atom(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p;
+
+ p = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (p == NULL)
+ return NULL;
+
+ switch (alisp_get_type(p)) {
+ case ALISP_OBJ_T:
+ case ALISP_OBJ_NIL:
+ case ALISP_OBJ_INTEGER:
+ case ALISP_OBJ_FLOAT:
+ case ALISP_OBJ_STRING:
+ case ALISP_OBJ_IDENTIFIER:
+ case ALISP_OBJ_POINTER:
+ delete_tree(instance, p);
+ return &alsa_lisp_t;
+ default:
+ break;
+ }
+
+ delete_tree(instance, p);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (cons expr1 expr2)
+ */
+static struct alisp_object * F_cons(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p;
+
+ p = new_object(instance, ALISP_OBJ_CONS);
+ if (p) {
+ p->value.c.car = eval(instance, car(args));
+ p->value.c.cdr = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ } else {
+ delete_tree(instance, args);
+ }
+
+ return p;
+}
+
+/*
+ * Syntax: (list expr1...)
+ */
+static struct alisp_object * F_list(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * first = NULL, * prev = NULL, * p1;
+
+ if (p == &alsa_lisp_nil)
+ return &alsa_lisp_nil;
+
+ do {
+ p1 = new_object(instance, ALISP_OBJ_CONS);
+ if (p1 == NULL) {
+ delete_tree(instance, p);
+ delete_tree(instance, first);
+ return NULL;
+ }
+ p1->value.c.car = eval(instance, car(p));
+ if (p1->value.c.car == NULL) {
+ delete_tree(instance, first);
+ delete_tree(instance, cdr(p));
+ delete_object(instance, p);
+ return NULL;
+ }
+ if (first == NULL)
+ first = p1;
+ if (prev != NULL)
+ prev->value.c.cdr = p1;
+ prev = p1;
+ p = cdr(p1 = p);
+ delete_object(instance, p1);
+ } while (p != &alsa_lisp_nil);
+
+ return first;
+}
+
+static inline int eq(struct alisp_object * p1, struct alisp_object * p2)
+{
+ return p1 == p2;
+}
+
+static int equal(struct alisp_object * p1, struct alisp_object * p2)
+{
+ int type1, type2;
+
+ if (eq(p1, p2))
+ return 1;
+
+ type1 = alisp_get_type(p1);
+ type2 = alisp_get_type(p2);
+
+ if (type1 == ALISP_OBJ_CONS || type2 == ALISP_OBJ_CONS)
+ return 0;
+
+ if (type1 == type2) {
+ switch (type1) {
+ case ALISP_OBJ_STRING:
+ return !strcmp(p1->value.s, p2->value.s);
+ case ALISP_OBJ_INTEGER:
+ return p1->value.i == p2->value.i;
+ case ALISP_OBJ_FLOAT:
+ return p1->value.i == p2->value.i;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * Syntax: (eq expr1 expr2)
+ */
+static struct alisp_object * F_eq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (eq(p1, p2)) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (equal expr1 expr2)
+ */
+static struct alisp_object * F_equal(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (equal(p1, p2)) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_t;
+ }
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (quote expr)
+ */
+static struct alisp_object * F_quote(struct alisp_instance *instance ATTRIBUTE_UNUSED, struct alisp_object * args)
+{
+ struct alisp_object *p = car(args);
+
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ return p;
+}
+
+/*
+ * Syntax: (and expr...)
+ */
+static struct alisp_object * F_and(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1 = NULL, * n;
+
+ do {
+ if (p1)
+ delete_tree(instance, p1);
+ p1 = eval(instance, car(p));
+ if (p1 == &alsa_lisp_nil) {
+ delete_tree(instance, p1);
+ delete_tree(instance, cdr(p));
+ delete_object(instance, p);
+ return &alsa_lisp_nil;
+ }
+ p = cdr(n = p);
+ delete_object(instance, n);
+ } while (p != &alsa_lisp_nil);
+
+ return p1;
+}
+
+/*
+ * Syntax: (or expr...)
+ */
+static struct alisp_object * F_or(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1 = NULL, * n;
+
+ do {
+ if (p1)
+ delete_tree(instance, p1);
+ p1 = eval(instance, car(p));
+ if (p1 != &alsa_lisp_nil) {
+ delete_tree(instance, cdr(p));
+ delete_object(instance, p);
+ return p1;
+ }
+ p = cdr(n = p);
+ delete_object(instance, n);
+ } while (p != &alsa_lisp_nil);
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (not expr)
+ * Syntax: (null expr)
+ */
+static struct alisp_object * F_not(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = eval(instance, car(args));
+
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (p != &alsa_lisp_nil) {
+ delete_tree(instance, p);
+ return &alsa_lisp_nil;
+ }
+
+ delete_tree(instance, p);
+ return &alsa_lisp_t;
+}
+
+/*
+ * Syntax: (cond (expr1 [expr2])...)
+ */
+static struct alisp_object * F_cond(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * p2, * p3;
+
+ do {
+ p1 = car(p);
+ if ((p2 = eval(instance, car(p1))) != &alsa_lisp_nil) {
+ p3 = cdr(p1);
+ delete_object(instance, p1);
+ delete_tree(instance, cdr(p));
+ delete_object(instance, p);
+ if (p3 != &alsa_lisp_nil) {
+ delete_tree(instance, p2);
+ return F_progn(instance, p3);
+ } else {
+ delete_tree(instance, p3);
+ return p2;
+ }
+ } else {
+ delete_tree(instance, p2);
+ delete_tree(instance, cdr(p1));
+ delete_object(instance, p1);
+ }
+ p = cdr(p2 = p);
+ delete_object(instance, p2);
+ } while (p != &alsa_lisp_nil);
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (if expr then-expr else-expr...)
+ */
+static struct alisp_object * F_if(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * p3;
+
+ p1 = car(args);
+ p2 = car(cdr(args));
+ p3 = cdr(cdr(args));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ p1 = eval(instance, p1);
+ if (p1 != &alsa_lisp_nil) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p3);
+ return eval(instance, p2);
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return F_progn(instance, p3);
+}
+
+/*
+ * Syntax: (when expr then-expr...)
+ */
+static struct alisp_object * F_when(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = car(args);
+ p2 = cdr(args);
+ delete_object(instance, args);
+ if ((p1 = eval(instance, p1)) != &alsa_lisp_nil) {
+ delete_tree(instance, p1);
+ return F_progn(instance, p2);
+ } else {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ }
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (unless expr else-expr...)
+ */
+static struct alisp_object * F_unless(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2;
+
+ p1 = car(args);
+ p2 = cdr(args);
+ delete_object(instance, args);
+ if ((p1 = eval(instance, p1)) == &alsa_lisp_nil) {
+ return F_progn(instance, p2);
+ } else {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ }
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (while expr exprs...)
+ */
+static struct alisp_object * F_while(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * p3;
+
+ p1 = car(args);
+ p2 = cdr(args);
+
+ delete_object(instance, args);
+ while (1) {
+ incref_tree(instance, p1);
+ if ((p3 = eval(instance, p1)) == &alsa_lisp_nil)
+ break;
+ delete_tree(instance, p3);
+ incref_tree(instance, p2);
+ delete_tree(instance, F_progn(instance, p2));
+ }
+
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (progn expr...)
+ */
+static struct alisp_object * F_progn(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1 = NULL, * n;
+
+ do {
+ if (p1)
+ delete_tree(instance, p1);
+ p1 = eval(instance, car(p));
+ n = cdr(p);
+ delete_object(instance, p);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ return p1;
+}
+
+/*
+ * Syntax: (prog1 expr...)
+ */
+static struct alisp_object * F_prog1(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * first = NULL, * p1;
+
+ do {
+ p1 = eval(instance, car(p));
+ if (first == NULL)
+ first = p1;
+ else
+ delete_tree(instance, p1);
+ p1 = cdr(p);
+ delete_object(instance, p);
+ p = p1;
+ } while (p != &alsa_lisp_nil);
+
+ if (first == NULL)
+ first = &alsa_lisp_nil;
+
+ return first;
+}
+
+/*
+ * Syntax: (prog2 expr...)
+ */
+static struct alisp_object * F_prog2(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * second = NULL, * p1;
+ int i = 0;
+
+ do {
+ ++i;
+ p1 = eval(instance, car(p));
+ if (i == 2)
+ second = p1;
+ else
+ delete_tree(instance, p1);
+ p1 = cdr(p);
+ delete_object(instance, p);
+ p = p1;
+ } while (p != &alsa_lisp_nil);
+
+ if (second == NULL)
+ second = &alsa_lisp_nil;
+
+ return second;
+}
+
+/*
+ * Syntax: (set name value)
+ */
+static struct alisp_object * F_set(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1 = eval(instance, car(args)),
+ * p2 = eval(instance, car(cdr(args)));
+
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ if (!check_set_object(instance, p1)) {
+ delete_tree(instance, p2);
+ p2 = &alsa_lisp_nil;
+ } else {
+ if (set_object(instance, p1, p2) == NULL) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return NULL;
+ }
+ }
+ delete_tree(instance, p1);
+ return incref_tree(instance, p2);
+}
+
+/*
+ * Syntax: (unset name)
+ */
+static struct alisp_object * F_unset(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1 = eval(instance, car(args));
+
+ delete_tree(instance, unset_object(instance, p1));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ return p1;
+}
+
+/*
+ * Syntax: (setq name value...)
+ * Syntax: (setf name value...)
+ * `name' is not evalled
+ */
+static struct alisp_object * F_setq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1, * p2 = NULL, *n;
+
+ do {
+ p1 = car(p);
+ p2 = eval(instance, car(cdr(p)));
+ n = cdr(cdr(p));
+ delete_object(instance, cdr(p));
+ delete_object(instance, p);
+ if (!check_set_object(instance, p1)) {
+ delete_tree(instance, p2);
+ p2 = &alsa_lisp_nil;
+ } else {
+ if (set_object(instance, p1, p2) == NULL) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return NULL;
+ }
+ }
+ delete_tree(instance, p1);
+ p = n;
+ } while (p != &alsa_lisp_nil);
+
+ return incref_tree(instance, p2);
+}
+
+/*
+ * Syntax: (unsetq name...)
+ * Syntax: (unsetf name...)
+ * `name' is not evalled
+ */
+static struct alisp_object * F_unsetq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1 = NULL, * n;
+
+ do {
+ if (p1)
+ delete_tree(instance, p1);
+ p1 = unset_object(instance, car(p));
+ delete_tree(instance, car(p));
+ p = cdr(n = p);
+ delete_object(instance, n);
+ } while (p != &alsa_lisp_nil);
+
+ return p1;
+}
+
+/*
+ * Syntax: (defun name arglist expr...)
+ * `name' is not evalled
+ * `arglist' is not evalled
+ */
+static struct alisp_object * F_defun(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1 = car(args),
+ * p2 = car(cdr(args)),
+ * p3 = cdr(cdr(args));
+ struct alisp_object * lexpr;
+
+ lexpr = new_object(instance, ALISP_OBJ_CONS);
+ if (lexpr) {
+ lexpr->value.c.car = new_identifier(instance, "lambda");
+ if (lexpr->value.c.car == NULL) {
+ delete_object(instance, lexpr);
+ delete_tree(instance, args);
+ return NULL;
+ }
+ if ((lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS)) == NULL) {
+ delete_object(instance, lexpr->value.c.car);
+ delete_object(instance, lexpr);
+ delete_tree(instance, args);
+ return NULL;
+ }
+ lexpr->value.c.cdr->value.c.car = p2;
+ lexpr->value.c.cdr->value.c.cdr = p3;
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ if (set_object(instance, p1, lexpr) == NULL) {
+ delete_tree(instance, p1);
+ delete_tree(instance, lexpr);
+ return NULL;
+ }
+ delete_tree(instance, p1);
+ } else {
+ delete_tree(instance, args);
+ }
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * eval_func(struct alisp_instance *instance, struct alisp_object * p, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * p3, * p4;
+ struct alisp_object ** eval_objs, ** save_objs;
+ int i;
+
+ p1 = car(p);
+ if (alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER) &&
+ !strcmp(p1->value.s, "lambda")) {
+ p2 = car(cdr(p));
+ p3 = args;
+
+ if ((i = count_list(p2)) != count_list(p3)) {
+ lisp_warn(instance, "wrong number of parameters");
+ goto _delete;
+ }
+
+ eval_objs = malloc(2 * i * sizeof(struct alisp_object *));
+ if (eval_objs == NULL) {
+ nomem();
+ goto _delete;
+ }
+ save_objs = eval_objs + i;
+
+ /*
+ * Save the new variable values.
+ */
+ i = 0;
+ while (p3 != &alsa_lisp_nil) {
+ eval_objs[i++] = eval(instance, car(p3));
+ p3 = cdr(p4 = p3);
+ delete_object(instance, p4);
+ }
+
+ /*
+ * Save the old variable values and set the new ones.
+ */
+ i = 0;
+ while (p2 != &alsa_lisp_nil) {
+ p3 = car(p2);
+ save_objs[i] = replace_object(instance, p3, eval_objs[i]);
+ if (save_objs[i] == NULL &&
+ set_object_direct(instance, p3, eval_objs[i]) == NULL) {
+ p4 = NULL;
+ goto _end;
+ }
+ p2 = cdr(p2);
+ ++i;
+ }
+
+ p4 = F_progn(instance, cdr(incref_tree(instance, p3 = cdr(p))));
+
+ /*
+ * Restore the old variable values.
+ */
+ p2 = car(p3);
+ delete_object(instance, p3);
+ i = 0;
+ while (p2 != &alsa_lisp_nil) {
+ p3 = car(p2);
+ if (save_objs[i] == NULL) {
+ p3 = unset_object(instance, p3);
+ } else {
+ p3 = replace_object(instance, p3, save_objs[i]);
+ }
+ i++;
+ delete_tree(instance, p3);
+ delete_tree(instance, car(p2));
+ p2 = cdr(p3 = p2);
+ delete_object(instance, p3);
+ }
+
+ _end:
+ free(eval_objs);
+
+ return p4;
+ } else {
+ _delete:
+ delete_tree(instance, args);
+ }
+ return &alsa_lisp_nil;
+}
+
+struct alisp_object * F_gc(struct alisp_instance *instance ATTRIBUTE_UNUSED, struct alisp_object * args ATTRIBUTE_UNUSED)
+{
+ /* improved: no more traditional gc */
+ return &alsa_lisp_t;
+}
+
+/*
+ * Syntax: (path what)
+ * what is string ('data')
+ */
+struct alisp_object * F_path(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (!alisp_compare_type(p1, ALISP_OBJ_STRING)) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ if (!strcmp(p1->value.s, "data")) {
+ delete_tree(instance, p1);
+ return new_string(instance, ALSA_CONFIG_DIR);
+ }
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (include filename...)
+ */
+struct alisp_object * F_include(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1;
+ int res = -ENOENT;
+
+ do {
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_STRING))
+ res = alisp_include_file(instance, p1->value.s);
+ delete_tree(instance, p1);
+ p = cdr(p1 = p);
+ delete_object(instance, p1);
+ } while (p != &alsa_lisp_nil);
+
+ return new_integer(instance, res);
+}
+
+/*
+ * Syntax: (string-to-integer value)
+ * 'value' can be integer or float type
+ */
+struct alisp_object * F_string_to_integer(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = eval(instance, car(args)), * p1;
+
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (alisp_compare_type(p, ALISP_OBJ_INTEGER))
+ return p;
+ if (alisp_compare_type(p, ALISP_OBJ_FLOAT)) {
+ p1 = new_integer(instance, floor(p->value.f));
+ } else {
+ lisp_warn(instance, "expected an integer or float for integer conversion");
+ p1 = &alsa_lisp_nil;
+ }
+ delete_tree(instance, p);
+ return p1;
+}
+
+/*
+ * Syntax: (string-to-float value)
+ * 'value' can be integer or float type
+ */
+struct alisp_object * F_string_to_float(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = eval(instance, car(args)), * p1;
+
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (alisp_compare_type(p, ALISP_OBJ_FLOAT))
+ return p;
+ if (alisp_compare_type(p, ALISP_OBJ_INTEGER)) {
+ p1 = new_float(instance, p->value.i);
+ } else {
+ lisp_warn(instance, "expected an integer or float for integer conversion");
+ p1 = &alsa_lisp_nil;
+ }
+ delete_tree(instance, p);
+ return p1;
+}
+
+static int append_to_string(char **s, int *len, char *from, int size)
+{
+ if (*len == 0) {
+ *s = malloc(*len = size + 1);
+ if (*s == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ memcpy(*s, from, size);
+ } else {
+ *len += size;
+ *s = realloc(*s, *len);
+ if (*s == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ memcpy(*s + strlen(*s), from, size);
+ }
+ (*s)[*len - 1] = '\0';
+ return 0;
+}
+
+static int format_parse_char(struct alisp_instance *instance, char **s, int *len, struct alisp_object *p)
+{
+ char b;
+
+ if (!alisp_compare_type(p, ALISP_OBJ_INTEGER)) {
+ lisp_warn(instance, "format: expected integer\n");
+ return 0;
+ }
+ b = p->value.i;
+ return append_to_string(s, len, &b, 1);
+}
+
+static int format_parse_integer(struct alisp_instance *instance, char **s, int *len, struct alisp_object *p)
+{
+ int res;
+ char *s1;
+
+ if (!alisp_compare_type(p, ALISP_OBJ_INTEGER) &&
+ !alisp_compare_type(p, ALISP_OBJ_FLOAT)) {
+ lisp_warn(instance, "format: expected integer or float\n");
+ return 0;
+ }
+ s1 = malloc(64);
+ if (s1 == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ sprintf(s1, "%li", alisp_compare_type(p, ALISP_OBJ_FLOAT) ? (long)floor(p->value.f) : p->value.i);
+ res = append_to_string(s, len, s1, strlen(s1));
+ free(s1);
+ return res;
+}
+
+static int format_parse_float(struct alisp_instance *instance, char **s, int *len, struct alisp_object *p)
+{
+ int res;
+ char *s1;
+
+ if (!alisp_compare_type(p, ALISP_OBJ_INTEGER) &&
+ !alisp_compare_type(p, ALISP_OBJ_FLOAT)) {
+ lisp_warn(instance, "format: expected integer or float\n");
+ return 0;
+ }
+ s1 = malloc(64);
+ if (s1 == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ sprintf(s1, "%f", alisp_compare_type(p, ALISP_OBJ_FLOAT) ? p->value.f : (double)p->value.i);
+ res = append_to_string(s, len, s1, strlen(s1));
+ free(s1);
+ return res;
+}
+
+static int format_parse_string(struct alisp_instance *instance, char **s, int *len, struct alisp_object *p)
+{
+ if (!alisp_compare_type(p, ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "format: expected string\n");
+ return 0;
+ }
+ return append_to_string(s, len, p->value.s, strlen(p->value.s));
+}
+
+/*
+ * Syntax: (format format value...)
+ * 'format' is C-like format string
+ */
+struct alisp_object * F_format(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = eval(instance, car(args)), * p1 = cdr(args), * n;
+ char *s, *s1, *s2;
+ int len;
+
+ delete_object(instance, args);
+ if (!alisp_compare_type(p, ALISP_OBJ_STRING)) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p);
+ lisp_warn(instance, "format: expected an format string");
+ return &alsa_lisp_nil;
+ }
+ s = p->value.s;
+ s1 = NULL;
+ len = 0;
+ n = eval(instance, car(p1));
+ do {
+ while (1) {
+ s2 = s;
+ while (*s2 && *s2 != '%')
+ s2++;
+ if (s2 != s) {
+ if (append_to_string(&s1, &len, s, s2 - s) < 0) {
+ __error:
+ delete_tree(instance, n);
+ delete_tree(instance, cdr(p1));
+ delete_object(instance, p1);
+ delete_tree(instance, p);
+ return NULL;
+ }
+ }
+ if (*s2 == '%')
+ s2++;
+ switch (*s2) {
+ case '%':
+ if (append_to_string(&s1, &len, s2, 1) < 0)
+ goto __error;
+ s = s2 + 1;
+ break;
+ case 'c':
+ if (format_parse_char(instance, &s1, &len, n) < 0)
+ goto __error;
+ s = s2 + 1;
+ goto __next;
+ case 'd':
+ case 'i':
+ if (format_parse_integer(instance, &s1, &len, n) < 0)
+ goto __error;
+ s = s2 + 1;
+ goto __next;
+ case 'f':
+ if (format_parse_float(instance, &s1, &len, n) < 0)
+ goto __error;
+ s = s2 + 1;
+ goto __next;
+ case 's':
+ if (format_parse_string(instance, &s1, &len, n) < 0)
+ goto __error;
+ s = s2 + 1;
+ goto __next;
+ case '\0':
+ goto __end;
+ default:
+ lisp_warn(instance, "unknown format char '%c'", *s2);
+ s = s2 + 1;
+ goto __next;
+ }
+ }
+ __next:
+ delete_tree(instance, n);
+ p1 = cdr(n = p1);
+ delete_object(instance, n);
+ n = eval(instance, car(p1));
+ } while (*s);
+ __end:
+ delete_tree(instance, n);
+ delete_tree(instance, cdr(p1));
+ delete_object(instance, p1);
+ delete_tree(instance, p);
+ if (len > 0) {
+ p1 = new_string(instance, s1);
+ free(s1);
+ } else {
+ p1 = &alsa_lisp_nil;
+ }
+ return p1;
+}
+
+/*
+ * Syntax: (compare-strings str1 start1 end1 str2 start2 end2 /opt-case-insensitive)
+ * 'str1' is first compared string
+ * 'start1' is first char (0..)
+ * 'end1' is last char (0..)
+ * 'str2' is second compared string
+ * 'start2' is first char (0..)
+ * 'end2' is last char (0..)
+ * /opt-case-insensitive true - case insensitive match
+ */
+struct alisp_object * F_compare_strings(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1 = args, * n, * p[7];
+ char *s1, *s2;
+ int start1, end1, start2, end2;
+
+ for (start1 = 0; start1 < 7; start1++) {
+ p[start1] = eval(instance, car(p1));
+ p1 = cdr(n = p1);
+ delete_object(instance, n);
+ }
+ delete_tree(instance, p1);
+ if (alisp_compare_type(p[0], ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "compare-strings: first argument must be string\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (alisp_compare_type(p[1], ALISP_OBJ_INTEGER)) {
+ lisp_warn(instance, "compare-strings: second argument must be integer\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (alisp_compare_type(p[2], ALISP_OBJ_INTEGER)) {
+ lisp_warn(instance, "compare-strings: third argument must be integer\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (alisp_compare_type(p[3], ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "compare-strings: fifth argument must be string\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (!alisp_compare_type(p[4], ALISP_OBJ_NIL) &&
+ !alisp_compare_type(p[4], ALISP_OBJ_INTEGER)) {
+ lisp_warn(instance, "compare-strings: fourth argument must be integer\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (!alisp_compare_type(p[5], ALISP_OBJ_NIL) &&
+ !alisp_compare_type(p[5], ALISP_OBJ_INTEGER)) {
+ lisp_warn(instance, "compare-strings: sixth argument must be integer\n");
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ s1 = p[0]->value.s;
+ start1 = p[1]->value.i;
+ end1 = p[2]->value.i;
+ s2 = p[3]->value.s;
+ start2 = alisp_compare_type(p[4], ALISP_OBJ_NIL) ? 0 : p[4]->value.i;
+ end2 = alisp_compare_type(p[5], ALISP_OBJ_NIL) ? start2 + (end1 - start1) : p[5]->value.i;
+ if (start1 < 0 || start2 < 0 || end1 < 0 || end2 < 0 ||
+ start1 >= (int)strlen(s1) || start2 >= (int)strlen(s2) ||
+ (end1 - start1) != (end2 - start2)) {
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ if (p[6] != &alsa_lisp_nil) {
+ while (start1 < end1) {
+ if (s1[start1] == '\0' ||
+ s2[start2] == '\0' ||
+ tolower(s1[start1]) != tolower(s2[start2])) {
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ start1++;
+ start2++;
+ }
+ } else {
+ while (start1 < end1) {
+ if (s1[start1] == '\0' ||
+ s2[start2] == '\0' ||
+ s1[start1] != s2[start2]) {
+ p1 = &alsa_lisp_nil;
+ goto __err;
+ }
+ start1++;
+ start2++;
+ }
+ }
+ p1 = &alsa_lisp_t;
+
+ __err:
+ for (start1 = 0; start1 < 7; start1++)
+ delete_tree(instance, p[start1]);
+ return p1;
+}
+
+/*
+ * Syntax: (assoc key alist)
+ */
+struct alisp_object * F_assoc(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * n;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ do {
+ if (eq(p1, car(car(p2)))) {
+ n = car(p2);
+ delete_tree(instance, p1);
+ delete_tree(instance, cdr(p2));
+ delete_object(instance, p2);
+ return n;
+ }
+ delete_tree(instance, car(p2));
+ p2 = cdr(n = p2);
+ delete_object(instance, n);
+ } while (p2 != &alsa_lisp_nil);
+
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (rassoc value alist)
+ */
+struct alisp_object * F_rassoc(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, *p2, * n;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ do {
+ if (eq(p1, cdr(car(p2)))) {
+ n = car(p2);
+ delete_tree(instance, p1);
+ delete_tree(instance, cdr(p2));
+ delete_object(instance, p2);
+ return n;
+ }
+ delete_tree(instance, car(p2));
+ p2 = cdr(n = p2);
+ delete_object(instance, n);
+ } while (p2 != &alsa_lisp_nil);
+
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (assq key alist)
+ */
+struct alisp_object * F_assq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * n;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ do {
+ if (equal(p1, car(car(p2)))) {
+ n = car(p2);
+ delete_tree(instance, p1);
+ delete_tree(instance, cdr(p2));
+ delete_object(instance, p2);
+ return n;
+ }
+ delete_tree(instance, car(p2));
+ p2 = cdr(n = p2);
+ delete_object(instance, n);
+ } while (p2 != &alsa_lisp_nil);
+
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (nth index alist)
+ */
+struct alisp_object * F_nth(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * n;
+ long idx;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+ }
+ if (!alisp_compare_type(p2, ALISP_OBJ_CONS)) {
+ delete_object(instance, p1);
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+ }
+ idx = p1->value.i;
+ delete_object(instance, p1);
+ while (idx-- > 0) {
+ delete_tree(instance, car(p2));
+ p2 = cdr(n = p2);
+ delete_object(instance, n);
+ }
+ n = car(p2);
+ delete_tree(instance, cdr(p2));
+ delete_object(instance, p2);
+ return n;
+}
+
+/*
+ * Syntax: (rassq value alist)
+ */
+struct alisp_object * F_rassq(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, * p2, * n;
+
+ p1 = eval(instance, car(args));
+ p2 = eval(instance, car(cdr(args)));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+
+ do {
+ if (equal(p1, cdr(car(p2)))) {
+ n = car(p2);
+ delete_tree(instance, p1);
+ delete_tree(instance, cdr(p2));
+ delete_object(instance, p2);
+ return n;
+ }
+ delete_tree(instance, car(p2));
+ p2 = cdr(n = p2);
+ delete_object(instance, n);
+ } while (p2 != &alsa_lisp_nil);
+
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * F_dump_memory(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = car(args);
+
+ if (p != &alsa_lisp_nil && cdr(args) == &alsa_lisp_nil &&
+ alisp_compare_type(p, ALISP_OBJ_STRING)) {
+ if (strlen(p->value.s) > 0) {
+ dump_objects(instance, p->value.s);
+ delete_tree(instance, args);
+ return &alsa_lisp_t;
+ } else
+ lisp_warn(instance, "expected filename");
+ } else
+ lisp_warn(instance, "wrong number of parameters (expected string)");
+
+ delete_tree(instance, args);
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * F_stat_memory(struct alisp_instance *instance, struct alisp_object * args)
+{
+ snd_output_printf(instance->out, "*** Memory stats\n");
+ snd_output_printf(instance->out, " used_objs = %li, free_objs = %li, max_objs = %li, obj_size = %i (total bytes = %li, max bytes = %li)\n",
+ instance->used_objs,
+ instance->free_objs,
+ instance->max_objs,
+ (int)sizeof(struct alisp_object),
+ (long)((instance->used_objs + instance->free_objs) * sizeof(struct alisp_object)),
+ (long)(instance->max_objs * sizeof(struct alisp_object)));
+ delete_tree(instance, args);
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * F_check_memory(struct alisp_instance *instance, struct alisp_object * args)
+{
+ delete_tree(instance, args);
+ if (instance->used_objs > 0) {
+ fprintf(stderr, "!!!alsa lisp - check memory failed!!!\n");
+ F_stat_memory(instance, &alsa_lisp_nil);
+ exit(EXIT_FAILURE);
+ }
+ return &alsa_lisp_t;
+}
+
+static struct alisp_object * F_dump_objects(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = car(args);
+
+ if (p != &alsa_lisp_nil && cdr(args) == &alsa_lisp_nil &&
+ alisp_compare_type(p, ALISP_OBJ_STRING)) {
+ if (strlen(p->value.s) > 0) {
+ dump_obj_lists(instance, p->value.s);
+ delete_tree(instance, args);
+ return &alsa_lisp_t;
+ } else
+ lisp_warn(instance, "expected filename");
+ } else
+ lisp_warn(instance, "wrong number of parameters (expected string)");
+
+ delete_tree(instance, args);
+ return &alsa_lisp_nil;
+}
+
+struct intrinsic {
+ const char *name;
+ struct alisp_object * (*func)(struct alisp_instance *instance, struct alisp_object * args);
+};
+
+static const struct intrinsic intrinsics[] = {
+ { "!=", F_numneq },
+ { "%", F_mod },
+ { "&check-memory", F_check_memory },
+ { "&dump-memory", F_dump_memory },
+ { "&dump-objects", F_dump_objects },
+ { "&stat-memory", F_stat_memory },
+ { "*", F_mul },
+ { "+", F_add },
+ { "-", F_sub },
+ { "/", F_div },
+ { "<", F_lt },
+ { "<=", F_le },
+ { "=", F_numeq },
+ { ">", F_gt },
+ { ">=", F_ge },
+ { "and", F_and },
+ { "assoc", F_assoc },
+ { "assq", F_assq },
+ { "atom", F_atom },
+ { "car", F_car },
+ { "cdr", F_cdr },
+ { "compare-strings", F_compare_strings },
+ { "concat", F_concat },
+ { "cond", F_cond },
+ { "cons", F_cons },
+ { "defun", F_defun },
+ { "eq", F_eq },
+ { "equal", F_equal },
+ { "eval", F_eval },
+ { "exfun", F_exfun },
+ { "format", F_format },
+ { "funcall", F_funcall },
+ { "garbage-collect", F_gc },
+ { "gc", F_gc },
+ { "if", F_if },
+ { "include", F_include },
+ { "list", F_list },
+ { "not", F_not },
+ { "nth", F_nth },
+ { "null", F_not },
+ { "or", F_or },
+ { "path", F_path },
+ { "princ", F_princ },
+ { "prog1", F_prog1 },
+ { "prog2", F_prog2 },
+ { "progn", F_progn },
+ { "quote", F_quote },
+ { "rassoc", F_rassoc },
+ { "rassq", F_rassq },
+ { "set", F_set },
+ { "setf", F_setq },
+ { "setq", F_setq },
+ { "string-equal", F_equal },
+ { "string-to-float", F_string_to_float },
+ { "string-to-integer", F_string_to_integer },
+ { "string-to-number", F_string_to_float },
+ { "string=", F_equal },
+ { "unless", F_unless },
+ { "unset", F_unset },
+ { "unsetf", F_unsetq },
+ { "unsetq", F_unsetq },
+ { "when", F_when },
+ { "while", F_while },
+};
+
+#include "alisp_snd.c"
+
+static int compar(const void *p1, const void *p2)
+{
+ return strcmp(((struct intrinsic *)p1)->name,
+ ((struct intrinsic *)p2)->name);
+}
+
+static inline struct alisp_object * eval_cons1(struct alisp_instance *instance, struct alisp_object * p1, struct alisp_object * p2)
+{
+ struct alisp_object * p3;
+ struct intrinsic key, *item;
+
+ key.name = p1->value.s;
+
+ if ((item = bsearch(&key, intrinsics,
+ sizeof intrinsics / sizeof intrinsics[0],
+ sizeof intrinsics[0], compar)) != NULL) {
+ delete_object(instance, p1);
+ return item->func(instance, p2);
+ }
+
+ if ((item = bsearch(&key, snd_intrinsics,
+ sizeof snd_intrinsics / sizeof snd_intrinsics[0],
+ sizeof snd_intrinsics[0], compar)) != NULL) {
+ delete_object(instance, p1);
+ return item->func(instance, p2);
+ }
+
+ if ((p3 = get_object(instance, p1)) != &alsa_lisp_nil) {
+ delete_object(instance, p1);
+ return eval_func(instance, p3, p2);
+ } else {
+ lisp_warn(instance, "function `%s' is undefined", p1->value.s);
+ delete_object(instance, p1);
+ delete_tree(instance, p2);
+ }
+
+ return &alsa_lisp_nil;
+}
+
+/*
+ * Syntax: (funcall function args...)
+ */
+static struct alisp_object * F_funcall(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = eval(instance, car(args)), * p1;
+
+ if (!alisp_compare_type(p, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(p, ALISP_OBJ_STRING)) {
+ lisp_warn(instance, "expected an function name");
+ delete_tree(instance, p);
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ return &alsa_lisp_nil;
+ }
+ p1 = cdr(args);
+ delete_object(instance, args);
+ return eval_cons1(instance, p, p1);
+}
+
+static inline struct alisp_object * eval_cons(struct alisp_instance *instance, struct alisp_object * p)
+{
+ struct alisp_object * p1 = car(p), * p2;
+
+ if (p1 != &alsa_lisp_nil && alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER)) {
+ if (!strcmp(p1->value.s, "lambda"))
+ return p;
+
+ p2 = cdr(p);
+ delete_object(instance, p);
+ return eval_cons1(instance, p1, p2);
+ } else {
+ delete_tree(instance, p);
+ }
+
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * eval(struct alisp_instance *instance, struct alisp_object * p)
+{
+ switch (alisp_get_type(p)) {
+ case ALISP_OBJ_IDENTIFIER: {
+ struct alisp_object *r = incref_tree(instance, get_object(instance, p));
+ delete_object(instance, p);
+ return r;
+ }
+ case ALISP_OBJ_INTEGER:
+ case ALISP_OBJ_FLOAT:
+ case ALISP_OBJ_STRING:
+ case ALISP_OBJ_POINTER:
+ return p;
+ case ALISP_OBJ_CONS:
+ return eval_cons(instance, p);
+ default:
+ break;
+ }
+
+ return p;
+}
+
+static struct alisp_object * F_eval(struct alisp_instance *instance, struct alisp_object * args)
+{
+ return eval(instance, eval(instance, car(args)));
+}
+
+/*
+ * main routine
+ */
+
+static int alisp_include_file(struct alisp_instance *instance, const char *filename)
+{
+ snd_input_t *old_in;
+ struct alisp_object *p, *p1;
+ char *name;
+ int retval = 0, err;
+
+ err = snd_user_file(filename, &name);
+ if (err < 0)
+ return err;
+ old_in = instance->in;
+ err = snd_input_stdio_open(&instance->in, name, "r");
+ if (err < 0) {
+ retval = err;
+ goto _err;
+ }
+ if (instance->verbose)
+ lisp_verbose(instance, "** include filename '%s'", name);
+
+ for (;;) {
+ if ((p = parse_object(instance, 0)) == NULL)
+ break;
+ if (instance->verbose) {
+ lisp_verbose(instance, "** code");
+ princ_object(instance->vout, p);
+ snd_output_putc(instance->vout, '\n');
+ }
+ p1 = eval(instance, p);
+ if (p1 == NULL) {
+ retval = -ENOMEM;
+ break;
+ }
+ if (instance->verbose) {
+ lisp_verbose(instance, "** result");
+ princ_object(instance->vout, p1);
+ snd_output_putc(instance->vout, '\n');
+ }
+ delete_tree(instance, p1);
+ if (instance->debug) {
+ lisp_debug(instance, "** objects after operation");
+ print_obj_lists(instance, instance->dout);
+ }
+ }
+
+ snd_input_close(instance->in);
+ _err:
+ free(name);
+ instance->in = old_in;
+ return retval;
+}
+
+int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **_instance)
+{
+ struct alisp_instance *instance;
+ struct alisp_object *p, *p1;
+ int i, j, retval = 0;
+
+ instance = (struct alisp_instance *)malloc(sizeof(struct alisp_instance));
+ if (instance == NULL) {
+ nomem();
+ return -ENOMEM;
+ }
+ memset(instance, 0, sizeof(struct alisp_instance));
+ instance->verbose = cfg->verbose && cfg->vout;
+ instance->warning = cfg->warning && cfg->wout;
+ instance->debug = cfg->debug && cfg->dout;
+ instance->in = cfg->in;
+ instance->out = cfg->out;
+ instance->vout = cfg->vout;
+ instance->eout = cfg->eout;
+ instance->wout = cfg->wout;
+ instance->dout = cfg->dout;
+ INIT_LIST_HEAD(&instance->free_objs_list);
+ for (i = 0; i < ALISP_OBJ_PAIR_HASH_SIZE; i++) {
+ for (j = 0; j <= ALISP_OBJ_LAST_SEARCH; j++)
+ INIT_LIST_HEAD(&instance->used_objs_list[i][j]);
+ INIT_LIST_HEAD(&instance->setobjs_list[i]);
+ }
+
+ init_lex(instance);
+
+ for (;;) {
+ if ((p = parse_object(instance, 0)) == NULL)
+ break;
+ if (instance->verbose) {
+ lisp_verbose(instance, "** code");
+ princ_object(instance->vout, p);
+ snd_output_putc(instance->vout, '\n');
+ }
+ p1 = eval(instance, p);
+ if (p1 == NULL) {
+ retval = -ENOMEM;
+ break;
+ }
+ if (instance->verbose) {
+ lisp_verbose(instance, "** result");
+ princ_object(instance->vout, p1);
+ snd_output_putc(instance->vout, '\n');
+ }
+ delete_tree(instance, p1);
+ if (instance->debug) {
+ lisp_debug(instance, "** objects after operation");
+ print_obj_lists(instance, instance->dout);
+ }
+ }
+
+ if (_instance)
+ *_instance = instance;
+ else
+ alsa_lisp_free(instance);
+
+ return 0;
+}
+
+void alsa_lisp_free(struct alisp_instance *instance)
+{
+ if (instance == NULL)
+ return;
+ done_lex(instance);
+ free_objects(instance);
+ free(instance);
+}
+
+struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input)
+{
+ snd_output_t *output, *eoutput;
+ struct alisp_cfg *cfg;
+ int err;
+
+ err = snd_output_stdio_attach(&output, stdout, 0);
+ if (err < 0)
+ return NULL;
+ err = snd_output_stdio_attach(&eoutput, stderr, 0);
+ if (err < 0) {
+ snd_output_close(output);
+ return NULL;
+ }
+ cfg = calloc(1, sizeof(struct alisp_cfg));
+ if (cfg == NULL) {
+ snd_output_close(eoutput);
+ snd_output_close(output);
+ return NULL;
+ }
+ cfg->out = output;
+ cfg->wout = eoutput;
+ cfg->eout = eoutput;
+ cfg->dout = eoutput;
+ cfg->in = input;
+ return cfg;
+}
+
+void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg)
+{
+ snd_input_close(cfg->in);
+ snd_output_close(cfg->out);
+ snd_output_close(cfg->dout);
+ free(cfg);
+}
+
+int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
+ const char *id, const char *args, ...)
+{
+ int err = 0;
+ struct alisp_object *aargs = NULL, *obj, *res;
+
+ if (args && *args != 'n') {
+ va_list ap;
+ struct alisp_object *p;
+ p = NULL;
+ va_start(ap, args);
+ while (*args) {
+ if (*args++ != '%') {
+ err = -EINVAL;
+ break;
+ }
+ if (*args == '\0') {
+ err = -EINVAL;
+ break;
+ }
+ obj = NULL;
+ err = 0;
+ switch (*args++) {
+ case 's':
+ obj = new_string(instance, va_arg(ap, char *));
+ break;
+ case 'i':
+ obj = new_integer(instance, va_arg(ap, int));
+ break;
+ case 'l':
+ obj = new_integer(instance, va_arg(ap, long));
+ break;
+ case 'f':
+ case 'd':
+ obj = new_integer(instance, va_arg(ap, double));
+ break;
+ case 'p': {
+ char _ptrid[24];
+ char *ptrid = _ptrid;
+ while (*args && *args != '%')
+ *ptrid++ = *args++;
+ *ptrid = 0;
+ if (ptrid == _ptrid) {
+ err = -EINVAL;
+ break;
+ }
+ obj = new_cons_pointer(instance, _ptrid, va_arg(ap, void *));
+ obj = quote_object(instance, obj);
+ break;
+ }
+ default:
+ err = -EINVAL;
+ break;
+ }
+ if (err < 0)
+ goto __args_end;
+ if (obj == NULL) {
+ err = -ENOMEM;
+ goto __args_end;
+ }
+ if (p == NULL) {
+ p = aargs = new_object(instance, ALISP_OBJ_CONS);
+ } else {
+ p->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
+ p = p->value.c.cdr;
+ }
+ if (p == NULL) {
+ err = -ENOMEM;
+ goto __args_end;
+ }
+ p->value.c.car = obj;
+ }
+ __args_end:
+ va_end(ap);
+ if (err < 0)
+ return err;
+#if 0
+ snd_output_printf(instance->wout, ">>>");
+ princ_object(instance->wout, aargs);
+ snd_output_printf(instance->wout, "<<<\n");
+#endif
+ }
+
+ err = -ENOENT;
+ if (aargs == NULL)
+ aargs = &alsa_lisp_nil;
+ if ((obj = get_object1(instance, id)) != &alsa_lisp_nil) {
+ res = eval_func(instance, obj, aargs);
+ err = 0;
+ } else {
+ struct intrinsic key, *item;
+ key.name = id;
+ if ((item = bsearch(&key, intrinsics,
+ sizeof intrinsics / sizeof intrinsics[0],
+ sizeof intrinsics[0], compar)) != NULL) {
+ res = item->func(instance, aargs);
+ err = 0;
+ } else if ((item = bsearch(&key, snd_intrinsics,
+ sizeof snd_intrinsics / sizeof snd_intrinsics[0],
+ sizeof snd_intrinsics[0], compar)) != NULL) {
+ res = item->func(instance, aargs);
+ err = 0;
+ } else {
+ res = &alsa_lisp_nil;
+ }
+ }
+ if (res == NULL)
+ err = -ENOMEM;
+ if (err == 0 && result) {
+ *result = res;
+ } else {
+ delete_tree(instance, res);
+ }
+
+ return 0;
+}
+
+void alsa_lisp_result_free(struct alisp_instance *instance,
+ struct alisp_seq_iterator *result)
+{
+ delete_tree(instance, result);
+}
+
+int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
+ struct alisp_seq_iterator **seq)
+{
+ struct alisp_object * p1;
+
+ p1 = get_object1(instance, id);
+ if (p1 == NULL)
+ return -ENOMEM;
+ *seq = p1;
+ return 0;
+}
+
+int alsa_lisp_seq_next(struct alisp_seq_iterator **seq)
+{
+ struct alisp_object * p1 = *seq;
+
+ p1 = cdr(p1);
+ if (p1 == &alsa_lisp_nil)
+ return -ENOENT;
+ *seq = p1;
+ return 0;
+}
+
+int alsa_lisp_seq_count(struct alisp_seq_iterator *seq)
+{
+ int count = 0;
+
+ while (seq != &alsa_lisp_nil) {
+ count++;
+ seq = cdr(seq);
+ }
+ return count;
+}
+
+int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val)
+{
+ if (alisp_compare_type(seq, ALISP_OBJ_CONS))
+ seq = seq->value.c.cdr;
+ if (alisp_compare_type(seq, ALISP_OBJ_INTEGER))
+ *val = seq->value.i;
+ else
+ return -EINVAL;
+ return 0;
+}
+
+int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr)
+{
+ struct alisp_object * p2;
+
+ if (alisp_compare_type(seq, ALISP_OBJ_CONS) &&
+ alisp_compare_type(seq->value.c.car, ALISP_OBJ_CONS))
+ seq = seq->value.c.car;
+ if (alisp_compare_type(seq, ALISP_OBJ_CONS)) {
+ p2 = seq->value.c.car;
+ if (!alisp_compare_type(p2, ALISP_OBJ_STRING))
+ return -EINVAL;
+ if (strcmp(p2->value.s, ptr_id))
+ return -EINVAL;
+ p2 = seq->value.c.cdr;
+ if (!alisp_compare_type(p2, ALISP_OBJ_POINTER))
+ return -EINVAL;
+ *ptr = (void *)seq->value.ptr;
+ } else
+ return -EINVAL;
+ return 0;
+}
diff --git a/alsa-lib/src/alisp/alisp_local.h b/alsa-lib/src/alisp/alisp_local.h
new file mode 100644
index 0000000..4558ebb
--- /dev/null
+++ b/alsa-lib/src/alisp/alisp_local.h
@@ -0,0 +1,151 @@
+/*
+ * ALSA lisp implementation
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * Based on work of Sandro Sigala (slisp-1.2)
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "list.h"
+
+enum alisp_tokens {
+ ALISP_IDENTIFIER,
+ ALISP_INTEGER,
+ ALISP_FLOAT,
+ ALISP_FLOATE,
+ ALISP_STRING
+};
+
+enum alisp_objects {
+ ALISP_OBJ_INTEGER,
+ ALISP_OBJ_FLOAT,
+ ALISP_OBJ_IDENTIFIER,
+ ALISP_OBJ_STRING,
+ ALISP_OBJ_POINTER,
+ ALISP_OBJ_CONS,
+ ALISP_OBJ_LAST_SEARCH = ALISP_OBJ_CONS,
+ ALISP_OBJ_NIL,
+ ALISP_OBJ_T,
+};
+
+struct alisp_object;
+
+#define ALISP_TYPE_MASK 0xf0000000
+#define ALISP_TYPE_SHIFT 28
+#define ALISP_REFS_MASK 0x0fffffff
+#define ALISP_REFS_SHIFT 0
+#define ALISP_MAX_REFS (ALISP_REFS_MASK>>ALISP_REFS_SHIFT)
+#define ALISP_MAX_REFS_LIMIT ((ALISP_MAX_REFS + 1) / 2)
+
+struct alisp_object {
+ struct list_head list;
+ unsigned int type_refs; /* type and count of references */
+ union {
+ char *s;
+ long i;
+ double f;
+ const void *ptr;
+ struct {
+ struct alisp_object *car;
+ struct alisp_object *cdr;
+ } c;
+ } value;
+};
+
+static inline enum alisp_objects alisp_get_type(struct alisp_object *p)
+{
+ return (p->type_refs >> ALISP_TYPE_SHIFT);
+}
+
+static inline void alisp_set_type(struct alisp_object *p, enum alisp_objects type)
+{
+ p->type_refs &= ~ALISP_TYPE_MASK;
+ p->type_refs |= (unsigned int)type << ALISP_TYPE_SHIFT;
+}
+
+static inline int alisp_compare_type(struct alisp_object *p, enum alisp_objects type)
+{
+ return ((unsigned int)type << ALISP_TYPE_SHIFT) ==
+ (p->type_refs & ALISP_TYPE_MASK);
+}
+
+static inline void alisp_set_refs(struct alisp_object *p, unsigned int refs)
+{
+ p->type_refs &= ~ALISP_REFS_MASK;
+ p->type_refs |= refs & ALISP_REFS_MASK;
+}
+
+static inline unsigned int alisp_get_refs(struct alisp_object *p)
+{
+ return p->type_refs & ALISP_REFS_MASK;
+}
+
+static inline unsigned int alisp_inc_refs(struct alisp_object *p)
+{
+ unsigned r = alisp_get_refs(p) + 1;
+ alisp_set_refs(p, r);
+ return r;
+}
+
+static inline unsigned int alisp_dec_refs(struct alisp_object *p)
+{
+ unsigned r = alisp_get_refs(p) - 1;
+ alisp_set_refs(p, r);
+ return r;
+}
+
+struct alisp_object_pair {
+ struct list_head list;
+ const char *name;
+ struct alisp_object *value;
+};
+
+#define ALISP_LEX_BUF_MAX 16
+#define ALISP_OBJ_PAIR_HASH_SHIFT 4
+#define ALISP_OBJ_PAIR_HASH_SIZE (1<<ALISP_OBJ_PAIR_HASH_SHIFT)
+#define ALISP_OBJ_PAIR_HASH_MASK (ALISP_OBJ_PAIR_HASH_SIZE-1)
+#define ALISP_FREE_OBJ_POOL 512 /* free objects above this pool */
+
+struct alisp_instance {
+ int verbose: 1,
+ warning: 1,
+ debug: 1;
+ /* i/o */
+ snd_input_t *in;
+ snd_output_t *out;
+ snd_output_t *eout; /* error output */
+ snd_output_t *vout; /* verbose output */
+ snd_output_t *wout; /* warning output */
+ snd_output_t *dout; /* debug output */
+ /* lexer */
+ int charno;
+ int lineno;
+ int lex_buf[ALISP_LEX_BUF_MAX];
+ int *lex_bufp;
+ char *token_buffer;
+ int token_buffer_max;
+ int thistoken;
+ /* object allocator / storage */
+ long free_objs;
+ long used_objs;
+ long max_objs;
+ struct list_head free_objs_list;
+ struct list_head used_objs_list[ALISP_OBJ_PAIR_HASH_SIZE][ALISP_OBJ_LAST_SEARCH + 1];
+ /* set object */
+ struct list_head setobjs_list[ALISP_OBJ_PAIR_HASH_SIZE];
+};
diff --git a/alsa-lib/src/alisp/alisp_snd.c b/alsa-lib/src/alisp/alisp_snd.c
new file mode 100644
index 0000000..de429d9
--- /dev/null
+++ b/alsa-lib/src/alisp/alisp_snd.c
@@ -0,0 +1,943 @@
+/*
+ * ALSA lisp implementation - sound related commands
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+struct acall_table {
+ const char *name;
+ struct alisp_object * (*func) (struct alisp_instance *instance, struct acall_table * item, struct alisp_object * args);
+ void * xfunc;
+ const char *prefix;
+};
+
+/*
+ * helper functions
+ */
+
+static inline int get_integer(struct alisp_object * obj)
+{
+ if (alisp_compare_type(obj, ALISP_OBJ_INTEGER))
+ return obj->value.i;
+ return 0;
+}
+
+static inline const void *get_pointer(struct alisp_object * obj)
+{
+ if (alisp_compare_type(obj, ALISP_OBJ_POINTER))
+ return obj->value.ptr;
+ return NULL;
+}
+
+static const char *get_string(struct alisp_object * obj, const char * deflt)
+{
+ if (obj == &alsa_lisp_t)
+ return "true";
+ if (alisp_compare_type(obj, ALISP_OBJ_STRING) ||
+ alisp_compare_type(obj, ALISP_OBJ_IDENTIFIER))
+ return obj->value.s;
+ return deflt;
+}
+
+struct flags {
+ const char *key;
+ unsigned int mask;
+};
+
+static unsigned int get_flags(struct alisp_instance * instance,
+ struct alisp_object * obj,
+ const struct flags * flags,
+ unsigned int deflt)
+{
+ const char *key;
+ int invert;
+ unsigned int result;
+ const struct flags *ptr;
+ struct alisp_object *n;
+
+ if (obj == &alsa_lisp_nil)
+ return deflt;
+ result = deflt;
+ do {
+ key = get_string(obj, NULL);
+ if (key) {
+ invert = key[0] == '!';
+ key += invert;
+ ptr = flags;
+ while (ptr->key) {
+ if (!strcmp(ptr->key, key)) {
+ if (invert)
+ result &= ~ptr->mask;
+ else
+ result |= ptr->mask;
+ break;
+ }
+ ptr++;
+ }
+ }
+ delete_tree(instance, car(obj));
+ obj = cdr(n = obj);
+ delete_object(instance, n);
+ } while (obj != &alsa_lisp_nil);
+ return result;
+}
+
+static const void *get_ptr(struct alisp_instance * instance,
+ struct alisp_object * obj,
+ const char *_ptr_id)
+{
+ const char *ptr_id;
+ const void *ptr;
+
+ ptr_id = get_string(car(obj), NULL);
+ if (ptr_id == NULL) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ if (strcmp(ptr_id, _ptr_id)) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ ptr = get_pointer(cdr(obj));
+ delete_tree(instance, obj);
+ return ptr;
+}
+
+static struct alisp_object * new_lexpr(struct alisp_instance * instance, int err)
+{
+ struct alisp_object * lexpr;
+
+ lexpr = new_object(instance, ALISP_OBJ_CONS);
+ if (lexpr == NULL)
+ return NULL;
+ lexpr->value.c.car = new_integer(instance, err);
+ if (lexpr->value.c.car == NULL) {
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
+ if (lexpr->value.c.cdr == NULL) {
+ delete_object(instance, lexpr->value.c.car);
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * add_cons(struct alisp_instance * instance,
+ struct alisp_object *lexpr,
+ int cdr, const char *id,
+ struct alisp_object *obj)
+{
+ struct alisp_object * p1, * p2;
+
+ if (lexpr == NULL || obj == NULL) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ if (cdr) {
+ p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
+ } else {
+ p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
+ }
+ lexpr = p1;
+ if (p1 == NULL) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ p1->value.c.car = new_object(instance, ALISP_OBJ_CONS);
+ if ((p2 = p1->value.c.car) == NULL)
+ goto __err;
+ p2->value.c.car = new_string(instance, id);
+ if (p2->value.c.car == NULL) {
+ __err:
+ if (cdr)
+ lexpr->value.c.cdr = NULL;
+ else
+ lexpr->value.c.car = NULL;
+ delete_tree(instance, p1);
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ p2->value.c.cdr = obj;
+ return lexpr;
+}
+
+static struct alisp_object * add_cons2(struct alisp_instance * instance,
+ struct alisp_object *lexpr,
+ int cdr, struct alisp_object *obj)
+{
+ struct alisp_object * p1;
+
+ if (lexpr == NULL || obj == NULL) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ if (cdr) {
+ p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
+ } else {
+ p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
+ }
+ lexpr = p1;
+ if (p1 == NULL) {
+ delete_tree(instance, obj);
+ return NULL;
+ }
+ p1->value.c.car = obj;
+ return lexpr;
+}
+
+static struct alisp_object * new_result1(struct alisp_instance * instance,
+ int err, const char *ptr_id, void *ptr)
+{
+ struct alisp_object * lexpr, * p1;
+
+ if (err < 0)
+ ptr = NULL;
+ lexpr = new_object(instance, ALISP_OBJ_CONS);
+ if (lexpr == NULL)
+ return NULL;
+ lexpr->value.c.car = new_integer(instance, err);
+ if (lexpr->value.c.car == NULL) {
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ p1 = add_cons(instance, lexpr, 1, ptr_id, new_pointer(instance, ptr));
+ if (p1 == NULL) {
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * new_result2(struct alisp_instance * instance,
+ int err, int val)
+{
+ struct alisp_object * lexpr, * p1;
+
+ if (err < 0)
+ val = 0;
+ lexpr = new_lexpr(instance, err);
+ if (lexpr == NULL)
+ return NULL;
+ p1 = lexpr->value.c.cdr;
+ p1->value.c.car = new_integer(instance, val);
+ if (p1->value.c.car == NULL) {
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * new_result3(struct alisp_instance * instance,
+ int err, const char *str)
+{
+ struct alisp_object * lexpr, * p1;
+
+ if (err < 0)
+ str = "";
+ lexpr = new_lexpr(instance, err);
+ if (lexpr == NULL)
+ return NULL;
+ p1 = lexpr->value.c.cdr;
+ p1->value.c.car = new_string(instance, str);
+ if (p1->value.c.car == NULL) {
+ delete_object(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+/*
+ * macros
+ */
+
+/*
+ * HCTL functions
+ */
+
+typedef int (*snd_int_pp_strp_int_t)(void **rctl, const char *name, int mode);
+typedef int (*snd_int_pp_p_t)(void **rctl, void *handle);
+typedef int (*snd_int_p_t)(void *rctl);
+typedef char * (*snd_str_p_t)(void *rctl);
+typedef int (*snd_int_intp_t)(int *val);
+typedef int (*snd_int_str_t)(const char *str);
+typedef int (*snd_int_int_strp_t)(int val, char **str);
+typedef void *(*snd_p_p_t)(void *handle);
+
+static struct alisp_object * FA_int_pp_strp_int(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ const char *name;
+ int err, mode;
+ void *handle;
+ struct alisp_object *p1, *p2;
+ static const struct flags flags[] = {
+ { "nonblock", SND_CTL_NONBLOCK },
+ { "async", SND_CTL_ASYNC },
+ { "readonly", SND_CTL_READONLY },
+ { NULL, 0 }
+ };
+
+ name = get_string(p1 = eval(instance, car(args)), NULL);
+ if (name == NULL)
+ return &alsa_lisp_nil;
+ mode = get_flags(instance, p2 = eval(instance, car(cdr(args))), flags, 0);
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ delete_tree(instance, p2);
+ err = ((snd_int_pp_strp_int_t)item->xfunc)(&handle, name, mode);
+ delete_tree(instance, p1);
+ return new_result1(instance, err, item->prefix, handle);
+}
+
+static struct alisp_object * FA_int_pp_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ int err;
+ void *handle;
+ const char *prefix1;
+ struct alisp_object *p1;
+
+ if (item->xfunc == &snd_hctl_open_ctl)
+ prefix1 = "ctl";
+ else {
+ delete_tree(instance, args);
+ return &alsa_lisp_nil;
+ }
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (void *)get_ptr(instance, p1, prefix1);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ err = ((snd_int_pp_p_t)item->xfunc)(&handle, handle);
+ return new_result1(instance, err, item->prefix, handle);
+}
+
+static struct alisp_object * FA_p_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ void *handle;
+ const char *prefix1;
+ struct alisp_object * p1;
+
+ if (item->xfunc == &snd_hctl_first_elem ||
+ item->xfunc == &snd_hctl_last_elem ||
+ item->xfunc == &snd_hctl_elem_next ||
+ item->xfunc == &snd_hctl_elem_prev)
+ prefix1 = "hctl_elem";
+ else if (item->xfunc == &snd_hctl_ctl)
+ prefix1 = "ctl";
+ else {
+ delete_tree(instance, args);
+ return &alsa_lisp_nil;
+ }
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (void *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ handle = ((snd_p_p_t)item->xfunc)(handle);
+ return new_cons_pointer(instance, prefix1, handle);
+}
+
+static struct alisp_object * FA_int_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ void *handle;
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (void *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ return new_integer(instance, ((snd_int_p_t)item->xfunc)(handle));
+}
+
+static struct alisp_object * FA_str_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ void *handle;
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (void *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ return new_string(instance, ((snd_str_p_t)item->xfunc)(handle));
+}
+
+static struct alisp_object * FA_int_intp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ int val, err;
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ val = p1->value.i;
+ delete_tree(instance, p1);
+ err = ((snd_int_intp_t)item->xfunc)(&val);
+ return new_result2(instance, err, val);
+}
+
+static struct alisp_object * FA_int_str(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ int err;
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (!alisp_compare_type(p1, ALISP_OBJ_STRING) &&
+ !alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER)) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ err = ((snd_int_str_t)item->xfunc)(p1->value.s);
+ delete_tree(instance, p1);
+ return new_integer(instance, err);
+}
+
+static struct alisp_object * FA_int_int_strp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ int err;
+ char *str;
+ long val;
+ struct alisp_object * p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ val = p1->value.i;
+ delete_tree(instance, p1);
+ err = ((snd_int_int_strp_t)item->xfunc)(val, &str);
+ return new_result3(instance, err, str);
+}
+
+static struct alisp_object * FA_card_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_ctl_t *handle;
+ struct alisp_object * lexpr, * p1;
+ snd_ctl_card_info_t * info;
+ int err;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (snd_ctl_t *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ snd_ctl_card_info_alloca(&info);
+ err = snd_ctl_card_info(handle, info);
+ lexpr = new_lexpr(instance, err);
+ if (err < 0)
+ return lexpr;
+ p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", new_string(instance, snd_ctl_card_info_get_id(info)));
+ p1 = add_cons(instance, p1, 1, "driver", new_string(instance, snd_ctl_card_info_get_driver(info)));
+ p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_ctl_card_info_get_name(info)));
+ p1 = add_cons(instance, p1, 1, "longname", new_string(instance, snd_ctl_card_info_get_longname(info)));
+ p1 = add_cons(instance, p1, 1, "mixername", new_string(instance, snd_ctl_card_info_get_mixername(info)));
+ p1 = add_cons(instance, p1, 1, "components", new_string(instance, snd_ctl_card_info_get_components(info)));
+ if (p1 == NULL) {
+ delete_tree(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * create_ctl_elem_id(struct alisp_instance * instance, snd_ctl_elem_id_t * id, struct alisp_object * cons)
+{
+ cons = add_cons(instance, cons, 0, "numid", new_integer(instance, snd_ctl_elem_id_get_numid(id)));
+ cons = add_cons(instance, cons, 1, "iface", new_string(instance, snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(id))));
+ cons = add_cons(instance, cons, 1, "dev", new_integer(instance, snd_ctl_elem_id_get_device(id)));
+ cons = add_cons(instance, cons, 1, "subdev", new_integer(instance, snd_ctl_elem_id_get_subdevice(id)));
+ cons = add_cons(instance, cons, 1, "name", new_string(instance, snd_ctl_elem_id_get_name(id)));
+ cons = add_cons(instance, cons, 1, "index", new_integer(instance, snd_ctl_elem_id_get_index(id)));
+ return cons;
+}
+
+static int parse_ctl_elem_id(struct alisp_instance * instance,
+ struct alisp_object * cons,
+ snd_ctl_elem_id_t * id)
+{
+ struct alisp_object *p1;
+ const char *xid;
+
+ if (cons == NULL)
+ return -ENOMEM;
+ snd_ctl_elem_id_clear(id);
+ id->numid = 0;
+ do {
+ p1 = car(cons);
+ if (alisp_compare_type(p1, ALISP_OBJ_CONS)) {
+ xid = get_string(p1->value.c.car, NULL);
+ if (xid == NULL) {
+ /* noop */
+ } else if (!strcmp(xid, "numid")) {
+ snd_ctl_elem_id_set_numid(id, get_integer(p1->value.c.cdr));
+ } else if (!strcmp(xid, "iface")) {
+ snd_ctl_elem_id_set_interface(id, snd_config_get_ctl_iface_ascii(get_string(p1->value.c.cdr, "0")));
+ } else if (!strcmp(xid, "dev")) {
+ snd_ctl_elem_id_set_device(id, get_integer(p1->value.c.cdr));
+ } else if (!strcmp(xid, "subdev")) {
+ snd_ctl_elem_id_set_subdevice(id, get_integer(p1->value.c.cdr));
+ } else if (!strcmp(xid, "name")) {
+ snd_ctl_elem_id_set_name(id, get_string(p1->value.c.cdr, "?"));
+ } else if (!strcmp(xid, "index")) {
+ snd_ctl_elem_id_set_index(id, get_integer(p1->value.c.cdr));
+ }
+ }
+ delete_tree(instance, p1);
+ cons = cdr(p1 = cons);
+ delete_object(instance, p1);
+ } while (cons != &alsa_lisp_nil);
+ return 0;
+}
+
+static struct alisp_object * FA_hctl_find_elem(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_hctl_t *handle;
+ snd_ctl_elem_id_t *id;
+ struct alisp_object *p1;
+
+ handle = (snd_hctl_t *)get_ptr(instance, car(args), item->prefix);
+ if (handle == NULL) {
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ return &alsa_lisp_nil;
+ }
+ snd_ctl_elem_id_alloca(&id);
+ p1 = car(cdr(args));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ if (parse_ctl_elem_id(instance, eval(instance, p1), id) < 0)
+ return &alsa_lisp_nil;
+ return new_cons_pointer(instance, "hctl_elem", snd_hctl_find_elem(handle, id));
+}
+
+static struct alisp_object * FA_hctl_elem_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_hctl_elem_t *handle;
+ struct alisp_object * lexpr, * p1, * p2;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_type_t type;
+ int err;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_id_alloca(&id);
+ err = snd_hctl_elem_info(handle, info);
+ lexpr = new_lexpr(instance, err);
+ if (err < 0)
+ return lexpr;
+ type = snd_ctl_elem_info_get_type(info);
+ p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", p2 = new_object(instance, ALISP_OBJ_CONS));
+ snd_ctl_elem_info_get_id(info, id);
+ if (create_ctl_elem_id(instance, id, p2) == NULL) {
+ delete_tree(instance, lexpr);
+ return NULL;
+ }
+ p1 = add_cons(instance, p1, 1, "type", new_string(instance, snd_ctl_elem_type_name(type)));
+ p1 = add_cons(instance, p1, 1, "readable", new_integer(instance, snd_ctl_elem_info_is_readable(info)));
+ p1 = add_cons(instance, p1, 1, "writeable", new_integer(instance, snd_ctl_elem_info_is_writable(info)));
+ p1 = add_cons(instance, p1, 1, "volatile", new_integer(instance, snd_ctl_elem_info_is_volatile(info)));
+ p1 = add_cons(instance, p1, 1, "inactive", new_integer(instance, snd_ctl_elem_info_is_inactive(info)));
+ p1 = add_cons(instance, p1, 1, "locked", new_integer(instance, snd_ctl_elem_info_is_locked(info)));
+ p1 = add_cons(instance, p1, 1, "isowner", new_integer(instance, snd_ctl_elem_info_is_owner(info)));
+ p1 = add_cons(instance, p1, 1, "owner", new_integer(instance, snd_ctl_elem_info_get_owner(info)));
+ p1 = add_cons(instance, p1, 1, "count", new_integer(instance, snd_ctl_elem_info_get_count(info)));
+ err = snd_ctl_elem_info_get_dimensions(info);
+ if (err > 0) {
+ int idx;
+ p1 = add_cons(instance, p1, 1, "dimensions", p2 = new_object(instance, ALISP_OBJ_CONS));
+ for (idx = 0; idx < err; idx++)
+ p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, snd_ctl_elem_info_get_dimension(info, idx)));
+ }
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_ENUMERATED: {
+ unsigned int items, item;
+ items = snd_ctl_elem_info_get_items(info);
+ p1 = add_cons(instance, p1, 1, "items", p2 = new_object(instance, ALISP_OBJ_CONS));
+ for (item = 0; item < items; item++) {
+ snd_ctl_elem_info_set_item(info, item);
+ err = snd_hctl_elem_info(handle, info);
+ if (err < 0) {
+ p2 = add_cons2(instance, p2, item, &alsa_lisp_nil);
+ } else {
+ p2 = add_cons2(instance, p2, item, new_string(instance, snd_ctl_elem_info_get_item_name(info)));
+ }
+ }
+ break;
+ }
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ p1 = add_cons(instance, p1, 1, "min", new_integer(instance, snd_ctl_elem_info_get_min(info)));
+ p1 = add_cons(instance, p1, 1, "max", new_integer(instance, snd_ctl_elem_info_get_max(info)));
+ p1 = add_cons(instance, p1, 1, "step", new_integer(instance, snd_ctl_elem_info_get_step(info)));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ p1 = add_cons(instance, p1, 1, "min64", new_float(instance, snd_ctl_elem_info_get_min64(info)));
+ p1 = add_cons(instance, p1, 1, "max64", new_float(instance, snd_ctl_elem_info_get_max64(info)));
+ p1 = add_cons(instance, p1, 1, "step64", new_float(instance, snd_ctl_elem_info_get_step64(info)));
+ break;
+ default:
+ break;
+ }
+ if (p1 == NULL) {
+ delete_tree(instance, lexpr);
+ return NULL;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * FA_hctl_elem_read(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_hctl_elem_t *handle;
+ struct alisp_object * lexpr, * p1 = NULL, * obj;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *value;
+ snd_ctl_elem_type_t type;
+ unsigned int idx, count;
+ int err;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_value_alloca(&value);
+ err = snd_hctl_elem_info(handle, info);
+ if (err >= 0)
+ err = snd_hctl_elem_read(handle, value);
+ lexpr = new_lexpr(instance, err);
+ if (err < 0)
+ return lexpr;
+ type = snd_ctl_elem_info_get_type(info);
+ count = snd_ctl_elem_info_get_count(info);
+ if (type == SND_CTL_ELEM_TYPE_IEC958) {
+ count = sizeof(snd_aes_iec958_t);
+ type = SND_CTL_ELEM_TYPE_BYTES;
+ }
+ for (idx = 0; idx < count; idx++) {
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ obj = new_integer(instance, snd_ctl_elem_value_get_boolean(value, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ obj = new_integer(instance, snd_ctl_elem_value_get_integer(value, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ obj = new_integer(instance, snd_ctl_elem_value_get_integer64(value, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ obj = new_integer(instance, snd_ctl_elem_value_get_enumerated(value, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ obj = new_integer(instance, snd_ctl_elem_value_get_byte(value, idx));
+ break;
+ default:
+ obj = NULL;
+ break;
+ }
+ if (idx == 0) {
+ p1 = add_cons2(instance, lexpr->value.c.cdr, 0, obj);
+ } else {
+ p1 = add_cons2(instance, p1, 1, obj);
+ }
+ }
+ if (p1 == NULL) {
+ delete_tree(instance, lexpr);
+ return &alsa_lisp_nil;
+ }
+ return lexpr;
+}
+
+static struct alisp_object * FA_hctl_elem_write(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_hctl_elem_t *handle;
+ struct alisp_object * p1 = NULL, * obj;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *value;
+ snd_ctl_elem_type_t type;
+ unsigned int idx, count;
+ int err;
+
+ p1 = car(cdr(args));
+ obj = eval(instance, car(args));
+ delete_tree(instance, cdr(cdr(args)));
+ delete_object(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (snd_hctl_elem_t *)get_ptr(instance, obj, item->prefix);
+ if (handle == NULL) {
+ delete_tree(instance, p1);
+ return &alsa_lisp_nil;
+ }
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_value_alloca(&value);
+ err = snd_hctl_elem_info(handle, info);
+ if (err < 0) {
+ delete_tree(instance, p1);
+ return new_integer(instance, err);
+ }
+ type = snd_ctl_elem_info_get_type(info);
+ count = snd_ctl_elem_info_get_count(info);
+ if (type == SND_CTL_ELEM_TYPE_IEC958) {
+ count = sizeof(snd_aes_iec958_t);
+ type = SND_CTL_ELEM_TYPE_BYTES;
+ }
+ idx = -1;
+ do {
+ if (++idx >= count) {
+ delete_tree(instance, p1);
+ break;
+ }
+ obj = car(p1);
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ snd_ctl_elem_value_set_boolean(value, idx, get_integer(obj));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ snd_ctl_elem_value_set_integer(value, idx, get_integer(obj));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ snd_ctl_elem_value_set_integer64(value, idx, get_integer(obj));
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ snd_ctl_elem_value_set_enumerated(value, idx, get_integer(obj));
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ snd_ctl_elem_value_set_byte(value, idx, get_integer(obj));
+ break;
+ default:
+ break;
+ }
+ delete_tree(instance, obj);
+ p1 = cdr(obj = p1);
+ delete_object(instance, obj);
+ } while (p1 != &alsa_lisp_nil);
+ err = snd_hctl_elem_write(handle, value);
+ return new_integer(instance, err);
+}
+
+static struct alisp_object * FA_pcm_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
+{
+ snd_pcm_t *handle;
+ struct alisp_object * lexpr, * p1;
+ snd_pcm_info_t *info;
+ int err;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ handle = (snd_pcm_t *)get_ptr(instance, p1, item->prefix);
+ if (handle == NULL)
+ return &alsa_lisp_nil;
+ snd_pcm_info_alloca(&info);
+ err = snd_pcm_info(handle, info);
+ lexpr = new_lexpr(instance, err);
+ if (err < 0)
+ return lexpr;
+ p1 = add_cons(instance, lexpr->value.c.cdr, 0, "card", new_integer(instance, snd_pcm_info_get_card(info)));
+ p1 = add_cons(instance, p1, 1, "device", new_integer(instance, snd_pcm_info_get_device(info)));
+ p1 = add_cons(instance, p1, 1, "subdevice", new_integer(instance, snd_pcm_info_get_subdevice(info)));
+ p1 = add_cons(instance, p1, 1, "id", new_string(instance, snd_pcm_info_get_id(info)));
+ p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_pcm_info_get_name(info)));
+ p1 = add_cons(instance, p1, 1, "subdevice_name", new_string(instance, snd_pcm_info_get_subdevice_name(info)));
+ p1 = add_cons(instance, p1, 1, "class", new_integer(instance, snd_pcm_info_get_class(info)));
+ p1 = add_cons(instance, p1, 1, "subclass", new_integer(instance, snd_pcm_info_get_subclass(info)));
+ p1 = add_cons(instance, p1, 1, "subdevices_count", new_integer(instance, snd_pcm_info_get_subdevices_count(info)));
+ p1 = add_cons(instance, p1, 1, "subdevices_avail", new_integer(instance, snd_pcm_info_get_subdevices_avail(info)));
+ //p1 = add_cons(instance, p1, 1, "sync", new_string(instance, snd_pcm_info_get_sync(info)));
+ return lexpr;
+}
+
+/*
+ * main code
+ */
+
+static const struct acall_table acall_table[] = {
+ { "card_get_index", &FA_int_str, (void *)snd_card_get_index, NULL },
+ { "card_get_longname", &FA_int_int_strp, (void *)snd_card_get_longname, NULL },
+ { "card_get_name", &FA_int_int_strp, (void *)snd_card_get_name, NULL },
+ { "card_next", &FA_int_intp, (void *)&snd_card_next, NULL },
+ { "ctl_card_info", &FA_card_info, NULL, "ctl" },
+ { "ctl_close", &FA_int_p, (void *)&snd_ctl_close, "ctl" },
+ { "ctl_open", &FA_int_pp_strp_int, (void *)&snd_ctl_open, "ctl" },
+ { "hctl_close", &FA_int_p, (void *)&snd_hctl_close, "hctl" },
+ { "hctl_ctl", &FA_p_p, (void *)&snd_hctl_ctl, "hctl" },
+ { "hctl_elem_info", &FA_hctl_elem_info, (void *)&snd_hctl_elem_info, "hctl_elem" },
+ { "hctl_elem_next", &FA_p_p, (void *)&snd_hctl_elem_next, "hctl_elem" },
+ { "hctl_elem_prev", &FA_p_p, (void *)&snd_hctl_elem_prev, "hctl_elem" },
+ { "hctl_elem_read", &FA_hctl_elem_read, (void *)&snd_hctl_elem_read, "hctl_elem" },
+ { "hctl_elem_write", &FA_hctl_elem_write, (void *)&snd_hctl_elem_write, "hctl_elem" },
+ { "hctl_find_elem", &FA_hctl_find_elem, (void *)&snd_hctl_find_elem, "hctl" },
+ { "hctl_first_elem", &FA_p_p, (void *)&snd_hctl_first_elem, "hctl" },
+ { "hctl_free", &FA_int_p, (void *)&snd_hctl_free, "hctl" },
+ { "hctl_last_elem", &FA_p_p, (void *)&snd_hctl_last_elem, "hctl" },
+ { "hctl_load", &FA_int_p, (void *)&snd_hctl_load, "hctl" },
+ { "hctl_open", &FA_int_pp_strp_int, (void *)&snd_hctl_open, "hctl" },
+ { "hctl_open_ctl", &FA_int_pp_p, (void *)&snd_hctl_open_ctl, "hctl" },
+ { "pcm_info", &FA_pcm_info, NULL, "pcm" },
+ { "pcm_name", &FA_str_p, (void *)&snd_pcm_name, "pcm" },
+};
+
+static int acall_compar(const void *p1, const void *p2)
+{
+ return strcmp(((struct acall_table *)p1)->name,
+ ((struct acall_table *)p2)->name);
+}
+
+static struct alisp_object * F_acall(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p1, *p2;
+ struct acall_table key, *item;
+
+ p1 = eval(instance, car(args));
+ p2 = cdr(args);
+ delete_object(instance, args);
+ if (!alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER) &&
+ !alisp_compare_type(p1, ALISP_OBJ_STRING)) {
+ delete_tree(instance, p2);
+ return &alsa_lisp_nil;
+ }
+ key.name = p1->value.s;
+ if ((item = bsearch(&key, acall_table,
+ sizeof acall_table / sizeof acall_table[0],
+ sizeof acall_table[0], acall_compar)) != NULL) {
+ delete_tree(instance, p1);
+ return item->func(instance, item, p2);
+ }
+ delete_tree(instance, p1);
+ delete_tree(instance, p2);
+ lisp_warn(instance, "acall function %s' is undefined", p1->value.s);
+ return &alsa_lisp_nil;
+}
+
+static struct alisp_object * F_ahandle(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object *p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ args = car(cdr(p1));
+ delete_tree(instance, cdr(cdr(p1)));
+ delete_object(instance, cdr(p1));
+ delete_tree(instance, car(p1));
+ delete_object(instance, p1);
+ return args;
+}
+
+static struct alisp_object * F_aerror(struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object *p1;
+
+ p1 = eval(instance, car(args));
+ delete_tree(instance, cdr(args));
+ delete_object(instance, args);
+ args = car(p1);
+ if (args == &alsa_lisp_nil) {
+ delete_tree(instance, p1);
+ return new_integer(instance, SND_ERROR_ALISP_NIL);
+ } else {
+ delete_tree(instance, cdr(p1));
+ delete_object(instance, p1);
+ }
+ return args;
+}
+
+static int common_error(snd_output_t **rout, struct alisp_instance *instance, struct alisp_object * args)
+{
+ struct alisp_object * p = args, * p1;
+ snd_output_t *out;
+ int err;
+
+ err = snd_output_buffer_open(&out);
+ if (err < 0) {
+ delete_tree(instance, args);
+ return err;
+ }
+
+ do {
+ p1 = eval(instance, car(p));
+ if (alisp_compare_type(p1, ALISP_OBJ_STRING))
+ snd_output_printf(out, "%s", p1->value.s);
+ else
+ princ_object(out, p1);
+ delete_tree(instance, p1);
+ p = cdr(p1 = p);
+ delete_object(instance, p1);
+ } while (p != &alsa_lisp_nil);
+
+ *rout = out;
+ return 0;
+}
+
+static struct alisp_object * F_snderr(struct alisp_instance *instance, struct alisp_object * args)
+{
+ snd_output_t *out;
+ char *str;
+
+ if (common_error(&out, instance, args) < 0)
+ return &alsa_lisp_nil;
+ snd_output_buffer_string(out, &str);
+ SNDERR(str);
+ snd_output_close(out);
+ return &alsa_lisp_t;
+}
+
+static struct alisp_object * F_syserr(struct alisp_instance *instance, struct alisp_object * args)
+{
+ snd_output_t *out;
+ char *str;
+
+ if (common_error(&out, instance, args) < 0)
+ return &alsa_lisp_nil;
+ snd_output_buffer_string(out, &str);
+ SYSERR(str);
+ snd_output_close(out);
+ return &alsa_lisp_t;
+}
+
+static const struct intrinsic snd_intrinsics[] = {
+ { "Acall", F_acall },
+ { "Aerror", F_aerror },
+ { "Ahandle", F_ahandle },
+ { "Aresult", F_ahandle },
+ { "Asnderr", F_snderr },
+ { "Asyserr", F_syserr }
+};
diff --git a/alsa-lib/src/async.c b/alsa-lib/src/async.c
new file mode 100644
index 0000000..98aec78
--- /dev/null
+++ b/alsa-lib/src/async.c
@@ -0,0 +1,206 @@
+/**
+ * \file async.c
+ * \brief Async notification helpers
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2001
+ */
+/*
+ * Async notification helpers
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm/pcm_local.h"
+#include "control/control_local.h"
+#include <signal.h>
+
+#ifdef SND_ASYNC_RT_SIGNAL
+/** async signal number */
+static int snd_async_signo;
+
+void snd_async_init(void) __attribute__ ((constructor));
+
+void snd_async_init(void)
+{
+ snd_async_signo = __libc_allocate_rtsig(0);
+ if (snd_async_signo < 0) {
+ SNDERR("Unable to find a RT signal to use for snd_async");
+ exit(1);
+ }
+}
+#else
+/** async signal number */
+static const int snd_async_signo = SIGIO;
+#endif
+
+static LIST_HEAD(snd_async_handlers);
+
+static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
+{
+ int fd;
+ struct list_head *i;
+ //assert(siginfo->si_code == SI_SIGIO);
+ fd = siginfo->si_fd;
+ list_for_each(i, &snd_async_handlers) {
+ snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
+ if (h->fd == fd && h->callback)
+ h->callback(h);
+ }
+}
+
+/**
+ * \brief Registers an async handler.
+ * \param handler The function puts the pointer to the new async handler
+ * object at the address specified by \p handler.
+ * \param fd The file descriptor to be associated with the callback.
+ * \param callback The async callback function.
+ * \param private_data Private data for the async callback function.
+ * \result Zero if successful, otherwise a negative error code.
+ *
+ * This function associates the callback function with the given file,
+ * and saves this association in a \c snd_async_handler_t object.
+ *
+ * Whenever the \c SIGIO signal is raised for the file \p fd, the callback
+ * function will be called with its parameter pointing to the async handler
+ * object returned by this function.
+ *
+ * The ALSA \c sigaction handler for the \c SIGIO signal automatically
+ * multiplexes the notifications to the registered async callbacks.
+ * However, the application is responsible for instructing the device driver
+ * to generate the \c SIGIO signal.
+ *
+ * The \c SIGIO signal may have been replaced with another signal,
+ * see #snd_async_handler_get_signo.
+ *
+ * When the async handler isn't needed anymore, you must delete it with
+ * #snd_async_del_handler.
+ *
+ * \see snd_async_add_pcm_handler, snd_async_add_ctl_handler
+ */
+int snd_async_add_handler(snd_async_handler_t **handler, int fd,
+ snd_async_callback_t callback, void *private_data)
+{
+ snd_async_handler_t *h;
+ int was_empty;
+ assert(handler);
+ h = malloc(sizeof(*h));
+ if (!h)
+ return -ENOMEM;
+ h->fd = fd;
+ h->callback = callback;
+ h->private_data = private_data;
+ was_empty = list_empty(&snd_async_handlers);
+ list_add_tail(&h->glist, &snd_async_handlers);
+ INIT_LIST_HEAD(&h->hlist);
+ *handler = h;
+ if (was_empty) {
+ int err;
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_flags = SA_RESTART | SA_SIGINFO;
+ act.sa_sigaction = snd_async_handler;
+ sigemptyset(&act.sa_mask);
+ err = sigaction(snd_async_signo, &act, NULL);
+ if (err < 0) {
+ SYSERR("sigaction");
+ return -errno;
+ }
+ }
+ return 0;
+}
+
+/**
+ * \brief Deletes an async handler.
+ * \param handler Handle of the async handler to delete.
+ * \result Zero if successful, otherwise a negative error code.
+ */
+int snd_async_del_handler(snd_async_handler_t *handler)
+{
+ int err = 0;
+ assert(handler);
+ list_del(&handler->glist);
+ if (list_empty(&snd_async_handlers)) {
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_flags = 0;
+ act.sa_handler = SIG_DFL;
+ err = sigaction(snd_async_signo, &act, NULL);
+ if (err < 0) {
+ SYSERR("sigaction");
+ return -errno;
+ }
+ }
+ if (handler->type == SND_ASYNC_HANDLER_GENERIC)
+ goto _end;
+ if (!list_empty(&handler->hlist))
+ list_del(&handler->hlist);
+ if (!list_empty(&handler->hlist))
+ goto _end;
+ switch (handler->type) {
+#ifdef BUILD_PCM
+ case SND_ASYNC_HANDLER_PCM:
+ err = snd_pcm_async(handler->u.pcm, -1, 1);
+ break;
+#endif
+ case SND_ASYNC_HANDLER_CTL:
+ err = snd_ctl_async(handler->u.ctl, -1, 1);
+ break;
+ default:
+ assert(0);
+ }
+ _end:
+ free(handler);
+ return err;
+}
+
+/**
+ * \brief Returns the signal number assigned to an async handler.
+ * \param handler Handle to an async handler.
+ * \result The signal number if successful, otherwise a negative error code.
+ *
+ * The signal number for async handlers usually is \c SIGIO,
+ * but wizards can redefine it to a realtime signal
+ * when compiling the ALSA library.
+ */
+int snd_async_handler_get_signo(snd_async_handler_t *handler)
+{
+ assert(handler);
+ return snd_async_signo;
+}
+
+/**
+ * \brief Returns the file descriptor assigned to an async handler.
+ * \param handler Handle to an async handler.
+ * \result The file descriptor if successful, otherwise a negative error code.
+ */
+int snd_async_handler_get_fd(snd_async_handler_t *handler)
+{
+ assert(handler);
+ return handler->fd;
+}
+
+/**
+ * \brief Returns the private data assigned to an async handler.
+ * \param handler Handle to an async handler.
+ * \result The \c private_data value registered with the async handler.
+ */
+void *snd_async_handler_get_callback_private(snd_async_handler_t *handler)
+{
+ assert(handler);
+ return handler->private_data;
+}
+
diff --git a/alsa-lib/src/compat/Makefile.am b/alsa-lib/src/compat/Makefile.am
new file mode 100644
index 0000000..01f54fc
--- /dev/null
+++ b/alsa-lib/src/compat/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LTLIBRARIES = libcompat.la
+EXTRA_libcompat_la_SOURCES = hsearch_r.c
+
+if ALSA_HSEARCH_R
+libcompat_la_SOURCES = empty.c hsearch_r.c
+else
+libcompat_la_SOURCES = empty.c
+endif
diff --git a/alsa-lib/src/compat/Makefile.in b/alsa-lib/src/compat/Makefile.in
new file mode 100644
index 0000000..636cf89
--- /dev/null
+++ b/alsa-lib/src/compat/Makefile.in
@@ -0,0 +1,530 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/compat
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libcompat_la_LIBADD =
+am__libcompat_la_SOURCES_DIST = empty.c hsearch_r.c
+@ALSA_HSEARCH_R_FALSE@am_libcompat_la_OBJECTS = empty.lo
+@ALSA_HSEARCH_R_TRUE@am_libcompat_la_OBJECTS = empty.lo hsearch_r.lo
+libcompat_la_OBJECTS = $(am_libcompat_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libcompat_la_SOURCES) $(EXTRA_libcompat_la_SOURCES)
+DIST_SOURCES = $(am__libcompat_la_SOURCES_DIST) \
+ $(EXTRA_libcompat_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+noinst_LTLIBRARIES = libcompat.la
+EXTRA_libcompat_la_SOURCES = hsearch_r.c
+@ALSA_HSEARCH_R_FALSE@libcompat_la_SOURCES = empty.c
+@ALSA_HSEARCH_R_TRUE@libcompat_la_SOURCES = empty.c hsearch_r.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/compat/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/compat/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libcompat.la: $(libcompat_la_OBJECTS) $(libcompat_la_DEPENDENCIES)
+ $(LINK) $(libcompat_la_LDFLAGS) $(libcompat_la_OBJECTS) $(libcompat_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsearch_r.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/compat/hsearch_r.c b/alsa-lib/src/compat/hsearch_r.c
new file mode 100644
index 0000000..96ceac1
--- /dev/null
+++ b/alsa-lib/src/compat/hsearch_r.c
@@ -0,0 +1,236 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <string.h>
+
+#define __USE_GNU
+#ifndef __set_errno
+#define __set_errno(e) errno = (e)
+#endif
+#include <search.h>
+
+/* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
+ [Knuth] The Art of Computer Programming, part 3 (6.4) */
+
+
+/* The reentrant version has no static variables to maintain the state.
+ Instead the interface of all functions is extended to take an argument
+ which describes the current status. */
+typedef struct _ENTRY
+{
+ unsigned int used;
+ ENTRY entry;
+}
+_ENTRY;
+
+
+/* For the used double hash method the table size has to be a prime. To
+ correct the user given table size we need a prime test. This trivial
+ algorithm is adequate because
+ a) the code is (most probably) called a few times per program run and
+ b) the number is small because the table must fit in the core */
+static int
+isprime (unsigned int number)
+{
+ /* no even number will be passed */
+ unsigned int div = 3;
+
+ while (div * div < number && number % div != 0)
+ div += 2;
+
+ return number % div != 0;
+}
+
+
+/* Before using the hash table we must allocate memory for it.
+ Test for an existing table are done. We allocate one element
+ more as the found prime number says. This is done for more effective
+ indexing as explained in the comment for the hsearch function.
+ The contents of the table is zeroed, especially the field used
+ becomes zero. */
+int
+hcreate_r (nel, htab)
+ size_t nel;
+ struct hsearch_data *htab;
+{
+ /* Test for correct arguments. */
+ if (htab == NULL)
+ {
+ __set_errno (EINVAL);
+ return 0;
+ }
+
+ /* There is still another table active. Return with error. */
+ if (htab->table != NULL)
+ return 0;
+
+ /* Change nel to the first prime number not smaller as nel. */
+ nel |= 1; /* make odd */
+ while (!isprime (nel))
+ nel += 2;
+
+ htab->size = nel;
+ htab->filled = 0;
+
+ /* allocate memory and zero out */
+ htab->table = (_ENTRY *) calloc (htab->size + 1, sizeof (_ENTRY));
+ if (htab->table == NULL)
+ return 0;
+
+ /* everything went alright */
+ return 1;
+}
+
+
+/* After using the hash table it has to be destroyed. The used memory can
+ be freed and the local static variable can be marked as not used. */
+void
+hdestroy_r (htab)
+ struct hsearch_data *htab;
+{
+ /* Test for correct arguments. */
+ if (htab == NULL)
+ {
+ __set_errno (EINVAL);
+ return;
+ }
+
+ if (htab->table != NULL)
+ /* free used memory */
+ free (htab->table);
+
+ /* the sign for an existing table is an value != NULL in htable */
+ htab->table = NULL;
+}
+
+
+/* This is the search function. It uses double hashing with open addressing.
+ The argument item.key has to be a pointer to an zero terminated, most
+ probably strings of chars. The function for generating a number of the
+ strings is simple but fast. It can be replaced by a more complex function
+ like ajw (see [Aho,Sethi,Ullman]) if the needs are shown.
+
+ We use an trick to speed up the lookup. The table is created by hcreate
+ with one more element available. This enables us to use the index zero
+ special. This index will never be used because we store the first hash
+ index in the field used where zero means not used. Every other value
+ means used. The used field can be used as a first fast comparison for
+ equality of the stored and the parameter value. This helps to prevent
+ unnecessary expensive calls of strcmp. */
+int
+hsearch_r (item, action, retval, htab)
+ ENTRY item;
+ ACTION action;
+ ENTRY **retval;
+ struct hsearch_data *htab;
+{
+ unsigned int hval;
+ unsigned int count;
+ unsigned int len = strlen (item.key);
+ unsigned int idx;
+
+ /* Compute an value for the given string. Perhaps use a better method. */
+ hval = len;
+ count = len;
+ while (count-- > 0)
+ {
+ hval <<= 4;
+ hval += item.key[count];
+ }
+
+ /* First hash function: simply take the modulo but prevent zero. */
+ hval %= htab->size;
+ if (hval == 0)
+ ++hval;
+
+ /* The first index tried. */
+ idx = hval;
+
+ if (htab->table[idx].used)
+ {
+ /* Further action might be required according to the action value. */
+ unsigned hval2;
+
+ if (htab->table[idx].used == hval
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ {
+ if (action == ENTER)
+ htab->table[idx].entry.data = item.data;
+
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+
+ /* Second hash function, as suggested in [Knuth] */
+ hval2 = 1 + hval % (htab->size - 2);
+
+ do
+ {
+ /* Because SIZE is prime this guarantees to step through all
+ available indexes. */
+ if (idx <= hval2)
+ idx = htab->size + idx - hval2;
+ else
+ idx -= hval2;
+
+ /* If we visited all entries leave the loop unsuccessfully. */
+ if (idx == hval)
+ break;
+
+ /* If entry is found use it. */
+ if (htab->table[idx].used == hval
+ && strcmp (item.key, htab->table[idx].entry.key) == 0)
+ {
+ if (action == ENTER)
+ htab->table[idx].entry.data = item.data;
+
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+ }
+ while (htab->table[idx].used);
+ }
+
+ /* An empty bucket has been found. */
+ if (action == ENTER)
+ {
+ /* If table is full and another entry should be entered return
+ with error. */
+ if (action == ENTER && htab->filled == htab->size)
+ {
+ __set_errno (ENOMEM);
+ *retval = NULL;
+ return 0;
+ }
+
+ htab->table[idx].used = hval;
+ htab->table[idx].entry = item;
+
+ ++htab->filled;
+
+ *retval = &htab->table[idx].entry;
+ return 1;
+ }
+
+ __set_errno (ESRCH);
+ *retval = NULL;
+ return 0;
+}
diff --git a/alsa-lib/src/conf.c b/alsa-lib/src/conf.c
new file mode 100644
index 0000000..c86f819
--- /dev/null
+++ b/alsa-lib/src/conf.c
@@ -0,0 +1,4074 @@
+/**
+ * \file conf.c
+ * \ingroup Configuration
+ * \brief Configuration helper functions
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ *
+ * Tree based, full nesting configuration functions.
+ *
+ * See the \ref conf page for more details.
+ */
+/*
+ * Configuration helper functions
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>,
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page conf Configuration files
+
+<P>Configuration files use a simple format allowing modern
+data description like nesting and array assignments.</P>
+
+\section conf_whitespace Whitespace
+
+Whitespace is the collective name given to spaces (blanks), horizontal and
+vertical tabs, newline characters, and comments. Whitespace can
+indicate where configuration tokens start and end, but beyond this function,
+any surplus whitespace is discarded. For example, the two sequences
+
+\code
+ a 1 b 2
+\endcode
+
+and
+
+\code
+ a 1
+ b 2
+\endcode
+
+are lexically equivalent and parse identically to give the four tokens:
+
+\code
+a
+1
+b
+2
+\endcode
+
+The ASCII characters representing whitespace can occur within literal
+strings, in which case they are protected from the normal parsing process
+(they remain as part of the string). For example:
+
+\code
+ name "John Smith"
+\endcode
+
+parses to two tokens, including the single literal-string token "John
+Smith".
+
+\section conf_linesplicing Line continuation with \
+
+A special case occurs if a newline character in a string is preceded
+by a backslash (\). The backslash and the new line are both discarded,
+allowing two physical lines of text to be treated as one unit.
+
+\code
+"John \
+Smith"
+\endcode
+
+is parsed as "John Smith".
+
+\section conf_comments Comments
+
+A single-line comment begins with the character #. The comment can start
+at any position, and extends to the end of the line.
+
+\code
+ a 1 # this is a comment
+\endcode
+
+\section conf_include Including configuration files
+
+To include another configuration file, write the file name in angle brackets.
+The prefix \c confdir: will reference the global configuration directory.
+
+\code
+</etc/alsa1.conf>
+<confdir:pcm/surround.conf>
+\endcode
+
+\section conf_punctuators Punctuators
+
+The configuration punctuators (also known as separators) are:
+
+\code
+ {} [] , ; = . ' " new-line form-feed carriage-return whitespace
+\endcode
+
+\subsection conf_braces Braces
+
+Opening and closing braces { } indicate the start and end of a compound
+statement:
+
+\code
+a {
+ b 1
+}
+\endcode
+
+\subsection conf_brackets Brackets
+
+Opening and closing brackets indicate a single array definition. The
+identifiers are automatically generated starting with zero.
+
+\code
+a [
+ "first"
+ "second"
+]
+\endcode
+
+The above code is equal to
+
+\code
+a.0 "first"
+a.1 "second"
+\endcode
+
+\subsection conf_comma_semicolon Comma and semicolon
+
+The comma (,) or semicolon (;) can separate value assignments. It is not
+strictly required to use these separators because whitespace suffices to
+separate tokens.
+
+\code
+a 1;
+b 1,
+\endcode
+
+\subsection conf_equal Equal sign
+
+The equal sign (=) can separate variable declarations from
+initialization lists:
+
+\code
+a=1
+b=2
+\endcode
+
+Using equal signs is not required because whitespace suffices to separate
+tokens.
+
+\section conf_assigns Assignments
+
+The configuration file defines id (key) and value pairs. The id (key) can be
+composed from ASCII digits, characters from a to z and A to Z, and the
+underscore (_). The value can be either a string, an integer, a real number,
+or a compound statement.
+
+\subsection conf_single Single assignments
+
+\code
+a 1 # is equal to
+a=1 # is equal to
+a=1; # is equal to
+a 1,
+\endcode
+
+\subsection conf_compound Compound assignments (definitions using braces)
+
+\code
+a {
+ b = 1
+}
+a={
+ b 1,
+}
+\endcode
+
+\section conf_compound1 Compound assignments (one key definitions)
+
+\code
+a.b 1
+a.b=1
+\endcode
+
+\subsection conf_array Array assignments (definitions using brackets)
+
+\code
+a [
+ "first"
+ "second"
+]
+\endcode
+
+\subsection conf_array1 Array assignments (one key definitions)
+
+\code
+a.0 "first"
+a.1 "second"
+\endcode
+
+\section conf_mode Operation modes for parsing nodes
+
+By default, the node operation mode is 'merge+create', i.e., if
+a configuration node is not present a new one is created, otherwise
+the latest assignment is merged (if possible - type checking). The
+'merge+create' operation mode is specified with the prefix character plus (+).
+
+The operation mode 'merge' merges the node with the old one (which must
+exist). Type checking is done, so strings cannot be assigned to integers
+and so on. This mode is specified with the prefix character minus (-).
+
+The operation mode 'do not override' ignores a new configuration node
+if a configuration node with the same name exists. This mode is specified with
+the prefix character question mark (?).
+
+The operation mode 'override' always overrides the old configuration node
+with new contents. This mode is specified with the prefix character
+exclamation mark (!).
+
+\code
+defaults.pcm.!device 1
+\endcode
+
+\section conf_syntax_summary Syntax summary
+
+\code
+# Configuration file syntax
+
+# Include a new configuration file
+<filename>
+
+# Simple assignment
+name [=] value [,|;]
+
+# Compound assignment (first style)
+name [=] {
+ name1 [=] value [,|;]
+ ...
+}
+
+# Compound assignment (second style)
+name.name1 [=] value [,|;]
+
+# Array assignment (first style)
+name [
+ value0 [,|;]
+ value1 [,|;]
+ ...
+]
+
+# Array assignment (second style)
+name.0 [=] value0 [,|;]
+name.1 [=] value1 [,|;]
+\endcode
+
+\section conf_syntax_ref References
+
+\ref confarg
+\ref conffunc
+\ref confhooks
+
+*/
+
+/*! \page confarg Runtime arguments in configuration files
+
+<P>The ALSA library can accept runtime arguments for some configuration
+blocks. This extension is built on top of the basic configuration file
+syntax.<P>
+
+\section confarg_define Defining arguments
+
+Arguments are defined using the id (key) \c \@args and array values containing
+the string names of the arguments:
+
+\code
+@args [ CARD ] # or
+@args.0 CARD
+\endcode
+
+\section confarg_type Defining argument types and default values
+
+An argument's type is specified with the id (key) \c \@args and the argument
+name. The type and the default value are specified in the compound block:
+
+\code
+@args.CARD {
+ type string
+ default "abcd"
+}
+\endcode
+
+\section confarg_refer Referring to arguments
+
+Arguments are referred to with a dollar-sign ($) and the name of the argument:
+
+\code
+ card $CARD
+\endcode
+
+\section confarg_usage Usage
+
+To use a block with arguments, write the argument values after the key,
+separated with a colon (:). For example, all these names for PCM interfaces
+give the same result:
+
+\code
+hw:0,1
+hw:CARD=0,DEV=1
+hw:{CARD 0 DEV 1}
+plug:"hw:0,1"
+plug:{SLAVE="hw:{CARD 0 DEV 1}"}
+\endcode
+
+As you see, arguments can be specified in their proper order or by name.
+Note that arguments enclosed in braces are parsed in the same way as in
+configuration files, but using the override method by default.
+
+\section confarg_example Example
+
+\code
+pcm.demo {
+ @args [ CARD DEVICE ]
+ @args.CARD {
+ type string
+ default "supersonic"
+ }
+ @args.DEVICE {
+ type integer
+ default 0
+ }
+ type hw
+ card $CARD
+ device $DEVICE
+}
+\endcode
+
+*/
+
+/*! \page conffunc Runtime functions in configuration files
+
+<P>The ALSA library can modify the configuration at runtime.
+Several built-in functions are available.</P>
+
+<P>A function is defined with the id \c \@func and the function name. All other
+values in the current compound are used as configuration for the function.
+If the compound func.\<function_name\> is defined in the root node, then the
+library and function from this compound configuration are used, otherwise
+'snd_func_' is prefixed to the string and code from the ALSA library is used.
+The definition of a function looks like:</P>
+
+\code
+func.remove_first_char {
+ lib "/usr/lib/libasoundextend.so"
+ func "extend_remove_first_char"
+}
+\endcode
+
+*/
+
+/*! \page confhooks Hooks in configuration files
+
+<P>The hook extension in the ALSA library allows expansion of configuration
+nodes at run-time. The existence of a hook is determined by the
+presence of a \@hooks compound node.</P>
+
+<P>This example defines a hook which loads two configuration files at the
+beginning:</P>
+
+\code
+@hooks [
+ {
+ func load
+ files [
+ "/etc/asound.conf"
+ "~/.asoundrc"
+ ]
+ errors false
+ }
+]
+\endcode
+
+\section confhooks_ref Function reference
+
+<UL>
+ <LI>The function load - \c snd_config_hook_load() - loads and parses the
+ given configuration files.
+ <LI>The function load_for_all_cards - \c snd_config_hook_load_for_all_cards() -
+ loads and parses the given configuration files for each installed sound
+ card. The driver name (the type of the sound card) is passed in the
+ private configuration node.
+</UL>
+
+*/
+
+
+#include <stdarg.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <locale.h>
+#include "local.h"
+#ifdef HAVE_LIBPTHREAD
+#include <pthread.h>
+#endif
+
+#ifndef DOC_HIDDEN
+
+struct _snd_config {
+ char *id;
+ snd_config_type_t type;
+ union {
+ long integer;
+ long long integer64;
+ char *string;
+ double real;
+ const void *ptr;
+ struct {
+ struct list_head fields;
+ int join;
+ } compound;
+ } u;
+ struct list_head list;
+ snd_config_t *father;
+ int hop;
+};
+
+struct filedesc {
+ char *name;
+ snd_input_t *in;
+ unsigned int line, column;
+ struct filedesc *next;
+};
+
+#define LOCAL_ERROR (-0x68000000)
+
+#define LOCAL_UNTERMINATED_STRING (LOCAL_ERROR - 0)
+#define LOCAL_UNTERMINATED_QUOTE (LOCAL_ERROR - 1)
+#define LOCAL_UNEXPECTED_CHAR (LOCAL_ERROR - 2)
+#define LOCAL_UNEXPECTED_EOF (LOCAL_ERROR - 3)
+
+typedef struct {
+ struct filedesc *current;
+ int unget;
+ int ch;
+} input_t;
+
+static int safe_strtoll(const char *str, long long *val)
+{
+ long long v;
+ int endidx;
+ if (!*str)
+ return -EINVAL;
+ errno = 0;
+ if (sscanf(str, "%Li%n", &v, &endidx) < 1)
+ return -EINVAL;
+ if (str[endidx])
+ return -EINVAL;
+ *val = v;
+ return 0;
+}
+
+int safe_strtol(const char *str, long *val)
+{
+ char *end;
+ long v;
+ if (!*str)
+ return -EINVAL;
+ errno = 0;
+ v = strtol(str, &end, 0);
+ if (errno)
+ return -errno;
+ if (*end)
+ return -EINVAL;
+ *val = v;
+ return 0;
+}
+
+static int safe_strtod(const char *str, double *val)
+{
+ char *end;
+ double v;
+ char *saved_locale;
+ char locstr[64]; /* enough? */
+ int err;
+
+ if (!*str)
+ return -EINVAL;
+ saved_locale = setlocale(LC_NUMERIC, NULL);
+ if (saved_locale) {
+ snprintf(locstr, sizeof(locstr), "%s", saved_locale);
+ setlocale(LC_NUMERIC, "C");
+ }
+ errno = 0;
+ v = strtod(str, &end);
+ err = -errno;
+ if (saved_locale)
+ setlocale(LC_NUMERIC, locstr);
+ if (err)
+ return err;
+ if (*end)
+ return -EINVAL;
+ *val = v;
+ return 0;
+}
+
+static int get_char(input_t *input)
+{
+ int c;
+ struct filedesc *fd;
+ if (input->unget) {
+ input->unget = 0;
+ return input->ch;
+ }
+ again:
+ fd = input->current;
+ c = snd_input_getc(fd->in);
+ switch (c) {
+ case '\n':
+ fd->column = 0;
+ fd->line++;
+ break;
+ case '\t':
+ fd->column += 8 - fd->column % 8;
+ break;
+ case EOF:
+ if (fd->next) {
+ snd_input_close(fd->in);
+ free(fd->name);
+ input->current = fd->next;
+ free(fd);
+ goto again;
+ }
+ return LOCAL_UNEXPECTED_EOF;
+ default:
+ fd->column++;
+ break;
+ }
+ return (unsigned char)c;
+}
+
+static void unget_char(int c, input_t *input)
+{
+ assert(!input->unget);
+ input->ch = c;
+ input->unget = 1;
+}
+
+static int get_delimstring(char **string, int delim, input_t *input);
+
+static int get_char_skip_comments(input_t *input)
+{
+ int c;
+ while (1) {
+ c = get_char(input);
+ if (c == '<') {
+ char *str;
+ snd_input_t *in;
+ struct filedesc *fd;
+ int err = get_delimstring(&str, '>', input);
+ if (err < 0)
+ return err;
+ if (!strncmp(str, "confdir:", 8)) {
+ char *tmp = malloc(strlen(ALSA_CONFIG_DIR) + 1 + strlen(str + 8) + 1);
+ if (tmp == NULL) {
+ free(str);
+ return -ENOMEM;
+ }
+ sprintf(tmp, ALSA_CONFIG_DIR "/%s", str + 8);
+ free(str);
+ str = tmp;
+ }
+ err = snd_input_stdio_open(&in, str, "r");
+ if (err < 0) {
+ SNDERR("Cannot access file %s", str);
+ free(str);
+ return err;
+ }
+ fd = malloc(sizeof(*fd));
+ if (!fd) {
+ free(str);
+ return -ENOMEM;
+ }
+ fd->name = str;
+ fd->in = in;
+ fd->next = input->current;
+ fd->line = 1;
+ fd->column = 0;
+ input->current = fd;
+ continue;
+ }
+ if (c != '#')
+ break;
+ while (1) {
+ c = get_char(input);
+ if (c < 0)
+ return c;
+ if (c == '\n')
+ break;
+ }
+ }
+
+ return c;
+}
+
+
+static int get_nonwhite(input_t *input)
+{
+ int c;
+ while (1) {
+ c = get_char_skip_comments(input);
+ switch (c) {
+ case ' ':
+ case '\f':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ return c;
+ }
+ }
+}
+
+static int get_quotedchar(input_t *input)
+{
+ int c;
+ c = get_char(input);
+ switch (c) {
+ case 'n':
+ return '\n';
+ case 't':
+ return '\t';
+ case 'v':
+ return '\v';
+ case 'b':
+ return '\b';
+ case 'r':
+ return '\r';
+ case 'f':
+ return '\f';
+ case '0' ... '7':
+ {
+ int num = c - '0';
+ int i = 1;
+ do {
+ c = get_char(input);
+ if (c < '0' || c > '7') {
+ unget_char(c, input);
+ break;
+ }
+ num = num * 8 + c - '0';
+ i++;
+ } while (i < 3);
+ return num;
+ }
+ default:
+ return c;
+ }
+}
+
+#define LOCAL_STR_BUFSIZE 64
+struct local_string {
+ char *buf;
+ size_t alloc;
+ size_t idx;
+ char tmpbuf[LOCAL_STR_BUFSIZE];
+};
+
+static void init_local_string(struct local_string *s)
+{
+ memset(s, 0, sizeof(*s));
+ s->buf = s->tmpbuf;
+ s->alloc = LOCAL_STR_BUFSIZE;
+}
+
+static void free_local_string(struct local_string *s)
+{
+ if (s->buf != s->tmpbuf)
+ free(s->buf);
+}
+
+static int add_char_local_string(struct local_string *s, int c)
+{
+ if (s->idx >= s->alloc) {
+ size_t nalloc = s->alloc * 2;
+ if (s->buf == s->tmpbuf) {
+ s->buf = malloc(nalloc);
+ if (s->buf == NULL)
+ return -ENOMEM;
+ memcpy(s->buf, s->tmpbuf, s->alloc);
+ } else {
+ char *ptr = realloc(s->buf, nalloc);
+ if (ptr == NULL)
+ return -ENOMEM;
+ s->buf = ptr;
+ }
+ s->alloc = nalloc;
+ }
+ s->buf[s->idx++] = c;
+ return 0;
+}
+
+static char *copy_local_string(struct local_string *s)
+{
+ char *dst = malloc(s->idx + 1);
+ if (dst) {
+ memcpy(dst, s->buf, s->idx);
+ dst[s->idx] = '\0';
+ }
+ return dst;
+}
+
+static int get_freestring(char **string, int id, input_t *input)
+{
+ struct local_string str;
+ int c;
+
+ init_local_string(&str);
+ while (1) {
+ c = get_char(input);
+ if (c < 0) {
+ if (c == LOCAL_UNEXPECTED_EOF) {
+ *string = copy_local_string(&str);
+ if (! *string)
+ c = -ENOMEM;
+ else
+ c = 0;
+ }
+ break;
+ }
+ switch (c) {
+ case '.':
+ if (!id)
+ break;
+ case ' ':
+ case '\f':
+ case '\t':
+ case '\n':
+ case '\r':
+ case '=':
+ case ',':
+ case ';':
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '\'':
+ case '"':
+ case '\\':
+ case '#':
+ *string = copy_local_string(&str);
+ if (! *string)
+ c = -ENOMEM;
+ else {
+ unget_char(c, input);
+ c = 0;
+ }
+ goto _out;
+ default:
+ break;
+ }
+ if (add_char_local_string(&str, c) < 0) {
+ c = -ENOMEM;
+ break;
+ }
+ }
+ _out:
+ free_local_string(&str);
+ return c;
+}
+
+static int get_delimstring(char **string, int delim, input_t *input)
+{
+ struct local_string str;
+ int c;
+
+ init_local_string(&str);
+ while (1) {
+ c = get_char(input);
+ if (c < 0)
+ break;
+ if (c == '\\') {
+ c = get_quotedchar(input);
+ if (c < 0)
+ break;
+ if (c == '\n')
+ continue;
+ } else if (c == delim) {
+ *string = copy_local_string(&str);
+ if (! *string)
+ c = -ENOMEM;
+ else
+ c = 0;
+ break;
+ }
+ if (add_char_local_string(&str, c) < 0) {
+ c = -ENOMEM;
+ break;
+ }
+ }
+ free_local_string(&str);
+ return c;
+}
+
+/* Return 0 for free string, 1 for delimited string */
+static int get_string(char **string, int id, input_t *input)
+{
+ int c = get_nonwhite(input), err;
+ if (c < 0)
+ return c;
+ switch (c) {
+ case '=':
+ case ',':
+ case ';':
+ case '.':
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '\\':
+ return LOCAL_UNEXPECTED_CHAR;
+ case '\'':
+ case '"':
+ err = get_delimstring(string, c, input);
+ if (err < 0)
+ return err;
+ return 1;
+ default:
+ unget_char(c, input);
+ err = get_freestring(string, id, input);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+}
+
+static int _snd_config_make(snd_config_t **config, char **id, snd_config_type_t type)
+{
+ snd_config_t *n;
+ assert(config);
+ n = calloc(1, sizeof(*n));
+ if (n == NULL) {
+ if (*id) {
+ free(*id);
+ *id = NULL;
+ }
+ return -ENOMEM;
+ }
+ if (id) {
+ n->id = *id;
+ *id = NULL;
+ }
+ n->type = type;
+ if (type == SND_CONFIG_TYPE_COMPOUND)
+ INIT_LIST_HEAD(&n->u.compound.fields);
+ *config = n;
+ return 0;
+}
+
+
+static int _snd_config_make_add(snd_config_t **config, char **id,
+ snd_config_type_t type, snd_config_t *father)
+{
+ snd_config_t *n;
+ int err;
+ assert(father->type == SND_CONFIG_TYPE_COMPOUND);
+ err = _snd_config_make(&n, id, type);
+ if (err < 0)
+ return err;
+ n->father = father;
+ list_add_tail(&n->list, &father->u.compound.fields);
+ *config = n;
+ return 0;
+}
+
+static int _snd_config_search(snd_config_t *config,
+ const char *id, int len, snd_config_t **result)
+{
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, config) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (len < 0) {
+ if (strcmp(n->id, id) != 0)
+ continue;
+ } else if (strlen(n->id) != (size_t) len ||
+ memcmp(n->id, id, (size_t) len) != 0)
+ continue;
+ if (result)
+ *result = n;
+ return 0;
+ }
+ return -ENOENT;
+}
+
+static int parse_value(snd_config_t **_n, snd_config_t *father, input_t *input, char **id, int skip)
+{
+ snd_config_t *n = *_n;
+ char *s;
+ int err;
+
+ err = get_string(&s, 0, input);
+ if (err < 0)
+ return err;
+ if (skip) {
+ free(s);
+ return 0;
+ }
+ if (err == 0 && ((s[0] >= '0' && s[0] <= '9') || s[0] == '-')) {
+ long long i;
+ errno = 0;
+ err = safe_strtoll(s, &i);
+ if (err < 0) {
+ double r;
+ err = safe_strtod(s, &r);
+ if (err >= 0) {
+ free(s);
+ if (n) {
+ if (n->type != SND_CONFIG_TYPE_REAL) {
+ SNDERR("%s is not a real", *id);
+ return -EINVAL;
+ }
+ } else {
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_REAL, father);
+ if (err < 0)
+ return err;
+ }
+ n->u.real = r;
+ *_n = n;
+ return 0;
+ }
+ } else {
+ free(s);
+ if (n) {
+ if (n->type != SND_CONFIG_TYPE_INTEGER && n->type != SND_CONFIG_TYPE_INTEGER64) {
+ SNDERR("%s is not an integer", *id);
+ return -EINVAL;
+ }
+ } else {
+ if (i <= INT_MAX)
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, father);
+ else
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, father);
+ if (err < 0)
+ return err;
+ }
+ if (n->type == SND_CONFIG_TYPE_INTEGER)
+ n->u.integer = (long) i;
+ else
+ n->u.integer64 = i;
+ *_n = n;
+ return 0;
+ }
+ }
+ if (n) {
+ if (n->type != SND_CONFIG_TYPE_STRING) {
+ SNDERR("%s is not a string", *id);
+ free(s);
+ return -EINVAL;
+ }
+ } else {
+ err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_STRING, father);
+ if (err < 0)
+ return err;
+ }
+ free(n->u.string);
+ n->u.string = s;
+ *_n = n;
+ return 0;
+}
+
+static int parse_defs(snd_config_t *father, input_t *input, int skip, int override);
+static int parse_array_defs(snd_config_t *farther, input_t *input, int skip, int override);
+
+static int parse_array_def(snd_config_t *father, input_t *input, int idx, int skip, int override)
+{
+ char *id = NULL;
+ int c;
+ int err;
+ snd_config_t *n = NULL;
+
+ if (!skip) {
+ char static_id[12];
+ snprintf(static_id, sizeof(static_id), "%i", idx);
+ id = strdup(static_id);
+ if (id == NULL)
+ return -ENOMEM;
+ }
+ c = get_nonwhite(input);
+ if (c < 0) {
+ err = c;
+ goto __end;
+ }
+ switch (c) {
+ case '{':
+ case '[':
+ {
+ char endchr;
+ if (!skip) {
+ if (n) {
+ if (n->type != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("%s is not a compound", id);
+ err = -EINVAL;
+ goto __end;
+ }
+ } else {
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
+ if (err < 0)
+ goto __end;
+ }
+ }
+ if (c == '{') {
+ err = parse_defs(n, input, skip, override);
+ endchr = '}';
+ } else {
+ err = parse_array_defs(n, input, skip, override);
+ endchr = ']';
+ }
+ c = get_nonwhite(input);
+ if (c < 0) {
+ err = c;
+ goto __end;
+ }
+ if (c != endchr) {
+ if (n)
+ snd_config_delete(n);
+ err = LOCAL_UNEXPECTED_CHAR;
+ goto __end;
+ }
+ break;
+ }
+ default:
+ unget_char(c, input);
+ err = parse_value(&n, father, input, &id, skip);
+ if (err < 0)
+ goto __end;
+ break;
+ }
+ err = 0;
+ __end:
+ free(id);
+ return err;
+}
+
+static int parse_array_defs(snd_config_t *father, input_t *input, int skip, int override)
+{
+ int idx = 0;
+ while (1) {
+ int c = get_nonwhite(input), err;
+ if (c < 0)
+ return c;
+ unget_char(c, input);
+ if (c == ']')
+ return 0;
+ err = parse_array_def(father, input, idx++, skip, override);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static int parse_def(snd_config_t *father, input_t *input, int skip, int override)
+{
+ char *id = NULL;
+ int c;
+ int err;
+ snd_config_t *n;
+ enum {MERGE_CREATE, MERGE, OVERRIDE, DONT_OVERRIDE} mode;
+ while (1) {
+ c = get_nonwhite(input);
+ if (c < 0)
+ return c;
+ switch (c) {
+ case '+':
+ mode = MERGE_CREATE;
+ break;
+ case '-':
+ mode = MERGE;
+ break;
+ case '?':
+ mode = DONT_OVERRIDE;
+ break;
+ case '!':
+ mode = OVERRIDE;
+ break;
+ default:
+ mode = !override ? MERGE_CREATE : OVERRIDE;
+ unget_char(c, input);
+ }
+ err = get_string(&id, 1, input);
+ if (err < 0)
+ return err;
+ c = get_nonwhite(input);
+ if (c != '.')
+ break;
+ if (skip) {
+ free(id);
+ continue;
+ }
+ if (_snd_config_search(father, id, -1, &n) == 0) {
+ if (mode == DONT_OVERRIDE) {
+ skip = 1;
+ free(id);
+ continue;
+ }
+ if (mode != OVERRIDE) {
+ if (n->type != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("%s is not a compound", id);
+ return -EINVAL;
+ }
+ n->u.compound.join = 1;
+ father = n;
+ free(id);
+ continue;
+ }
+ snd_config_delete(n);
+ }
+ if (mode == MERGE) {
+ SNDERR("%s does not exists", id);
+ err = -ENOENT;
+ goto __end;
+ }
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
+ if (err < 0)
+ goto __end;
+ n->u.compound.join = 1;
+ father = n;
+ }
+ if (c == '=') {
+ c = get_nonwhite(input);
+ if (c < 0)
+ return c;
+ }
+ if (!skip) {
+ if (_snd_config_search(father, id, -1, &n) == 0) {
+ if (mode == DONT_OVERRIDE) {
+ skip = 1;
+ n = NULL;
+ } else if (mode == OVERRIDE) {
+ snd_config_delete(n);
+ n = NULL;
+ }
+ } else {
+ n = NULL;
+ if (mode == MERGE) {
+ SNDERR("%s does not exists", id);
+ err = -ENOENT;
+ goto __end;
+ }
+ }
+ }
+ switch (c) {
+ case '{':
+ case '[':
+ {
+ char endchr;
+ if (!skip) {
+ if (n) {
+ if (n->type != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("%s is not a compound", id);
+ err = -EINVAL;
+ goto __end;
+ }
+ } else {
+ err = _snd_config_make_add(&n, &id, SND_CONFIG_TYPE_COMPOUND, father);
+ if (err < 0)
+ goto __end;
+ }
+ }
+ if (c == '{') {
+ err = parse_defs(n, input, skip, override);
+ endchr = '}';
+ } else {
+ err = parse_array_defs(n, input, skip, override);
+ endchr = ']';
+ }
+ c = get_nonwhite(input);
+ if (c != endchr) {
+ if (n)
+ snd_config_delete(n);
+ err = LOCAL_UNEXPECTED_CHAR;
+ goto __end;
+ }
+ break;
+ }
+ default:
+ unget_char(c, input);
+ err = parse_value(&n, father, input, &id, skip);
+ if (err < 0)
+ goto __end;
+ break;
+ }
+ c = get_nonwhite(input);
+ switch (c) {
+ case ';':
+ case ',':
+ break;
+ default:
+ unget_char(c, input);
+ }
+ __end:
+ free(id);
+ return err;
+}
+
+static int parse_defs(snd_config_t *father, input_t *input, int skip, int override)
+{
+ int c, err;
+ while (1) {
+ c = get_nonwhite(input);
+ if (c < 0)
+ return c == LOCAL_UNEXPECTED_EOF ? 0 : c;
+ unget_char(c, input);
+ if (c == '}')
+ return 0;
+ err = parse_def(father, input, skip, override);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static void string_print(char *str, int id, snd_output_t *out)
+{
+ unsigned char *p = (unsigned char *)str;
+ if (!id) {
+ switch (*p) {
+ case 0:
+ assert(0);
+ break;
+ case '0' ... '9':
+ case '-':
+ goto quoted;
+ }
+ }
+ if (!*p) {
+ snd_output_puts(out, "''");
+ return;
+ }
+ loop:
+ switch (*p) {
+ case 0:
+ goto nonquoted;
+ case 1 ... 31:
+ case 127 ... 255:
+ case ' ':
+ case '=':
+ case ';':
+ case ',':
+ case '.':
+ case '{':
+ case '}':
+ case '\'':
+ case '"':
+ goto quoted;
+ default:
+ p++;
+ goto loop;
+ }
+ nonquoted:
+ snd_output_puts(out, str);
+ return;
+ quoted:
+ snd_output_putc(out, '\'');
+ p = (unsigned char *)str;
+ while (*p) {
+ int c;
+ c = *p;
+ switch (c) {
+ case '\n':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 'n');
+ break;
+ case '\t':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 't');
+ break;
+ case '\v':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 'v');
+ break;
+ case '\b':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 'b');
+ break;
+ case '\r':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 'r');
+ break;
+ case '\f':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, 'f');
+ break;
+ case '\'':
+ snd_output_putc(out, '\\');
+ snd_output_putc(out, c);
+ break;
+ case 32 ... '\'' - 1:
+ case '\'' + 1 ... 126:
+ snd_output_putc(out, c);
+ break;
+ default:
+ snd_output_printf(out, "\\%04o", c);
+ break;
+ }
+ p++;
+ }
+ snd_output_putc(out, '\'');
+}
+
+static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsigned int level, unsigned int joins);
+
+static int _snd_config_save_leaf(snd_config_t *n, snd_output_t *out,
+ unsigned int level)
+{
+ int err;
+ unsigned int k;
+ switch (n->type) {
+ case SND_CONFIG_TYPE_INTEGER:
+ snd_output_printf(out, "%ld", n->u.integer);
+ break;
+ case SND_CONFIG_TYPE_INTEGER64:
+ snd_output_printf(out, "%Ld", n->u.integer64);
+ break;
+ case SND_CONFIG_TYPE_REAL:
+ snd_output_printf(out, "%-16g", n->u.real);
+ break;
+ case SND_CONFIG_TYPE_STRING:
+ string_print(n->u.string, 0, out);
+ break;
+ case SND_CONFIG_TYPE_POINTER:
+ SNDERR("cannot save runtime pointer type");
+ return -EINVAL;
+ case SND_CONFIG_TYPE_COMPOUND:
+ snd_output_putc(out, '{');
+ snd_output_putc(out, '\n');
+ err = _snd_config_save_leaves(n, out, level + 1, 0);
+ if (err < 0)
+ return err;
+ for (k = 0; k < level; ++k) {
+ snd_output_putc(out, '\t');
+ }
+ snd_output_putc(out, '}');
+ break;
+ }
+ return 0;
+}
+
+static void id_print(snd_config_t *n, snd_output_t *out, unsigned int joins)
+{
+ if (joins > 0) {
+ assert(n->father);
+ id_print(n->father, out, joins - 1);
+ snd_output_putc(out, '.');
+ }
+ string_print(n->id, 1, out);
+}
+
+static int _snd_config_save_leaves(snd_config_t *config, snd_output_t *out, unsigned int level, unsigned int joins)
+{
+ unsigned int k;
+ int err;
+ snd_config_iterator_t i, next;
+ assert(config && out);
+ snd_config_for_each(i, next, config) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (n->type == SND_CONFIG_TYPE_COMPOUND &&
+ n->u.compound.join) {
+ err = _snd_config_save_leaves(n, out, level, joins + 1);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ for (k = 0; k < level; ++k) {
+ snd_output_putc(out, '\t');
+ }
+ id_print(n, out, joins);
+#if 0
+ snd_output_putc(out, ' ');
+ snd_output_putc(out, '=');
+#endif
+ snd_output_putc(out, ' ');
+ err = _snd_config_save_leaf(n, out, level);
+ if (err < 0)
+ return err;
+#if 0
+ snd_output_putc(out, ';');
+#endif
+ snd_output_putc(out, '\n');
+ }
+ return 0;
+}
+#endif
+
+
+/**
+ * \brief Substitutes one configuration node to another.
+ * \param dst Handle to the destination node.
+ * \param src Handle to the source node. Must not be the same as \p dst.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * If both nodes are compounds, the source compound node members are
+ * appended to the destination compound node.
+ *
+ * If the destination node is a compound and the source node is
+ * an ordinary type, the compound members are deleted (including
+ * their contents).
+ *
+ * A successful call to this function invalidates the source node.
+ */
+int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
+{
+ assert(dst && src);
+ if (dst->type == SND_CONFIG_TYPE_COMPOUND &&
+ src->type == SND_CONFIG_TYPE_COMPOUND) { /* append */
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, src) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ n->father = dst;
+ }
+ src->u.compound.fields.next->prev = &dst->u.compound.fields;
+ src->u.compound.fields.prev->next = &dst->u.compound.fields;
+ } else if (dst->type == SND_CONFIG_TYPE_COMPOUND) {
+ int err;
+ err = snd_config_delete_compound_members(dst);
+ if (err < 0)
+ return err;
+ }
+ free(dst->id);
+ dst->id = src->id;
+ dst->type = src->type;
+ dst->u = src->u;
+ free(src);
+ return 0;
+}
+
+/**
+ * \brief Converts an ASCII string to a configuration node type.
+ * \param ascii A string containing a configuration node type.
+ * \param type The function puts the node type at the address specified
+ * by \p type.
+ * \return Zero if successgul, otherwise a negative error code.
+ */
+int snd_config_get_type_ascii(const char *ascii, snd_config_type_t *type)
+{
+ assert(ascii && type);
+ if (!strcmp(ascii, "integer")) {
+ *type = SND_CONFIG_TYPE_INTEGER;
+ return 0;
+ }
+ if (!strcmp(ascii, "integer64")) {
+ *type = SND_CONFIG_TYPE_INTEGER64;
+ return 0;
+ }
+ if (!strcmp(ascii, "real")) {
+ *type = SND_CONFIG_TYPE_REAL;
+ return 0;
+ }
+ if (!strcmp(ascii, "string")) {
+ *type = SND_CONFIG_TYPE_STRING;
+ return 0;
+ }
+ if (!strcmp(ascii, "compound")) {
+ *type = SND_CONFIG_TYPE_COMPOUND;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Returns the type of a configuration node.
+ * \param config Handle to the configuration node.
+ * \return The node's type.
+ */
+snd_config_type_t snd_config_get_type(const snd_config_t *config)
+{
+ return config->type;
+}
+
+/**
+ * \brief Returns the id of a configuration node.
+ * \param config Handle to the configuration node.
+ * \param id The function puts the pointer to the id string at the address
+ * specified by \p id.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The returned string is owned by the configuration node; the application
+ * must not modify or delete it.
+ */
+int snd_config_get_id(const snd_config_t *config, const char **id)
+{
+ assert(config && id);
+ *id = config->id;
+ return 0;
+}
+
+/**
+ * \brief Sets the id of a configuration node.
+ * \param config Handle to the configuration node.
+ * \param id The new node id.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_set_id(snd_config_t *config, const char *id)
+{
+ char *new_id;
+ assert(config && id);
+ new_id = strdup(id);
+ if (!new_id)
+ return -ENOMEM;
+ free(config->id);
+ config->id = new_id;
+ return 0;
+}
+
+/**
+ * \brief Creates a top level configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The returned node is a compound node.
+ */
+int snd_config_top(snd_config_t **config)
+{
+ assert(config);
+ return _snd_config_make(config, 0, SND_CONFIG_TYPE_COMPOUND);
+}
+
+static int snd_config_load1(snd_config_t *config, snd_input_t *in, int override)
+{
+ int err;
+ input_t input;
+ struct filedesc *fd, *fd_next;
+ assert(config && in);
+ fd = malloc(sizeof(*fd));
+ if (!fd)
+ return -ENOMEM;
+ fd->name = NULL;
+ fd->in = in;
+ fd->line = 1;
+ fd->column = 0;
+ fd->next = NULL;
+ input.current = fd;
+ input.unget = 0;
+ err = parse_defs(config, &input, 0, override);
+ fd = input.current;
+ if (err < 0) {
+ const char *str;
+ switch (err) {
+ case LOCAL_UNTERMINATED_STRING:
+ str = "Unterminated string";
+ err = -EINVAL;
+ break;
+ case LOCAL_UNTERMINATED_QUOTE:
+ str = "Unterminated quote";
+ err = -EINVAL;
+ break;
+ case LOCAL_UNEXPECTED_CHAR:
+ str = "Unexpected char";
+ err = -EINVAL;
+ break;
+ case LOCAL_UNEXPECTED_EOF:
+ str = "Unexpected end of file";
+ err = -EINVAL;
+ break;
+ default:
+ str = strerror(-err);
+ break;
+ }
+ SNDERR("%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
+ goto _end;
+ }
+ if (get_char(&input) != LOCAL_UNEXPECTED_EOF) {
+ SNDERR("%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
+ err = -EINVAL;
+ goto _end;
+ }
+ _end:
+ while (fd->next) {
+ fd_next = fd->next;
+ snd_input_close(fd->in);
+ free(fd->name);
+ free(fd);
+ fd = fd_next;
+ }
+ free(fd);
+ return err;
+}
+
+/**
+ * \brief Loads a configuration tree.
+ * \param config Handle to a top level configuration node.
+ * \param in Input handle to read the configuration from.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_load(snd_config_t *config, snd_input_t *in)
+{
+ return snd_config_load1(config, in, 0);
+}
+
+/**
+ * \brief Loads a configuration tree and overrides existing configuration nodes.
+ * \param config Handle to a top level configuration node.
+ * \param in Input handle to read the configuration from.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_load_override(snd_config_t *config, snd_input_t *in)
+{
+ return snd_config_load1(config, in, 1);
+}
+
+/**
+ * \brief Adds a child to a compound configuration node.
+ * \param father Handle to the compound configuration node.
+ * \param leaf Handle to the configuration node to be added to \p father.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_add(snd_config_t *father, snd_config_t *leaf)
+{
+ snd_config_iterator_t i, next;
+ assert(father && leaf);
+ snd_config_for_each(i, next, father) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (strcmp(leaf->id, n->id) == 0)
+ return -EEXIST;
+ }
+ leaf->father = father;
+ list_add_tail(&leaf->list, &father->u.compound.fields);
+ return 0;
+}
+
+/**
+ * \brief Removes a configuration node from its tree.
+ * \param config Handle to the configuration node to be removed.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This functions does \e not delete the removed node.
+ */
+int snd_config_remove(snd_config_t *config)
+{
+ assert(config);
+ if (config->father)
+ list_del(&config->list);
+ config->father = NULL;
+ return 0;
+}
+
+/**
+ * \brief Deletes a configuration node (freeing all its related resources).
+ * \param config Handle to the configuration node to be deleted.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * If the node is a child node, it is removed from the tree before being
+ * deleted. If the node is a compound node, all children are deleted
+ * recursively.
+ */
+int snd_config_delete(snd_config_t *config)
+{
+ assert(config);
+ switch (config->type) {
+ case SND_CONFIG_TYPE_COMPOUND:
+ {
+ int err;
+ struct list_head *i;
+ i = config->u.compound.fields.next;
+ while (i != &config->u.compound.fields) {
+ struct list_head *nexti = i->next;
+ snd_config_t *leaf = snd_config_iterator_entry(i);
+ err = snd_config_delete(leaf);
+ if (err < 0)
+ return err;
+ i = nexti;
+ }
+ break;
+ }
+ case SND_CONFIG_TYPE_STRING:
+ free(config->u.string);
+ break;
+ default:
+ break;
+ }
+ if (config->father)
+ list_del(&config->list);
+ free(config->id);
+ free(config);
+ return 0;
+}
+
+/**
+ * \brief Deletes the children of a compound configuration node (freeing all its related resources)
+ * \param config Handle to the compound configuration node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * Any compound nodes among the children of \p config are deleted recursively.
+ */
+int snd_config_delete_compound_members(const snd_config_t *config)
+{
+ int err;
+ struct list_head *i;
+
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_COMPOUND)
+ return -EINVAL;
+ i = config->u.compound.fields.next;
+ while (i != &config->u.compound.fields) {
+ struct list_head *nexti = i->next;
+ snd_config_t *leaf = snd_config_iterator_entry(i);
+ err = snd_config_delete(leaf);
+ if (err < 0)
+ return err;
+ i = nexti;
+ }
+ return 0;
+}
+
+/**
+ * \brief Creates a configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param type The type of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_make(snd_config_t **config, const char *id,
+ snd_config_type_t type)
+{
+ char *id1;
+ assert(config);
+ if (id) {
+ id1 = strdup(id);
+ if (!id1)
+ return -ENOMEM;
+ } else
+ id1 = NULL;
+ return _snd_config_make(config, &id1, type);
+}
+
+/**
+ * \brief Creates an integer configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The value of the new node is 0.
+ */
+int snd_config_make_integer(snd_config_t **config, const char *id)
+{
+ return snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
+}
+
+/**
+ * \brief Creates an integer64 configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The value of the new node is 0.
+ */
+int snd_config_make_integer64(snd_config_t **config, const char *id)
+{
+ return snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64);
+}
+
+/**
+ * \brief Creates a real configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The value of the new node is 0.0.
+ */
+int snd_config_make_real(snd_config_t **config, const char *id)
+{
+ return snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
+}
+
+/**
+ * \brief Creates a string configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The value of the new node is \c NULL.
+ */
+int snd_config_make_string(snd_config_t **config, const char *id)
+{
+ return snd_config_make(config, id, SND_CONFIG_TYPE_STRING);
+}
+
+/**
+ * \brief Creates a pointer configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The value of the new node is \c NULL.
+ */
+int snd_config_make_pointer(snd_config_t **config, const char *id)
+{
+ return snd_config_make(config, id, SND_CONFIG_TYPE_POINTER);
+}
+
+/**
+ * \brief Creates an empty compound configuration node.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param join Join flag.
+ * This is checked in #snd_config_save to change look. (Huh?)
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_make_compound(snd_config_t **config, const char *id,
+ int join)
+{
+ int err;
+ err = snd_config_make(config, id, SND_CONFIG_TYPE_COMPOUND);
+ if (err < 0)
+ return err;
+ (*config)->u.compound.join = join;
+ return 0;
+}
+
+/**
+ * \brief Creates an integer configuration node with the given initial value.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param value The initial value of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_imake_integer(snd_config_t **config, const char *id, const long value)
+{
+ int err;
+
+ err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
+ if (err < 0)
+ return err;
+ (*config)->u.integer = value;
+ return 0;
+}
+
+/**
+ * \brief Creates an integer configuration node with the given initial value.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param value The initial value of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_imake_integer64(snd_config_t **config, const char *id, const long long value)
+{
+ int err;
+
+ err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64);
+ if (err < 0)
+ return err;
+ (*config)->u.integer64 = value;
+ return 0;
+}
+
+/**
+ * \brief Creates a real configuration node with the given initial value.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param value The initial value of the new node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_imake_real(snd_config_t **config, const char *id, const double value)
+{
+ int err;
+
+ err = snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
+ if (err < 0)
+ return err;
+ (*config)->u.real = value;
+ return 0;
+}
+
+/**
+ * \brief Creates a string configuration node with the given initial value.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param value The initial value of the new node. May be \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This function creates the new node with its own copy of the passed string.
+ */
+int snd_config_imake_string(snd_config_t **config, const char *id, const char *value)
+{
+ int err;
+ snd_config_t *tmp;
+
+ err = snd_config_make(&tmp, id, SND_CONFIG_TYPE_STRING);
+ if (err < 0)
+ return err;
+ if (value) {
+ tmp->u.string = strdup(value);
+ if (!tmp->u.string) {
+ snd_config_delete(tmp);
+ return -ENOMEM;
+ }
+ } else {
+ tmp->u.string = NULL;
+ }
+ *config = tmp;
+ return 0;
+}
+
+/**
+ * \brief Creates a pointer configuration node with the given initial value.
+ * \param config The function puts the handle to the new node at the address
+ * specified by \p config.
+ * \param id The id of the new node.
+ * \param value The initial value of the new node. May be \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_imake_pointer(snd_config_t **config, const char *id, const void *value)
+{
+ int err;
+
+ err = snd_config_make(config, id, SND_CONFIG_TYPE_POINTER);
+ if (err < 0)
+ return err;
+ (*config)->u.ptr = value;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of an integer configuration node.
+ * \param config Handle to the configuration node.
+ * \param value The new value for the node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_set_integer(snd_config_t *config, long value)
+{
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_INTEGER)
+ return -EINVAL;
+ config->u.integer = value;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of an integer64 configuration node.
+ * \param config Handle to the configuration node.
+ * \param value The new value for the node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_set_integer64(snd_config_t *config, long long value)
+{
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_INTEGER64)
+ return -EINVAL;
+ config->u.integer64 = value;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of a real configuration node.
+ * \param config Handle to the configuration node.
+ * \param value The new value for the node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_set_real(snd_config_t *config, double value)
+{
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_REAL)
+ return -EINVAL;
+ config->u.real = value;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of a string configuration node.
+ * \param config Handle to the configuration node.
+ * \param value The new value for the node. May be \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This function deletes the old string in the node and stores a copy of
+ * the passed string in the node.
+ */
+int snd_config_set_string(snd_config_t *config, const char *value)
+{
+ char *new_string;
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_STRING)
+ return -EINVAL;
+ if (value) {
+ new_string = strdup(value);
+ if (!new_string)
+ return -ENOMEM;
+ } else {
+ new_string = NULL;
+ }
+ free(config->u.string);
+ config->u.string = new_string;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of a pointer configuration node.
+ * \param config Handle to the configuration node.
+ * \param value The new value for the node. May be \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This function does not free the old pointer in the node.
+ */
+int snd_config_set_pointer(snd_config_t *config, const void *value)
+{
+ assert(config);
+ if (config->type != SND_CONFIG_TYPE_POINTER)
+ return -EINVAL;
+ config->u.ptr = value;
+ return 0;
+}
+
+/**
+ * \brief Changes the value of a configuration node.
+ * \param config Handle to the configuration node.
+ * \param ascii The new value for the node as an ASCII string. \p ascii must
+ * not be \c NULL, not even for a string node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The node must have a simple type, and the new value must have the same type.
+ */
+int snd_config_set_ascii(snd_config_t *config, const char *ascii)
+{
+ assert(config && ascii);
+ switch (config->type) {
+ case SND_CONFIG_TYPE_INTEGER:
+ {
+ long i;
+ int err = safe_strtol(ascii, &i);
+ if (err < 0)
+ return err;
+ config->u.integer = i;
+ }
+ break;
+ case SND_CONFIG_TYPE_INTEGER64:
+ {
+ long long i;
+ int err = safe_strtoll(ascii, &i);
+ if (err < 0)
+ return err;
+ config->u.integer64 = i;
+ }
+ break;
+ case SND_CONFIG_TYPE_REAL:
+ {
+ double d;
+ int err = safe_strtod(ascii, &d);
+ if (err < 0)
+ return err;
+ config->u.real = d;
+ break;
+ }
+ case SND_CONFIG_TYPE_STRING:
+ {
+ char *ptr = strdup(ascii);
+ if (ptr == NULL)
+ return -ENOMEM;
+ free(config->u.string);
+ config->u.string = ptr;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+/**
+ * \brief Returns the value of an integer configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_get_integer(const snd_config_t *config, long *ptr)
+{
+ assert(config && ptr);
+ if (config->type != SND_CONFIG_TYPE_INTEGER)
+ return -EINVAL;
+ *ptr = config->u.integer;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of an integer64 configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_get_integer64(const snd_config_t *config, long long *ptr)
+{
+ assert(config && ptr);
+ if (config->type != SND_CONFIG_TYPE_INTEGER64)
+ return -EINVAL;
+ *ptr = config->u.integer64;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of a real configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_get_real(const snd_config_t *config, double *ptr)
+{
+ assert(config && ptr);
+ if (config->type != SND_CONFIG_TYPE_REAL)
+ return -EINVAL;
+ *ptr = config->u.real;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of a real or integer configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * If the node's type is integer or integer64, the value is converted
+ * to the \c double type on the fly.
+ */
+int snd_config_get_ireal(const snd_config_t *config, double *ptr)
+{
+ assert(config && ptr);
+ if (config->type == SND_CONFIG_TYPE_REAL)
+ *ptr = config->u.real;
+ else if (config->type == SND_CONFIG_TYPE_INTEGER)
+ *ptr = config->u.integer;
+ else if (config->type == SND_CONFIG_TYPE_INTEGER64)
+ *ptr = config->u.integer64;
+ else
+ return -EINVAL;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of a string configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * The returned string is owned by the configuration node; the application
+ * must not modify or delete it.
+ */
+int snd_config_get_string(const snd_config_t *config, const char **ptr)
+{
+ assert(config && ptr);
+ if (config->type != SND_CONFIG_TYPE_STRING)
+ return -EINVAL;
+ *ptr = config->u.string;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of a pointer configuration node.
+ * \param config Handle to the configuration node.
+ * \param ptr The function puts the node's value at the address specified
+ * by \p ptr.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_get_pointer(const snd_config_t *config, const void **ptr)
+{
+ assert(config && ptr);
+ if (config->type != SND_CONFIG_TYPE_POINTER)
+ return -EINVAL;
+ *ptr = config->u.ptr;
+ return 0;
+}
+
+/**
+ * \brief Returns the value of a configuration node as a string.
+ * \param config Handle to the configuration node.
+ * \param ascii The function puts the pointer to the returned string at the
+ * address specified by \p ascii.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This function dynamically allocates the returned string. The application
+ * is responsible for deleting it with \c free() when it is no longer used.
+ */
+int snd_config_get_ascii(const snd_config_t *config, char **ascii)
+{
+ assert(config && ascii);
+ switch (config->type) {
+ case SND_CONFIG_TYPE_INTEGER:
+ {
+ char res[12];
+ int err;
+ err = snprintf(res, sizeof(res), "%li", config->u.integer);
+ if (err < 0 || err == sizeof(res)) {
+ assert(0);
+ return -ENOMEM;
+ }
+ *ascii = strdup(res);
+ }
+ break;
+ case SND_CONFIG_TYPE_INTEGER64:
+ {
+ char res[32];
+ int err;
+ err = snprintf(res, sizeof(res), "%Li", config->u.integer64);
+ if (err < 0 || err == sizeof(res)) {
+ assert(0);
+ return -ENOMEM;
+ }
+ *ascii = strdup(res);
+ }
+ break;
+ case SND_CONFIG_TYPE_REAL:
+ {
+ char res[32];
+ int err;
+ err = snprintf(res, sizeof(res), "%-16g", config->u.real);
+ if (err < 0 || err == sizeof(res)) {
+ assert(0);
+ return -ENOMEM;
+ }
+ if (res[0]) { /* trim the string */
+ char *ptr;
+ ptr = res + strlen(res) - 1;
+ while (ptr != res && *ptr == ' ')
+ ptr--;
+ if (*ptr != ' ')
+ ptr++;
+ *ptr = '\0';
+ }
+ *ascii = strdup(res);
+ }
+ break;
+ case SND_CONFIG_TYPE_STRING:
+ if (config->u.string)
+ *ascii = strdup(config->u.string);
+ else {
+ *ascii = NULL;
+ return 0;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+ if (*ascii == NULL)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief Compares the id of a configuration node to a given string.
+ * \param config Handle to the configuration node.
+ * \param id ASCII id.
+ * \return The same value as the result of the \c strcmp function.
+ */
+int snd_config_test_id(const snd_config_t *config, const char *id)
+{
+ assert(config && id);
+ return strcmp(config->id, id);
+}
+
+/**
+ * \brief Dumps the contents of a configuration node or tree.
+ * \param config Handle to the (root) configuration node.
+ * \param out Output handle.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_save(snd_config_t *config, snd_output_t *out)
+{
+ assert(config && out);
+ if (config->type == SND_CONFIG_TYPE_COMPOUND)
+ return _snd_config_save_leaves(config, out, 0, 0);
+ else
+ return _snd_config_save_leaf(config, out, 0);
+}
+
+/*
+ * *** search macros ***
+ */
+
+#ifndef DOC_HIDDEN
+
+#define SND_CONFIG_SEARCH(config, key, result, extra_code) \
+{ \
+ snd_config_t *n; \
+ int err; \
+ const char *p; \
+ assert(config && key); \
+ while (1) { \
+ if (config->type != SND_CONFIG_TYPE_COMPOUND) \
+ return -ENOENT; \
+ { extra_code ; } \
+ p = strchr(key, '.'); \
+ if (p) { \
+ err = _snd_config_search(config, key, p - key, &n); \
+ if (err < 0) \
+ return err; \
+ config = n; \
+ key = p + 1; \
+ } else \
+ return _snd_config_search(config, key, -1, result); \
+ } \
+}
+
+#define SND_CONFIG_SEARCHA(root, config, key, result, fcn, extra_code) \
+{ \
+ snd_config_t *n; \
+ int err; \
+ const char *p; \
+ assert(config && key); \
+ while (1) { \
+ if (config->type != SND_CONFIG_TYPE_COMPOUND) { \
+ if (snd_config_get_string(config, &p) < 0) \
+ return -ENOENT; \
+ err = fcn(root, root, p, &config); \
+ if (err < 0) \
+ return err; \
+ } \
+ { extra_code ; } \
+ p = strchr(key, '.'); \
+ if (p) { \
+ err = _snd_config_search(config, key, p - key, &n); \
+ if (err < 0) \
+ return err; \
+ config = n; \
+ key = p + 1; \
+ } else \
+ return _snd_config_search(config, key, -1, result); \
+ } \
+}
+
+#define SND_CONFIG_SEARCHV(config, result, fcn) \
+{ \
+ snd_config_t *n; \
+ va_list arg; \
+ assert(config); \
+ va_start(arg, result); \
+ while (1) { \
+ const char *k = va_arg(arg, const char *); \
+ int err; \
+ if (!k) \
+ break; \
+ err = fcn(config, k, &n); \
+ if (err < 0) \
+ return err; \
+ config = n; \
+ } \
+ va_end(arg); \
+ if (result) \
+ *result = n; \
+ return 0; \
+}
+
+#define SND_CONFIG_SEARCHVA(root, config, result, fcn) \
+{ \
+ snd_config_t *n; \
+ va_list arg; \
+ assert(config); \
+ va_start(arg, result); \
+ while (1) { \
+ const char *k = va_arg(arg, const char *); \
+ int err; \
+ if (!k) \
+ break; \
+ err = fcn(root, config, k, &n); \
+ if (err < 0) \
+ return err; \
+ config = n; \
+ } \
+ va_end(arg); \
+ if (result) \
+ *result = n; \
+ return 0; \
+}
+
+#define SND_CONFIG_SEARCH_ALIAS(config, base, key, result, fcn1, fcn2) \
+{ \
+ snd_config_t *res = NULL; \
+ char *old_key; \
+ int err, first = 1, maxloop = 1000; \
+ assert(config && key); \
+ while (1) { \
+ old_key = strdup(key); \
+ if (old_key == NULL) { \
+ err = -ENOMEM; \
+ res = NULL; \
+ break; \
+ } \
+ err = first && base ? -EIO : fcn1(config, config, key, &res); \
+ if (err < 0) { \
+ if (!base) \
+ break; \
+ err = fcn2(config, config, &res, base, key, NULL); \
+ if (err < 0) \
+ break; \
+ } \
+ if (snd_config_get_string(res, &key) < 0) \
+ break; \
+ if (!first && (strcmp(key, old_key) == 0 || maxloop <= 0)) { \
+ if (maxloop == 0) \
+ SNDERR("maximum loop count reached (circular configuration?)"); \
+ else \
+ SNDERR("key %s refers to itself", key); \
+ err = -EINVAL; \
+ res = NULL; \
+ break; \
+ } \
+ free(old_key); \
+ first = 0; \
+ maxloop--; \
+ } \
+ free(old_key); \
+ if (!res) \
+ return err; \
+ if (result) \
+ *result = res; \
+ return 0; \
+}
+
+#endif /* DOC_HIDDEN */
+
+/**
+ * \brief Searches for a node in a configuration tree.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param key Search key: one or more node keys, separated with dots.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_search(snd_config_t *config, const char *key, snd_config_t **result)
+{
+ SND_CONFIG_SEARCH(config, key, result, );
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, expanding aliases.
+ * \param root Handle to the root configuration node containing alias
+ * definitions.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param key Search key: one or more node keys, separated with dots.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_searcha(snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result)
+{
+ SND_CONFIG_SEARCHA(root, config, key, result, snd_config_searcha, );
+}
+
+/**
+ * \brief Searches for a node in a configuration tree.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \param ... One or more concatenated dot separated search keys, terminated with \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_searchv(snd_config_t *config, snd_config_t **result, ...)
+{
+ SND_CONFIG_SEARCHV(config, result, snd_config_search);
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, expanding aliases.
+ * \param root Handle to the root configuration node containing alias
+ * definitions.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \param ... One or more concatenated dot separated search keys, terminated with \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_searchva(snd_config_t *root, snd_config_t *config, snd_config_t **result, ...)
+{
+ SND_CONFIG_SEARCHVA(root, config, result, snd_config_searcha);
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, using an alias.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param base Search key base, or \c NULL.
+ * \param key Search key suffix.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * First \c key is tried, then, if nothing is found, \c base.key is tried.
+ * If the value found is a string, this is recursively tried in the
+ * same way.
+ */
+int snd_config_search_alias(snd_config_t *config,
+ const char *base, const char *key,
+ snd_config_t **result)
+{
+ SND_CONFIG_SEARCH_ALIAS(config, base, key, result,
+ snd_config_searcha, snd_config_searchva);
+}
+
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data);
+
+/**
+ * \brief Searches for a node in a configuration tree and expands hooks.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param key Search key: one or more node keys, separated with dots.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_search_hooks(snd_config_t *config, const char *key, snd_config_t **result)
+{
+ SND_CONFIG_SEARCH(config, key, result, \
+ err = snd_config_hooks(config, NULL); \
+ if (err < 0) \
+ return err; \
+ );
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, expanding aliases and hooks.
+ * \param root Handle to the root configuration node containing alias
+ * definitions.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param key Search key: one or more node keys, separated with dots.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_searcha_hooks(snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result)
+{
+ SND_CONFIG_SEARCHA(root, config, key, result,
+ snd_config_searcha_hooks,
+ err = snd_config_hooks(config, NULL); \
+ if (err < 0) \
+ return err; \
+ );
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, expanding aliases and hooks.
+ * \param root Handle to the root configuration node containing alias
+ * definitions.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \param ... One or more concatenated dot separated search keys, terminated with \c NULL.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_searchva_hooks(snd_config_t *root, snd_config_t *config,
+ snd_config_t **result, ...)
+{
+ SND_CONFIG_SEARCHVA(root, config, result, snd_config_searcha_hooks);
+}
+
+/**
+ * \brief Searches for a node in a configuration tree, using an alias and expanding hooks.
+ * \param config Handle to the root of the configuration (sub)tree to search.
+ * \param base Search key base, or \c NULL.
+ * \param key Search key suffix.
+ * \param result The function puts the handle to the node found at the address
+ * specified by \p result.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * First \c key is tried, then, if nothing is found, \c base.key is tried.
+ * If the value found is a string, this is recursively tried in the
+ * same way.
+ */
+int snd_config_search_alias_hooks(snd_config_t *config,
+ const char *base, const char *key,
+ snd_config_t **result)
+{
+ SND_CONFIG_SEARCH_ALIAS(config, base, key, result,
+ snd_config_searcha_hooks,
+ snd_config_searchva_hooks);
+}
+
+/** The name of the environment variable containing the files list for #snd_config_update. */
+#define ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH"
+
+/** The name of the default files used by #snd_config_update. */
+#define ALSA_CONFIG_PATH_DEFAULT ALSA_CONFIG_DIR "/alsa.conf"
+
+/**
+ * \ingroup Config
+ * Configuration top level node (the global configuration).
+ */
+snd_config_t *snd_config = NULL;
+
+#ifndef DOC_HIDDEN
+struct finfo {
+ char *name;
+ dev_t dev;
+ ino_t ino;
+ time_t mtime;
+};
+
+struct _snd_config_update {
+ unsigned int count;
+ struct finfo *finfo;
+};
+#endif /* DOC_HIDDEN */
+
+static snd_config_update_t *snd_config_global_update = NULL;
+
+static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_config_t *private_data)
+{
+ void *h = NULL;
+ snd_config_t *c, *func_conf = NULL;
+ char *buf = NULL;
+ const char *lib = NULL, *func_name = NULL;
+ const char *str;
+ int (*func)(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data) = NULL;
+ int err;
+
+ err = snd_config_search(config, "func", &c);
+ if (err < 0) {
+ SNDERR("Field func is missing");
+ return err;
+ }
+ err = snd_config_get_string(c, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for field func");
+ return err;
+ }
+ err = snd_config_search_definition(root, "hook_func", str, &func_conf);
+ if (err >= 0) {
+ snd_config_iterator_t i, next;
+ if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for func %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, func_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = n->id;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "func") == 0) {
+ err = snd_config_get_string(n, &func_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ }
+ }
+ if (!func_name) {
+ int len = 16 + strlen(str) + 1;
+ buf = malloc(len);
+ if (! buf) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ snprintf(buf, len, "snd_config_hook_%s", str);
+ buf[len-1] = '\0';
+ func_name = buf;
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ func = h ? snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK)) : NULL;
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!func) {
+ SNDERR("symbol %s is not defined inside %s", func_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (func_conf)
+ snd_config_delete(func_conf);
+ if (err >= 0) {
+ snd_config_t *nroot;
+ err = func(root, config, &nroot, private_data);
+ if (err < 0)
+ SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
+ snd_dlclose(h);
+ if (err >= 0 && nroot)
+ err = snd_config_substitute(root, nroot);
+ }
+ free(buf);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
+{
+ snd_config_t *n;
+ snd_config_iterator_t i, next;
+ int err, hit, idx = 0;
+
+ if ((err = snd_config_search(config, "@hooks", &n)) < 0)
+ return 0;
+ snd_config_remove(n);
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, n) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = n->id;
+ long i;
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not and integer", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ if (i == idx) {
+ err = snd_config_hooks_call(config, n, private_data);
+ if (err < 0)
+ return err;
+ idx++;
+ hit = 1;
+ }
+ }
+ } while (hit);
+ err = 0;
+ _err:
+ snd_config_delete(n);
+ return err;
+}
+
+/**
+ * \brief Loads and parses the given configurations files.
+ * \param root Handle to the root configuration node.
+ * \param config Handle to the configuration node for this hook.
+ * \param dst The function puts the handle to the configuration node loaded
+ * from the file(s) at the address specified by \p dst.
+ * \param private_data Handle to the private data configuration node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data)
+{
+ snd_config_t *n;
+ snd_config_iterator_t i, next;
+ struct finfo *fi = NULL;
+ int err, idx = 0, fi_count = 0, errors = 1, hit;
+
+ assert(root && dst);
+ if ((err = snd_config_search(config, "errors", &n)) >= 0) {
+ char *tmp;
+ err = snd_config_get_ascii(n, &tmp);
+ if (err < 0)
+ return err;
+ errors = snd_config_get_bool_ascii(tmp);
+ free(tmp);
+ if (errors < 0) {
+ SNDERR("Invalid bool value in field errors");
+ return errors;
+ }
+ }
+ if ((err = snd_config_search(config, "files", &n)) < 0) {
+ SNDERR("Unable to find field files in the pre-load section");
+ return -EINVAL;
+ }
+ if ((err = snd_config_expand(n, root, NULL, private_data, &n)) < 0) {
+ SNDERR("Unable to expand filenames in the pre-load section");
+ return err;
+ }
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for field filenames");
+ goto _err;
+ }
+ snd_config_for_each(i, next, n) {
+ snd_config_t *c = snd_config_iterator_entry(i);
+ const char *str;
+ if ((err = snd_config_get_string(c, &str)) < 0) {
+ SNDERR("Field %s is not a string", c->id);
+ goto _err;
+ }
+ fi_count++;
+ }
+ fi = calloc(fi_count, sizeof(*fi));
+ if (fi == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, n) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = n->id;
+ long i;
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not and integer", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ if (i == idx) {
+ char *name;
+ if ((err = snd_config_get_ascii(n, &name)) < 0)
+ goto _err;
+ if ((err = snd_user_file(name, &fi[idx].name)) < 0)
+ fi[idx].name = name;
+ else
+ free(name);
+ idx++;
+ hit = 1;
+ }
+ }
+ } while (hit);
+ for (idx = 0; idx < fi_count; idx++) {
+ snd_input_t *in;
+ if (!errors && access(fi[idx].name, R_OK) < 0)
+ continue;
+ err = snd_input_stdio_open(&in, fi[idx].name, "r");
+ if (err >= 0) {
+ err = snd_config_load(root, in);
+ snd_input_close(in);
+ if (err < 0) {
+ SNDERR("%s may be old or corrupted: consider to remove or fix it", fi[idx].name);
+ goto _err;
+ }
+ } else {
+ SNDERR("cannot access file %s", fi[idx].name);
+ }
+ }
+ *dst = NULL;
+ err = 0;
+ _err:
+ if (fi)
+ for (idx = 0; idx < fi_count; idx++)
+ free(fi[idx].name);
+ free(fi);
+ snd_config_delete(n);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
+#endif
+
+#ifndef DOC_HIDDEN
+int snd_determine_driver(int card, char **driver);
+#endif
+
+/**
+ * \brief Loads and parses the given configurations files for each installed sound card.
+ * \param root Handle to the root configuration node.
+ * \param config Handle to the configuration node for this hook.
+ * \param dst The function puts the handle to the configuration node loaded
+ * from the file(s) at the address specified by \p dst.
+ * \param private_data Handle to the private data configuration node.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED)
+{
+ int card = -1, err;
+
+ do {
+ err = snd_card_next(&card);
+ if (err < 0)
+ return err;
+ if (card >= 0) {
+ snd_config_t *n, *private_data = NULL;
+ const char *driver;
+ char *fdriver = NULL;
+ err = snd_determine_driver(card, &fdriver);
+ if (err < 0)
+ return err;
+ if (snd_config_search(root, fdriver, &n) >= 0) {
+ if (snd_config_get_string(n, &driver) < 0)
+ goto __err;
+ while (1) {
+ char *s = strchr(driver, '.');
+ if (s == NULL)
+ break;
+ driver = s + 1;
+ }
+ if (snd_config_search(root, driver, &n) >= 0)
+ goto __err;
+ } else {
+ driver = fdriver;
+ }
+ err = snd_config_imake_string(&private_data, "string", driver);
+ if (err < 0)
+ goto __err;
+ err = snd_config_hook_load(root, config, &n, private_data);
+ __err:
+ if (private_data)
+ snd_config_delete(private_data);
+ free(fdriver);
+ if (err < 0)
+ return err;
+ }
+ } while (card >= 0);
+ *dst = NULL;
+ return 0;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
+#endif
+
+/**
+ * \brief Updates a configuration tree by rereading the configuration files (if needed).
+ * \param _top Address of the handle to the top level node.
+ * \param _update Address of a pointer to private update information.
+ * \param cfgs A list of configuration file names, delimited with ':'.
+ * If \p cfgs is set to \c NULL, the default global configuration
+ * file is used ("/usr/share/alsa/alsa.conf").
+ * \return A non-negative value if successful, otherwise a negative error code.
+ * \retval 0 No action is needed.
+ * \retval 1 The configuration tree has been rebuilt.
+ *
+ * The global configuration files are specified in the environment variable
+ * \c ALSA_CONFIG_PATH.
+ *
+ * \warning If the configuration tree is reread, all string pointers and
+ * configuration node handles previously obtained from this tree become invalid.
+ */
+int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, const char *cfgs)
+{
+ int err;
+ const char *configs, *c;
+ unsigned int k;
+ size_t l;
+ snd_config_update_t *local;
+ snd_config_update_t *update;
+ snd_config_t *top;
+
+ assert(_top && _update);
+ top = *_top;
+ update = *_update;
+ configs = cfgs;
+ if (!configs) {
+ configs = getenv(ALSA_CONFIG_PATH_VAR);
+ if (!configs || !*configs)
+ configs = ALSA_CONFIG_PATH_DEFAULT;
+ }
+ for (k = 0, c = configs; (l = strcspn(c, ": ")) > 0; ) {
+ c += l;
+ k++;
+ if (!*c)
+ break;
+ c++;
+ }
+ if (k == 0) {
+ local = NULL;
+ goto _reread;
+ }
+ local = (snd_config_update_t *)calloc(1, sizeof(snd_config_update_t));
+ if (!local)
+ return -ENOMEM;
+ local->count = k;
+ local->finfo = calloc(local->count, sizeof(struct finfo));
+ if (!local->finfo) {
+ free(local);
+ return -ENOMEM;
+ }
+ for (k = 0, c = configs; (l = strcspn(c, ": ")) > 0; ) {
+ char name[l + 1];
+ memcpy(name, c, l);
+ name[l] = 0;
+ err = snd_user_file(name, &local->finfo[k].name);
+ if (err < 0)
+ goto _end;
+ c += l;
+ k++;
+ if (!*c)
+ break;
+ c++;
+ }
+ for (k = 0; k < local->count; ++k) {
+ struct stat st;
+ struct finfo *lf = &local->finfo[k];
+ if (stat(lf->name, &st) >= 0) {
+ lf->dev = st.st_dev;
+ lf->ino = st.st_ino;
+ lf->mtime = st.st_mtime;
+ } else {
+ SNDERR("Cannot access file %s", lf->name);
+ free(lf->name);
+ memmove(&local->finfo[k], &local->finfo[k+1], sizeof(struct finfo) * (local->count - k - 1));
+ k--;
+ local->count--;
+ }
+ }
+ if (!update)
+ goto _reread;
+ if (local->count != update->count)
+ goto _reread;
+ for (k = 0; k < local->count; ++k) {
+ struct finfo *lf = &local->finfo[k];
+ struct finfo *uf = &update->finfo[k];
+ if (strcmp(lf->name, uf->name) != 0 ||
+ lf->dev != uf->dev ||
+ lf->ino != uf->ino ||
+ lf->mtime != uf->mtime)
+ goto _reread;
+ }
+ err = 0;
+
+ _end:
+ if (err < 0) {
+ if (top) {
+ snd_config_delete(top);
+ *_top = NULL;
+ }
+ if (update) {
+ snd_config_update_free(update);
+ *_update = NULL;
+ }
+ }
+ if (local)
+ snd_config_update_free(local);
+ return err;
+
+ _reread:
+ *_top = NULL;
+ *_update = NULL;
+ if (update) {
+ snd_config_update_free(update);
+ update = NULL;
+ }
+ if (top) {
+ snd_config_delete(top);
+ top = NULL;
+ }
+ err = snd_config_top(&top);
+ if (err < 0)
+ goto _end;
+ if (!local)
+ goto _skip;
+ for (k = 0; k < local->count; ++k) {
+ snd_input_t *in;
+ err = snd_input_stdio_open(&in, local->finfo[k].name, "r");
+ if (err >= 0) {
+ err = snd_config_load(top, in);
+ snd_input_close(in);
+ if (err < 0) {
+ SNDERR("%s may be old or corrupted: consider to remove or fix it", local->finfo[k].name);
+ goto _end;
+ }
+ } else {
+ SNDERR("cannot access file %s", local->finfo[k].name);
+ }
+ }
+ _skip:
+ err = snd_config_hooks(top, NULL);
+ if (err < 0) {
+ SNDERR("hooks failed, removing configuration");
+ goto _end;
+ }
+ *_top = top;
+ *_update = local;
+ return 1;
+}
+
+#ifdef HAVE_LIBPTHREAD
+static pthread_mutex_t snd_config_update_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+/**
+ * \brief Updates #snd_config by rereading the global configuration files (if needed).
+ * \return A non-negative value if successful, otherwise a negative error code.
+ * \retval 0 No action is needed.
+ * \retval 1 The configuration tree has been rebuilt.
+ *
+ * The global configuration files are specified in the environment variable
+ * \c ALSA_CONFIG_PATH. If this is not set, the default value is
+ * "/usr/share/alsa/alsa.conf".
+ *
+ * \warning If the configuration tree is reread, all string pointers and
+ * configuration node handles previously obtained from this tree become invalid.
+ */
+int snd_config_update(void)
+{
+ int err;
+
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_lock(&snd_config_update_mutex);
+#endif
+ err = snd_config_update_r(&snd_config, &snd_config_global_update, NULL);
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_unlock(&snd_config_update_mutex);
+#endif
+ return err;
+}
+
+/**
+ * \brief Frees a private update structure.
+ * \param update The private update structure to free.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_update_free(snd_config_update_t *update)
+{
+ unsigned int k;
+
+ assert(update);
+ for (k = 0; k < update->count; k++)
+ free(update->finfo[k].name);
+ free(update->finfo);
+ free(update);
+ return 0;
+}
+
+/**
+ * \brief Frees the global configuration tree in #snd_config.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_config_update_free_global(void)
+{
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_lock(&snd_config_update_mutex);
+#endif
+ if (snd_config)
+ snd_config_delete(snd_config);
+ snd_config = NULL;
+ if (snd_config_global_update)
+ snd_config_update_free(snd_config_global_update);
+ snd_config_global_update = NULL;
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_unlock(&snd_config_update_mutex);
+#endif
+ /* FIXME: better to place this in another place... */
+ snd_dlobj_cache_cleanup();
+
+ return 0;
+}
+
+/**
+ * \brief Returns an iterator pointing to the first child of a compound configuration node.
+ * \param node Handle to the compound configuration node.
+ * \return An iterator pointing to the first child.
+ */
+snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node)
+{
+ assert(node->type == SND_CONFIG_TYPE_COMPOUND);
+ return node->u.compound.fields.next;
+}
+
+/**
+ * \brief Returns an iterator pointing to the next sibling.
+ * \param iterator An iterator pointing to a child configuration node.
+ * \return An iterator pointing to the next sibling of \p iterator.
+ * If \p iterator is the last sibling, the returned value is the same
+ * as the result of calling #snd_config_iterator_end on the father
+ * of the nodes.
+ */
+snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator)
+{
+ return iterator->next;
+}
+
+/**
+ * \brief Returns an iterator pointing past the last child of a compound configuration node.
+ * \param node Handle to the compound configuration node.
+ * \return An iterator pointing past the last child of \p node.
+ */
+snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node)
+{
+ assert(node->type == SND_CONFIG_TYPE_COMPOUND);
+ return (const snd_config_iterator_t)&node->u.compound.fields;
+}
+
+/**
+ * \brief Returns the configuration node handle pointed to by an iterator.
+ * \param iterator A configuration node iterator.
+ * \return The configuration node handle pointed to by \p iterator.
+ */
+snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator)
+{
+ return list_entry(iterator, snd_config_t, list);
+}
+
+#ifndef DOC_HIDDEN
+typedef enum _snd_config_walk_pass {
+ SND_CONFIG_WALK_PASS_PRE,
+ SND_CONFIG_WALK_PASS_POST,
+ SND_CONFIG_WALK_PASS_LEAF,
+} snd_config_walk_pass_t;
+#endif
+
+/* Return 1 if node needs to be attached to father */
+/* Return 2 if compound is replaced with standard node */
+#ifndef DOC_HIDDEN
+typedef int (*snd_config_walk_callback_t)(snd_config_t *src,
+ snd_config_t *root,
+ snd_config_t **dst,
+ snd_config_walk_pass_t pass,
+ snd_config_t *private_data);
+#endif
+
+static int snd_config_walk(snd_config_t *src,
+ snd_config_t *root,
+ snd_config_t **dst,
+ snd_config_walk_callback_t callback,
+ snd_config_t *private_data)
+{
+ int err;
+ snd_config_iterator_t i, next;
+
+ switch (snd_config_get_type(src)) {
+ case SND_CONFIG_TYPE_COMPOUND:
+ err = callback(src, root, dst, SND_CONFIG_WALK_PASS_PRE, private_data);
+ if (err <= 0)
+ return err;
+ snd_config_for_each(i, next, src) {
+ snd_config_t *s = snd_config_iterator_entry(i);
+ snd_config_t *d = NULL;
+
+ err = snd_config_walk(s, root, (dst && *dst) ? &d : NULL,
+ callback, private_data);
+ if (err < 0)
+ goto _error;
+ if (err && d) {
+ err = snd_config_add(*dst, d);
+ if (err < 0)
+ goto _error;
+ }
+ }
+ err = callback(src, root, dst, SND_CONFIG_WALK_PASS_POST, private_data);
+ if (err <= 0) {
+ _error:
+ if (dst && *dst)
+ snd_config_delete(*dst);
+ }
+ break;
+ default:
+ err = callback(src, root, dst, SND_CONFIG_WALK_PASS_LEAF, private_data);
+ break;
+ }
+ return err;
+}
+
+static int _snd_config_copy(snd_config_t *src,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t **dst,
+ snd_config_walk_pass_t pass,
+ snd_config_t *private_data ATTRIBUTE_UNUSED)
+{
+ int err;
+ const char *id = src->id;
+ snd_config_type_t type = snd_config_get_type(src);
+ switch (pass) {
+ case SND_CONFIG_WALK_PASS_PRE:
+ err = snd_config_make_compound(dst, id, src->u.compound.join);
+ if (err < 0)
+ return err;
+ break;
+ case SND_CONFIG_WALK_PASS_LEAF:
+ err = snd_config_make(dst, id, type);
+ if (err < 0)
+ return err;
+ switch (type) {
+ case SND_CONFIG_TYPE_INTEGER:
+ {
+ long v;
+ err = snd_config_get_integer(src, &v);
+ assert(err >= 0);
+ snd_config_set_integer(*dst, v);
+ break;
+ }
+ case SND_CONFIG_TYPE_INTEGER64:
+ {
+ long long v;
+ err = snd_config_get_integer64(src, &v);
+ assert(err >= 0);
+ snd_config_set_integer64(*dst, v);
+ break;
+ }
+ case SND_CONFIG_TYPE_REAL:
+ {
+ double v;
+ err = snd_config_get_real(src, &v);
+ assert(err >= 0);
+ snd_config_set_real(*dst, v);
+ break;
+ }
+ case SND_CONFIG_TYPE_STRING:
+ {
+ const char *s;
+ err = snd_config_get_string(src, &s);
+ assert(err >= 0);
+ err = snd_config_set_string(*dst, s);
+ if (err < 0)
+ return err;
+ break;
+ }
+ default:
+ assert(0);
+ }
+ break;
+ default:
+ break;
+ }
+ return 1;
+}
+
+/**
+ * \brief Creates a copy of a configuration node.
+ * \param dst The function puts the handle to the new configuration node
+ * at the address specified by \p dst.
+ * \param src Handle to the source configuration node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ */
+int snd_config_copy(snd_config_t **dst,
+ snd_config_t *src)
+{
+ return snd_config_walk(src, NULL, dst, _snd_config_copy, NULL);
+}
+
+static int _snd_config_expand(snd_config_t *src,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t **dst,
+ snd_config_walk_pass_t pass,
+ snd_config_t *private_data)
+{
+ int err;
+ const char *id = src->id;
+ snd_config_type_t type = snd_config_get_type(src);
+ switch (pass) {
+ case SND_CONFIG_WALK_PASS_PRE:
+ {
+ if (strcmp(id, "@args") == 0)
+ return 0;
+ err = snd_config_make_compound(dst, id, src->u.compound.join);
+ if (err < 0)
+ return err;
+ break;
+ }
+ case SND_CONFIG_WALK_PASS_LEAF:
+ switch (type) {
+ case SND_CONFIG_TYPE_INTEGER:
+ {
+ long v;
+ err = snd_config_get_integer(src, &v);
+ assert(err >= 0);
+ err = snd_config_imake_integer(dst, id, v);
+ if (err < 0)
+ return err;
+ break;
+ }
+ case SND_CONFIG_TYPE_INTEGER64:
+ {
+ long long v;
+ err = snd_config_get_integer64(src, &v);
+ assert(err >= 0);
+ err = snd_config_imake_integer64(dst, id, v);
+ if (err < 0)
+ return err;
+ break;
+ }
+ case SND_CONFIG_TYPE_REAL:
+ {
+ double v;
+ err = snd_config_get_real(src, &v);
+ assert(err >= 0);
+ err = snd_config_imake_real(dst, id, v);
+ if (err < 0)
+ return err;
+ break;
+ }
+ case SND_CONFIG_TYPE_STRING:
+ {
+ const char *s;
+ snd_config_t *val;
+ snd_config_t *vars = private_data;
+ snd_config_get_string(src, &s);
+ if (*s == '$') {
+ s++;
+ if (snd_config_search(vars, s, &val) < 0)
+ return 0;
+ err = snd_config_copy(dst, val);
+ if (err < 0)
+ return err;
+ err = snd_config_set_id(*dst, id);
+ if (err < 0) {
+ snd_config_delete(*dst);
+ return err;
+ }
+ } else {
+ err = snd_config_imake_string(dst, id, s);
+ if (err < 0)
+ return err;
+ }
+ break;
+ }
+ default:
+ assert(0);
+ }
+ break;
+ default:
+ break;
+ }
+ return 1;
+}
+
+static int _snd_config_evaluate(snd_config_t *src,
+ snd_config_t *root,
+ snd_config_t **dst ATTRIBUTE_UNUSED,
+ snd_config_walk_pass_t pass,
+ snd_config_t *private_data)
+{
+ int err;
+ if (pass == SND_CONFIG_WALK_PASS_PRE) {
+ char *buf = NULL;
+ const char *lib = NULL, *func_name = NULL;
+ const char *str;
+ int (*func)(snd_config_t **dst, snd_config_t *root,
+ snd_config_t *src, snd_config_t *private_data) = NULL;
+ void *h = NULL;
+ snd_config_t *c, *func_conf = NULL;
+ err = snd_config_search(src, "@func", &c);
+ if (err < 0)
+ return 1;
+ err = snd_config_get_string(c, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for @func");
+ return err;
+ }
+ err = snd_config_search_definition(root, "func", str, &func_conf);
+ if (err >= 0) {
+ snd_config_iterator_t i, next;
+ if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for func %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, func_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id = n->id;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "func") == 0) {
+ err = snd_config_get_string(n, &func_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ }
+ }
+ if (!func_name) {
+ int len = 9 + strlen(str) + 1;
+ buf = malloc(len);
+ if (! buf) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ snprintf(buf, len, "snd_func_%s", str);
+ buf[len-1] = '\0';
+ func_name = buf;
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ func = snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ goto _errbuf;
+ } else if (!func) {
+ SNDERR("symbol %s is not defined inside %s", func_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ goto _errbuf;
+ }
+ _err:
+ if (func_conf)
+ snd_config_delete(func_conf);
+ if (err >= 0) {
+ snd_config_t *eval;
+ err = func(&eval, root, src, private_data);
+ if (err < 0)
+ SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
+ snd_dlclose(h);
+ if (err >= 0 && eval) {
+ /* substitute merges compound members */
+ /* we don't want merging at all */
+ err = snd_config_delete_compound_members(src);
+ if (err >= 0)
+ err = snd_config_substitute(src, eval);
+ }
+ }
+ _errbuf:
+ free(buf);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+ return 1;
+}
+
+/**
+ * \brief Evaluates a configuration node at runtime.
+ * \param config Handle to the source configuration node.
+ * \param root Handle to the root of the source configuration.
+ * \param private_data Handle to the private data node for runtime evaluation.
+ * \param result The function puts the handle to the result node at the
+ * address specified by \p result. \p result is \c NULL for
+ * in-place evaluation.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ * \note Only in-place evaluation is currently implemented.
+ */
+int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
+ snd_config_t *private_data, snd_config_t **result)
+{
+ /* FIXME: Only in place evaluation is currently implemented */
+ assert(result == NULL);
+ return snd_config_walk(config, root, result, _snd_config_evaluate, private_data);
+}
+
+static int load_defaults(snd_config_t *subs, snd_config_t *defs)
+{
+ snd_config_iterator_t d, dnext;
+ snd_config_for_each(d, dnext, defs) {
+ snd_config_t *def = snd_config_iterator_entry(d);
+ snd_config_iterator_t f, fnext;
+ if (snd_config_get_type(def) != SND_CONFIG_TYPE_COMPOUND)
+ continue;
+ snd_config_for_each(f, fnext, def) {
+ snd_config_t *fld = snd_config_iterator_entry(f);
+ const char *id = fld->id;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "default") == 0) {
+ snd_config_t *deflt;
+ int err;
+ err = snd_config_copy(&deflt, fld);
+ if (err < 0)
+ return err;
+ err = snd_config_set_id(deflt, def->id);
+ if (err < 0) {
+ snd_config_delete(deflt);
+ return err;
+ }
+ err = snd_config_add(subs, deflt);
+ if (err < 0) {
+ snd_config_delete(deflt);
+ return err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ }
+ return 0;
+}
+
+static void skip_blank(const char **ptr)
+{
+ while (1) {
+ switch (**ptr) {
+ case ' ':
+ case '\f':
+ case '\t':
+ case '\n':
+ case '\r':
+ break;
+ default:
+ return;
+ }
+ (*ptr)++;
+ }
+}
+
+static int parse_char(const char **ptr)
+{
+ int c;
+ assert(**ptr == '\\');
+ (*ptr)++;
+ c = **ptr;
+ switch (c) {
+ case 'n':
+ c = '\n';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case '0' ... '7':
+ {
+ int num = c - '0';
+ int i = 1;
+ (*ptr)++;
+ do {
+ c = **ptr;
+ if (c < '0' || c > '7')
+ break;
+ num = num * 8 + c - '0';
+ i++;
+ (*ptr)++;
+ } while (i < 3);
+ return num;
+ }
+ default:
+ break;
+ }
+ (*ptr)++;
+ return c;
+}
+
+static int parse_id(const char **ptr)
+{
+ if (!**ptr)
+ return -EINVAL;
+ while (1) {
+ switch (**ptr) {
+ case '\f':
+ case '\t':
+ case '\n':
+ case '\r':
+ case ',':
+ case '=':
+ case '\0':
+ return 0;
+ default:
+ break;
+ }
+ (*ptr)++;
+ }
+}
+
+static int parse_string(const char **ptr, char **val)
+{
+ const size_t bufsize = 256;
+ char _buf[bufsize];
+ char *buf = _buf;
+ size_t alloc = bufsize;
+ char delim = **ptr;
+ size_t idx = 0;
+ (*ptr)++;
+ while (1) {
+ int c = **ptr;
+ switch (c) {
+ case '\0':
+ SNDERR("Unterminated string");
+ return -EINVAL;
+ case '\\':
+ c = parse_char(ptr);
+ if (c < 0)
+ return c;
+ break;
+ default:
+ (*ptr)++;
+ if (c == delim) {
+ *val = malloc(idx + 1);
+ if (!*val)
+ return -ENOMEM;
+ memcpy(*val, buf, idx);
+ (*val)[idx] = 0;
+ if (alloc > bufsize)
+ free(buf);
+ return 0;
+ }
+ }
+ if (idx >= alloc) {
+ size_t old_alloc = alloc;
+ alloc *= 2;
+ if (old_alloc == bufsize) {
+ buf = malloc(alloc);
+ memcpy(buf, _buf, old_alloc);
+ } else {
+ buf = realloc(buf, alloc);
+ }
+ if (!buf)
+ return -ENOMEM;
+ }
+ buf[idx++] = c;
+ }
+}
+
+
+/* Parse var=val or val */
+static int parse_arg(const char **ptr, unsigned int *varlen, char **val)
+{
+ const char *str;
+ int err, vallen;
+ skip_blank(ptr);
+ str = *ptr;
+ if (*str == '"' || *str == '\'') {
+ err = parse_string(ptr, val);
+ if (err < 0)
+ return err;
+ *varlen = 0;
+ return 0;
+ }
+ err = parse_id(ptr);
+ if (err < 0)
+ return err;
+ vallen = *ptr - str;
+ skip_blank(ptr);
+ if (**ptr != '=') {
+ *varlen = 0;
+ goto _value;
+ }
+ *varlen = vallen;
+ (*ptr)++;
+ skip_blank(ptr);
+ str = *ptr;
+ if (*str == '"' || *str == '\'') {
+ err = parse_string(ptr, val);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+ err = parse_id(ptr);
+ if (err < 0)
+ return err;
+ vallen = *ptr - str;
+ _value:
+ *val = malloc(vallen + 1);
+ if (!*val)
+ return -ENOMEM;
+ memcpy(*val, str, vallen);
+ (*val)[vallen] = 0;
+ return 0;
+}
+
+
+/* val1, val2, ...
+ * var1=val1,var2=val2,...
+ * { conf syntax }
+ */
+static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
+{
+ int err;
+ int arg = 0;
+ if (str == NULL)
+ return 0;
+ skip_blank(&str);
+ if (!*str)
+ return 0;
+ if (*str == '{') {
+ int len = strlen(str);
+ snd_input_t *input;
+ snd_config_iterator_t i, next;
+ while (1) {
+ switch (str[--len]) {
+ case ' ':
+ case '\f':
+ case '\t':
+ case '\n':
+ case '\r':
+ continue;
+ default:
+ break;
+ }
+ break;
+ }
+ if (str[len] != '}')
+ return -EINVAL;
+ err = snd_input_buffer_open(&input, str + 1, len - 1);
+ if (err < 0)
+ return err;
+ err = snd_config_load_override(subs, input);
+ snd_input_close(input);
+ if (err < 0)
+ return err;
+ snd_config_for_each(i, next, subs) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ snd_config_t *d;
+ const char *id = n->id;
+ err = snd_config_search(defs, id, &d);
+ if (err < 0) {
+ SNDERR("Unknown parameter %s", id);
+ return err;
+ }
+ }
+ return 0;
+ }
+
+ while (1) {
+ char buf[256];
+ const char *var = buf;
+ unsigned int varlen;
+ snd_config_t *def, *sub, *typ;
+ const char *new = str;
+ const char *tmp;
+ char *val = NULL;
+ err = parse_arg(&new, &varlen, &val);
+ if (err < 0)
+ goto _err;
+ if (varlen > 0) {
+ assert(varlen < sizeof(buf));
+ memcpy(buf, str, varlen);
+ buf[varlen] = 0;
+ } else {
+ sprintf(buf, "%d", arg);
+ }
+ err = snd_config_search_alias(defs, NULL, var, &def);
+ if (err < 0) {
+ SNDERR("Unknown parameter %s", var);
+ goto _err;
+ }
+ if (snd_config_get_type(def) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Parameter %s definition is not correct", var);
+ err = -EINVAL;
+ goto _err;
+ }
+ var = def->id;
+ err = snd_config_search(subs, var, &sub);
+ if (err >= 0)
+ snd_config_delete(sub);
+ err = snd_config_search(def, "type", &typ);
+ if (err < 0) {
+ _invalid_type:
+ SNDERR("Parameter %s definition is missing a valid type info", var);
+ goto _err;
+ }
+ err = snd_config_get_string(typ, &tmp);
+ if (err < 0)
+ goto _invalid_type;
+ if (strcmp(tmp, "integer") == 0) {
+ long v;
+ err = snd_config_make(&sub, var, SND_CONFIG_TYPE_INTEGER);
+ if (err < 0)
+ goto _err;
+ err = safe_strtol(val, &v);
+ if (err < 0) {
+ SNDERR("Parameter %s must be an integer", var);
+ goto _err;
+ }
+ err = snd_config_set_integer(sub, v);
+ if (err < 0)
+ goto _err;
+ } else if (strcmp(tmp, "integer64") == 0) {
+ long long v;
+ err = snd_config_make(&sub, var, SND_CONFIG_TYPE_INTEGER64);
+ if (err < 0)
+ goto _err;
+ err = safe_strtoll(val, &v);
+ if (err < 0) {
+ SNDERR("Parameter %s must be an integer", var);
+ goto _err;
+ }
+ err = snd_config_set_integer64(sub, v);
+ if (err < 0)
+ goto _err;
+ } else if (strcmp(tmp, "real") == 0) {
+ double v;
+ err = snd_config_make(&sub, var, SND_CONFIG_TYPE_REAL);
+ if (err < 0)
+ goto _err;
+ err = safe_strtod(val, &v);
+ if (err < 0) {
+ SNDERR("Parameter %s must be a real", var);
+ goto _err;
+ }
+ err = snd_config_set_real(sub, v);
+ if (err < 0)
+ goto _err;
+ } else if (strcmp(tmp, "string") == 0) {
+ err = snd_config_make(&sub, var, SND_CONFIG_TYPE_STRING);
+ if (err < 0)
+ goto _err;
+ err = snd_config_set_string(sub, val);
+ if (err < 0)
+ goto _err;
+ } else {
+ err = -EINVAL;
+ goto _invalid_type;
+ }
+ err = snd_config_set_id(sub, var);
+ if (err < 0)
+ goto _err;
+ err = snd_config_add(subs, sub);
+ if (err < 0) {
+ _err:
+ free(val);
+ return err;
+ }
+ free(val);
+ if (!*new)
+ break;
+ if (*new != ',')
+ return -EINVAL;
+ str = new + 1;
+ arg++;
+ }
+ return 0;
+}
+
+/**
+ * \brief Expands a configuration node applying arguments and functions.
+ * \param config Handle to the configuration node.
+ * \param root Handle to the root configuration node.
+ * \param args Arguments string (optional).
+ * \param private_data Handle to the private data node for functions.
+ * \param result The function puts the handle to the result configuration node
+ * at the address specified by \p result.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ */
+int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args,
+ snd_config_t *private_data, snd_config_t **result)
+{
+ int err;
+ snd_config_t *defs, *subs = NULL, *res;
+ err = snd_config_search(config, "@args", &defs);
+ if (err < 0) {
+ if (args != NULL) {
+ SNDERR("Unknown parameters %s", args);
+ return -EINVAL;
+ }
+ err = snd_config_copy(&res, config);
+ if (err < 0)
+ return err;
+ } else {
+ err = snd_config_top(&subs);
+ if (err < 0)
+ return err;
+ err = load_defaults(subs, defs);
+ if (err < 0) {
+ SNDERR("Load defaults error: %s", snd_strerror(err));
+ goto _end;
+ }
+ err = parse_args(subs, args, defs);
+ if (err < 0) {
+ SNDERR("Parse arguments error: %s", snd_strerror(err));
+ goto _end;
+ }
+ err = snd_config_evaluate(subs, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("Args evaluate error: %s", snd_strerror(err));
+ goto _end;
+ }
+ err = snd_config_walk(config, root, &res, _snd_config_expand, subs);
+ if (err < 0) {
+ SNDERR("Expand error (walk): %s", snd_strerror(err));
+ goto _end;
+ }
+ }
+ err = snd_config_evaluate(res, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("Evaluate error: %s", snd_strerror(err));
+ snd_config_delete(res);
+ goto _end;
+ }
+ *result = res;
+ err = 1;
+ _end:
+ if (subs)
+ snd_config_delete(subs);
+ return err;
+}
+
+/**
+ * \brief Searches for a definition in a configuration tree, using aliases and expanding hooks and arguments.
+ * \param config Handle to the configuration (sub)tree to search.
+ * \param base Implicit key base, or \c NULL for none.
+ * \param name Key suffix.
+ * \param result The function puts the handle to the expanded found node at
+ * the address specified by \p result.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * First the key is tried, then, if nothing is found, base.key is tried.
+ * If the value found is a string, this is recursively tried in the
+ * same way.
+ *
+ * If \p key contains a dot (.), the implicit base is ignored and the key
+ * starts from the root given by \p config.
+ */
+int snd_config_search_definition(snd_config_t *config,
+ const char *base, const char *name,
+ snd_config_t **result)
+{
+ snd_config_t *conf;
+ char *key;
+ const char *args = strchr(name, ':');
+ int err;
+ if (args) {
+ args++;
+ key = alloca(args - name);
+ memcpy(key, name, args - name - 1);
+ key[args - name - 1] = '\0';
+ } else {
+ key = (char *) name;
+ }
+ /*
+ * if key contains dot (.), the implicit base is ignored
+ * and the key starts from root given by the 'config' parameter
+ */
+ err = snd_config_search_alias_hooks(config, strchr(key, '.') ? NULL : base, key, &conf);
+ if (err < 0)
+ return err;
+ return snd_config_expand(conf, config, args, NULL, result);
+}
+
+#ifndef DOC_HIDDEN
+void snd_config_set_hop(snd_config_t *conf, int hop)
+{
+ conf->hop = hop;
+}
+
+int snd_config_check_hop(snd_config_t *conf)
+{
+ if (conf) {
+ if (conf->hop >= SND_CONF_MAX_HOPS) {
+ SYSERR("Too many definition levels (looped?)\n");
+ return -EINVAL;
+ }
+ return conf->hop;
+ }
+ return 0;
+}
+#endif
+
+#if 0
+/* Not strictly needed, but useful to check for memory leaks */
+void _snd_config_end(void) __attribute__ ((destructor));
+
+static void _snd_config_end(void)
+{
+ int k;
+ if (snd_config)
+ snd_config_delete(snd_config);
+ snd_config = 0;
+ for (k = 0; k < files_info_count; ++k)
+ free(files_info[k].name);
+ free(files_info);
+ files_info = NULL;
+ files_info_count = 0;
+}
+#endif
diff --git a/alsa-lib/src/conf/Makefile.am b/alsa-lib/src/conf/Makefile.am
new file mode 100644
index 0000000..2e5d0bf
--- /dev/null
+++ b/alsa-lib/src/conf/Makefile.am
@@ -0,0 +1,15 @@
+SUBDIRS=cards pcm
+
+cfg_files = alsa.conf
+if BUILD_ALISP
+cfg_files += sndo-mixer.alisp
+endif
+if BUILD_MODULES
+cfg_files += smixer.conf
+endif
+
+EXTRA_DIST = $(cfg_files)
+
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)
+alsa_DATA = $(cfg_files)
diff --git a/alsa-lib/src/conf/Makefile.in b/alsa-lib/src/conf/Makefile.in
new file mode 100644
index 0000000..8043576
--- /dev/null
+++ b/alsa-lib/src/conf/Makefile.in
@@ -0,0 +1,610 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_ALISP_TRUE@am__append_1 = sndo-mixer.alisp
+@BUILD_MODULES_TRUE@am__append_2 = smixer.conf
+subdir = src/conf
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsadir)"
+alsaDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(alsa_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = cards pcm
+cfg_files = alsa.conf $(am__append_1) $(am__append_2)
+EXTRA_DIST = $(cfg_files)
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)
+alsa_DATA = $(cfg_files)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/conf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-alsaDATA: $(alsa_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsadir)" || $(mkdir_p) "$(DESTDIR)$(alsadir)"
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(alsadir)/$$f'"; \
+ $(alsaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+
+uninstall-alsaDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(alsadir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-alsaDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-alsaDATA uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-alsaDATA install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-alsaDATA uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/conf/alsa.conf b/alsa-lib/src/conf/alsa.conf
new file mode 100644
index 0000000..db64259
--- /dev/null
+++ b/alsa-lib/src/conf/alsa.conf
@@ -0,0 +1,607 @@
+#
+# ALSA library configuration file
+#
+
+# pre-load the configuration files
+
+@hooks [
+ {
+ func load
+ files [
+ "/etc/asound.conf"
+ "~/.asoundrc"
+ ]
+ errors false
+ }
+]
+
+# load card-specific configuration files (on request)
+
+cards.@hooks [
+ {
+ func load
+ files [
+ {
+ @func concat
+ strings [
+ { @func datadir }
+ "/cards/aliases.conf"
+ ]
+ }
+ ]
+ }
+ {
+ func load_for_all_cards
+ files [
+ {
+ @func concat
+ strings [
+ { @func datadir }
+ "/cards/"
+ { @func private_string }
+ ".conf"
+ ]
+ }
+ ]
+ errors false
+ }
+]
+
+#
+# defaults
+#
+
+# show all name hints also for definitions without hint {} section
+defaults.namehint.showall off
+# show just basic name hints
+defaults.namehint.basic on
+# show extended name hints
+defaults.namehint.extended off
+#
+defaults.ctl.card 0
+defaults.pcm.card 0
+defaults.pcm.device 0
+defaults.pcm.subdevice -1
+defaults.pcm.nonblock 1
+defaults.pcm.ipc_key 5678293
+defaults.pcm.ipc_gid audio
+defaults.pcm.ipc_perm 0660
+defaults.pcm.dmix.max_periods 0
+defaults.pcm.dmix.rate 48000
+defaults.pcm.dmix.format "unchanged"
+defaults.pcm.dmix.card defaults.pcm.card
+defaults.pcm.dmix.device defaults.pcm.device
+defaults.pcm.dsnoop.card defaults.pcm.card
+defaults.pcm.dsnoop.device defaults.pcm.device
+defaults.pcm.front.card defaults.pcm.card
+defaults.pcm.front.device defaults.pcm.device
+defaults.pcm.rear.card defaults.pcm.card
+defaults.pcm.rear.device defaults.pcm.device
+defaults.pcm.center_lfe.card defaults.pcm.card
+defaults.pcm.center_lfe.device defaults.pcm.device
+defaults.pcm.side.card defaults.pcm.card
+defaults.pcm.side.device defaults.pcm.device
+defaults.pcm.surround40.card defaults.pcm.card
+defaults.pcm.surround40.device defaults.pcm.device
+defaults.pcm.surround41.card defaults.pcm.card
+defaults.pcm.surround41.device defaults.pcm.device
+defaults.pcm.surround50.card defaults.pcm.card
+defaults.pcm.surround50.device defaults.pcm.device
+defaults.pcm.surround51.card defaults.pcm.card
+defaults.pcm.surround51.device defaults.pcm.device
+defaults.pcm.surround71.card defaults.pcm.card
+defaults.pcm.surround71.device defaults.pcm.device
+defaults.pcm.iec958.card defaults.pcm.card
+defaults.pcm.iec958.device defaults.pcm.device
+defaults.pcm.modem.card defaults.pcm.card
+defaults.pcm.modem.device defaults.pcm.device
+# truncate files via file or tee PCM
+defaults.pcm.file_format "raw"
+defaults.pcm.file_truncate true
+defaults.rawmidi.card 0
+defaults.rawmidi.device 0
+defaults.rawmidi.subdevice -1
+defaults.hwdep.card 0
+defaults.hwdep.device 0
+defaults.timer.class 2
+defaults.timer.sclass 0
+defaults.timer.card 0
+defaults.timer.device 0
+defaults.timer.subdevice 0
+
+#
+# PCM interface
+#
+
+# redirect to load-on-demand extended pcm definitions
+pcm.cards cards.pcm
+
+pcm.default cards.pcm.default
+pcm.front cards.pcm.front
+pcm.rear cards.pcm.rear
+pcm.center_lfe cards.pcm.center_lfe
+pcm.side cards.pcm.side
+pcm.surround40 cards.pcm.surround40
+pcm.surround41 cards.pcm.surround41
+pcm.surround50 cards.pcm.surround50
+pcm.surround51 cards.pcm.surround51
+pcm.surround71 cards.pcm.surround71
+pcm.iec958 cards.pcm.iec958
+pcm.spdif iec958
+pcm.hdmi cards.pcm.hdmi
+pcm.dmix cards.pcm.dmix
+pcm.dsnoop cards.pcm.dsnoop
+pcm.modem cards.pcm.modem
+pcm.phoneline cards.pcm.phoneline
+
+pcm.hw {
+ @args [ CARD DEV SUBDEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_PCM_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.device
+ }
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.subdevice
+ }
+ }
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.extended
+ }
+ description "Direct hardware device without any conversions"
+ }
+}
+
+pcm.plughw {
+ @args [ CARD DEV SUBDEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_PCM_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.device
+ }
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.subdevice
+ }
+ }
+ type plug
+ slave.pcm {
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.extended
+ }
+ description "Hardware device with all software conversions"
+ }
+}
+
+pcm.plug {
+ @args [ SLAVE ]
+ @args.SLAVE {
+ type string
+ }
+ type plug
+ slave.pcm $SLAVE
+}
+
+pcm.shm {
+ @args [ SOCKET PCM ]
+ @args.SOCKET {
+ type string
+ }
+ @args.PCM {
+ type string
+ }
+ type shm
+ server $SOCKET
+ pcm $PCM
+}
+
+pcm.tee {
+ @args [ SLAVE FILE FORMAT ]
+ @args.SLAVE {
+ type string
+ }
+ @args.FILE {
+ type string
+ }
+ @args.FORMAT {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.file_format
+ }
+ }
+ type file
+ slave.pcm $SLAVE
+ file $FILE
+ format $FORMAT
+ truncate {
+ @func refer
+ name defaults.pcm.file_truncate
+ }
+}
+
+pcm.file {
+ @args [ FILE FORMAT ]
+ @args.FILE {
+ type string
+ }
+ @args.FORMAT {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.file_format
+ }
+ }
+ type file
+ slave.pcm null
+ file $FILE
+ format $FORMAT
+ truncate {
+ @func refer
+ name defaults.pcm.file_truncate
+ }
+}
+
+pcm.null {
+ type null
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "Discard all samples (playback) or generate zero samples (capture)"
+ }
+}
+
+#
+# Control interface
+#
+
+ctl.default {
+ type hw
+ card {
+ @func getenv
+ vars [
+ ALSA_CTL_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.ctl.card
+ }
+ }
+}
+
+ctl.hw {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_CTL_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.ctl.card
+ }
+ }
+ }
+ type hw
+ card $CARD
+}
+
+ctl.shm {
+ @args [ SOCKET CTL ]
+ @args.SOCKET {
+ type string
+ }
+ @args.CTL {
+ type string
+ }
+ type shm
+ server $SOCKET
+ ctl $CTL
+}
+
+#
+# RawMidi interface
+#
+
+rawmidi.default {
+ type hw
+ card {
+ @func getenv
+ vars [
+ ALSA_RAWMIDI_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.rawmidi.card
+ }
+ }
+ device {
+ @func igetenv
+ vars [
+ ALSA_RAWMIDI_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.rawmidi.device
+ }
+ }
+}
+
+rawmidi.hw {
+ @args [ CARD DEV SUBDEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_RAWMIDI_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.rawmidi.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_RAWMIDI_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.rawmidi.device
+ }
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default -1
+ }
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ hint {
+ description "Direct rawmidi driver device"
+ device $DEV
+ }
+}
+
+rawmidi.virtual {
+ @args [ MERGE ]
+ @args.MERGE {
+ type string
+ default 1
+ }
+ type virtual
+ merge $MERGE
+}
+
+#
+# Sequencer interface
+#
+
+seq.default {
+ type hw
+}
+
+seq.hw {
+ type hw
+}
+
+#
+# HwDep interface
+#
+
+hwdep.default {
+ type hw
+ card {
+ @func getenv
+ vars [
+ ALSA_HWDEP_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.hwdep.card
+ }
+ }
+ device {
+ @func igetenv
+ vars [
+ ALSA_HWDEP_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.hwdep.device
+ }
+ }
+}
+
+hwdep.hw {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_HWDEP_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.hwdep.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_HWDEP_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.hwdep.device
+ }
+ }
+ }
+ type hw
+ card $CARD
+ device $DEV
+}
+
+#
+# Timer interface
+#
+
+timer_query.default {
+ type hw
+}
+
+timer_query.hw {
+ type hw
+}
+
+timer.default {
+ type hw
+ class {
+ @func refer
+ name defaults.timer.class
+ }
+ sclass {
+ @func refer
+ name defaults.timer.sclass
+ }
+ card {
+ @func refer
+ name defaults.timer.card
+ }
+ device {
+ @func refer
+ name defaults.timer.device
+ }
+ subdevice {
+ @func refer
+ name defaults.timer.subdevice
+ }
+ hint.description "Default direct hardware timer device"
+}
+
+timer.hw {
+ @args [ CLASS SCLASS CARD DEV SUBDEV ]
+ @args.CLASS {
+ type integer
+ default {
+ @func refer
+ name defaults.timer.class
+ }
+ }
+ @args.SCLASS {
+ type integer
+ default {
+ @func refer
+ name defaults.timer.sclass
+ }
+ }
+ @args.CARD {
+ type string
+ default {
+ @func refer
+ name defaults.timer.card
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func refer
+ name defaults.timer.device
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default {
+ @func refer
+ name defaults.timer.subdevice
+ }
+ }
+ type hw
+ class $CLASS
+ sclass $SCLASS
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+}
diff --git a/alsa-lib/src/conf/cards/AACI.conf b/alsa-lib/src/conf/cards/AACI.conf
new file mode 100644
index 0000000..748586a
--- /dev/null
+++ b/alsa-lib/src/conf/cards/AACI.conf
@@ -0,0 +1,47 @@
+#
+# ALSA library configuration for ARM AACI Primecell PL-041
+#
+
+<confdir:pcm/front.conf>
+
+AACI.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/surround40.conf>
+
+AACI.pcm.surround40.0 "cards.AACI.pcm.front.0"
+
+<confdir:pcm/surround51.conf>
+
+AACI.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.AACI.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 6
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 0 channel 3 }
+ { slave 0 channel 4 }
+ { slave 0 channel 2 }
+ { slave 0 channel 5 }
+ ]
+}
diff --git a/alsa-lib/src/conf/cards/ATIIXP-MODEM.conf b/alsa-lib/src/conf/cards/ATIIXP-MODEM.conf
new file mode 100644
index 0000000..6e52af0
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ATIIXP-MODEM.conf
@@ -0,0 +1,22 @@
+#
+# Configuration for the ATI IXP 150/200/250 modem controllers
+#
+
+<confdir:pcm/modem.conf>
+
+ATIIXP-MODEM.pcm.modem.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ slave.channels 2
+ slave.format S16_LE
+ ttable.0.1 1
+ ttable.1.0 0
+ hint.show off
+}
diff --git a/alsa-lib/src/conf/cards/ATIIXP-SPDMA.conf b/alsa-lib/src/conf/cards/ATIIXP-SPDMA.conf
new file mode 100644
index 0000000..5c80815
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ATIIXP-SPDMA.conf
@@ -0,0 +1,165 @@
+#
+# Configuration for the ATI IXP 150/200/250 chips
+#
+
+<confdir:pcm/front.conf>
+
+ATIIXP-SPDMA.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+ATIIXP.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ATIIXP-SPDMA.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ATIIXP-SPDMA.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ATIIXP-SPDMA.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type iec958
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ format IEC958_SUBFRAME_LE
+ }
+ status [ $AES0 $AES1 $AES2 $AES3 ]
+}
diff --git a/alsa-lib/src/conf/cards/ATIIXP.conf b/alsa-lib/src/conf/cards/ATIIXP.conf
new file mode 100644
index 0000000..38d8023
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ATIIXP.conf
@@ -0,0 +1,184 @@
+#
+# Configuration for the ATI IXP 150/200/250 chips
+#
+
+<confdir:pcm/front.conf>
+
+ATIIXP.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+ATIIXP.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ATIIXP.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ATIIXP.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ATIIXP.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 3
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/AU8810.conf b/alsa-lib/src/conf/cards/AU8810.conf
new file mode 100644
index 0000000..24d46c3
--- /dev/null
+++ b/alsa-lib/src/conf/cards/AU8810.conf
@@ -0,0 +1,38 @@
+#
+# Configuration for the AU8810 chip
+#
+
+<confdir:pcm/front.conf>
+
+AU8810.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/iec958.conf>
+
+AU8810.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hw
+ card $CARD
+ device 1
+}
diff --git a/alsa-lib/src/conf/cards/AU8820.conf b/alsa-lib/src/conf/cards/AU8820.conf
new file mode 100644
index 0000000..0789025
--- /dev/null
+++ b/alsa-lib/src/conf/cards/AU8820.conf
@@ -0,0 +1,14 @@
+#
+# Configuration for the AU8820 chip
+#
+
+<confdir:pcm/front.conf>
+
+AU8820.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
diff --git a/alsa-lib/src/conf/cards/AU8830.conf b/alsa-lib/src/conf/cards/AU8830.conf
new file mode 100644
index 0000000..39e66d5
--- /dev/null
+++ b/alsa-lib/src/conf/cards/AU8830.conf
@@ -0,0 +1,42 @@
+#
+# Configuration for the AU8830 chip
+#
+
+<confdir:pcm/front.conf>
+
+AU8830.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/surround40.conf>
+
+AU8830.pcm.surround40.0 "cards.AU8830.pcm.front.0"
+
+<confdir:pcm/iec958.conf>
+
+AU8830.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hw
+ card $CARD
+ device 1
+}
diff --git a/alsa-lib/src/conf/cards/Audigy.conf b/alsa-lib/src/conf/cards/Audigy.conf
new file mode 100644
index 0000000..ea1e53d
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Audigy.conf
@@ -0,0 +1,318 @@
+#
+# Configuration for the Audigy chip
+#
+
+<confdir:pcm/front.conf>
+
+Audigy.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
+ }
+
+ ]
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+Audigy.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/center_lfe.conf>
+
+Audigy.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+
+Audigy.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround51.conf>
+
+Audigy.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+Audigy.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Optical Raw Playback Switch"
+ lock true
+ preserve true
+ value [ 1 1 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
+ }
+ {
+ name "Audigy Analog/Digital Output Jack"
+ lock true
+ preserve true
+ value 1
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/Audigy2.conf b/alsa-lib/src/conf/cards/Audigy2.conf
new file mode 100644
index 0000000..0290f6f
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Audigy2.conf
@@ -0,0 +1,425 @@
+#
+# Configuration for the Audigy2 chip
+#
+
+<confdir:pcm/front.conf>
+
+Audigy2.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
+ }
+
+ ]
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+Audigy2.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/center_lfe.conf>
+
+Audigy2.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/side.conf>
+
+Audigy2.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+
+Audigy2.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround51.conf>
+
+Audigy2.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround71.conf>
+
+Audigy2.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.Audigy2.pcm.side.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ { slave 3 channel 0 }
+ { slave 3 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+Audigy2.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Optical Raw Playback Switch"
+ lock true
+ preserve true
+ value [ 1 1 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
+ }
+ {
+ name "Audigy Analog/Digital Output Jack"
+ lock true
+ preserve true
+ value 1
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/Aureon51.conf b/alsa-lib/src/conf/cards/Aureon51.conf
new file mode 100644
index 0000000..24b4d94
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Aureon51.conf
@@ -0,0 +1,179 @@
+#
+# Configuration for the Aureon51 (Envy24HT) chip
+#
+
+# default with dmix & dsnoop
+Aureon51.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+Aureon51.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+Aureon51.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 1
+}
+
+<confdir:pcm/center_lfe.conf>
+
+Aureon51.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/side.conf>
+
+Aureon51.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 2
+}
+
+<confdir:pcm/surround40.conf>
+
+Aureon51.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 4
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+Aureon51.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 6
+}
+
+<confdir:pcm/iec958.conf>
+
+Aureon51.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ device 1
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+ capture.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Capture Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+}
diff --git a/alsa-lib/src/conf/cards/Aureon71.conf b/alsa-lib/src/conf/cards/Aureon71.conf
new file mode 100644
index 0000000..1479c25
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Aureon71.conf
@@ -0,0 +1,190 @@
+#
+# Configuration for the Aureon71 (Envy24HT) chip
+#
+
+# default with dmix & dsnoop
+Aureon71.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+Aureon71.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+Aureon71.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/center_lfe.conf>
+
+Aureon71.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 1
+}
+
+<confdir:pcm/side.conf>
+
+Aureon71.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 2
+}
+
+<confdir:pcm/surround40.conf>
+
+Aureon71.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 4
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+Aureon71.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 6
+}
+
+<confdir:pcm/surround71.conf>
+
+Aureon71.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/iec958.conf>
+
+Aureon71.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ device 1
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+ capture.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Capture Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CA0106.conf b/alsa-lib/src/conf/cards/CA0106.conf
new file mode 100644
index 0000000..9d21770
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CA0106.conf
@@ -0,0 +1,280 @@
+#
+# Configuration for the CA0106 chip
+#
+
+# default with dmix & dsnoop
+CA0106.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+CA0106.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+CA0106.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/center_lfe.conf>
+
+CA0106.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/side.conf>
+
+CA0106.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 3
+}
+
+<confdir:pcm/surround40.conf>
+
+CA0106.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+<confdir:pcm/surround71.conf>
+
+CA0106.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+CA0106.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CA0106.pcm.side.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ { slave 3 channel 0 }
+ { slave 3 channel 1 }
+ ]
+}
+
+
+
+
+<confdir:pcm/iec958.conf>
+
+CA0106.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Front Playback Volume"
+ index 0
+ lock true
+ preserve true
+ value [ 207 207 ] # Puts 0x30303030 in the Volume register. 0xff - 0x30 = 0xcf = 207
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value 1
+ }
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ index 1
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ index 1
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CMI8338-SWIEC.conf b/alsa-lib/src/conf/cards/CMI8338-SWIEC.conf
new file mode 100644
index 0000000..af3a579
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CMI8338-SWIEC.conf
@@ -0,0 +1,129 @@
+#
+# Configuration for the CMI8338/8738 chip (w/o multi-channel support)
+# using software IEC958 subframe conversion
+#
+
+<confdir:pcm/front.conf>
+
+CMI8338-SWIEC.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+CMI8338-SWIEC.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+# 2nd DAC
+# FIXME: we need a volume attenuator for rear channel.
+CMI8338-SWIEC.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/surround40.conf>
+
+# for the old CM8738 with 2nd DAC for rear
+CMI8338-SWIEC.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ master 1
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CMI8338-SWIEC.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CMI8338-SWIEC.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+CMI8338-SWIEC.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type iec958
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ status [ $AES0 $AES1 $AES2 $AES3 ]
+ preamble.z 3
+ preamble.y 5
+ preamble.x 9
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CMI8338.conf b/alsa-lib/src/conf/cards/CMI8338.conf
new file mode 100644
index 0000000..144fc9b
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CMI8338.conf
@@ -0,0 +1,143 @@
+#
+# Configuration for the CMI8338/8738 chip (w/o multi-channel support)
+#
+
+<confdir:pcm/front.conf>
+
+CMI8338.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+CMI8338.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+# 2nd DAC
+# FIXME: we need a volume attenuator for rear channel.
+CMI8338.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/surround40.conf>
+
+# for the old CM8738 with 2nd DAC for rear
+CMI8338.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ master 1
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CMI8338.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CMI8338.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+CMI8338.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ device 2
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Loop"
+ lock true
+ preserve true
+ value off
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CMI8738-MC6.conf b/alsa-lib/src/conf/cards/CMI8738-MC6.conf
new file mode 100644
index 0000000..171c772
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CMI8738-MC6.conf
@@ -0,0 +1,161 @@
+#
+# Configuration for the CMI8738 chip with 4/6 multi-channel support
+#
+
+<confdir:pcm/front.conf>
+
+CMI8738-MC6.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+CMI8738-MC6.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+# 2nd DAC
+# FIXME: we need a volume attenuator for rear channel.
+CMI8738-MC6.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/surround40.conf>
+
+CMI8738-MC6.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Four Channel Mode"
+ lock true
+ preserve true
+ value false
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+CMI8738-MC6.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Four Channel Mode"
+ lock true
+ preserve true
+ value false
+ }
+ ]
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+CMI8738-MC6.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ device 2
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Loop"
+ lock true
+ preserve true
+ value off
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CMI8738-MC8.conf b/alsa-lib/src/conf/cards/CMI8738-MC8.conf
new file mode 100644
index 0000000..a5bf6cb
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CMI8738-MC8.conf
@@ -0,0 +1,230 @@
+#
+# Configuration for the CMI8768 chip with 8 multi-channel support
+#
+
+<confdir:pcm/front.conf>
+
+CMI8738-MC8.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+CMI8738-MC8.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+# 2nd DAC
+CMI8738-MC8.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+CMI8738-MC8.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Four Channel Mode"
+ lock true
+ preserve true
+ value false
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+CMI8738-MC8.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Four Channel Mode"
+ lock true
+ preserve true
+ value false
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround71.conf>
+
+CMI8738-MC8.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 8
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Four Channel Mode"
+ lock true
+ preserve true
+ value false
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+CMI8738-MC8.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ device 2
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Loop"
+ lock true
+ preserve true
+ value off
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+}
diff --git a/alsa-lib/src/conf/cards/CMI8788.conf b/alsa-lib/src/conf/cards/CMI8788.conf
new file mode 100644
index 0000000..26910d5
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CMI8788.conf
@@ -0,0 +1,133 @@
+#
+# Configuration for the CMI8788 chip
+#
+
+<confdir:pcm/front.conf>
+
+CMI8788.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix+softvol & dsnoop
+CMI8788.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+CMI8788.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 4
+}
+
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+CMI8788.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 6
+}
+
+<confdir:pcm/surround71.conf>
+
+CMI8788.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ channels 8
+}
+
+<confdir:pcm/iec958.conf>
+
+CMI8788.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ device 1
+ name "IEC958 Playback PCM Stream"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+}
+
+# vim: ft=alsaconf
diff --git a/alsa-lib/src/conf/cards/CS46xx.conf b/alsa-lib/src/conf/cards/CS46xx.conf
new file mode 100644
index 0000000..1983142
--- /dev/null
+++ b/alsa-lib/src/conf/cards/CS46xx.conf
@@ -0,0 +1,218 @@
+#
+# Configuration for the CS46xx chip
+#
+
+<confdir:pcm/front.conf>
+
+CS46xx.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with plughw
+# CS46xx supports multi-playback
+CS46xx.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "hw:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "hw:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+CS46xx.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Duplicate Front"
+ lock true
+ preserve true
+ value 0
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/center_lfe.conf>
+
+CS46xx.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 3
+}
+
+<confdir:pcm/surround40.conf>
+
+CS46xx.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CS46xx.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CS46xx.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+CS46xx.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CS46xx.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CS46xx.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.CS46xx.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+CS46xx.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value 1
+ }
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ device 2
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/EMU10K1.conf b/alsa-lib/src/conf/cards/EMU10K1.conf
new file mode 100644
index 0000000..7a7ebf5
--- /dev/null
+++ b/alsa-lib/src/conf/cards/EMU10K1.conf
@@ -0,0 +1,310 @@
+#
+# Configuration for the EMU10K1 chip
+#
+
+<confdir:pcm/front.conf>
+
+EMU10K1.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+EMU10K1.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/center_lfe.conf>
+
+EMU10K1.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Headphone Center Playback Switch"
+ index 1
+ preserve true
+ # lock true
+ value true
+ }
+ {
+ name "Headphone LFE Playback Switch"
+ index 1
+ preserve true
+ # lock true
+ value true
+ }
+# if you have a creative's digital receiver, you can get surround/center/lfe
+# output through the digital jack. so, the following is commented out.
+# pay attention in case of analog output from the shared center/digital
+# jack!
+# {
+# name "SB Live Analog/Digital Output Jack"
+# preserve true
+# lock true
+# value 0
+# }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
+ }
+ {
+ interface PCM
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "EMU10K1 PCM Send Routing"
+ index { @func private_pcm_subdevice }
+ lock true
+ optional true
+ value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+EMU10K1.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+EMU10K1.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+EMU10K1.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ device 2
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Optical Raw Playback Switch"
+ lock true
+ preserve true
+ value [ 1 1 ]
+ }
+ {
+ name "SB Live Analog/Digital Output Jack"
+ lock true
+ preserve true
+ value 1
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/EMU10K1X.conf b/alsa-lib/src/conf/cards/EMU10K1X.conf
new file mode 100644
index 0000000..b5fc708
--- /dev/null
+++ b/alsa-lib/src/conf/cards/EMU10K1X.conf
@@ -0,0 +1,201 @@
+#
+# Configuration for the EMU10K1X chip
+#
+
+# default with dmix & dsnoop
+EMU10K1X.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+EMU10K1X.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+EMU10K1X.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/center_lfe.conf>
+
+EMU10K1X.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/surround40.conf>
+
+EMU10K1X.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1X.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1X.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+EMU10K1X.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1X.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1X.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.EMU10K1X.pcm.center_lfe.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+EMU10K1X.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Analog/Digital Output Jack"
+ lock true
+ preserve true
+ value 0
+ }
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ index 0
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ index 0
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/ENS1370.conf b/alsa-lib/src/conf/cards/ENS1370.conf
new file mode 100644
index 0000000..32e4782
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ENS1370.conf
@@ -0,0 +1,107 @@
+#
+# Configuration for the ENS1370 chip
+#
+
+<confdir:pcm/front.conf>
+
+ENS1370.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+# default with dmix/dsnoop
+ENS1370.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+ENS1370.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface CARD
+ name "PCM 0 Output also on Line-In Jack"
+ preserve true
+ lock true
+ value true
+ }
+ {
+ name "PCM Switch"
+ preserve true
+ lock true
+ value [ false false ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ENS1370.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ master 1
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.ENS1370.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.ENS1370.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
diff --git a/alsa-lib/src/conf/cards/ENS1371.conf b/alsa-lib/src/conf/cards/ENS1371.conf
new file mode 100644
index 0000000..a6df425
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ENS1371.conf
@@ -0,0 +1,134 @@
+#
+# Configuration for the ENS1370 chip
+#
+
+<confdir:pcm/front.conf>
+
+ENS1371.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+ENS1371.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/rear.conf>
+
+ENS1371.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "AC97 2ch->4ch Copy Switch"
+ lock true
+ preserve true
+ value 0
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ENS1371.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [ "cards.ENS1371.pcm.front.0:CARD=" $CARD ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [ "cards.ENS1371.pcm.rear.0:CARD=" $CARD ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+ENS1371.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/ES1968.conf b/alsa-lib/src/conf/cards/ES1968.conf
new file mode 100644
index 0000000..a6ee119
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ES1968.conf
@@ -0,0 +1,12 @@
+# configuration for ESS Maestro2
+
+<confdir:pcm/front.conf>
+
+ES1968.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
diff --git a/alsa-lib/src/conf/cards/FM801.conf b/alsa-lib/src/conf/cards/FM801.conf
new file mode 100644
index 0000000..997b218
--- /dev/null
+++ b/alsa-lib/src/conf/cards/FM801.conf
@@ -0,0 +1,87 @@
+#
+# Configuration for the FM801 chip
+#
+
+<confdir:pcm/front.conf>
+
+FM801.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+FM801.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+FM801.pcm.surround40.0 "cards.FM801.pcm.front.0"
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+FM801.pcm.surround51.0 "cards.FM801.pcm.front.0"
+
+<confdir:pcm/iec958.conf>
+
+FM801.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ # {
+ # name "IEC958 Playback Default"
+ # value [ $AES0 $AES1 $AES2 $AES3 ]
+ # }
+ {
+ name "IEC958 Raw Data Playback Switch"
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/GUS.conf b/alsa-lib/src/conf/cards/GUS.conf
new file mode 100644
index 0000000..80e3058
--- /dev/null
+++ b/alsa-lib/src/conf/cards/GUS.conf
@@ -0,0 +1,66 @@
+#
+# Configuration for the GUS soundcards
+#
+
+<confdir:pcm/front.conf>
+
+GUS.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
+
+#
+# It's a temporary solution.
+#
+
+!pcm.hw {
+ @args [ CARD DEV SUBDEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_PCM_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.device
+ }
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.subdevice
+ }
+ }
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ mmap_emulation on
+}
diff --git a/alsa-lib/src/conf/cards/HDA-Intel.conf b/alsa-lib/src/conf/cards/HDA-Intel.conf
new file mode 100644
index 0000000..bcbcb9b
--- /dev/null
+++ b/alsa-lib/src/conf/cards/HDA-Intel.conf
@@ -0,0 +1,196 @@
+#
+# Configuration for the Intel HD audio (ICH6/ICH7)
+#
+
+<confdir:pcm/front.conf>
+
+HDA-Intel.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+HDA-Intel.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ control {
+ name "Digital Capture Volume"
+ card $CARD
+ }
+ min_dB -30.0
+ max_dB 30.0
+ resolution 121
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+<confdir:pcm/surround71.conf>
+
+HDA-Intel.pcm.surround40.0 cards.HDA-Intel.pcm.front.0
+HDA-Intel.pcm.surround51.0 cards.HDA-Intel.pcm.front.0
+HDA-Intel.pcm.surround71.0 cards.HDA-Intel.pcm.front.0
+
+<confdir:pcm/iec958.conf>
+
+HDA-Intel.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Capture Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ }
+ hint.device 1
+}
+
+<confdir:pcm/hdmi.conf>
+
+HDA-Intel.pcm.hdmi.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 3
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ hint.device 3
+}
+
+<confdir:pcm/modem.conf>
+
+HDA-Intel.pcm.modem.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 6
+ hint.show off
+}
diff --git a/alsa-lib/src/conf/cards/ICE1712.conf b/alsa-lib/src/conf/cards/ICE1712.conf
new file mode 100644
index 0000000..01e50d2
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ICE1712.conf
@@ -0,0 +1,141 @@
+#
+# Configuration for the ICE1712 (Envy24) chip
+#
+
+# default with dmix & dsnoop
+ICE1712.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+ICE1712.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ICE1712.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ICE1712.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+ ttable.4.4 1
+ ttable.5.5 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ICE1712.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type hooks
+ slave.pcm {
+ type route
+ ttable.0.8 1
+ ttable.1.9 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ slave.format S32_LE
+ slave.channels 10
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+ }
+ capture.pcm {
+ type route
+ ttable.0.8 1
+ ttable.1.9 1
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ slave.format S32_LE
+ slave.channels 12
+ }
+}
diff --git a/alsa-lib/src/conf/cards/ICE1724.conf b/alsa-lib/src/conf/cards/ICE1724.conf
new file mode 100644
index 0000000..e806b36
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ICE1724.conf
@@ -0,0 +1,224 @@
+#
+# Configuration for the ICE1724 (Envy24HT) chip
+#
+
+# default with dmix & dsnoop
+ICE1724.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
+ }
+ }
+}
+
+<confdir:pcm/front.conf>
+
+ICE1724.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+ICE1724.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 1
+}
+
+<confdir:pcm/center_lfe.conf>
+
+ICE1724.pcm.center_lfe.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/side.conf>
+
+ICE1724.pcm.side.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+ subdevice 2
+}
+
+<confdir:pcm/surround40.conf>
+
+ICE1724.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ slave {
+ channels 6
+ pcm {
+ type hw
+ card $CARD
+ }
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ICE1724.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ slave {
+ channels 6
+ pcm {
+ type hw
+ card $CARD
+ }
+ }
+}
+
+<confdir:pcm/surround71.conf>
+
+ICE1724.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ ttable.6.6 1
+ ttable.7.7 1
+ slave {
+ channels 8
+ pcm {
+ type hw
+ card $CARD
+ }
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ICE1724.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type asym
+ playback.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ device 1
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+ capture.pcm {
+ type linear
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface MIXER
+ name "IEC958 Capture Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+ }
+ slave.format S32_LE
+ }
+}
diff --git a/alsa-lib/src/conf/cards/ICH-MODEM.conf b/alsa-lib/src/conf/cards/ICH-MODEM.conf
new file mode 100644
index 0000000..b96b5aa
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ICH-MODEM.conf
@@ -0,0 +1,15 @@
+#
+# Configuration for the Intel/AMD modem controllers
+#
+
+<confdir:pcm/modem.conf>
+
+ICH-MODEM.pcm.modem.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ hint.show off
+}
diff --git a/alsa-lib/src/conf/cards/ICH.conf b/alsa-lib/src/conf/cards/ICH.conf
new file mode 100644
index 0000000..47ffef9
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ICH.conf
@@ -0,0 +1,222 @@
+#
+# Configuration for the Intel ICH/ICH2/ICH3 chips
+#
+
+<confdir:pcm/front.conf>
+
+ICH.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+ICH.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ICH.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ICH.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ slave.channels 6
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ICH.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 0
+ optional true
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/ICH4.conf b/alsa-lib/src/conf/cards/ICH4.conf
new file mode 100644
index 0000000..1bf5605
--- /dev/null
+++ b/alsa-lib/src/conf/cards/ICH4.conf
@@ -0,0 +1,213 @@
+#
+# Configuration for the Intel ICH4/ICH5/ICH6 chips
+#
+
+<confdir:pcm/front.conf>
+
+ICH4.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+ICH4.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+ICH4.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+ICH4.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+ICH4.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 3
+ optional true
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/Maestro3.conf b/alsa-lib/src/conf/cards/Maestro3.conf
new file mode 100644
index 0000000..9432322
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Maestro3.conf
@@ -0,0 +1,38 @@
+# configuration for ESS Maestro3
+
+<confdir:pcm/front.conf>
+
+Maestro3.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+Maestro3.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ # we need to specify device and subdevice numbers
+ # for a device with multiple substreams
+ @func concat
+ strings [ "dmix:" $CARD ",0,0" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
diff --git a/alsa-lib/src/conf/cards/Makefile.am b/alsa-lib/src/conf/cards/Makefile.am
new file mode 100644
index 0000000..f4d6c17
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Makefile.am
@@ -0,0 +1,73 @@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)/cards
+cfg_files = aliases.conf \
+ AACI.conf \
+ ATIIXP.conf \
+ ATIIXP-SPDMA.conf \
+ ATIIXP-MODEM.conf \
+ AU8810.conf \
+ AU8820.conf \
+ AU8830.conf \
+ Audigy.conf \
+ Audigy2.conf \
+ Aureon51.conf \
+ Aureon71.conf \
+ CA0106.conf \
+ CMI8338.conf \
+ CMI8338-SWIEC.conf \
+ CMI8738-MC6.conf \
+ CMI8738-MC8.conf \
+ CMI8788.conf \
+ CS46xx.conf \
+ EMU10K1.conf \
+ EMU10K1X.conf \
+ ENS1370.conf \
+ ENS1371.conf \
+ ES1968.conf \
+ FM801.conf \
+ GUS.conf \
+ HDA-Intel.conf \
+ ICE1712.conf \
+ ICE1724.conf \
+ ICH.conf \
+ ICH4.conf \
+ ICH-MODEM.conf \
+ Maestro3.conf \
+ NFORCE.conf \
+ PC-Speaker.conf \
+ PMac.conf \
+ PMacToonie.conf \
+ PS3.conf \
+ RME9636.conf \
+ RME9652.conf \
+ SI7018.conf \
+ TRID4DWAVENX.conf \
+ USB-Audio.conf \
+ YMF744.conf \
+ VIA686A.conf \
+ VIA8233.conf \
+ VIA8233A.conf \
+ VIA8237.conf \
+ VX222.conf \
+ VXPocket.conf \
+ VXPocket440.conf
+
+if BUILD_ALISP
+cfg_files += aliases.alisp
+endif
+
+alsa_DATA = $(cfg_files)
+
+if BUILD_ALISP
+SI7018dir = $(alsaconfigdir)/cards/SI7018
+SI7018_files = \
+ SI7018/sndoc-mixer.alisp \
+ SI7018/sndop-mixer.alisp
+SI7018_DATA = $(SI7018_files)
+else
+SI7018_files=
+endif
+
+EXTRA_DIST = \
+ $(cfg_files) \
+ $(SI7018_files)
diff --git a/alsa-lib/src/conf/cards/Makefile.in b/alsa-lib/src/conf/cards/Makefile.in
new file mode 100644
index 0000000..b44be0f
--- /dev/null
+++ b/alsa-lib/src/conf/cards/Makefile.in
@@ -0,0 +1,493 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_ALISP_TRUE@am__append_1 = aliases.alisp
+subdir = src/conf/cards
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(SI7018dir)" "$(DESTDIR)$(alsadir)"
+SI7018DATA_INSTALL = $(INSTALL_DATA)
+alsaDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(SI7018_DATA) $(alsa_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)/cards
+cfg_files = aliases.conf AACI.conf ATIIXP.conf ATIIXP-SPDMA.conf \
+ ATIIXP-MODEM.conf AU8810.conf AU8820.conf AU8830.conf \
+ Audigy.conf Audigy2.conf Aureon51.conf Aureon71.conf \
+ CA0106.conf CMI8338.conf CMI8338-SWIEC.conf CMI8738-MC6.conf \
+ CMI8738-MC8.conf CMI8788.conf CS46xx.conf EMU10K1.conf \
+ EMU10K1X.conf ENS1370.conf ENS1371.conf ES1968.conf FM801.conf \
+ GUS.conf HDA-Intel.conf ICE1712.conf ICE1724.conf ICH.conf \
+ ICH4.conf ICH-MODEM.conf Maestro3.conf NFORCE.conf \
+ PC-Speaker.conf PMac.conf PMacToonie.conf PS3.conf \
+ RME9636.conf RME9652.conf SI7018.conf TRID4DWAVENX.conf \
+ USB-Audio.conf YMF744.conf VIA686A.conf VIA8233.conf \
+ VIA8233A.conf VIA8237.conf VX222.conf VXPocket.conf \
+ VXPocket440.conf $(am__append_1)
+alsa_DATA = $(cfg_files)
+@BUILD_ALISP_TRUE@SI7018dir = $(alsaconfigdir)/cards/SI7018
+@BUILD_ALISP_FALSE@SI7018_files =
+@BUILD_ALISP_TRUE@SI7018_files = \
+@BUILD_ALISP_TRUE@ SI7018/sndoc-mixer.alisp \
+@BUILD_ALISP_TRUE@ SI7018/sndop-mixer.alisp
+
+@BUILD_ALISP_TRUE@SI7018_DATA = $(SI7018_files)
+EXTRA_DIST = \
+ $(cfg_files) \
+ $(SI7018_files)
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conf/cards/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/conf/cards/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-SI7018DATA: $(SI7018_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(SI7018dir)" || $(mkdir_p) "$(DESTDIR)$(SI7018dir)"
+ @list='$(SI7018_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(SI7018DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(SI7018dir)/$$f'"; \
+ $(SI7018DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(SI7018dir)/$$f"; \
+ done
+
+uninstall-SI7018DATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(SI7018_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(SI7018dir)/$$f'"; \
+ rm -f "$(DESTDIR)$(SI7018dir)/$$f"; \
+ done
+install-alsaDATA: $(alsa_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsadir)" || $(mkdir_p) "$(DESTDIR)$(alsadir)"
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(alsadir)/$$f'"; \
+ $(alsaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+
+uninstall-alsaDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/SI7018
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(SI7018dir)" "$(DESTDIR)$(alsadir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-SI7018DATA install-alsaDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-SI7018DATA uninstall-alsaDATA \
+ uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-SI7018DATA \
+ install-alsaDATA install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am uninstall uninstall-SI7018DATA uninstall-alsaDATA \
+ uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/conf/cards/NFORCE.conf b/alsa-lib/src/conf/cards/NFORCE.conf
new file mode 100644
index 0000000..6ebefe3
--- /dev/null
+++ b/alsa-lib/src/conf/cards/NFORCE.conf
@@ -0,0 +1,295 @@
+#
+# Configuration for the nVIDIA nForce/2/3
+#
+
+<confdir:pcm/front.conf>
+
+NFORCE.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+NFORCE.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+NFORCE.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+NFORCE.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ slave.channels 6
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/surround71.conf>
+
+NFORCE.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ ttable.6.6 1
+ ttable.7.7 1
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "8ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ slave.channels 8
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+NFORCE.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 0
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/PC-Speaker.conf b/alsa-lib/src/conf/cards/PC-Speaker.conf
new file mode 100644
index 0000000..c82654d
--- /dev/null
+++ b/alsa-lib/src/conf/cards/PC-Speaker.conf
@@ -0,0 +1,52 @@
+#
+# Configuration for PC-Speaker driver
+#
+
+<confdir:pcm/front.conf>
+
+PC-Speaker.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "Master Playback Volume"
+ card $CARD
+ }
+ min_dB -10.0
+ max_dB 20.0
+}
+
+# default with dmix & null
+PC-Speaker.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ control {
+ name "Master Playback Volume"
+ card $CARD
+ }
+ min_dB -10.0
+ max_dB 20.0
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ }
+ capture.pcm {
+ type null
+ }
+}
+
diff --git a/alsa-lib/src/conf/cards/PMac.conf b/alsa-lib/src/conf/cards/PMac.conf
new file mode 100644
index 0000000..d1fdb17
--- /dev/null
+++ b/alsa-lib/src/conf/cards/PMac.conf
@@ -0,0 +1,37 @@
+#
+# Configuration for PMac
+#
+
+<confdir:pcm/front.conf>
+
+PMac.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+PMac.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:CARD=" $CARD ",FORMAT=S16_BE" ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:CARD=" $CARD ",FORMAT=S16_BE" ]
+ }
+ }
+}
diff --git a/alsa-lib/src/conf/cards/PMacToonie.conf b/alsa-lib/src/conf/cards/PMacToonie.conf
new file mode 100644
index 0000000..1e0eb59
--- /dev/null
+++ b/alsa-lib/src/conf/cards/PMacToonie.conf
@@ -0,0 +1,51 @@
+#
+# Configuration for PMac Toonie
+#
+
+<confdir:pcm/front.conf>
+
+PMacToonie.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol & dsnoop
+PMacToonie.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ strings [ "dmix:CARD=" $CARD ",FORMAT=S16_BE" ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:CARD=" $CARD ",FORMAT=S16_BE" ]
+ }
+ }
+}
diff --git a/alsa-lib/src/conf/cards/PS3.conf b/alsa-lib/src/conf/cards/PS3.conf
new file mode 100644
index 0000000..b642f0d
--- /dev/null
+++ b/alsa-lib/src/conf/cards/PS3.conf
@@ -0,0 +1,85 @@
+#
+# Configuration for PS3
+#
+
+<confdir:pcm/front.conf>
+
+PS3.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+}
+
+# default with dmix+softvol
+PS3.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ @func concat
+ #strings [ "dmix:CARD=" $CARD ]
+ strings [ "dmix:CARD=" $CARD ",FORMAT=S16" ]
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+PS3.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/RME9636.conf b/alsa-lib/src/conf/cards/RME9636.conf
new file mode 100644
index 0000000..e8dc5fa
--- /dev/null
+++ b/alsa-lib/src/conf/cards/RME9636.conf
@@ -0,0 +1,61 @@
+#
+# Configuration for the RME9636
+#
+
+<confdir:pcm/front.conf>
+
+RME9636.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# FIXME: This configuration is not valid for double-speed rates.
+
+<confdir:pcm/iec958.conf>
+
+RME9636.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type route
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ }
+ channels 18
+ }
+ ttable.0.16 1
+ ttable.1.17 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ lock true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/RME9652.conf b/alsa-lib/src/conf/cards/RME9652.conf
new file mode 100644
index 0000000..1147d81
--- /dev/null
+++ b/alsa-lib/src/conf/cards/RME9652.conf
@@ -0,0 +1,61 @@
+#
+# Configuration for the RME9652
+#
+
+<confdir:pcm/front.conf>
+
+RME9652.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# FIXME: This configuration is not valid for double-speed rates.
+
+<confdir:pcm/iec958.conf>
+
+RME9652.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type route
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ }
+ channels 26
+ }
+ ttable.0.24 1
+ ttable.1.25 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ lock true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/SI7018.conf b/alsa-lib/src/conf/cards/SI7018.conf
new file mode 100644
index 0000000..15972a4
--- /dev/null
+++ b/alsa-lib/src/conf/cards/SI7018.conf
@@ -0,0 +1,166 @@
+#
+# Configuration for the SI7018 chip
+#
+# This configuration does not reflect hardware.
+#
+
+<confdir:pcm/front.conf>
+
+SI7018.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+SI7018.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "PCM Playback Volume"
+ preserve true
+ lock true
+ value [ 24 24 ]
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+SI7018.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.SI7018.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.SI7018.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+SI7018.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.SI7018.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.SI7018.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.SI7018.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ { slave 2 channel 0 }
+ { slave 2 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+SI7018.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ device 1
+ lock true
+ preserve true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/SI7018/sndoc-mixer.alisp b/alsa-lib/src/conf/cards/SI7018/sndoc-mixer.alisp
new file mode 100644
index 0000000..ade1ea3
--- /dev/null
+++ b/alsa-lib/src/conf/cards/SI7018/sndoc-mixer.alisp
@@ -0,0 +1,11 @@
+;
+; SiS SI7018 mixer abstract layer
+;
+; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
+; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
+;
+
+(defun sndoc_mixer_open (hctl pcm)
+ (princ "sndoc_mixer_open: hctl=" hctl " pcm=" pcm "\n")
+ 0
+)
diff --git a/alsa-lib/src/conf/cards/SI7018/sndop-mixer.alisp b/alsa-lib/src/conf/cards/SI7018/sndop-mixer.alisp
new file mode 100644
index 0000000..285e289
--- /dev/null
+++ b/alsa-lib/src/conf/cards/SI7018/sndop-mixer.alisp
@@ -0,0 +1,11 @@
+;
+; SiS SI7018 mixer abstract layer
+;
+; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
+; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
+;
+
+(defun sndop_mixer_open (hctl pcm)
+ (princ "sndop_mixer_open: hctl=" hctl " pcm=" pcm "\n")
+ 0
+)
diff --git a/alsa-lib/src/conf/cards/TRID4DWAVENX.conf b/alsa-lib/src/conf/cards/TRID4DWAVENX.conf
new file mode 100644
index 0000000..bbf6b7c
--- /dev/null
+++ b/alsa-lib/src/conf/cards/TRID4DWAVENX.conf
@@ -0,0 +1,129 @@
+#
+# Configuration for the Trident 4D-Wave NX chip
+#
+
+<confdir:pcm/front.conf>
+
+TRID4DWAVENX.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+TRID4DWAVENX.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Rear Path"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ name "PCM Front Playback Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ preserve true
+ value 0
+ }
+ {
+ name "PCM Reverb Playback Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ preserve true
+ value 127
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+TRID4DWAVENX.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.TRID4DWAVENX.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.TRID4DWAVENX.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+TRID4DWAVENX.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ device 2
+ lock true
+ preserve true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/USB-Audio.conf b/alsa-lib/src/conf/cards/USB-Audio.conf
new file mode 100644
index 0000000..d6fbec5
--- /dev/null
+++ b/alsa-lib/src/conf/cards/USB-Audio.conf
@@ -0,0 +1,334 @@
+#
+# USB-Audio.conf - configuration for USB Audio devices
+#
+#
+# DO NO EDIT; this is an internal ALSA file.
+# If you want to add your own definitions, put them into /etc/asound.conf or
+# ~/.asoundrc, with "cards." before the "USB-Audio", e.g.:
+#
+# cards.USB-Audio.pcm.use_dmix."NoiseBlaster 3000" no
+#
+# If your device requires such a definition to work correctly, please report it
+# to <alsa-devel@alsa-project.org>.
+
+
+# If a device has sample formats not supported by dmix, dmix can be disabled
+# here.
+USB-Audio.pcm.use_dmix {
+ "AudioPhile" no # uses big-endian 24-bit samples
+}
+
+# If a device does not have a four-channel mode for the front/rear outputs,
+# other modes can be selected here.
+# six_channels - for devices that route the last two of the four channels
+# to the center/LFE outputs
+# two_stereo_devices - for devices that have two stereo audio interfaces
+USB-Audio.pcm.surround40_type {
+ "AudioPhile" two_stereo_devices
+ "OmniStudio" two_stereo_devices
+ "Quattro" two_stereo_devices
+ "SB Audigy 2 NX" six_channels
+}
+
+# If a device does not use the first PCM device for digital data, the device
+# number for the iec958 device can be changed here.
+USB-Audio.pcm.iec958_device {
+ # "NoiseBlaster 3000" 42
+}
+
+
+# If a device requires non-standard definitions for front, surround40,
+# surround51, surround71 or iec958, they can be defined here.
+
+# USB-Audio."NoiseBlaster 3000".pcm.surround51 {
+# @args [ CARD ]
+# @args.CARD { type string }
+# ...
+# }
+
+
+################################################################################
+
+<confdir:pcm/front.conf>
+
+USB-Audio.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD { type string }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio."
+ { @func card_name card $CARD }
+ ".pcm.front:CARD=" $CARD
+ ]
+ }
+ default {
+ # We could use softvol, but the driver might have guessed a
+ # wrong name for the real volume control.
+ type hw
+ card $CARD
+ device 0
+ }
+}
+
+USB-Audio.pcm.default {
+ @args [ CARD ]
+ @args.CARD { type string }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio.pcm.default_playback_dmix_"
+ {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio.pcm.use_dmix."
+ { @func card_name card $CARD }
+ ]
+ }
+ default yes
+ }
+ ":CARD=" $CARD
+ ]
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+USB-Audio.pcm.default_playback_dmix_yes {
+ @args [ CARD ]
+ @args.CARD { type string }
+ @func concat
+ strings [ "dmix:" $CARD ]
+}
+
+USB-Audio.pcm.default_playback_dmix_no {
+ @args [ CARD ]
+ @args.CARD { type string }
+ type hw
+ card $CARD
+ device 0
+}
+
+<confdir:pcm/surround40.conf>
+
+USB-Audio.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD { type string }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio."
+ { @func card_name card $CARD }
+ ".pcm.surround40:CARD=" $CARD
+ ]
+ }
+ default {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio.pcm.surround40_"
+ {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio.pcm.surround40_type."
+ { @func card_name card $CARD }
+ ]
+ }
+ default default
+ }
+ ":CARD=" $CARD
+ ]
+ }
+ }
+}
+
+USB-Audio.pcm.surround40_default {
+ @args [ CARD ]
+ @args.CARD { type string }
+ type hw
+ card $CARD
+ device 0
+}
+
+USB-Audio.pcm.surround40_six_channels {
+ @args [ CARD ]
+ @args.CARD { type string }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ channels 6
+ }
+}
+
+USB-Audio.pcm.surround40_two_stereo_devices {
+ @args [ CARD ]
+ @args.CARD { type string }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+ slave.pcm {
+ type multi
+ slaves {
+ a {
+ pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ channels 2
+ }
+ b {
+ pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ channels 2
+ }
+ }
+ bindings [
+ { slave a channel 0 }
+ { slave a channel 1 }
+ { slave b channel 0 }
+ { slave b channel 1 }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+USB-Audio.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD { type string }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio."
+ { @func card_name card $CARD }
+ ".pcm.surround51:CARD=" $CARD
+ ]
+ }
+ default {
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ channels 6
+ }
+ }
+}
+
+<confdir:pcm/surround71.conf>
+
+USB-Audio.pcm.surround71.0 {
+ @args [ CARD ]
+ @args.CARD { type string }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio."
+ { @func card_name card $CARD }
+ ".pcm.surround71:CARD=" $CARD
+ ]
+ }
+ default {
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ ttable.6.6 1
+ ttable.7.7 1
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ channels 8
+ }
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+USB-Audio.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD { type string }
+ @args.AES0 { type integer }
+ @args.AES1 { type integer }
+ @args.AES2 { type integer }
+ @args.AES3 { type integer }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio."
+ { @func card_name card $CARD }
+ ".pcm.iec958:CARD=" $CARD
+ ",AES0=" $AES0 ",AES1=" $AES1 ",AES2=" $AES2 ",AES3=" $AES3
+ ]
+ }
+ default {
+ # FIXME: we cannot set the AES parameters
+ type hw
+ card $CARD
+ device {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards.USB-Audio.pcm.iec958_device."
+ { @func card_name card $CARD }
+ ]
+ }
+ default 0
+ }
+ }
+}
+
+# vim: ft=alsaconf
diff --git a/alsa-lib/src/conf/cards/VIA686A.conf b/alsa-lib/src/conf/cards/VIA686A.conf
new file mode 100644
index 0000000..e4a06f2
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VIA686A.conf
@@ -0,0 +1,89 @@
+#
+# Configuration for the VIA686A chip
+#
+# SPDIF support is not complete - it might not work, especially with AC3
+# passthru mode...
+#
+
+<confdir:pcm/front.conf>
+
+VIA686A.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+VIA686A.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+VIA686A.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 0
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VIA8233.conf b/alsa-lib/src/conf/cards/VIA8233.conf
new file mode 100644
index 0000000..668bfd9
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VIA8233.conf
@@ -0,0 +1,200 @@
+#
+# Configuration for the VIA8233/VIA8233C/VIA8235 chip with 4/6 multi-channel support
+#
+
+<confdir:pcm/front.conf>
+
+VIA8233.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with softvol/dsnoop
+# VIA8233 supports multi-playback
+VIA8233.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+VIA8233.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+VIA8233.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+VIA8233.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ subdevice 3
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 3
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VIA8233A.conf b/alsa-lib/src/conf/cards/VIA8233A.conf
new file mode 100644
index 0000000..97d2a7d
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VIA8233A.conf
@@ -0,0 +1,204 @@
+#
+# Configuration for the VIA8233A chip with 4/6 multi-channel support
+#
+
+<confdir:pcm/front.conf>
+
+VIA8233A.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with dmix/dsnoop
+VIA8233A.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dmix:" $CARD ]
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+VIA8233A.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Swap Surround Slot"
+ lock true
+ preserve true
+ value false
+ optional true
+ }
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+VIA8233A.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Swap Surround Slot"
+ lock true
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ # for old drivers
+ {
+ name "Line-In As Surround"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Mic As Center/LFE"
+ preserve true
+ value true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/iec958.conf>
+
+VIA8233A.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 3
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VIA8237.conf b/alsa-lib/src/conf/cards/VIA8237.conf
new file mode 100644
index 0000000..404e190
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VIA8237.conf
@@ -0,0 +1,190 @@
+#
+# Configuration for the VIA8237 chip with 4/6 multi-channel support
+#
+
+<confdir:pcm/front.conf>
+
+VIA8237.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+# default with softvol/dsnoop
+# VIA8237 supports multi-playback
+VIA8237.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type softvol
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ control {
+ name "PCM Playback Volume"
+ card $CARD
+ }
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ @func concat
+ strings [ "dsnoop:" $CARD ]
+ }
+ }
+}
+
+<confdir:pcm/surround40.conf>
+
+VIA8237.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 4
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "4ch"
+ lock true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+}
+
+<confdir:pcm/surround41.conf>
+<confdir:pcm/surround50.conf>
+<confdir:pcm/surround51.conf>
+
+VIA8237.pcm.surround51.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type route
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.4 1
+ ttable.3.5 1
+ ttable.4.2 1
+ ttable.5.3 1
+ slave.pcm {
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ channels 6
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Channel Mode"
+ preserve true
+ value "6ch"
+ lock true
+ optional true
+ }
+ {
+ name "Surround Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ {
+ name "Center/LFE Down Mix"
+ preserve true
+ value off
+ lock true
+ optional true
+ }
+ ]
+ }
+ }
+ slave.channels 6
+}
+
+<confdir:pcm/iec958.conf>
+
+VIA8237.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ subdevice 3
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback AC97-SPSA"
+ lock true
+ preserve true
+ value 3
+ }
+ {
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value true
+ }
+ {
+ name "IEC958 Output Switch"
+ lock true
+ preserve true
+ value true
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VX222.conf b/alsa-lib/src/conf/cards/VX222.conf
new file mode 100644
index 0000000..3385f25
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VX222.conf
@@ -0,0 +1,61 @@
+#
+# Configuration for Digigram VX222
+#
+
+<confdir:pcm/front.conf>
+
+VX222.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/iec958.conf>
+
+VX222.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VXPocket.conf b/alsa-lib/src/conf/cards/VXPocket.conf
new file mode 100644
index 0000000..fe44ff5
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VXPocket.conf
@@ -0,0 +1,61 @@
+#
+# Configuration for Digigram VXpocket
+#
+
+<confdir:pcm/front.conf>
+
+VXPocket.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/iec958.conf>
+
+VXPocket.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/VXPocket440.conf b/alsa-lib/src/conf/cards/VXPocket440.conf
new file mode 100644
index 0000000..197c2d6
--- /dev/null
+++ b/alsa-lib/src/conf/cards/VXPocket440.conf
@@ -0,0 +1,110 @@
+#
+# Configuration for Digigram VXpocket440
+#
+
+<confdir:pcm/front.conf>
+
+VXPocket440.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+VXPocket440.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 1
+}
+
+<confdir:pcm/surround40.conf>
+
+VXPocket440.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ master 1
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.VXPocket440.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.VXPocket440.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+VXPocket440.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ interface PCM
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ {
+ # for compatibility with older drivers
+ name "IEC958 Playback Default"
+ lock true
+ preserve true
+ optional true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/YMF744.conf b/alsa-lib/src/conf/cards/YMF744.conf
new file mode 100644
index 0000000..84dbcbe
--- /dev/null
+++ b/alsa-lib/src/conf/cards/YMF744.conf
@@ -0,0 +1,108 @@
+#
+# Configuration for the YMF744 chip
+#
+
+<confdir:pcm/front.conf>
+
+YMF744.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+}
+
+<confdir:pcm/rear.conf>
+
+YMF744.pcm.rear.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 2
+}
+
+<confdir:pcm/surround40.conf>
+
+YMF744.pcm.surround40.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type multi
+ slaves [
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.YMF744.pcm.front.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ {
+ pcm {
+ @func concat
+ strings [
+ "cards.YMF744.pcm.rear.0:CARD=" $CARD
+ ]
+ }
+ channels 2
+ }
+ ]
+ bindings [
+ { slave 0 channel 0 }
+ { slave 0 channel 1 }
+ { slave 1 channel 0 }
+ { slave 1 channel 1 }
+ ]
+}
+
+<confdir:pcm/iec958.conf>
+
+YMF744.pcm.iec958.0 {
+ @args [ CARD AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ }
+ @args.AES0 {
+ type integer
+ }
+ @args.AES1 {
+ type integer
+ }
+ @args.AES2 {
+ type integer
+ }
+ @args.AES3 {
+ type integer
+ }
+ type hooks
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "IEC958 Playback Switch"
+ lock true
+ preserve true
+ value 1
+ }
+ {
+ interface PCM
+ name "IEC958 Playback PCM Stream"
+ device 1
+ lock true
+ preserve true
+ value [ $AES0 $AES1 $AES2 $AES3 ]
+ }
+ ]
+ }
+}
diff --git a/alsa-lib/src/conf/cards/aliases.alisp b/alsa-lib/src/conf/cards/aliases.alisp
new file mode 100644
index 0000000..1661caa
--- /dev/null
+++ b/alsa-lib/src/conf/cards/aliases.alisp
@@ -0,0 +1,29 @@
+(setq snd_card_aliases_array
+ (
+ ("YMF724" . "YMF744")
+ ("YMF724F" . "YMF744")
+ ("YMF740" . "YMF744")
+ ("YMF740C" . "YMF744")
+ ("YMF754" . "YMF744")
+ ("CMIPCI" . "CMI8338")
+ ("CMI8738" . "CMI8338")
+ ("CMI8738-MC4" . "CMI8738-MC6")
+ ("E-mu APS" . "EMU10K1")
+ ("GUS Max" . "GUS")
+ ("GUS ACE" . "GUS")
+ ("GUS Extreme" . "GUS")
+ ("AMD InterWave" . "GUS")
+ ("Dynasonic 3-D" . "GUS")
+ ("InterWave STB" . "GUS")
+ )
+)
+
+(defun snd_card_alias (cardname)
+ (setq r (assq cardname snd_card_aliases_array))
+ (setq r (if (null r) cardname r))
+ (unsetq r)
+)
+
+(defun snd_card_alias_unset ()
+ (unsetq snd_card_aliases_array snd_card_alias)
+)
diff --git a/alsa-lib/src/conf/cards/aliases.conf b/alsa-lib/src/conf/cards/aliases.conf
new file mode 100644
index 0000000..c788621
--- /dev/null
+++ b/alsa-lib/src/conf/cards/aliases.conf
@@ -0,0 +1,57 @@
+#
+# Define aliases for various drivers
+#
+
+YMF724 cards.YMF744
+YMF724F cards.YMF744
+YMF740 cards.YMF744
+YMF740C cards.YMF744
+YMF754 cards.YMF744
+CMIPCI cards.CMI8338
+CMI8738 cards.CMI8338
+CMI8738-SWIEC cards.CMI8338-SWIEC
+CMI8738-MC4 cards.CMI8738-MC6
+'E-mu APS' cards.EMU10K1
+'GUS MAX' cards.GUS
+'GUS ACE' cards.GUS
+'GUS Extreme' cards.GUS
+'AMD InterWave' cards.GUS
+'Dynasonic 3-D' cards.GUS
+'InterWave STB' cards.GUS
+au8810 cards.AU8810
+au8820 cards.AU8820
+au8830 cards.AU8830
+Prodigy71 cards.Aureon71
+Prodigy71LT cards.Aureon71
+Prodigy71HIFI cards.Aureon71
+Aureon71Univ cards.Aureon71
+VIA82XX-MODEM cards.ICH-MODEM
+'MPU-401 UART' cards.MPU-401
+'VX222/Old' cards.VX222
+'VX222/v2' cards.VX222
+'VX222/Mic' cards.VX222
+'CMI8330/C3D' cards.CMI8330
+'SB AWE' cards.SBAWE
+'SB Pro' cards.SBPro
+'PMac Burgundy' cards.PMac
+'PMac DACA' cards.PMac
+'PMac Tumbler' cards.PMac
+'PMac Snapper' cards.PMac
+'PMac Screamer' cards.PMac
+'PMac AWACS' cards.PMac
+'PMac Toonie' cards.PMacToonie
+AppleOnbdAudio cards.PMacToonie
+'USB US-X2Y' cards.US-X2Y
+'Serial MIDI' cards.SerialMIDI
+'Prodif Plus' cards.ProdifPlus
+ESM1 cards.ES1968
+ES1978 cards.ES1968
+Allegro cards.Maestro3
+Canyon3D-2 cards.Maestro3
+Azalia cards.HDA-Intel
+aaci-pl041 cards.AACI
+AV200 cards.CMI8788
+
+<confdir:pcm/default.conf>
+<confdir:pcm/dmix.conf>
+<confdir:pcm/dsnoop.conf>
diff --git a/alsa-lib/src/conf/pcm/Makefile.am b/alsa-lib/src/conf/pcm/Makefile.am
new file mode 100644
index 0000000..cc3286e
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/Makefile.am
@@ -0,0 +1,12 @@
+cfg_files = default.conf front.conf rear.conf center_lfe.conf side.conf\
+ surround40.conf surround41.conf \
+ surround50.conf surround51.conf \
+ surround71.conf iec958.conf hdmi.conf modem.conf \
+ dmix.conf dsnoop.conf \
+ dpl.conf
+
+EXTRA_DIST = $(cfg_files)
+
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)/pcm
+alsa_DATA = $(cfg_files)
diff --git a/alsa-lib/src/conf/pcm/Makefile.in b/alsa-lib/src/conf/pcm/Makefile.in
new file mode 100644
index 0000000..ea64506
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/Makefile.in
@@ -0,0 +1,455 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/conf/pcm
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsadir)"
+alsaDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(alsa_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+cfg_files = default.conf front.conf rear.conf center_lfe.conf side.conf\
+ surround40.conf surround41.conf \
+ surround50.conf surround51.conf \
+ surround71.conf iec958.conf hdmi.conf modem.conf \
+ dmix.conf dsnoop.conf \
+ dpl.conf
+
+EXTRA_DIST = $(cfg_files)
+alsaconfigdir = @ALSA_CONFIG_DIR@
+alsadir = $(alsaconfigdir)/pcm
+alsa_DATA = $(cfg_files)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conf/pcm/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/conf/pcm/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-alsaDATA: $(alsa_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsadir)" || $(mkdir_p) "$(DESTDIR)$(alsadir)"
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(alsadir)/$$f'"; \
+ $(alsaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+
+uninstall-alsaDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(alsadir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-alsaDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-alsaDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-alsaDATA \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-alsaDATA uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/conf/pcm/center_lfe.conf b/alsa-lib/src/conf/pcm/center_lfe.conf
new file mode 100644
index 0000000..4ef6f49
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/center_lfe.conf
@@ -0,0 +1,58 @@
+#
+# Hardware output from center & lfe speakers
+#
+
+pcm.!center_lfe {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_CENTER_LFE_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.center_lfe.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_CENTER_LFE_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.center_lfe.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.center_lfe." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "Center and Subwoofer speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/default.conf b/alsa-lib/src/conf/pcm/default.conf
new file mode 100644
index 0000000..864a903
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/default.conf
@@ -0,0 +1,57 @@
+#
+# Default output
+#
+
+pcm.!default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.card
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ # use card-specific definition if exists
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.default:CARD=" $CARD
+ ]
+ }
+ default {
+ # use plughw as default
+ type plug
+ slave.pcm {
+ type hw
+ card $CARD
+ }
+ hint.device 0
+ }
+ }
+ hint {
+ description "Default Audio Device"
+ device_output {
+ @func refer
+ name defaults.pcm.dmix.device
+ }
+ device_input {
+ @func refer
+ name defaults.pcm.dsnoop.device
+ }
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/dmix.conf b/alsa-lib/src/conf/pcm/dmix.conf
new file mode 100644
index 0000000..4108ddb
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/dmix.conf
@@ -0,0 +1,115 @@
+#
+# dmix output
+#
+
+pcm.!dmix {
+ @args [ CARD DEV SUBDEV FORMAT RATE ]
+ @args.CARD {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.dmix.card
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.dmix.device
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default 0
+ }
+ @args.FORMAT {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.dmix.format
+ }
+ }
+ @args.RATE {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.dmix.rate
+ }
+ }
+ type dmix
+ ipc_key {
+ @func refer
+ name defaults.pcm.ipc_key
+ }
+ ipc_gid {
+ @func refer
+ name defaults.pcm.ipc_gid
+ }
+ ipc_perm {
+ @func refer
+ name defaults.pcm.ipc_perm
+ }
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ }
+ format $FORMAT
+ rate $RATE
+ period_size {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dmix.period_size"
+ ]
+ }
+ default 1024
+ }
+ period_time {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dmix.period_time"
+ ]
+ }
+ default -1
+ }
+ periods {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dmix.periods"
+ ]
+ }
+ default 16
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.extended
+ }
+ description "Direct sample mixing device"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/dpl.conf b/alsa-lib/src/conf/pcm/dpl.conf
new file mode 100644
index 0000000..1009bb3
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/dpl.conf
@@ -0,0 +1,43 @@
+pcm.!dpl {
+ @args [ SLAVE ]
+ @args.SLAVE {
+ type string
+ }
+ type route
+ slave.pcm $SLAVE
+ slave.channels 2
+ # input: FL/FR/SL/SR/C/LFE
+ # S=SL+SR, LFE not used
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.0 0.707
+ ttable.2.1 -0.707
+ ttable.3.0 0.707
+ ttable.3.1 -0.707
+ ttable.4.0 0.707
+ ttable.4.1 0.707
+ ttable.5.0 0
+ ttable.5.1 0
+}
+
+pcm.!dpl2 {
+ @args [SLAVE]
+ @args.SLAVE {
+ type string
+ }
+ type route
+ slave.pcm $SLAVE
+ slave.channels 2
+ # input: FL/FR/SL/SR/C/LFE
+ # LFE not used
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.0 0.866
+ ttable.2.1 -0.5
+ ttable.3.0 0.5
+ ttable.3.1 -0.866
+ ttable.4.0 0.707
+ ttable.4.1 0.707
+ ttable.5.0 0
+ ttable.5.1 0
+}
diff --git a/alsa-lib/src/conf/pcm/dsnoop.conf b/alsa-lib/src/conf/pcm/dsnoop.conf
new file mode 100644
index 0000000..49cfca9
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/dsnoop.conf
@@ -0,0 +1,115 @@
+#
+# dsnoop
+#
+
+pcm.!dsnoop {
+ @args [ CARD DEV SUBDEV FORMAT RATE ]
+ @args.CARD {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.dsnoop.card
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.dsnoop.device
+ }
+ }
+ @args.SUBDEV {
+ type integer
+ default 0
+ }
+ @args.FORMAT {
+ type string
+ default {
+ @func refer
+ name defaults.pcm.dmix.format
+ }
+ }
+ @args.RATE {
+ type integer
+ default {
+ @func refer
+ name defaults.pcm.dmix.rate
+ }
+ }
+ type dsnoop
+ ipc_key {
+ @func refer
+ name defaults.pcm.ipc_key
+ }
+ ipc_gid {
+ @func refer
+ name defaults.pcm.ipc_gid
+ }
+ ipc_perm {
+ @func refer
+ name defaults.pcm.ipc_perm
+ }
+ slave {
+ pcm {
+ type hw
+ card $CARD
+ device $DEV
+ subdevice $SUBDEV
+ }
+ format $FORMAT
+ rate $RATE
+ period_size {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dsnoop.period_size"
+ ]
+ }
+ default 1024
+ }
+ period_time {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dsnoop.period_time"
+ ]
+ }
+ default -1
+ }
+ periods {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.dsnoop.periods"
+ ]
+ }
+ default 16
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.extended
+ }
+ description "Direct sample snooping device"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/front.conf b/alsa-lib/src/conf/pcm/front.conf
new file mode 100644
index 0000000..7aff0cb
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/front.conf
@@ -0,0 +1,58 @@
+#
+# Hardware output from front speakers
+#
+
+pcm.!front {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_FRONT_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.front.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_FRONT_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.front.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.front." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "Front speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/hdmi.conf b/alsa-lib/src/conf/pcm/hdmi.conf
new file mode 100644
index 0000000..aad7065
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/hdmi.conf
@@ -0,0 +1,83 @@
+#
+# Hardware output from HDMI
+#
+
+pcm.!hdmi {
+ @args [ CARD DEV AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_IEC958_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.iec958.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_IEC958_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.iec958.device
+ }
+ }
+ }
+ @args.AES0 {
+ type integer
+ # consumer, not-copyright, emphasis-none, mode=0
+ default 0x04
+ }
+ @args.AES1 {
+ type integer
+ # original, PCM coder
+ default 0x82
+ }
+ @args.AES2 {
+ type integer
+ # source and channel
+ default 0x00
+ }
+ @args.AES3 {
+ type integer
+ # fs=48000Hz, clock accuracy=1000ppm
+ default 0x02
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.hdmi." $DEV ":"
+ "CARD=" $CARD ","
+ "AES0=" $AES0 ","
+ "AES1=" $AES1 ","
+ "AES2=" $AES2 ","
+ "AES3=" $AES3
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "HDMI Audio Output"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/iec958.conf b/alsa-lib/src/conf/pcm/iec958.conf
new file mode 100644
index 0000000..ac139b5
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/iec958.conf
@@ -0,0 +1,83 @@
+#
+# Hardware output from iec958
+#
+
+pcm.!iec958 {
+ @args [ CARD DEV AES0 AES1 AES2 AES3 ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_IEC958_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.iec958.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_IEC958_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.iec958.device
+ }
+ }
+ }
+ @args.AES0 {
+ type integer
+ # consumer, not-copyright, emphasis-none, mode=0
+ default 0x04
+ }
+ @args.AES1 {
+ type integer
+ # original, PCM coder
+ default 0x82
+ }
+ @args.AES2 {
+ type integer
+ # source and channel
+ default 0x00
+ }
+ @args.AES3 {
+ type integer
+ # fs=48000Hz, clock accuracy=1000ppm
+ default 0x02
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.iec958." $DEV ":"
+ "CARD=" $CARD ","
+ "AES0=" $AES0 ","
+ "AES1=" $AES1 ","
+ "AES2=" $AES2 ","
+ "AES3=" $AES3
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "IEC958 (S/PDIF) Digital Audio Output"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/modem.conf b/alsa-lib/src/conf/pcm/modem.conf
new file mode 100644
index 0000000..0af0e72
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/modem.conf
@@ -0,0 +1,106 @@
+#
+# "raw" modem - phoneline
+#
+
+pcm.!phoneline {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_MODEM_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.modem.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_MODEM_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.modem.device
+ }
+ }
+ }
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.modem." $DEV ":CARD=" $CARD
+ ]
+ }
+ hint.show off
+}
+
+#
+# "autohooked" modem
+#
+
+pcm.!modem {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_MODEM_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.modem.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_MODEM_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.modem.device
+ }
+ }
+ }
+ type hooks
+ slave {
+ pcm {
+ @func concat
+ strings [
+ "cards.pcm.phoneline:CARD=" $CARD ",DEV=" $DEV
+ ]
+ }
+ }
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Off-hook Switch"
+ preserve true
+ value "on"
+ lock false
+ optional true
+ }
+ ]
+ }
+ hint.show off
+}
diff --git a/alsa-lib/src/conf/pcm/rear.conf b/alsa-lib/src/conf/pcm/rear.conf
new file mode 100644
index 0000000..85c70aa
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/rear.conf
@@ -0,0 +1,58 @@
+#
+# Hardware output from rear speakers
+#
+
+pcm.!rear {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_REAR_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.rear.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_REAR_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.rear.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.rear." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "Rear speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/side.conf b/alsa-lib/src/conf/pcm/side.conf
new file mode 100644
index 0000000..4a81af0
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/side.conf
@@ -0,0 +1,58 @@
+#
+# Hardware output from side speakers
+#
+
+pcm.!side {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SIDE_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.side.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SIDE_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.side.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.side." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ show {
+ @func refer
+ name defaults.namehint.basic
+ }
+ description "Side speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/surround40.conf b/alsa-lib/src/conf/pcm/surround40.conf
new file mode 100644
index 0000000..361ccaa
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/surround40.conf
@@ -0,0 +1,59 @@
+#
+# Hardware output from 4.0 speakers.
+# Samples must be positioned:
+# chn0 - front left
+# chn1 - front right
+# chn2 - rear left
+# chn3 - rear right
+#
+
+pcm.!surround40 {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SURROUND40_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround40.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SURROUND40_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround40.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.surround40." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ description "4.0 Surround output to Front and Rear speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/surround41.conf b/alsa-lib/src/conf/pcm/surround41.conf
new file mode 100644
index 0000000..10e486e
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/surround41.conf
@@ -0,0 +1,66 @@
+#
+# Hardware output from 4.1 speakers.
+# Samples must be positioned:
+# chn0 - front left
+# chn1 - front right
+# chn2 - rear left
+# chn3 - rear right
+# chn4 - LFE
+#
+
+pcm.!surround41 {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SURROUND41_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround41.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SURROUND41_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround41.device
+ }
+ }
+ }
+ type route
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.surround51." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ slave.channels 6
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+ ttable.4.5 1
+ hint {
+ description "4.1 Surround output to Front, Rear and Subwoofer speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/surround50.conf b/alsa-lib/src/conf/pcm/surround50.conf
new file mode 100644
index 0000000..7b7b17e
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/surround50.conf
@@ -0,0 +1,66 @@
+#
+# Hardware output from 5.0 speakers.
+# Samples must be positioned:
+# chn0 - front left
+# chn1 - front right
+# chn2 - rear left
+# chn3 - rear right
+# chn4 - center
+#
+
+pcm.!surround50 {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SURROUND50_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround50.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SURROUND50_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround50.device
+ }
+ }
+ }
+ type route
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.surround51." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ slave.channels 6
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+ ttable.4.4 1
+ hint {
+ description "5.0 Surround output to Front, Center and Rear speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/surround51.conf b/alsa-lib/src/conf/pcm/surround51.conf
new file mode 100644
index 0000000..3a7543f
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/surround51.conf
@@ -0,0 +1,61 @@
+#
+# Hardware output from 5.1 speakers
+# Samples must be positioned:
+# chn0 - front left
+# chn1 - front right
+# chn2 - rear left
+# chn3 - rear right
+# chn4 - center
+# chn5 - lfe
+#
+
+pcm.!surround51 {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SURROUND51_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround51.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SURROUND51_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround51.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.surround51." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ description "5.1 Surround output to Front, Center, Rear and Subwoofer speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/pcm/surround71.conf b/alsa-lib/src/conf/pcm/surround71.conf
new file mode 100644
index 0000000..eb2360b
--- /dev/null
+++ b/alsa-lib/src/conf/pcm/surround71.conf
@@ -0,0 +1,63 @@
+#
+# Hardware output from 7.1 speakers
+# Samples must be positioned:
+# chn0 - front left
+# chn1 - front right
+# chn2 - rear left
+# chn3 - rear right
+# chn4 - center
+# chn5 - lfe
+# chn7 - side left
+# chn8 - side right
+#
+
+pcm.!surround71 {
+ @args [ CARD DEV ]
+ @args.CARD {
+ type string
+ default {
+ @func getenv
+ vars [
+ ALSA_SURROUND71_CARD
+ ALSA_PCM_CARD
+ ALSA_CARD
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround71.card
+ }
+ }
+ }
+ @args.DEV {
+ type integer
+ default {
+ @func igetenv
+ vars [
+ ALSA_SURROUND71_DEVICE
+ ]
+ default {
+ @func refer
+ name defaults.pcm.surround71.device
+ }
+ }
+ }
+ type empty
+ slave.pcm {
+ @func refer
+ name {
+ @func concat
+ strings [
+ "cards."
+ {
+ @func card_driver
+ card $CARD
+ }
+ ".pcm.surround71." $DEV ":CARD=" $CARD
+ ]
+ }
+ }
+ hint {
+ description "7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"
+ device $DEV
+ }
+}
diff --git a/alsa-lib/src/conf/smixer.conf b/alsa-lib/src/conf/smixer.conf
new file mode 100644
index 0000000..f215661
--- /dev/null
+++ b/alsa-lib/src/conf/smixer.conf
@@ -0,0 +1,13 @@
+_full smixer-python.so
+usb {
+ searchl "USB"
+ lib smixer-usb.so
+}
+ac97 {
+ searchl "AC97a:"
+ lib smixer-ac97.so
+}
+hda {
+ searchl "HDA:"
+ lib smixer-hda.so
+}
diff --git a/alsa-lib/src/conf/sndo-mixer.alisp b/alsa-lib/src/conf/sndo-mixer.alisp
new file mode 100644
index 0000000..c8b03f0
--- /dev/null
+++ b/alsa-lib/src/conf/sndo-mixer.alisp
@@ -0,0 +1,115 @@
+;
+; Toplevel configuration for the ALSA Ordinary Mixer Interface
+;
+; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
+; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
+;
+
+(defun sndo_include (hctl stream)
+ (setq info (Acall "ctl_card_info" (Acall "hctl_ctl" hctl)))
+ (if (= (Aerror info) 0)
+ (progn
+ (setq info (Aresult info))
+ (setq driver (cdr (assq "driver" (unsetq info))))
+ (setq file (concat (path "data") "/alsa/cards/" (snd_card_alias driver) "/sndo" stream "-mixer.alisp"))
+ (setq r (include file))
+ (when (= r -2) (Asyserr "unable to find file " file))
+ )
+ (setq r (Aerror info))
+ )
+ (unsetq info driver file r)
+)
+
+(defun sndo_mixer_open_fcn (hctl stream pcm)
+ (setq fcn (concat "sndo" stream "_mixer_open"))
+ (setq r (if (exfun fcn) (funcall fcn hctl pcm) 0))
+ (when (= r 0)
+ (setq hctls (if hctls (cons hctls (cons hctl)) hctl))
+ )
+ (unsetq fcn r)
+)
+
+(defun sndo_mixer_open_hctl (name stream pcm)
+ (setq hctl (Acall "hctl_open" name nil))
+ (setq r (Aerror hctl))
+ (when (= r 0)
+ (setq hctl (Aresult hctl))
+ (setq r (sndo_include hctl stream))
+ (if (= r 0)
+ (setq r (sndo_mixer_open_fcn hctl stream pcm))
+ (Acall "hctl_close" hctl)
+ )
+ )
+ (unsetq hctl r)
+)
+
+(defun sndo_mixer_open_virtual (name stream pcm)
+ (setq file (concat (path "data") "/alsa/virtual/" name "/sndo" stream "-mixer.alisp"))
+ (setq r (include file))
+ (when (= r -2) (Asyserr "unable to find file " file))
+ (when (= r 0) (setq r (sndo_mixer_open_fcn nil stream pcm)))
+ (unsetq file r)
+)
+
+(defun sndo_mixer_open1 (name stream)
+ (if (compare-strings name 0 2 "hw:" 0 2)
+ (sndo_mixer_open_hctl name stream nil)
+ (sndo_mixer_open_virtual name stream nil)
+ )
+)
+
+(defun sndo_mixer_open (pname cname)
+ (setq r (sndo_mixer_open1 pname "p"))
+ (when (= r 0) (setq r (sndo_mixer_open1 cname "c")))
+ (when (!= r 0) (sndo_mixer_close))
+ (unsetq sndo_mixer_open
+ sndo_mixer_open_pcm sndo_mixer_open_pcm1
+ sndo_mixer_open_virtual sndo_mixer_open_fcn
+ sndo_include r)
+)
+
+(defun sndo_mixer_open_pcm1 (pcm stream)
+ (setq info (Acall "pcm_info" pcm))
+ (setq r (Aerror info))
+ (when (= r 0)
+ (setq info (Aresult info))
+ (setq card (cdr (assq "card" info)))
+ (setq r
+ (if (< card 0)
+ (sndo_mixer_open_virtual (Acall "pcm_name" pcm) stream pcm)
+ (sndo_mixer_open_hctl (format "hw:%i" card) stream pcm)
+ )
+ )
+ )
+ (unsetq info card r)
+)
+
+(defun sndo_mixer_open_pcm (ppcm cpcm)
+ (setq r (sndo_mixer_open_pcm1 ppcm "p"))
+ (when (= r 0) (setq r (sndo_mixer_open_pcm1 cpcm "c")))
+ (when (!= r 0) (sndo_mixer_close))
+ (unsetq sndo_mixer_open
+ sndo_mixer_open_pcm sndo_mixer_open_pcm1
+ sndo_mixer_open_virtual sndo_mixer_open_fcn
+ sndo_include r)
+)
+
+(defun sndo_mixer_close1 (hctl stream)
+ (when hctl
+ (progn
+ (setq fcn (concat "sndo" stream "_mixer_close"))
+ (when (exfun fcn) (funcall fcn hctl))
+ (unsetq fcn)
+ (Acall "hctl_close" hctl)
+ )
+ )
+)
+
+(defun sndo_mixer_close nil
+ (sndo_mixer_close1 (nth 1 hctls) "c")
+ (sndo_mixer_close1 (nth 0 hctls) "p")
+ (snd_card_alias_unset)
+ (unsetq hctls)
+)
+
+(include (concat (path "data") "/alsa/cards/aliases.alisp"))
diff --git a/alsa-lib/src/confmisc.c b/alsa-lib/src/confmisc.c
new file mode 100644
index 0000000..80b0027
--- /dev/null
+++ b/alsa-lib/src/confmisc.c
@@ -0,0 +1,1304 @@
+/**
+ * \file confmisc.c
+ * \ingroup Configuration
+ * \brief Configuration helper functions
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ *
+ * Configuration helper functions.
+ *
+ * See the \ref conffunc page for more details.
+ */
+/*
+ * Miscellaneous configuration helper functions
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>,
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page conffunc
+
+\section conffunc_ref Function reference
+
+<UL>
+ <LI>The getenv function - snd_func_getenv() - obtains
+ an environment value. The result is a string.
+ <LI>The igetenv function - snd_func_igetenv() - obtains
+ an environment value. The result is an integer.
+ <LI>The concat function - snd_func_concat() - merges all specified
+ strings. The result is a string.
+ <LI>The iadd function - snd_func_iadd() - sum all specified integers.
+ The result is an integer.
+ <LI>The imul function - snd_func_imul() - multiply all specified integers.
+ The result is an integer.
+ <LI>The datadir function - snd_func_datadir() - returns the
+ ALSA data directory. The result is a string.
+ <LI>The refer function - snd_func_refer() - copies the referred
+ configuration. The result has the same type as the referred node.
+ <LI>The card_inum function - snd_func_card_inum() - returns
+ a card number (integers).
+ <LI>The card_driver function - snd_func_card_driver() - returns
+ a driver identification. The result is a string.
+ <LI>The card_id function - snd_func_card_id() - returns
+ a card identification. The result is a string.
+ <LI>The card_name function - snd_func_card_name() - returns
+ a card's name. The result is a string.
+ <LI>The pcm_id function - snd_func_pcm_id() - returns
+ a pcm identification. The result is a string.
+ <LI>The private_string function - snd_func_private_string() - returns the
+ string from the private_data node.
+ <LI>The private_card_driver function - snd_func_private_card_driver() -
+ returns the driver identification from the private_data node.
+ The result is a string.
+ <LI>The private_pcm_subdevice function - snd_func_private_pcm_subdevice() -
+ returns the PCM subdevice number from the private_data node.
+ The result is a string.
+</UL>
+
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include "local.h"
+
+/**
+ * \brief Gets the boolean value from the given ASCII string.
+ * \param ascii The string to be parsed.
+ * \return 0 or 1 if successful, otherwise a negative error code.
+ */
+int snd_config_get_bool_ascii(const char *ascii)
+{
+ unsigned int k;
+ static const struct {
+ const char str[8];
+ int val;
+ } b[] = {
+ { "0", 0 },
+ { "1", 1 },
+ { "false", 0 },
+ { "true", 1 },
+ { "no", 0 },
+ { "yes", 1 },
+ { "off", 0 },
+ { "on", 1 },
+ };
+ for (k = 0; k < sizeof(b) / sizeof(*b); k++) {
+ if (strcasecmp(b[k].str, ascii) == 0)
+ return b[k].val;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Gets the boolean value from a configuration node.
+ * \param conf Handle to the configuration node to be parsed.
+ * \return 0 or 1 if successful, otherwise a negative error code.
+ */
+int snd_config_get_bool(const snd_config_t *conf)
+{
+ long v;
+ const char *str, *id;
+ int err;
+
+ err = snd_config_get_id(conf, &id);
+ if (err < 0)
+ return err;
+ err = snd_config_get_integer(conf, &v);
+ if (err >= 0) {
+ if (v < 0 || v > 1) {
+ _invalid_value:
+ SNDERR("Invalid value for %s", id);
+ return -EINVAL;
+ }
+ return v;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ err = snd_config_get_bool_ascii(str);
+ if (err < 0)
+ goto _invalid_value;
+ return err;
+}
+
+/**
+ * \brief Gets the control interface index from the given ASCII string.
+ * \param ascii The string to be parsed.
+ * \return The control interface index if successful, otherwise a negative error code.
+ */
+int snd_config_get_ctl_iface_ascii(const char *ascii)
+{
+ long v;
+ snd_ctl_elem_iface_t idx;
+ if (isdigit(ascii[0])) {
+ if (safe_strtol(ascii, &v) >= 0) {
+ if (v < 0 || v > SND_CTL_ELEM_IFACE_LAST)
+ return -EINVAL;
+ return v;
+ }
+ }
+ for (idx = 0; idx <= SND_CTL_ELEM_IFACE_LAST; idx++) {
+ if (strcasecmp(snd_ctl_elem_iface_name(idx), ascii) == 0)
+ return idx;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Gets the control interface index from a configuration node.
+ * \param conf Handle to the configuration node to be parsed.
+ * \return The control interface index if successful, otherwise a negative error code.
+ */
+int snd_config_get_ctl_iface(const snd_config_t *conf)
+{
+ long v;
+ const char *str, *id;
+ int err;
+
+ err = snd_config_get_id(conf, &id);
+ if (err < 0)
+ return err;
+ err = snd_config_get_integer(conf, &v);
+ if (err >= 0) {
+ if (v < 0 || v > SND_CTL_ELEM_IFACE_LAST) {
+ _invalid_value:
+ SNDERR("Invalid value for %s", id);
+ return -EINVAL;
+ }
+ return v;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ err = snd_config_get_ctl_iface_ascii(str);
+ if (err < 0)
+ goto _invalid_value;
+ return err;
+}
+
+/*
+ * Helper functions for the configuration file
+ */
+
+/**
+ * \brief Returns an environment value.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with definitions for \c vars and
+ * \c default.
+ * \param private_data Handle to the \c private_data node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func getenv
+ vars [ MY_CARD CARD C ]
+ default 0
+ }
+\endcode
+ */
+int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *n, *d;
+ snd_config_iterator_t i, next;
+ const char *res, *id;
+ char *def = NULL;
+ int idx = 0, err, hit;
+
+ err = snd_config_search(src, "vars", &n);
+ if (err < 0) {
+ SNDERR("field vars not found");
+ goto __error;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating vars");
+ goto __error;
+ }
+ err = snd_config_search(src, "default", &d);
+ if (err < 0) {
+ SNDERR("field default not found");
+ goto __error;
+ }
+ err = snd_config_evaluate(d, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating default");
+ goto __error;
+ }
+ err = snd_config_get_ascii(d, &def);
+ if (err < 0) {
+ SNDERR("error getting field default");
+ goto __error;
+ }
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, n) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *ptr;
+ long i;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
+ SNDERR("field %s is not a string", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not an integer", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ if (i == idx) {
+ idx++;
+ err = snd_config_get_string(n, &ptr);
+ if (err < 0) {
+ SNDERR("invalid string for id %s", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ res = getenv(ptr);
+ if (res != NULL && *res != '\0')
+ goto __ok;
+ hit = 1;
+ }
+ }
+ } while (hit);
+ res = def;
+ __ok:
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id, res);
+ __error:
+ free(def);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns an integer environment value.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type integer) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with definitions for \c vars and
+ * \c default.
+ * \param private_data Handle to the \c private_data node.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func igetenv
+ vars [ MY_DEVICE DEVICE D ]
+ default 0
+ }
+\endcode
+ */
+int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *d;
+ const char *str, *id;
+ int err;
+ long v;
+
+ err = snd_func_getenv(&d, root, src, private_data);
+ if (err < 0)
+ return err;
+ err = snd_config_get_string(d, &str);
+ if (err < 0) {
+ snd_config_delete(d);
+ return err;
+ }
+ err = safe_strtol(str, &v);
+ if (err < 0) {
+ snd_config_delete(d);
+ return err;
+ }
+ snd_config_delete(d);
+ err = snd_config_get_id(src, &id);
+ if (err < 0)
+ return err;
+ err = snd_config_imake_integer(dst, id, v);
+ if (err < 0)
+ return err;
+ return 0;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Merges the given strings.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a definition for \c strings.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example (result is "a1b2c3"):
+\code
+ {
+ @func concat
+ strings [ "a1" "b2" "c3" ]
+ }
+\endcode
+ */
+int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *n;
+ snd_config_iterator_t i, next;
+ const char *id;
+ char *res = NULL, *tmp;
+ int idx = 0, len = 0, len1, err, hit;
+
+ err = snd_config_search(src, "strings", &n);
+ if (err < 0) {
+ SNDERR("field strings not found");
+ goto __error;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating strings");
+ goto __error;
+ }
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, n) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ char *ptr;
+ const char *id;
+ long i;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not an integer", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ if (i == idx) {
+ idx++;
+ err = snd_config_get_ascii(n, &ptr);
+ if (err < 0) {
+ SNDERR("invalid ascii string for id %s", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ len1 = strlen(ptr);
+ tmp = realloc(res, len + len1 + 1);
+ if (tmp == NULL) {
+ free(ptr);
+ free(res);
+ err = -ENOMEM;
+ goto __error;
+ }
+ memcpy(tmp + len, ptr, len1);
+ free(ptr);
+ len += len1;
+ tmp[len] = '\0';
+ res = tmp;
+ hit = 1;
+ }
+ }
+ } while (hit);
+ if (res == NULL) {
+ SNDERR("empty string is not accepted");
+ err = -EINVAL;
+ goto __error;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id, res);
+ free(res);
+ __error:
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+
+static int snd_func_iops(snd_config_t **dst,
+ snd_config_t *root,
+ snd_config_t *src,
+ snd_config_t *private_data,
+ int op)
+{
+ snd_config_t *n;
+ snd_config_iterator_t i, next;
+ const char *id;
+ char *res = NULL;
+ long result = 0, val;
+ int idx = 0, err, hit;
+
+ err = snd_config_search(src, "integers", &n);
+ if (err < 0) {
+ SNDERR("field integers not found");
+ goto __error;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating integers");
+ goto __error;
+ }
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, n) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long i;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not an integer", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ if (i == idx) {
+ idx++;
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("invalid integer for id %s", id);
+ err = -EINVAL;
+ goto __error;
+ }
+ switch (op) {
+ case 0: result += val; break;
+ case 1: result *= val; break;
+ }
+ hit = 1;
+ }
+ }
+ } while (hit);
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_integer(dst, id, result);
+ free(res);
+ __error:
+ return err;
+}
+
+
+/**
+ * \brief Sum the given integers.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type integer) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a definition for \c integers.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example (result is 10):
+\code
+ {
+ @func iadd
+ integers [ 2 3 5 ]
+ }
+\endcode
+ */
+int snd_func_iadd(snd_config_t **dst, snd_config_t *root,
+ snd_config_t *src, snd_config_t *private_data)
+{
+ return snd_func_iops(dst, root, src, private_data, 0);
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_iadd, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Multiply the given integers.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type integer) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a definition for \c integers.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example (result is 12):
+\code
+ {
+ @func imul
+ integers [ 2 3 2 ]
+ }
+\endcode
+ */
+int snd_func_imul(snd_config_t **dst, snd_config_t *root,
+ snd_config_t *src, snd_config_t *private_data)
+{
+ return snd_func_iops(dst, root, src, private_data, 1);
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_imul, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the ALSA data directory.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node.
+ * \param private_data Handle to the \c private_data node. Not used.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example (result is "/usr/share/alsa" using the default paths):
+\code
+ {
+ @func datadir
+ }
+\endcode
+ */
+int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED)
+{
+ int err;
+ const char *id;
+
+ err = snd_config_get_id(src, &id);
+ if (err < 0)
+ return err;
+ return snd_config_imake_string(dst, id, ALSA_CONFIG_DIR);
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+static int open_ctl(long card, snd_ctl_t **ctl)
+{
+ char name[16];
+ snprintf(name, sizeof(name), "hw:%li", card);
+ name[sizeof(name)-1] = '\0';
+ return snd_ctl_open(ctl, name, 0);
+}
+
+#if 0
+static int string_from_integer(char **dst, long v)
+{
+ char str[32];
+ char *res;
+ sprintf(str, "%li", v);
+ res = strdup(str);
+ if (res == NULL)
+ return -ENOMEM;
+ *dst = res;
+ return 0;
+}
+#endif
+
+/**
+ * \brief Returns the string from \c private_data.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node.
+ * \param private_data Handle to the \c private_data node (type string,
+ * id "string").
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func private_string
+ }
+\endcode
+ */
+int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *src, snd_config_t *private_data)
+{
+ int err;
+ const char *str, *id;
+
+ if (private_data == NULL)
+ return snd_config_copy(dst, src);
+ err = snd_config_test_id(private_data, "string");
+ if (err) {
+ SNDERR("field string not found");
+ return -EINVAL;
+ }
+ err = snd_config_get_string(private_data, &str);
+ if (err < 0) {
+ SNDERR("field string is not a string");
+ return err;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id, str);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+#ifndef DOC_HIDDEN
+int snd_determine_driver(int card, char **driver)
+{
+ snd_ctl_t *ctl = NULL;
+ snd_ctl_card_info_t *info;
+ char *res = NULL;
+ int err;
+
+ assert(card >= 0 && card <= 32);
+ err = open_ctl(card, &ctl);
+ if (err < 0) {
+ SNDERR("could not open control for card %i", card);
+ goto __error;
+ }
+ snd_ctl_card_info_alloca(&info);
+ err = snd_ctl_card_info(ctl, info);
+ if (err < 0) {
+ SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ goto __error;
+ }
+ res = strdup(snd_ctl_card_info_get_driver(info));
+ if (res == NULL)
+ err = -ENOMEM;
+ else {
+ *driver = res;
+ err = 0;
+ }
+ __error:
+ if (ctl)
+ snd_ctl_close(ctl);
+ return err;
+}
+#endif
+
+/**
+ * \brief Returns the driver identification from \c private_data.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node.
+ * \param private_data Handle to the \c private_data node (type integer,
+ * id "card").
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func private_card_driver
+ }
+\endcode
+ */
+int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ char *driver;
+ const char *id;
+ int err;
+ long card;
+
+ err = snd_config_test_id(private_data, "card");
+ if (err) {
+ SNDERR("field card not found");
+ return -EINVAL;
+ }
+ err = snd_config_get_integer(private_data, &card);
+ if (err < 0) {
+ SNDERR("field card is not an integer");
+ return err;
+ }
+ if ((err = snd_determine_driver(card, &driver)) < 0)
+ return err;
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id, driver);
+ free(driver);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_private_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+static int parse_card(snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *n;
+ char *str;
+ int card, err;
+
+ err = snd_config_search(src, "card", &n);
+ if (err < 0) {
+ SNDERR("field card not found");
+ return err;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating card");
+ return err;
+ }
+ err = snd_config_get_ascii(n, &str);
+ if (err < 0) {
+ SNDERR("field card is not an integer or a string");
+ return err;
+ }
+ card = snd_card_get_index(str);
+ if (card < 0)
+ SNDERR("cannot find card '%s'", str);
+ free(str);
+ return card;
+}
+
+/**
+ * \brief Returns the card number as integer.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a \c card definition.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func card_inum
+ card '0'
+ }
+\endcode
+ */
+int snd_func_card_inum(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ const char *id;
+ int card, err;
+
+ card = parse_card(root, src, private_data);
+ if (card < 0)
+ return card;
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_integer(dst, id, card);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_card_inum, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the driver identification for a card.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a \c card definition.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func card_driver
+ card 0
+ }
+\endcode
+ */
+int snd_func_card_driver(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *val;
+ int card, err;
+
+ card = parse_card(root, src, private_data);
+ if (card < 0)
+ return card;
+ err = snd_config_imake_integer(&val, "card", card);
+ if (err < 0)
+ return err;
+ err = snd_func_private_card_driver(dst, root, src, val);
+ snd_config_delete(val);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the identification of a card.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a \c card definition.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func card_id
+ card 0
+ }
+\endcode
+ */
+int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_ctl_t *ctl = NULL;
+ snd_ctl_card_info_t *info;
+ const char *id;
+ int card, err;
+
+ card = parse_card(root, src, private_data);
+ if (card < 0)
+ return card;
+ err = open_ctl(card, &ctl);
+ if (err < 0) {
+ SNDERR("could not open control for card %i", card);
+ goto __error;
+ }
+ snd_ctl_card_info_alloca(&info);
+ err = snd_ctl_card_info(ctl, info);
+ if (err < 0) {
+ SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ goto __error;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id,
+ snd_ctl_card_info_get_id(info));
+ __error:
+ if (ctl)
+ snd_ctl_close(ctl);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the name of a card.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with a \c card definition.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func card_name
+ card 0
+ }
+\endcode
+ */
+int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
+ snd_config_t *src, snd_config_t *private_data)
+{
+ snd_ctl_t *ctl = NULL;
+ snd_ctl_card_info_t *info;
+ const char *id;
+ int card, err;
+
+ card = parse_card(root, src, private_data);
+ if (card < 0)
+ return card;
+ err = open_ctl(card, &ctl);
+ if (err < 0) {
+ SNDERR("could not open control for card %i", card);
+ goto __error;
+ }
+ snd_ctl_card_info_alloca(&info);
+ err = snd_ctl_card_info(ctl, info);
+ if (err < 0) {
+ SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ goto __error;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id,
+ snd_ctl_card_info_get_name(info));
+ __error:
+ if (ctl)
+ snd_ctl_close(ctl);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+#ifdef BUILD_PCM
+
+/**
+ * \brief Returns the pcm identification of a device.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with definitions for \c card,
+ * \c device and (optionally) \c subdevice.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func pcm_id
+ card 0
+ device 0
+ subdevice 0 # optional
+ }
+\endcode
+ */
+int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
+{
+ snd_config_t *n;
+ snd_ctl_t *ctl = NULL;
+ snd_pcm_info_t *info;
+ const char *id;
+ long card, device, subdevice = 0;
+ int err;
+
+ card = parse_card(root, src, private_data);
+ if (card < 0)
+ return card;
+ err = snd_config_search(src, "device", &n);
+ if (err < 0) {
+ SNDERR("field device not found");
+ goto __error;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating device");
+ goto __error;
+ }
+ err = snd_config_get_integer(n, &device);
+ if (err < 0) {
+ SNDERR("field device is not an integer");
+ goto __error;
+ }
+ if (snd_config_search(src, "subdevice", &n) >= 0) {
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating subdevice");
+ goto __error;
+ }
+ err = snd_config_get_integer(n, &subdevice);
+ if (err < 0) {
+ SNDERR("field subdevice is not an integer");
+ goto __error;
+ }
+ }
+ err = open_ctl(card, &ctl);
+ if (err < 0) {
+ SNDERR("could not open control for card %li", card);
+ goto __error;
+ }
+ snd_pcm_info_alloca(&info);
+ snd_pcm_info_set_device(info, device);
+ snd_pcm_info_set_subdevice(info, subdevice);
+ err = snd_ctl_pcm_info(ctl, info);
+ if (err < 0) {
+ SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
+ goto __error;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_string(dst, id, snd_pcm_info_get_id(info));
+ __error:
+ if (ctl)
+ snd_ctl_close(ctl);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the pcm card and device arguments (in form CARD=N,DEV=M)
+ * for pcm specified by class and index.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type string) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with definitions for \c class
+ * and \c index.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func pcm_args_by_class
+ class 0
+ index 0
+ }
+\endcode
+ */
+int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
+{
+ snd_config_t *n;
+ snd_ctl_t *ctl = NULL;
+ snd_pcm_info_t *info;
+ const char *id;
+ int card = -1, dev;
+ long class, index;
+ int idx = 0;
+ int err;
+
+ err = snd_config_search(src, "class", &n);
+ if (err < 0) {
+ SNDERR("field class not found");
+ goto __out;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating class");
+ goto __out;
+ }
+ err = snd_config_get_integer(n, &class);
+ if (err < 0) {
+ SNDERR("field class is not an integer");
+ goto __out;
+ }
+ err = snd_config_search(src, "index", &n);
+ if (err < 0) {
+ SNDERR("field index not found");
+ goto __out;
+ }
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating index");
+ goto __out;
+ }
+ err = snd_config_get_integer(n, &index);
+ if (err < 0) {
+ SNDERR("field index is not an integer");
+ goto __out;
+ }
+
+ snd_pcm_info_alloca(&info);
+ while(1) {
+ err = snd_card_next(&card);
+ if (err < 0) {
+ SNDERR("could not get next card");
+ goto __out;
+ }
+ if (card < 0)
+ break;
+ err = open_ctl(card, &ctl);
+ if (err < 0) {
+ SNDERR("could not open control for card %i", card);
+ goto __out;
+ }
+ dev = -1;
+ memset(info, 0, snd_pcm_info_sizeof());
+ while(1) {
+ err = snd_ctl_pcm_next_device(ctl, &dev);
+ if (err < 0) {
+ SNDERR("could not get next pcm for card %i", card);
+ goto __out;
+ }
+ if (dev < 0)
+ break;
+ snd_pcm_info_set_device(info, dev);
+ err = snd_ctl_pcm_info(ctl, info);
+ if (err < 0)
+ continue;
+ if (snd_pcm_info_get_class(info) == (snd_pcm_class_t)class &&
+ index == idx++)
+ goto __out;
+ }
+ snd_ctl_close(ctl);
+ ctl = NULL;
+ }
+ err = -ENODEV;
+
+ __out:
+ if (ctl)
+ snd_ctl_close(ctl);
+ if (err < 0)
+ return err;
+ if((err = snd_config_get_id(src, &id)) >= 0) {
+ char name[32];
+ snprintf(name, sizeof(name), "CARD=%i,DEV=%i", card, dev);
+ err = snd_config_imake_string(dst, id, name);
+ }
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+/**
+ * \brief Returns the PCM subdevice from \c private_data.
+ * \param dst The function puts the handle to the result configuration node
+ * (with type integer) at the address specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node.
+ * \param private_data Handle to the \c private_data node (type pointer,
+ * id "pcm_handle").
+ * \return A non-negative value if successful, otherwise a negative error code.
+ *
+ * Example:
+\code
+ {
+ @func private_pcm_subdevice
+ }
+\endcode
+ */
+int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *src, snd_config_t *private_data)
+{
+ snd_pcm_info_t *info;
+ const char *id;
+ const void *data;
+ snd_pcm_t *pcm;
+ int err;
+
+ if (private_data == NULL)
+ return snd_config_copy(dst, src);
+ err = snd_config_test_id(private_data, "pcm_handle");
+ if (err) {
+ SNDERR("field pcm_handle not found");
+ return -EINVAL;
+ }
+ err = snd_config_get_pointer(private_data, &data);
+ pcm = (snd_pcm_t *)data;
+ if (err < 0) {
+ SNDERR("field pcm_handle is not a pointer");
+ return err;
+ }
+ snd_pcm_info_alloca(&info);
+ err = snd_pcm_info(pcm, info);
+ if (err < 0) {
+ SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_imake_integer(dst, id, snd_pcm_info_get_subdevice(info));
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
+
+#endif /* BUILD_PCM */
+
+/**
+ * \brief Copies the specified configuration node.
+ * \param dst The function puts the handle to the result configuration node
+ * (with the same type as the specified node) at the address
+ * specified by \p dst.
+ * \param root Handle to the root source node.
+ * \param src Handle to the source node, with definitions for \c name and
+ * (optionally) \c file.
+ * \param private_data Handle to the \c private_data node.
+ * \return A non-negative value if successful, otherwise a negative error code.
+ * \note The root source node can be modified!
+ *
+ * Example:
+\code
+ {
+ @func refer
+ file "/etc/myconf.conf" # optional
+ name "id1.id2.id3"
+ }
+\endcode
+ */
+int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
+ snd_config_t *private_data)
+{
+ snd_config_t *n;
+ const char *file = NULL, *name = NULL;
+ int err;
+
+ err = snd_config_search(src, "file", &n);
+ if (err >= 0) {
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating file");
+ goto _end;
+ }
+ err = snd_config_get_string(n, &file);
+ if (err < 0) {
+ SNDERR("file is not a string");
+ goto _end;
+ }
+ }
+ err = snd_config_search(src, "name", &n);
+ if (err >= 0) {
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0) {
+ SNDERR("error evaluating name");
+ goto _end;
+ }
+ err = snd_config_get_string(n, &name);
+ if (err < 0) {
+ SNDERR("name is not a string");
+ goto _end;
+ }
+ }
+ if (!name) {
+ err = -EINVAL;
+ SNDERR("name is not specified");
+ goto _end;
+ }
+ if (file) {
+ snd_input_t *input;
+ err = snd_input_stdio_open(&input, file, "r");
+ if (err < 0) {
+ SNDERR("Unable to open file %s: %s", file, snd_strerror(err));
+ goto _end;
+ }
+ err = snd_config_load(root, input);
+ snd_input_close(input);
+ if (err < 0)
+ goto _end;
+ }
+ err = snd_config_search_definition(root, NULL, name, dst);
+ if (err >= 0) {
+ const char *id;
+ err = snd_config_get_id(src, &id);
+ if (err >= 0)
+ err = snd_config_set_id(*dst, id);
+ } else {
+ err = snd_config_search(src, "default", &n);
+ if (err < 0)
+ SNDERR("Unable to find definition '%s'", name);
+ else {
+ const char *id;
+ err = snd_config_evaluate(n, root, private_data, NULL);
+ if (err < 0)
+ return err;
+ if ((err = snd_config_copy(dst, n)) >= 0) {
+ if ((err = snd_config_get_id(src, &id)) < 0 ||
+ (err = snd_config_set_id(*dst, id)) < 0)
+ snd_config_delete(*dst);
+ }
+ }
+ }
+ _end:
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE);
+#endif
diff --git a/alsa-lib/src/control/Makefile.am b/alsa-lib/src/control/Makefile.am
new file mode 100644
index 0000000..d4c50c0
--- /dev/null
+++ b/alsa-lib/src/control/Makefile.am
@@ -0,0 +1,17 @@
+EXTRA_LTLIBRARIES = libcontrol.la
+
+libcontrol_la_SOURCES = cards.c tlv.c namehint.c hcontrol.c \
+ control.c control_hw.c setup.c control_symbols.c
+if BUILD_CTL_PLUGIN_SHM
+libcontrol_la_SOURCES += control_shm.c
+endif
+if BUILD_CTL_PLUGIN_EXT
+libcontrol_la_SOURCES += control_ext.c
+endif
+
+noinst_HEADERS = control_local.h
+
+all: libcontrol.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/control/Makefile.in b/alsa-lib/src/control/Makefile.in
new file mode 100644
index 0000000..04b6545
--- /dev/null
+++ b/alsa-lib/src/control/Makefile.in
@@ -0,0 +1,538 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_CTL_PLUGIN_SHM_TRUE@am__append_1 = control_shm.c
+@BUILD_CTL_PLUGIN_EXT_TRUE@am__append_2 = control_ext.c
+subdir = src/control
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libcontrol_la_LIBADD =
+am__libcontrol_la_SOURCES_DIST = cards.c tlv.c namehint.c hcontrol.c \
+ control.c control_hw.c setup.c control_symbols.c control_shm.c \
+ control_ext.c
+@BUILD_CTL_PLUGIN_SHM_TRUE@am__objects_1 = control_shm.lo
+@BUILD_CTL_PLUGIN_EXT_TRUE@am__objects_2 = control_ext.lo
+am_libcontrol_la_OBJECTS = cards.lo tlv.lo namehint.lo hcontrol.lo \
+ control.lo control_hw.lo setup.lo control_symbols.lo \
+ $(am__objects_1) $(am__objects_2)
+libcontrol_la_OBJECTS = $(am_libcontrol_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libcontrol_la_SOURCES)
+DIST_SOURCES = $(am__libcontrol_la_SOURCES_DIST)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libcontrol.la
+libcontrol_la_SOURCES = cards.c tlv.c namehint.c hcontrol.c control.c \
+ control_hw.c setup.c control_symbols.c $(am__append_1) \
+ $(am__append_2)
+noinst_HEADERS = control_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/control/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/control/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libcontrol.la: $(libcontrol_la_OBJECTS) $(libcontrol_la_DEPENDENCIES)
+ $(LINK) $(libcontrol_la_LDFLAGS) $(libcontrol_la_OBJECTS) $(libcontrol_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cards.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control_ext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control_shm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control_symbols.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hcontrol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namehint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tlv.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+all: libcontrol.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/control/cards.c b/alsa-lib/src/control/cards.c
new file mode 100644
index 0000000..4d2c739
--- /dev/null
+++ b/alsa-lib/src/control/cards.c
@@ -0,0 +1,200 @@
+/**
+ * \file control/cards.c
+ * \brief Basic Soundcard Operations
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 1998-2001
+ */
+/*
+ * Soundcard Operations - main file
+ * Copyright (c) 1998 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "control_local.h"
+
+#ifndef DOC_HIDDEN
+#define SND_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
+#define SND_FILE_LOAD ALOAD_DEVICE_DIRECTORY "aloadC%i"
+#endif
+
+static int snd_card_load1(int card)
+{
+ int open_dev;
+ char control[sizeof(SND_FILE_CONTROL) + 10];
+
+ sprintf(control, SND_FILE_CONTROL, card);
+
+ open_dev = snd_open_device(control, O_RDONLY);
+#ifdef SUPPORT_ALOAD
+ if (open_dev < 0) {
+ char aload[sizeof(SND_FILE_LOAD) + 10];
+ sprintf(aload, SND_FILE_LOAD, card);
+ open_dev = snd_open_device(aload, O_RDONLY);
+ }
+#endif
+ if (open_dev >= 0) {
+ close (open_dev);
+ return 0;
+ } else {
+ return -errno;
+ }
+}
+
+/**
+ * \brief Try to load the driver for a card.
+ * \param card Card number.
+ * \return 1 if driver is present, zero if driver is not present
+ */
+int snd_card_load(int card)
+{
+ return !!(snd_card_load1(card) == 0);
+}
+
+/**
+ * \brief Try to determine the next card.
+ * \param rcard pointer to card number
+ * \result zero if success, otherwise a negative error code
+ *
+ * Tries to determine the next card from given card number.
+ * If card number is -1, then the first available card is
+ * returned. If the result card number is -1, no more cards
+ * are available.
+ */
+int snd_card_next(int *rcard)
+{
+ int card;
+
+ if (rcard == NULL)
+ return -EINVAL;
+ card = *rcard;
+ card = card < 0 ? 0 : card + 1;
+ for (; card < 32; card++) {
+ if (snd_card_load(card)) {
+ *rcard = card;
+ return 0;
+ }
+ }
+ *rcard = -1;
+ return 0;
+}
+
+/**
+ * \brief Convert card string to an integer value.
+ * \param string String containing card identifier
+ * \return zero if success, otherwise a negative error code
+ *
+ * The accepted format is an integer value in ASCII representation
+ * or the card identifier (the id parameter for sound-card drivers).
+ */
+int snd_card_get_index(const char *string)
+{
+ int card, err;
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t info;
+
+ if (!string || *string == '\0')
+ return -EINVAL;
+ if ((isdigit(*string) && *(string + 1) == 0) ||
+ (isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0)) {
+ if (sscanf(string, "%i", &card) != 1)
+ return -EINVAL;
+ if (card < 0 || card > 31)
+ return -EINVAL;
+ err = snd_card_load1(card);
+ if (err >= 0)
+ return card;
+ return err;
+ }
+ for (card = 0; card < 32; card++) {
+#ifdef SUPPORT_ALOAD
+ if (! snd_card_load(card))
+ continue;
+#endif
+ if (snd_ctl_hw_open(&handle, NULL, card, 0) < 0)
+ continue;
+ if (snd_ctl_card_info(handle, &info) < 0) {
+ snd_ctl_close(handle);
+ continue;
+ }
+ snd_ctl_close(handle);
+ if (!strcmp((const char *)info.id, string))
+ return card;
+ }
+ return -ENODEV;
+}
+
+/**
+ * \brief Obtain the card name.
+ * \param card Card number
+ * \param name Result - card name corresponding to card number
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_card_get_name(int card, char **name)
+{
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t info;
+ int err;
+
+ if (name == NULL)
+ return -EINVAL;
+ if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)
+ return err;
+ if ((err = snd_ctl_card_info(handle, &info)) < 0) {
+ snd_ctl_close(handle);
+ return err;
+ }
+ snd_ctl_close(handle);
+ *name = strdup((const char *)info.name);
+ if (*name == NULL)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief Obtain the card long name.
+ * \param card Card number
+ * \param name Result - card long name corresponding to card number
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_card_get_longname(int card, char **name)
+{
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t info;
+ int err;
+
+ if (name == NULL)
+ return -EINVAL;
+ if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)
+ return err;
+ if ((err = snd_ctl_card_info(handle, &info)) < 0) {
+ snd_ctl_close(handle);
+ return err;
+ }
+ snd_ctl_close(handle);
+ *name = strdup((const char *)info.longname);
+ if (*name == NULL)
+ return -ENOMEM;
+ return 0;
+}
diff --git a/alsa-lib/src/control/control.c b/alsa-lib/src/control/control.c
new file mode 100644
index 0000000..c090797
--- /dev/null
+++ b/alsa-lib/src/control/control.c
@@ -0,0 +1,2585 @@
+/**
+ * \file control/control.c
+ * \brief CTL interface - primitive controls
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000
+ *
+ * CTL interface is designed to access primitive controls.
+ * See \ref control page for more details.
+ */
+/*
+ * Control Interface - main file
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page control Control interface
+
+<P>Control interface is designed to access primitive controls. There is
+also interface notifying about control and structure changes.
+
+\section control_general_overview General overview
+
+The primitive controls can be integer, boolean, enumerators, bytes
+and IEC958 structure.
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/poll.h>
+#include "control_local.h"
+
+/**
+ * \brief get identifier of CTL handle
+ * \param ctl CTL handle
+ * \return ascii identifier of CTL handle
+ *
+ * Returns the ASCII identifier of given CTL handle. It's the same
+ * identifier specified in snd_ctl_open().
+ */
+const char *snd_ctl_name(snd_ctl_t *ctl)
+{
+ assert(ctl);
+ return ctl->name;
+}
+
+/**
+ * \brief get type of CTL handle
+ * \param ctl CTL handle
+ * \return type of CTL handle
+ *
+ * Returns the type #snd_ctl_type_t of given CTL handle.
+ */
+snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl)
+{
+ assert(ctl);
+ return ctl->type;
+}
+
+/**
+ * \brief close CTL handle
+ * \param ctl CTL handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified CTL handle and frees all associated
+ * resources.
+ */
+int snd_ctl_close(snd_ctl_t *ctl)
+{
+ int err;
+ while (!list_empty(&ctl->async_handlers)) {
+ snd_async_handler_t *h = list_entry(&ctl->async_handlers.next, snd_async_handler_t, hlist);
+ snd_async_del_handler(h);
+ }
+ err = ctl->ops->close(ctl);
+ free(ctl->name);
+ if (ctl->dl_handle)
+ snd_dlclose(ctl->dl_handle);
+ free(ctl);
+ return err;
+}
+
+/**
+ * \brief set nonblock mode
+ * \param ctl CTL handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock)
+{
+ int err;
+ assert(ctl);
+ err = ctl->ops->nonblock(ctl, nonblock);
+ if (err < 0)
+ return err;
+ ctl->nonblock = nonblock;
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name)
+{
+ snd_ctl_t *ctl;
+ ctl = calloc(1, sizeof(*ctl));
+ if (!ctl)
+ return -ENOMEM;
+ ctl->type = type;
+ if (name)
+ ctl->name = strdup(name);
+ INIT_LIST_HEAD(&ctl->async_handlers);
+ *ctlp = ctl;
+ return 0;
+}
+
+
+/**
+ * \brief set async mode
+ * \param ctl CTL handle
+ * \param sig Signal to raise: < 0 disable, 0 default (SIGIO)
+ * \param pid Process ID to signal: 0 current
+ * \return 0 on success otherwise a negative error code
+ *
+ * A signal is raised when a change happens.
+ */
+int snd_ctl_async(snd_ctl_t *ctl, int sig, pid_t pid)
+{
+ assert(ctl);
+ if (sig == 0)
+ sig = SIGIO;
+ if (pid == 0)
+ pid = getpid();
+ return ctl->ops->async(ctl, sig, pid);
+}
+#endif
+
+/**
+ * \brief get count of poll descriptors for CTL handle
+ * \param ctl CTL handle
+ * \return count of poll descriptors
+ */
+int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl)
+{
+ assert(ctl);
+ if (ctl->ops->poll_descriptors_count)
+ return ctl->ops->poll_descriptors_count(ctl);
+ if (ctl->poll_fd < 0)
+ return 0;
+ return 1;
+}
+
+/**
+ * \brief get poll descriptors
+ * \param ctl CTL handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space)
+{
+ assert(ctl && pfds);
+ if (ctl->ops->poll_descriptors)
+ return ctl->ops->poll_descriptors(ctl, pfds, space);
+ if (ctl->poll_fd < 0)
+ return 0;
+ if (space > 0) {
+ pfds->fd = ctl->poll_fd;
+ pfds->events = POLLIN|POLLERR|POLLNVAL;
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param ctl CTL handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(ctl && pfds && revents);
+ if (ctl->ops->poll_revents)
+ return ctl->ops->poll_revents(ctl, pfds, nfds, revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Ask to be informed about events (poll, #snd_ctl_async, #snd_ctl_read)
+ * \param ctl CTL handle
+ * \param subscribe 0 = unsubscribe, 1 = subscribe
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe)
+{
+ assert(ctl);
+ return ctl->ops->subscribe_events(ctl, subscribe);
+}
+
+
+/**
+ * \brief Get card related information
+ * \param ctl CTL handle
+ * \param info Card info pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info)
+{
+ assert(ctl && info);
+ return ctl->ops->card_info(ctl, info);
+}
+
+/**
+ * \brief Get a list of element identifiers
+ * \param ctl CTL handle
+ * \param list CTL element identifiers list pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list)
+{
+ assert(ctl && list);
+ assert(list->space == 0 || list->pids);
+ return ctl->ops->element_list(ctl, list);
+}
+
+/**
+ * \brief Get CTL element information
+ * \param ctl CTL handle
+ * \param info CTL element id/information pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
+{
+ assert(ctl && info && (info->id.name[0] || info->id.numid));
+ return ctl->ops->element_info(ctl, info);
+}
+
+/**
+ * \brief Create and add an user INTEGER CTL element
+ * \param ctl CTL handle
+ * \param id CTL element id to add
+ * \param count number of elements
+ * \param min minimum value
+ * \param max maximum value
+ * \param step value step
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count, long min, long max, long step)
+{
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *val;
+ unsigned int i;
+ int err;
+
+ assert(ctl && id && id->name[0]);
+ snd_ctl_elem_info_alloca(&info);
+ info->id = *id;
+ info->type = SND_CTL_ELEM_TYPE_INTEGER;
+ info->access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE;
+ info->count = count;
+ info->value.integer.min = min;
+ info->value.integer.max = max;
+ info->value.integer.step = step;
+ err = ctl->ops->element_add(ctl, info);
+ if (err < 0)
+ return err;
+ snd_ctl_elem_value_alloca(&val);
+ val->id = *id;
+ for (i = 0; i < count; i++)
+ val->value.integer.value[i] = min;
+ err = ctl->ops->element_write(ctl, val);
+ return err;
+}
+
+/**
+ * \brief Create and add an user INTEGER64 CTL element
+ * \param ctl CTL handle
+ * \param id CTL element id to add
+ * \param count number of elements
+ * \param min minimum value
+ * \param max maximum value
+ * \param step value step
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count, long long min, long long max,
+ long long step)
+{
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *val;
+ unsigned int i;
+ int err;
+
+ assert(ctl && id && id->name[0]);
+ snd_ctl_elem_info_alloca(&info);
+ info->id = *id;
+ info->type = SND_CTL_ELEM_TYPE_INTEGER64;
+ info->count = count;
+ info->value.integer64.min = min;
+ info->value.integer64.max = max;
+ info->value.integer64.step = step;
+ err = ctl->ops->element_add(ctl, info);
+ if (err < 0)
+ return err;
+ snd_ctl_elem_value_alloca(&val);
+ val->id = *id;
+ for (i = 0; i < count; i++)
+ val->value.integer64.value[i] = min;
+ err = ctl->ops->element_write(ctl, val);
+ return err;
+}
+
+/**
+ * \brief Create and add an user BOOLEAN CTL element
+ * \param ctl CTL handle
+ * \param id CTL element id to add
+ * \param count number of elements
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int count)
+{
+ snd_ctl_elem_info_t *info;
+
+ assert(ctl && id && id->name[0]);
+ snd_ctl_elem_info_alloca(&info);
+ info->id = *id;
+ info->type = SND_CTL_ELEM_TYPE_BOOLEAN;
+ info->count = count;
+ info->value.integer.min = 0;
+ info->value.integer.max = 1;
+ return ctl->ops->element_add(ctl, info);
+}
+
+/**
+ * \brief Create and add an user IEC958 CTL element
+ * \param ctl CTL handle
+ * \param id CTL element info to add
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id)
+{
+ snd_ctl_elem_info_t *info;
+
+ assert(ctl && id && id->name[0]);
+ snd_ctl_elem_info_alloca(&info);
+ info->id = *id;
+ info->type = SND_CTL_ELEM_TYPE_IEC958;
+ info->count = 1;
+ return ctl->ops->element_add(ctl, info);
+}
+
+/**
+ * \brief Remove an user CTL element
+ * \param ctl CTL handle
+ * \param id CTL element identification
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ assert(ctl && id && (id->name[0] || id->numid));
+ return ctl->ops->element_remove(ctl, id);
+}
+
+/**
+ * \brief Get CTL element value
+ * \param ctl CTL handle
+ * \param control CTL element id/value pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *control)
+{
+ assert(ctl && control && (control->id.name[0] || control->id.numid));
+ return ctl->ops->element_read(ctl, control);
+}
+
+/**
+ * \brief Set CTL element value
+ * \param ctl CTL handle
+ * \param control CTL element id/value pointer
+ * \retval 0 on success
+ * \retval >0 on success when value was changed
+ * \retval <0 a negative error code
+ */
+int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *control)
+{
+ assert(ctl && control && (control->id.name[0] || control->id.numid));
+ return ctl->ops->element_write(ctl, control);
+}
+
+static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
+ const snd_ctl_elem_id_t *id,
+ unsigned int *tlv, unsigned int tlv_size)
+{
+ snd_ctl_elem_info_t *info = NULL;
+ int err;
+
+ if (id->numid == 0) {
+ info = calloc(1, sizeof(*info));
+ if (info == NULL)
+ return -ENOMEM;
+ info->id = *id;
+ id = &info->id;
+ err = snd_ctl_elem_info(ctl, info);
+ if (err < 0)
+ goto __err;
+ if (id->numid == 0) {
+ err = -ENOENT;
+ goto __err;
+ }
+ }
+ err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size);
+ __err:
+ if (info)
+ free(info);
+ return err;
+}
+
+
+
+/**
+ * \brief Get CTL element TLV value
+ * \param ctl CTL handle
+ * \param id CTL element id pointer
+ * \param tlv TLV array pointer to store
+ * \param tlv_size TLV array size in bytes
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ unsigned int *tlv, unsigned int tlv_size)
+{
+ int err;
+ assert(ctl && id && (id->name[0] || id->numid) && tlv);
+ if (tlv_size < 2 * sizeof(int))
+ return -EINVAL;
+ /* 1.0.12 driver doesn't return the error even if the user TLV
+ * is empty. So, initialize TLV here with an invalid type
+ * and compare the returned value after ioctl for checking
+ * the validity of TLV.
+ */
+ tlv[0] = -1;
+ tlv[1] = 0;
+ err = snd_ctl_tlv_do(ctl, 0, id, tlv, tlv_size);
+ if (err >= 0 && tlv[0] == (unsigned int)-1)
+ err = -ENXIO;
+ return err;
+}
+
+/**
+ * \brief Set CTL element TLV value
+ * \param ctl CTL handle
+ * \param id CTL element id pointer
+ * \param tlv TLV array pointer to store
+ * \retval 0 on success
+ * \retval >0 on success when value was changed
+ * \retval <0 a negative error code
+ */
+int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv)
+{
+ assert(ctl && id && (id->name[0] || id->numid) && tlv);
+ return snd_ctl_tlv_do(ctl, 1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int));
+}
+
+/**
+ * \brief Process CTL element TLV command
+ * \param ctl CTL handle
+ * \param id CTL element id pointer
+ * \param tlv TLV array pointer to process
+ * \retval 0 on success
+ * \retval >0 on success when value was changed
+ * \retval <0 a negative error code
+ */
+int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ const unsigned int *tlv)
+{
+ assert(ctl && id && (id->name[0] || id->numid) && tlv);
+ return snd_ctl_tlv_do(ctl, -1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int));
+}
+
+/**
+ * \brief Lock CTL element
+ * \param ctl CTL handle
+ * \param id CTL element id pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ assert(ctl && id);
+ return ctl->ops->element_lock(ctl, id);
+}
+
+/**
+ * \brief Unlock CTL element
+ * \param ctl CTL handle
+ * \param id CTL element id pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ assert(ctl && id);
+ return ctl->ops->element_unlock(ctl, id);
+}
+
+/**
+ * \brief Get next hardware dependent device number
+ * \param ctl CTL handle
+ * \param device current device on entry and next device on return
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int *device)
+{
+ assert(ctl && device);
+ return ctl->ops->hwdep_next_device(ctl, device);
+}
+
+/**
+ * \brief Get info about a hardware dependent device
+ * \param ctl CTL handle
+ * \param info Hardware dependent device id/info pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info)
+{
+ assert(ctl && info);
+ return ctl->ops->hwdep_info(ctl, info);
+}
+
+/**
+ * \brief Get next PCM device number
+ * \param ctl CTL handle
+ * \param device current device on entry and next device on return
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int * device)
+{
+ assert(ctl && device);
+ return ctl->ops->pcm_next_device(ctl, device);
+}
+
+/**
+ * \brief Get info about a PCM device
+ * \param ctl CTL handle
+ * \param info PCM device id/info pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info)
+{
+ assert(ctl && info);
+ return ctl->ops->pcm_info(ctl, info);
+}
+
+/**
+ * \brief Set preferred PCM subdevice number of successive PCM open
+ * \param ctl CTL handle
+ * \param subdev Preferred PCM subdevice number
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev)
+{
+ assert(ctl);
+ return ctl->ops->pcm_prefer_subdevice(ctl, subdev);
+}
+
+/**
+ * \brief Get next RawMidi device number
+ * \param ctl CTL handle
+ * \param device current device on entry and next device on return
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device)
+{
+ assert(ctl && device);
+ return ctl->ops->rawmidi_next_device(ctl, device);
+}
+
+/**
+ * \brief Get info about a RawMidi device
+ * \param ctl CTL handle
+ * \param info RawMidi device id/info pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info)
+{
+ assert(ctl && info);
+ return ctl->ops->rawmidi_info(ctl, info);
+}
+
+/**
+ * \brief Set preferred RawMidi subdevice number of successive RawMidi open
+ * \param ctl CTL handle
+ * \param subdev Preferred RawMidi subdevice number
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
+{
+ assert(ctl);
+ return ctl->ops->rawmidi_prefer_subdevice(ctl, subdev);
+}
+
+/**
+ * \brief Set Power State to given SND_CTL_POWER_* value and do the power management
+ * \param ctl CTL handle
+ * \param state Desired Power State
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state)
+{
+ assert(ctl);
+ if (ctl->ops->set_power_state)
+ return ctl->ops->set_power_state(ctl, state);
+ return -ENXIO;
+}
+
+/**
+ * \brief Get actual Power State
+ * \param ctl CTL handle
+ * \param state Destination value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state)
+{
+ assert(ctl);
+ if (ctl->ops->get_power_state)
+ return ctl->ops->get_power_state(ctl, state);
+ return -ENXIO;
+}
+
+/**
+ * \brief Read an event
+ * \param ctl CTL handle
+ * \param event Event pointer
+ * \return number of events read otherwise a negative error code on failure
+ */
+int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
+{
+ assert(ctl && event);
+ return (ctl->ops->read)(ctl, event);
+}
+
+/**
+ * \brief Wait for a CTL to become ready (i.e. at least one event pending)
+ * \param ctl CTL handle
+ * \param timeout maximum time in milliseconds to wait
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
+{
+ struct pollfd *pfd;
+ unsigned short *revents;
+ int i, npfds, pollio, err, err_poll;
+
+ npfds = snd_ctl_poll_descriptors_count(ctl);
+ if (npfds <= 0 || npfds >= 16) {
+ SNDERR("Invalid poll_fds %d\n", npfds);
+ return -EIO;
+ }
+ pfd = alloca(sizeof(*pfd) * npfds);
+ revents = alloca(sizeof(*revents) * npfds);
+ err = snd_ctl_poll_descriptors(ctl, pfd, npfds);
+ if (err < 0)
+ return err;
+ if (err != npfds) {
+ SNDMSG("invalid poll descriptors %d\n", err);
+ return -EIO;
+ }
+ do {
+ err_poll = poll(pfd, npfds, timeout);
+ if (err_poll < 0)
+ return -errno;
+ if (! err_poll)
+ break;
+ err = snd_ctl_poll_descriptors_revents(ctl, pfd, npfds, revents);
+ if (err < 0)
+ return err;
+ pollio = 0;
+ for (i = 0; i < npfds; i++) {
+ if (revents[i] & (POLLERR | POLLNVAL))
+ return -EIO;
+ if ((revents[i] & (POLLIN | POLLOUT)) == 0)
+ continue;
+ pollio++;
+ }
+ } while (! pollio);
+
+ return err_poll > 0 ? 1 : 0;
+}
+
+/**
+ * \brief Add an async handler for a CTL
+ * \param handler Returned handler handle
+ * \param ctl CTL handle
+ * \param callback Callback function
+ * \param private_data Callback private data
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
+ snd_async_callback_t callback, void *private_data)
+{
+ int err;
+ int was_empty;
+ snd_async_handler_t *h;
+ err = snd_async_add_handler(&h, _snd_ctl_async_descriptor(ctl),
+ callback, private_data);
+ if (err < 0)
+ return err;
+ h->type = SND_ASYNC_HANDLER_CTL;
+ h->u.ctl = ctl;
+ was_empty = list_empty(&ctl->async_handlers);
+ list_add_tail(&h->hlist, &ctl->async_handlers);
+ if (was_empty) {
+ err = snd_ctl_async(ctl, snd_async_handler_get_signo(h), getpid());
+ if (err < 0) {
+ snd_async_del_handler(h);
+ return err;
+ }
+ }
+ *handler = h;
+ return 0;
+}
+
+/**
+ * \brief Return CTL handle related to an async handler
+ * \param handler Async handler handle
+ * \return CTL handle
+ */
+snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler)
+{
+ assert(handler->type == SND_ASYNC_HANDLER_CTL);
+ return handler->u.ctl;
+}
+
+static const char *const build_in_ctls[] = {
+ "hw", "shm", NULL
+};
+
+static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
+ snd_config_t *ctl_root, snd_config_t *ctl_conf, int mode)
+{
+ const char *str;
+ char *buf = NULL, *buf1 = NULL;
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *lib = NULL, *open_name = NULL;
+ const char *id;
+ int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_control_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for CTL %s definition", name);
+ else
+ SNDERR("Invalid type for CTL definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(ctl_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(ctl_root, "ctl_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for CTL type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ buf = malloc(strlen(str) + 32);
+ if (buf == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ open_name = buf;
+ sprintf(buf, "_snd_ctl_%s_open", str);
+ }
+ if (!lib) {
+ const char *const *build_in = build_in_ctls;
+ while (*build_in) {
+ if (!strcmp(*build_in, str))
+ break;
+ build_in++;
+ }
+ if (*build_in == NULL) {
+ buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ lib = buf1;
+ sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str);
+ }
+ }
+#ifndef PIC
+ snd_control_open_symbols();
+#endif
+ open_func = snd_dlobj_cache_lookup(open_name);
+ if (open_func) {
+ err = 0;
+ goto _err;
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (err >= 0) {
+ err = open_func(ctlp, name, ctl_root, ctl_conf, mode);
+ if (err >= 0) {
+ if (h /*&& (mode & SND_CTL_KEEP_ALIVE)*/) {
+ snd_dlobj_cache_add(open_name, h, open_func);
+ h = NULL;
+ }
+ (*ctlp)->dl_handle = h;
+ err = 0;
+ } else {
+ if (h)
+ snd_dlclose(h);
+ }
+ }
+ free(buf);
+ free(buf1);
+ return err;
+}
+
+static int snd_ctl_open_noupdate(snd_ctl_t **ctlp, snd_config_t *root, const char *name, int mode)
+{
+ int err;
+ snd_config_t *ctl_conf;
+ err = snd_config_search_definition(root, "ctl", name, &ctl_conf);
+ if (err < 0) {
+ SNDERR("Invalid CTL %s", name);
+ return err;
+ }
+ err = snd_ctl_open_conf(ctlp, name, root, ctl_conf, mode);
+ snd_config_delete(ctl_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a CTL
+ * \param ctlp Returned CTL handle
+ * \param name ASCII identifier of the CTL handle
+ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
+{
+ int err;
+ assert(ctlp && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_ctl_open_noupdate(ctlp, snd_config, name, mode);
+}
+
+/**
+ * \brief Opens a CTL using local configuration
+ * \param ctlp Returned CTL handle
+ * \param name ASCII identifier of the CTL handle
+ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC)
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_open_lconf(snd_ctl_t **ctlp, const char *name,
+ int mode, snd_config_t *lconf)
+{
+ assert(ctlp && name && lconf);
+ return snd_ctl_open_noupdate(ctlp, lconf, name, mode);
+}
+
+#ifndef DOC_HIDDEN
+#define TYPE(v) [SND_CTL_ELEM_TYPE_##v] = #v
+#define IFACE(v) [SND_CTL_ELEM_IFACE_##v] = #v
+#define IFACE1(v, n) [SND_CTL_ELEM_IFACE_##v] = #n
+#define EVENT(v) [SND_CTL_EVENT_##v] = #v
+
+static const char *const snd_ctl_elem_type_names[] = {
+ TYPE(NONE),
+ TYPE(BOOLEAN),
+ TYPE(INTEGER),
+ TYPE(ENUMERATED),
+ TYPE(BYTES),
+ TYPE(IEC958),
+ TYPE(INTEGER64),
+};
+
+static const char *const snd_ctl_elem_iface_names[] = {
+ IFACE(CARD),
+ IFACE(HWDEP),
+ IFACE(MIXER),
+ IFACE(PCM),
+ IFACE(RAWMIDI),
+ IFACE(TIMER),
+ IFACE(SEQUENCER),
+};
+
+static const char *const snd_ctl_event_type_names[] = {
+ EVENT(ELEM),
+};
+#endif
+
+/**
+ * \brief get name of a CTL element type
+ * \param type CTL element type
+ * \return ascii name of CTL element type
+ */
+const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type)
+{
+ assert(type <= SND_CTL_ELEM_TYPE_LAST);
+ return snd_ctl_elem_type_names[type];
+}
+
+/**
+ * \brief get name of a CTL element related interface
+ * \param iface CTL element related interface
+ * \return ascii name of CTL element related interface
+ */
+const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface)
+{
+ assert(iface <= SND_CTL_ELEM_IFACE_LAST);
+ return snd_ctl_elem_iface_names[iface];
+}
+
+/**
+ * \brief get name of a CTL event type
+ * \param type CTL event type
+ * \return ascii name of CTL event type
+ */
+const char *snd_ctl_event_type_name(snd_ctl_event_type_t type)
+{
+ assert(type <= SND_CTL_EVENT_LAST);
+ return snd_ctl_event_type_names[type];
+}
+
+/**
+ * \brief allocate space for CTL element identifiers list
+ * \param obj CTL element identifiers list
+ * \param entries Entries to allocate
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries)
+{
+ free(obj->pids);
+ obj->pids = calloc(entries, sizeof(*obj->pids));
+ if (!obj->pids) {
+ obj->space = 0;
+ return -ENOMEM;
+ }
+ obj->space = entries;
+ return 0;
+}
+
+/**
+ * \brief free previously allocated space for CTL element identifiers list
+ * \param obj CTL element identifiers list
+ */
+void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj)
+{
+ free(obj->pids);
+ obj->pids = NULL;
+ obj->space = 0;
+}
+
+/**
+ * \brief Get event mask for an element related event
+ * \param obj CTL event
+ * \return event mask for element related event
+ */
+unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.mask;
+}
+
+/**
+ * \brief Get CTL element identifier for an element related event
+ * \param obj CTL event
+ * \param ptr Pointer to returned CTL element identifier
+ */
+void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ *ptr = obj->data.elem.id;
+}
+
+/**
+ * \brief Get element numeric identifier for an element related event
+ * \param obj CTL event
+ * \return element numeric identifier
+ */
+unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.id.numid;
+}
+
+/**
+ * \brief Get interface part of CTL element identifier for an element related event
+ * \param obj CTL event
+ * \return interface part of element identifier
+ */
+snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.id.iface;
+}
+
+/**
+ * \brief Get device part of CTL element identifier for an element related event
+ * \param obj CTL event
+ * \return device part of element identifier
+ */
+unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.id.device;
+}
+
+/**
+ * \brief Get subdevice part of CTL element identifier for an element related event
+ * \param obj CTL event
+ * \return subdevice part of element identifier
+ */
+unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.id.subdevice;
+}
+
+/**
+ * \brief Get name part of CTL element identifier for an element related event
+ * \param obj CTL event
+ * \return name part of element identifier
+ */
+const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return (const char *)obj->data.elem.id.name;
+}
+
+/**
+ * \brief Get index part of CTL element identifier for an element related event
+ * \param obj CTL event
+ * \return index part of element identifier
+ */
+unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_EVENT_ELEM);
+ return obj->data.elem.id.index;
+}
+
+#ifndef DOC_HIDDEN
+int _snd_ctl_poll_descriptor(snd_ctl_t *ctl)
+{
+ assert(ctl);
+ return ctl->poll_fd;
+}
+#endif
+
+/**
+ * \brief get size of #snd_ctl_elem_id_t
+ * \return size in bytes
+ */
+size_t snd_ctl_elem_id_sizeof()
+{
+ return sizeof(snd_ctl_elem_id_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_elem_id_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_elem_id_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_elem_id_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_elem_id_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_elem_id_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_elem_id_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_elem_id_copy(snd_ctl_elem_id_t *dst, const snd_ctl_elem_id_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get numeric identifier from a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element numeric identifier
+ */
+unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return obj->numid;
+}
+
+/**
+ * \brief Get interface part of a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element related interface
+ */
+snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return obj->iface;
+}
+
+/**
+ * \brief Get device part of a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element related device
+ */
+unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return obj->device;
+}
+
+/**
+ * \brief Get subdevice part of a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element related subdevice
+ */
+unsigned int snd_ctl_elem_id_get_subdevice(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return obj->subdevice;
+}
+
+/**
+ * \brief Get name part of a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element name
+ */
+const char *snd_ctl_elem_id_get_name(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->name;
+}
+
+/**
+ * \brief Get index part of a CTL element identifier
+ * \param obj CTL element identifier
+ * \return CTL element index
+ */
+unsigned int snd_ctl_elem_id_get_index(const snd_ctl_elem_id_t *obj)
+{
+ assert(obj);
+ return obj->index;
+}
+
+/**
+ * \brief Set numeric identifier for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element numeric identifier
+ */
+void snd_ctl_elem_id_set_numid(snd_ctl_elem_id_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->numid = val;
+}
+
+/**
+ * \brief Set interface part for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element related interface
+ */
+void snd_ctl_elem_id_set_interface(snd_ctl_elem_id_t *obj, snd_ctl_elem_iface_t val)
+{
+ assert(obj);
+ obj->iface = val;
+}
+
+/**
+ * \brief Set device part for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element related device
+ */
+void snd_ctl_elem_id_set_device(snd_ctl_elem_id_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->device = val;
+}
+
+/**
+ * \brief Set subdevice part for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element related subdevice
+ */
+void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->subdevice = val;
+}
+
+/**
+ * \brief Set name part for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element name
+ */
+void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val)
+{
+ assert(obj);
+ strncpy((char *)obj->name, val, sizeof(obj->name));
+}
+
+/**
+ * \brief Set index part for a CTL element identifier
+ * \param obj CTL element identifier
+ * \param val CTL element index
+ */
+void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->index = val;
+}
+
+/**
+ * \brief get size of #snd_ctl_card_info_t
+ * \return size in bytes
+ */
+size_t snd_ctl_card_info_sizeof()
+{
+ return sizeof(snd_ctl_card_info_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_card_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_card_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_card_info_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_card_info_free(snd_ctl_card_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_card_info_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_card_info_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_card_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get card number from a CTL card info
+ * \param obj CTL card info
+ * \return card number
+ */
+int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return obj->card;
+}
+
+/**
+ * \brief Get card identifier from a CTL card info
+ * \param obj CTL card info
+ * \return card identifier
+ */
+const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id;
+}
+
+/**
+ * \brief Get card driver name from a CTL card info
+ * \param obj CTL card info
+ * \return card driver name
+ */
+const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->driver;
+}
+
+/**
+ * \brief Get card name from a CTL card info
+ * \param obj CTL card info
+ * \return card name
+ */
+const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->name;
+}
+
+/**
+ * \brief Get card long name from a CTL card info
+ * \param obj CTL card info
+ * \return card long name
+ */
+const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->longname;
+}
+
+/**
+ * \brief Get card mixer name from a CTL card info
+ * \param obj CTL card info
+ * \return card mixer name
+ */
+const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->mixername;
+}
+
+/**
+ * \brief Get card component list from a CTL card info
+ * \param obj CTL card info
+ * \return card mixer identifier
+ */
+const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->components;
+}
+
+/**
+ * \brief get size of #snd_ctl_event_t
+ * \return size in bytes
+ */
+size_t snd_ctl_event_sizeof()
+{
+ return sizeof(snd_ctl_event_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_event_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_event_malloc(snd_ctl_event_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_event_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_event_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_event_free(snd_ctl_event_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_event_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_event_clear(snd_ctl_event_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_event_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_event_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get type of a CTL event
+ * \param obj CTL event
+ * \return CTL event type
+ */
+snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj)
+{
+ assert(obj);
+ return obj->type;
+}
+
+/**
+ * \brief get size of #snd_ctl_elem_list_t
+ * \return size in bytes
+ */
+size_t snd_ctl_elem_list_sizeof()
+{
+ return sizeof(snd_ctl_elem_list_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_elem_list_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_elem_list_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_elem_list_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_elem_list_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_elem_list_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_elem_list_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_elem_list_copy(snd_ctl_elem_list_t *dst, const snd_ctl_elem_list_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Set index of first wanted CTL element identifier in a CTL element identifiers list
+ * \param obj CTL element identifiers list
+ * \param val index of CTL element to put at position 0 of list
+ */
+void snd_ctl_elem_list_set_offset(snd_ctl_elem_list_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->offset = val;
+}
+
+/**
+ * \brief Get number of used entries in CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \return number of used entries
+ */
+unsigned int snd_ctl_elem_list_get_used(const snd_ctl_elem_list_t *obj)
+{
+ assert(obj);
+ return obj->used;
+}
+
+/**
+ * \brief Get total count of elements present in CTL device (information present in every filled CTL element identifiers list)
+ * \param obj CTL element identifier list
+ * \return total number of elements
+ */
+unsigned int snd_ctl_elem_list_get_count(const snd_ctl_elem_list_t *obj)
+{
+ assert(obj);
+ return obj->count;
+}
+
+/**
+ * \brief Get CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \param ptr Pointer to returned CTL element identifier
+ */
+void snd_ctl_elem_list_get_id(const snd_ctl_elem_list_t *obj, unsigned int idx, snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ assert(idx < obj->used);
+ *ptr = obj->pids[idx];
+}
+
+/**
+ * \brief Get CTL element numeric identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element numeric identifier
+ */
+unsigned int snd_ctl_elem_list_get_numid(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return obj->pids[idx].numid;
+}
+
+/**
+ * \brief Get interface part of CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element related interface
+ */
+snd_ctl_elem_iface_t snd_ctl_elem_list_get_interface(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return obj->pids[idx].iface;
+}
+
+/**
+ * \brief Get device part of CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element related device
+ */
+unsigned int snd_ctl_elem_list_get_device(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return obj->pids[idx].device;
+}
+
+/**
+ * \brief Get subdevice part of CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element related subdevice
+ */
+unsigned int snd_ctl_elem_list_get_subdevice(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return obj->pids[idx].subdevice;
+}
+
+/**
+ * \brief Get name part of CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element name
+ */
+const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return (const char *)obj->pids[idx].name;
+}
+
+/**
+ * \brief Get index part of CTL element identifier for an entry of a CTL element identifiers list
+ * \param obj CTL element identifier list
+ * \param idx Index of entry
+ * \return CTL element index
+ */
+unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < obj->used);
+ return obj->pids[idx].index;
+}
+
+/**
+ * \brief get size of #snd_ctl_elem_info_t
+ * \return size in bytes
+ */
+size_t snd_ctl_elem_info_sizeof()
+{
+ return sizeof(snd_ctl_elem_info_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_elem_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_elem_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_elem_info_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_elem_info_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_elem_info_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_elem_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_elem_info_copy(snd_ctl_elem_info_t *dst, const snd_ctl_elem_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get type from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return CTL element content type
+ */
+snd_ctl_elem_type_t snd_ctl_elem_info_get_type(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->type;
+}
+
+/**
+ * \brief Get info about readability from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element is not readable, 1 if element is readable
+ */
+int snd_ctl_elem_info_is_readable(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_READ);
+}
+
+/**
+ * \brief Get info about writability from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element is not writable, 1 if element is not writable
+ */
+int snd_ctl_elem_info_is_writable(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_WRITE);
+}
+
+/**
+ * \brief Get info about notification feasibility from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if all element value changes are notified to subscribed applications, 1 otherwise
+ */
+int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_VOLATILE);
+}
+
+/**
+ * \brief Get info about status from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element value is not active, 1 if is active
+ */
+int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_INACTIVE);
+}
+
+/**
+ * \brief Get info whether an element is locked
+ * \param obj CTL element id/info
+ * \return 0 if element value is currently changeable, 1 if it's locked by another application
+ */
+int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_LOCK);
+}
+
+/**
+ * \brief Get info if I own an element
+ * \param obj CTL element id/info
+ * \return 0 if element value is currently changeable, 1 if it's locked by another application
+ */
+int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_OWNER);
+}
+
+/**
+ * \brief Get info if it's a user element
+ * \param obj CTL element id/info
+ * \return 0 if element value is a system element, 1 if it's a user-created element
+ */
+int snd_ctl_elem_info_is_user(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_USER);
+}
+
+/**
+ * \brief Get info about TLV readability from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element's TLV is not readable, 1 if element's TLV is readable
+ */
+int snd_ctl_elem_info_is_tlv_readable(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ);
+}
+
+/**
+ * \brief Get info about TLV writeability from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element's TLV is not writable, 1 if element's TLV is writable
+ */
+int snd_ctl_elem_info_is_tlv_writable(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE);
+}
+
+/**
+ * \brief Get info about TLV command possibility from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return 0 if element's TLV command is not possible, 1 if element's TLV command is supported
+ */
+int snd_ctl_elem_info_is_tlv_commandable(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND);
+}
+
+/**
+ * \brief (DEPRECATED) Get info about values passing policy from a CTL element value
+ * \param obj CTL element id/info
+ * \return 0 if element value need to be passed by contents, 1 if need to be passed with a pointer
+ */
+int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return 0;
+}
+link_warning(snd_ctl_elem_info_is_indirect, "Warning: snd_ctl_elem_info_is_indirect is deprecated, do not use it");
+
+/**
+ * \brief Get owner of a locked element
+ * \param obj CTL element id/info
+ * \return value entries count
+ */
+pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->owner;
+}
+
+/**
+ * \brief Get number of value entries from a CTL element id/info
+ * \param obj CTL element id/info
+ * \return value entries count
+ */
+unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->count;
+}
+
+/**
+ * \brief Get minimum value from a #SND_CTL_ELEM_TYPE_INTEGER CTL element id/info
+ * \param obj CTL element id/info
+ * \return Minimum value
+ */
+long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER);
+ return obj->value.integer.min;
+}
+
+/**
+ * \brief Get maximum value from a #SND_CTL_ELEM_TYPE_INTEGER CTL element id/info
+ * \param obj CTL element id/info
+ * \return Maximum value
+ */
+long snd_ctl_elem_info_get_max(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER);
+ return obj->value.integer.max;
+}
+
+/**
+ * \brief Get value step from a #SND_CTL_ELEM_TYPE_INTEGER CTL element id/info
+ * \param obj CTL element id/info
+ * \return Step
+ */
+long snd_ctl_elem_info_get_step(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER);
+ return obj->value.integer.step;
+}
+
+/**
+ * \brief Get minimum value from a #SND_CTL_ELEM_TYPE_INTEGER64 CTL element id/info
+ * \param obj CTL element id/info
+ * \return Minimum value
+ */
+long long snd_ctl_elem_info_get_min64(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER64);
+ return obj->value.integer64.min;
+}
+
+/**
+ * \brief Get maximum value from a #SND_CTL_ELEM_TYPE_INTEGER64 CTL element id/info
+ * \param obj CTL element id/info
+ * \return Maximum value
+ */
+long long snd_ctl_elem_info_get_max64(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER64);
+ return obj->value.integer64.max;
+}
+
+/**
+ * \brief Get value step from a #SND_CTL_ELEM_TYPE_INTEGER64 CTL element id/info
+ * \param obj CTL element id/info
+ * \return Step
+ */
+long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_INTEGER64);
+ return obj->value.integer64.step;
+}
+
+/**
+ * \brief Get number of items available from a #SND_CTL_ELEM_TYPE_ENUMERATED CTL element id/info
+ * \param obj CTL element id/info
+ * \return items count
+ */
+unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_ENUMERATED);
+ return obj->value.enumerated.items;
+}
+
+/**
+ * \brief Select item in a #SND_CTL_ELEM_TYPE_ENUMERATED CTL element id/info
+ * \param obj CTL element id/info
+ * \param val item number
+ */
+void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->value.enumerated.item = val;
+}
+
+/**
+ * \brief Get name for selected item in a #SND_CTL_ELEM_TYPE_ENUMERATED CTL element id/info
+ * \param obj CTL element id/info
+ * \return name of chosen item
+ */
+const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ assert(obj->type == SND_CTL_ELEM_TYPE_ENUMERATED);
+ return obj->value.enumerated.name;
+}
+
+/**
+ * \brief Get count of dimensions for given element
+ * \param obj CTL element id/info
+ * \return zero value if no dimensions are defined, otherwise positive value with count of dimensions
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_ctl_elem_info_get_dimensions)(const snd_ctl_elem_info_t *obj)
+#else
+int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj)
+#endif
+{
+ int i;
+
+ assert(obj);
+ for (i = 3; i >= 0; i--)
+ if (obj->dimen.d[i])
+ break;
+ return i + 1;
+}
+use_default_symbol_version(__snd_ctl_elem_info_get_dimensions, snd_ctl_elem_info_get_dimensions, ALSA_0.9.3);
+
+/**
+ * \brief Get specified of dimension width for given element
+ * \param obj CTL element id/info
+ * \param idx The dimension index
+ * \return zero value if no dimension width is defined, otherwise positive value with with of specified dimension
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_ctl_elem_info_get_dimension)(const snd_ctl_elem_info_t *obj, unsigned int idx)
+#else
+int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx)
+#endif
+{
+ assert(obj);
+ if (idx >= 3)
+ return 0;
+ return obj->dimen.d[idx];
+}
+use_default_symbol_version(__snd_ctl_elem_info_get_dimension, snd_ctl_elem_info_get_dimension, ALSA_0.9.3);
+
+/**
+ * \brief Get CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param ptr Pointer to returned CTL element identifier
+ */
+void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ *ptr = obj->id;
+}
+
+/**
+ * \brief Get element numeric identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return element numeric identifier
+ */
+unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->id.numid;
+}
+
+/**
+ * \brief Get interface part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return interface part of element identifier
+ */
+snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->id.iface;
+}
+
+/**
+ * \brief Get device part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return device part of element identifier
+ */
+unsigned int snd_ctl_elem_info_get_device(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->id.device;
+}
+
+/**
+ * \brief Get subdevice part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return subdevice part of element identifier
+ */
+unsigned int snd_ctl_elem_info_get_subdevice(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->id.subdevice;
+}
+
+/**
+ * \brief Get name part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return name part of element identifier
+ */
+const char *snd_ctl_elem_info_get_name(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id.name;
+}
+
+/**
+ * \brief Get index part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \return index part of element identifier
+ */
+unsigned int snd_ctl_elem_info_get_index(const snd_ctl_elem_info_t *obj)
+{
+ assert(obj);
+ return obj->id.index;
+}
+
+/**
+ * \brief Set CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param ptr CTL element identifier
+ */
+void snd_ctl_elem_info_set_id(snd_ctl_elem_info_t *obj, const snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ obj->id = *ptr;
+}
+
+/**
+ * \brief Set element numeric identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val element numeric identifier
+ */
+void snd_ctl_elem_info_set_numid(snd_ctl_elem_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.numid = val;
+}
+
+/**
+ * \brief Set interface part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val interface part of element identifier
+ */
+void snd_ctl_elem_info_set_interface(snd_ctl_elem_info_t *obj, snd_ctl_elem_iface_t val)
+{
+ assert(obj);
+ obj->id.iface = val;
+}
+
+/**
+ * \brief Set device part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val device part of element identifier
+ */
+void snd_ctl_elem_info_set_device(snd_ctl_elem_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.device = val;
+}
+
+/**
+ * \brief Set subdevice part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val subdevice part of element identifier
+ */
+void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.subdevice = val;
+}
+
+/**
+ * \brief Set name part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val name part of element identifier
+ */
+void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val)
+{
+ assert(obj);
+ strncpy((char *)obj->id.name, val, sizeof(obj->id.name));
+}
+
+/**
+ * \brief Set index part of CTL element identifier of a CTL element id/info
+ * \param obj CTL element id/info
+ * \param val index part of element identifier
+ */
+void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.index = val;
+}
+
+/**
+ * \brief get size of #snd_ctl_elem_value_t
+ * \return size in bytes
+ */
+size_t snd_ctl_elem_value_sizeof()
+{
+ return sizeof(snd_ctl_elem_value_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_ctl_elem_value_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_ctl_elem_value_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_ctl_elem_value_t
+ * \param obj pointer to object to free
+ */
+void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief clear given #snd_ctl_elem_value_t object
+ * \param obj pointer to object to clear
+ */
+void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj)
+{
+ memset(obj, 0, sizeof(snd_ctl_elem_value_t));
+}
+
+/**
+ * \brief copy one #snd_ctl_elem_value_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param ptr Pointer to returned CTL element identifier
+ */
+void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ *ptr = obj->id;
+}
+
+/**
+ * \brief Get element numeric identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return element numeric identifier
+ */
+unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->id.numid;
+}
+
+/**
+ * \brief Get interface part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return interface part of element identifier
+ */
+snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->id.iface;
+}
+
+/**
+ * \brief Get device part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return device part of element identifier
+ */
+unsigned int snd_ctl_elem_value_get_device(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->id.device;
+}
+
+/**
+ * \brief Get subdevice part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return subdevice part of element identifier
+ */
+unsigned int snd_ctl_elem_value_get_subdevice(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->id.subdevice;
+}
+
+/**
+ * \brief Get name part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return name part of element identifier
+ */
+const char *snd_ctl_elem_value_get_name(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id.name;
+}
+
+/**
+ * \brief Get index part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return index part of element identifier
+ */
+unsigned int snd_ctl_elem_value_get_index(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->id.index;
+}
+
+/**
+ * \brief Set CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param ptr CTL element identifier
+ */
+void snd_ctl_elem_value_set_id(snd_ctl_elem_value_t *obj, const snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ obj->id = *ptr;
+}
+
+/**
+ * \brief Set element numeric identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val element numeric identifier
+ */
+void snd_ctl_elem_value_set_numid(snd_ctl_elem_value_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.numid = val;
+}
+
+/**
+ * \brief Set interface part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val interface part of element identifier
+ */
+void snd_ctl_elem_value_set_interface(snd_ctl_elem_value_t *obj, snd_ctl_elem_iface_t val)
+{
+ assert(obj);
+ obj->id.iface = val;
+}
+
+/**
+ * \brief Set device part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val device part of element identifier
+ */
+void snd_ctl_elem_value_set_device(snd_ctl_elem_value_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.device = val;
+}
+
+/**
+ * \brief Set subdevice part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val subdevice part of element identifier
+ */
+void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.subdevice = val;
+}
+
+/**
+ * \brief Set name part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val name part of element identifier
+ */
+void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val)
+{
+ assert(obj);
+ strncpy((char *)obj->id.name, val, sizeof(obj->id.name));
+}
+
+/**
+ * \brief Set index part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param val index part of element identifier
+ */
+void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->id.index = val;
+}
+
+/**
+ * \brief Get value for an entry of a #SND_CTL_ELEM_TYPE_BOOLEAN CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \return value for the entry
+ */
+int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+ return obj->value.integer.value[idx];
+}
+
+/**
+ * \brief Get value for an entry of a #SND_CTL_ELEM_TYPE_INTEGER CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \return value for the entry
+ */
+long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0]));
+ return obj->value.integer.value[idx];
+}
+
+/**
+ * \brief Get value for an entry of a #SND_CTL_ELEM_TYPE_INTEGER64 CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \return value for the entry
+ */
+long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < sizeof(obj->value.integer64.value) / sizeof(obj->value.integer64.value[0]));
+ return obj->value.integer64.value[idx];
+}
+
+/**
+ * \brief Get value for an entry of a #SND_CTL_ELEM_TYPE_ENUMERATED CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \return value for the entry
+ */
+unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < sizeof(obj->value.enumerated.item) / sizeof(obj->value.enumerated.item[0]));
+ return obj->value.enumerated.item[idx];
+}
+
+/**
+ * \brief Get value for an entry of a #SND_CTL_ELEM_TYPE_BYTES CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \return value for the entry
+ */
+unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx)
+{
+ assert(obj);
+ assert(idx < sizeof(obj->value.bytes.data));
+ return obj->value.bytes.data[idx];
+}
+
+/**
+ * \brief Set value for an entry of a #SND_CTL_ELEM_TYPE_BOOLEAN CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \param val value for the entry
+ */
+void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val)
+{
+ assert(obj);
+ obj->value.integer.value[idx] = val;
+}
+
+/**
+ * \brief Set value for an entry of a #SND_CTL_ELEM_TYPE_INTEGER CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \param val value for the entry
+ */
+void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val)
+{
+ assert(obj);
+ obj->value.integer.value[idx] = val;
+}
+
+/**
+ * \brief Set value for an entry of a #SND_CTL_ELEM_TYPE_INTEGER64 CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \param val value for the entry
+ */
+void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val)
+{
+ assert(obj);
+ obj->value.integer64.value[idx] = val;
+}
+
+/**
+ * \brief Set value for an entry of a #SND_CTL_ELEM_TYPE_ENUMERATED CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \param val value for the entry
+ */
+void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val)
+{
+ assert(obj);
+ obj->value.enumerated.item[idx] = val;
+}
+
+/**
+ * \brief Set value for an entry of a #SND_CTL_ELEM_TYPE_BYTES CTL element id/value
+ * \param obj CTL element id/value
+ * \param idx Entry index
+ * \param val value for the entry
+ */
+void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val)
+{
+ assert(obj);
+ obj->value.bytes.data[idx] = val;
+}
+
+/**
+ * \brief Set CTL element #SND_CTL_ELEM_TYPE_BYTES value
+ * \param obj CTL handle
+ * \param data Bytes value
+ * \param size Size in bytes
+ */
+void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size)
+{
+ assert(obj);
+ if (size >= sizeof(obj->value.bytes.data)) {
+ assert(0);
+ return;
+ }
+ memcpy(obj->value.bytes.data, data, size);
+}
+
+/**
+ * \brief Get value for a #SND_CTL_ELEM_TYPE_BYTES CTL element id/value
+ * \param obj CTL element id/value
+ * \return Pointer to CTL element value
+ */
+const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj)
+{
+ assert(obj);
+ return obj->value.bytes.data;
+}
+
+/**
+ * \brief Get value for a #SND_CTL_ELEM_TYPE_IEC958 CTL element id/value
+ * \param obj CTL element id/value
+ * \param ptr Pointer to returned CTL element value
+ */
+void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr)
+{
+ assert(obj && ptr);
+ memcpy(ptr, &obj->value.iec958, sizeof(*ptr));
+}
+
+/**
+ * \brief Set value for a #SND_CTL_ELEM_TYPE_IEC958 CTL element id/value
+ * \param obj CTL element id/value
+ * \param ptr Pointer to CTL element value
+ */
+void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr)
+{
+ assert(obj && ptr);
+ memcpy(&obj->value.iec958, ptr, sizeof(obj->value.iec958));
+}
+
diff --git a/alsa-lib/src/control/control_ext.c b/alsa-lib/src/control/control_ext.c
new file mode 100644
index 0000000..a8675c1
--- /dev/null
+++ b/alsa-lib/src/control/control_ext.c
@@ -0,0 +1,679 @@
+/**
+ * \file control/control_ext.c
+ * \ingroup CtlPlugin_SDK
+ * \brief External Control Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ */
+/*
+ * Control Interface - External Control Plugin SDK
+ *
+ * Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include "control_local.h"
+#include "control_external.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_control_ext = "";
+#endif
+
+static int snd_ctl_ext_close(snd_ctl_t *handle)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ if (ext->callback->close)
+ ext->callback->close(ext);
+ return 0;
+}
+
+static int snd_ctl_ext_nonblock(snd_ctl_t *handle, int nonblock)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ ext->nonblock = nonblock;
+ return 0;
+}
+
+static int snd_ctl_ext_async(snd_ctl_t *ctl ATTRIBUTE_UNUSED,
+ int sig ATTRIBUTE_UNUSED,
+ pid_t pid ATTRIBUTE_UNUSED)
+{
+ return -ENOSYS;
+}
+
+static int snd_ctl_ext_subscribe_events(snd_ctl_t *handle, int subscribe)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ if (subscribe < 0)
+ return ext->subscribed;
+ ext->subscribed = !!subscribe;
+ if (ext->callback->subscribe_events)
+ ext->callback->subscribe_events(ext, subscribe);
+ return 0;
+}
+
+static int snd_ctl_ext_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ memset(info, 0, sizeof(*info));
+ info->card = ext->card_idx;
+ memcpy(info->id, ext->id, sizeof(info->id));
+ memcpy(info->driver, ext->driver, sizeof(info->driver));
+ memcpy(info->name, ext->name, sizeof(info->name));
+ memcpy(info->longname, ext->longname, sizeof(info->longname));
+ memcpy(info->mixername, ext->mixername, sizeof(info->mixername));
+ return 0;
+}
+
+static int snd_ctl_ext_elem_list(snd_ctl_t *handle, snd_ctl_elem_list_t *list)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+ int ret;
+ unsigned int i, offset;
+ snd_ctl_elem_id_t *ids;
+
+ list->count = ext->callback->elem_count(ext);
+ list->used = 0;
+ ids = list->pids;
+ offset = list->offset;
+ for (i = 0; i < list->space; i++) {
+ if (offset >= list->count)
+ break;
+ snd_ctl_elem_id_clear(ids);
+ ret = ext->callback->elem_list(ext, offset, ids);
+ if (ret < 0)
+ return ret;
+ list->used++;
+ offset++;
+ ids++;
+ }
+ return 0;
+}
+
+static int snd_ctl_ext_elem_info(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+ snd_ctl_ext_key_t key;
+ int type, ret;
+
+ key = ext->callback->find_elem(ext, &info->id);
+ if (key == SND_CTL_EXT_KEY_NOT_FOUND)
+ return -ENOENT;
+ ret = ext->callback->get_attribute(ext, key, &type, &info->access, &info->count);
+ if (ret < 0)
+ goto err;
+ info->type = type;
+ ret = -EINVAL;
+ switch (info->type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ info->value.integer.min = 0;
+ info->value.integer.max = 1;
+ ret = 0;
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ if (! ext->callback->get_integer_info)
+ goto err;
+ ret = ext->callback->get_integer_info(ext, key, &info->value.integer.min,
+ &info->value.integer.max,
+ &info->value.integer.step);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ if (! ext->callback->get_integer64_info)
+ goto err;
+ {
+ int64_t xmin, xmax, xstep;
+ ret = ext->callback->get_integer64_info(ext, key,
+ &xmin,
+ &xmax,
+ &xstep);
+ info->value.integer64.min = xmin;
+ info->value.integer64.max = xmax;
+ info->value.integer64.step = xstep;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ if (! ext->callback->get_enumerated_info)
+ goto err;
+ ret = ext->callback->get_enumerated_info(ext, key, &info->value.enumerated.items);
+ ext->callback->get_enumerated_name(ext, key, info->value.enumerated.item,
+ info->value.enumerated.name,
+ sizeof(info->value.enumerated.name));
+ break;
+ default:
+ ret = 0;
+ break;
+ }
+
+ err:
+ if (ext->callback->free_key)
+ ext->callback->free_key(ext, key);
+
+ return ret;
+}
+
+static int snd_ctl_ext_elem_add(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_ctl_elem_info_t *info ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_elem_replace(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_ctl_elem_info_t *info ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_elem_remove(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_ctl_elem_id_t *id ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_elem_read(snd_ctl_t *handle, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+ snd_ctl_ext_key_t key;
+ int type, ret;
+ unsigned int access, count;
+
+ key = ext->callback->find_elem(ext, &control->id);
+ if (key == SND_CTL_EXT_KEY_NOT_FOUND)
+ return -ENOENT;
+ ret = ext->callback->get_attribute(ext, key, &type, &access, &count);
+ if (ret < 0)
+ goto err;
+ ret = -EINVAL;
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ if (! ext->callback->read_integer)
+ goto err;
+ ret = ext->callback->read_integer(ext, key, control->value.integer.value);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ if (! ext->callback->read_integer64)
+ goto err;
+ ret = ext->callback->read_integer64(ext, key,
+ (int64_t*)control->value.integer64.value);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ if (! ext->callback->read_enumerated)
+ goto err;
+ ret = ext->callback->read_enumerated(ext, key, control->value.enumerated.item);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ if (! ext->callback->read_bytes)
+ goto err;
+ ret = ext->callback->read_bytes(ext, key, control->value.bytes.data,
+ sizeof(control->value.bytes.data));
+ break;
+ case SND_CTL_ELEM_TYPE_IEC958:
+ if (! ext->callback->read_iec958)
+ goto err;
+ ret = ext->callback->read_iec958(ext, key, (snd_aes_iec958_t *)&control->value.iec958);
+ break;
+ default:
+ break;
+ }
+
+ err:
+ if (ext->callback->free_key)
+ ext->callback->free_key(ext, key);
+
+ return ret;
+}
+
+static int snd_ctl_ext_elem_write(snd_ctl_t *handle, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+ snd_ctl_ext_key_t key;
+ int type, ret;
+ unsigned int access, count;
+
+ key = ext->callback->find_elem(ext, &control->id);
+ if (key == SND_CTL_EXT_KEY_NOT_FOUND)
+ return -ENOENT;
+ ret = ext->callback->get_attribute(ext, key, &type, &access, &count);
+ if (ret < 0)
+ goto err;
+ ret = -EINVAL;
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ if (! ext->callback->write_integer)
+ goto err;
+ ret = ext->callback->write_integer(ext, key, control->value.integer.value);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ if (! ext->callback->write_integer64)
+ goto err;
+ ret = ext->callback->write_integer64(ext, key, (int64_t *)control->value.integer64.value);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ if (! ext->callback->write_enumerated)
+ goto err;
+ ret = ext->callback->write_enumerated(ext, key, control->value.enumerated.item);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ if (! ext->callback->write_bytes)
+ goto err;
+ ret = ext->callback->write_bytes(ext, key, control->value.bytes.data,
+ sizeof(control->value.bytes.data));
+ break;
+ case SND_CTL_ELEM_TYPE_IEC958:
+ if (! ext->callback->write_iec958)
+ goto err;
+ ret = ext->callback->write_iec958(ext, key, (snd_aes_iec958_t *)&control->value.iec958);
+ break;
+ default:
+ break;
+ }
+
+ err:
+ if (ext->callback->free_key)
+ ext->callback->free_key(ext, key);
+
+ return ret;
+}
+
+static int snd_ctl_ext_elem_lock(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_ctl_elem_id_t *id ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_elem_unlock(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_ctl_elem_id_t *id ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_next_device(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ int *device ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_prefer_subdevice(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ int subdev ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_hwdep_info(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_hwdep_info_t *info ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_pcm_info(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_pcm_info_t *info ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_rawmidi_info(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ snd_rawmidi_info_t *info ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_ctl_ext_set_power_state(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ unsigned int state ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_ctl_ext_get_power_state(snd_ctl_t *handle ATTRIBUTE_UNUSED,
+ unsigned int *state ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_ctl_ext_read(snd_ctl_t *handle, snd_ctl_event_t *event)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ memset(event, 0, sizeof(*event));
+ return ext->callback->read_event(ext, &event->data.elem.id, &event->data.elem.mask);
+}
+
+static int snd_ctl_ext_poll_descriptors_count(snd_ctl_t *handle)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ if (ext->callback->poll_descriptors_count)
+ return ext->callback->poll_descriptors_count(ext);
+ if (ext->poll_fd >= 0)
+ return 1;
+ return 0;
+}
+
+static int snd_ctl_ext_poll_descriptors(snd_ctl_t *handle, struct pollfd *pfds, unsigned int space)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ if (ext->callback->poll_descriptors)
+ return ext->callback->poll_descriptors(ext, pfds, space);
+ if (ext->poll_fd < 0)
+ return 0;
+ if (space > 0) {
+ pfds->fd = ext->poll_fd;
+ pfds->events = POLLIN|POLLERR|POLLNVAL;
+ return 1;
+ }
+ return 0;
+}
+
+static int snd_ctl_ext_poll_revents(snd_ctl_t *handle, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_ctl_ext_t *ext = handle->private_data;
+
+ if (ext->callback->poll_revents)
+ return ext->callback->poll_revents(ext, pfds, nfds, revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+static const snd_ctl_ops_t snd_ctl_ext_ops = {
+ .close = snd_ctl_ext_close,
+ .nonblock = snd_ctl_ext_nonblock,
+ .async = snd_ctl_ext_async,
+ .subscribe_events = snd_ctl_ext_subscribe_events,
+ .card_info = snd_ctl_ext_card_info,
+ .element_list = snd_ctl_ext_elem_list,
+ .element_info = snd_ctl_ext_elem_info,
+ .element_add = snd_ctl_ext_elem_add,
+ .element_replace = snd_ctl_ext_elem_replace,
+ .element_remove = snd_ctl_ext_elem_remove,
+ .element_read = snd_ctl_ext_elem_read,
+ .element_write = snd_ctl_ext_elem_write,
+ .element_lock = snd_ctl_ext_elem_lock,
+ .element_unlock = snd_ctl_ext_elem_unlock,
+ .hwdep_next_device = snd_ctl_ext_next_device,
+ .hwdep_info = snd_ctl_ext_hwdep_info,
+ .pcm_next_device = snd_ctl_ext_next_device,
+ .pcm_info = snd_ctl_ext_pcm_info,
+ .pcm_prefer_subdevice = snd_ctl_ext_prefer_subdevice,
+ .rawmidi_next_device = snd_ctl_rawmidi_next_device,
+ .rawmidi_info = snd_ctl_ext_rawmidi_info,
+ .rawmidi_prefer_subdevice = snd_ctl_ext_prefer_subdevice,
+ .set_power_state = snd_ctl_ext_set_power_state,
+ .get_power_state = snd_ctl_ext_get_power_state,
+ .read = snd_ctl_ext_read,
+ .poll_descriptors_count = snd_ctl_ext_poll_descriptors_count,
+ .poll_descriptors = snd_ctl_ext_poll_descriptors,
+ .poll_revents = snd_ctl_ext_poll_revents,
+};
+
+/*
+ * Exported functions
+ */
+
+/*! \page ctl_external_plugins External Control Plugin SDK
+
+\section ctl_externals External Control Plugins
+
+The external plugins are implemented in a shared object file located
+at /usr/lib/alsa-lib (the exact location depends on the build option
+and asoundrc configuration). It has to be the file like
+libasound_module_ctl_MYPLUGIN.so, where MYPLUGIN corresponds to your
+own plugin name.
+
+The entry point of the plugin is defined via
+#SND_CTL_PLUGIN_DEFINE_FUNC() macro. This macro defines the function
+with a proper name to be referred from alsa-lib. The function takes
+the following 5 arguments:
+\code
+int (snd_ctl_t **phandle, const char *name, snd_config_t *root,
+ snd_config_t *conf, int mode)
+\endcode
+The first argument, phandle, is the pointer to store the resultant control
+handle. The arguments name, root and mode are the parameters
+to be passed to the plugin constructor. The conf is the configuration
+tree for the plugin. The arguments above are defined in the macro
+itself, so don't use variables with the same names to shadow
+parameters.
+
+After parsing the configuration parameters in the given conf tree,
+usually you will call the external plugin API function
+#snd_ctl_ext_create().
+The control handle must be filled *phandle in return.
+Then this function must return either a value 0 when succeeded, or a
+negative value as the error code.
+
+Finally, add #SND_CTL_PLUGIN_SYMBOL() with the name of your
+plugin as the argument at the end. This defines the proper versioned
+symbol as the reference.
+
+The typical code would look like below:
+\code
+struct myctl_info {
+ snd_ctl_ext_t ext;
+ int my_own_data;
+ ...
+};
+
+SND_CTL_PLUGIN_DEFINE_FUNC(myctl)
+{
+ snd_config_iterator_t i, next;
+ struct myctl_info *myctl;
+ int err;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "my_own_parameter") == 0) {
+ ....
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+
+ myctl = calloc(1, sizeof(*myctl));
+ if (myctl == NULL)
+ return -ENOMEM;
+
+ myctl->ext.version = SND_CTL_EXT_VERSION;
+ myctl->ext.card_idx = 0;
+ strcpy(myctl->ext.id, "Myctl");
+ strcpy(myctl->ext.name, "My Control");
+ strcpy(myctl->ext.longname, "My External Control for Foobar");
+ strcpy(myctl->ext.mixername, "My Control");
+ myctl->ext.callback = &my_own_callback;
+ myctl->ext.private_data = myctl;
+ ....
+
+ err = snd_pcm_extplug_create(&myctl->ext, name, mode);
+ if (err < 0) {
+ myctl_free(myctl);
+ return err;
+ }
+
+ *phandle = myctl->ext.handle;
+ return 0;
+}
+
+SND_CTL_PLUGIN_SYMBOL(myctl);
+\endcode
+
+Read the codes in alsa-plugins package for the real examples.
+
+
+\section ctl_ext_impl Implementation of External Control Plugins
+
+The following fields have to be filled in external control record before calling
+#snd_ctl_ext_create() : version, card_idx, id, name, longname, mixername, poll_fd and callback.
+Otherfields are optional and should be initialized with zero.
+
+The constant #SND_CTL_EXT_VERSION must be passed to the version
+field for the version check in alsa-lib. The card_idx field specifies the card
+index of this control. [FIXME: solve confliction of card index in alsa-lib?]
+
+The id, name, longname and mixername fields are the strings shown in the card_info
+inqurirys. They are the char arrays, so you have to <i>copy</i> strings to these
+fields.
+
+The callback field contains the table of callback functions for this plugin (defined as
+#snd_ctl_ext_callback_t).
+The poll_fd can be used to specify the poll file descriptor for this control.
+Set -1 if not available. Alternatively, you can define poll_descriptors_count and
+poll_descriptors callbacks in the callback table for handling the poll descriptor(s)
+dynamically after the creation of plugin instance.
+
+The driver can set an arbitrary value (pointer) to private_data
+field to refer its own data in the callbacks.
+
+The rest fields are filled by #snd_ctl_ext_create(). The handle field
+is the resultant PCM handle. The others are the current status of the
+PCM.
+
+\section ctl_ext_impl Callback Functions of External Control Plugins
+
+The callback functions in #snd_ctl_ext_callback_t define the real
+behavior of the driver. There are many callbacks but many of them are optional.
+
+The close callback is called when the PCM is closed. If the plugin
+allocates private resources, this is the place to release them
+again. This callback is optional.
+
+The elem_count and elem_list callbacks are mandatory. The elem_count returns the
+total number of control elements. The elem_list returns the control element ID
+of the corresponding element offset (the offset is from 0 to elem_count - 1).
+The id field is initialized to all zero in prior to elem_list callback. The callback
+has to fill the necessary field (typically iface, name and index) in return via the
+standard control API functions like #snd_ctl_elem_id_set_ifarce,
+#snd_ctl_elem_id_set_name and #snd_ctl_elem_id_set_index, etc. The callbacks should
+return 0 if successful, or a negative error code.
+
+The find_elem callback is used to convert the given control element ID to the
+certain key value for the faster access to get, read and write callbacks.
+The key type is alias of unsigned long, so you can assign some static number
+(e.g. index of the array) to this value of the corresponding element, or
+assign the pointer (cast to #snd_ctl_ext_key_t). When no key is defined or found,
+return #SND_CTL_EXT_KEY_NOT_FOUND. This callback is (very likely) required
+if you use get, read and write callbacks as follows.
+If you need to create a record dynamically (e.g. via malloc) at each find_elem call,
+the allocated record can be released with the optional free_key callback.
+
+The get_attribute is a mandatory callback, which returns the attribute of the
+control element given via a key value (converted with find_elem callback).
+It must fill the control element type (#snd_ctl_elem_type_t), the access type
+(#snd_ctl_ext_access_t), and the count (element array size). The callback returns
+0 if successful, or a negative error code, as usual.
+
+The get_integer_info, get_integetr64_info and get_enumerated_info callbacks are called
+to return the information of the given control element for each element type.
+For integer and integer64 types, the callbacks need to fill the minimal (imin),
+maximal (imax) and the step (istep) values of the control. For the enumerated type,
+the number of enum items must be filled. Additionally, the enum control has to define
+get_enumerated_name callback to store the name of the enumerated item of the given control
+element. All functions return 0 if successful, or a negative error code.
+
+For reading the current values of a control element, read_integer, read_integer64,
+read_enumerated, read_bytes and read_iec958 callbacks are called depending on the
+element type. These callbacks have to fill the current values of the element in return.
+Note that a control element can be an array. If it contains more than one values
+(i.e. the count value in get_attribute callback is more than 1), <i>all</i> values
+must be filled on the given value pointer as an array. Also, note that the boolean type
+is handled as integer here (although boolean type doesn't need to define the corresponding
+info callback since it's obvious). These callbacks return 0 if successful, or
+a negative error code.
+
+For writing the current values, write_integer, write_integer64, write_bytes, and
+write_iec958 callbacks are called as well as for read. The callbacks should check the
+current values and compare with the given values. If they are identical, the callbacks
+should do nothing and return 0. If they differ, update the current values and return 1,
+instead. For any errors, return a negative error code.
+
+The subscribe_events callback is called when the application subscribes or cancels
+the event notifications (e.g. through mixer API). The current value of event
+subscription is kept in the subscribed field.
+The read_event callback is called for reading a pending notification event.
+The callback needs to fill the event_mask value, a bit-field defined as SND_CTL_EVENT_MASK_XXX.
+If no event is pending, return -EAGAIN. These two callbacks are optional.
+
+The poll_descriptors_count and poll_descriptors callbacks are used to return
+the poll descriptor(s) via callbacks. As already mentioned, if the callback cannot
+set the static poll_fd, you can define these callbacks to return dynamically.
+Also, when multiple poll descriptors are required, use these callbacks.
+The poll_revents callback is used for handle poll revents.
+
+*/
+
+/**
+ * \brief Create an external control plugin instance
+ * \param ext the plugin handle
+ * \param name name of control
+ * \param mode control open mode
+ * \return 0 if successful, or a negative error code
+ *
+ * Creates the external control instance.
+ *
+ */
+int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
+{
+ snd_ctl_t *ctl;
+ int err;
+
+ if (ext->version != SND_CTL_EXT_VERSION) {
+ SNDERR("ctl_ext: Plugin version mismatch\n");
+ return -ENXIO;
+ }
+
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name);
+ if (err < 0)
+ return err;
+
+ ext->handle = ctl;
+
+ ctl->ops = &snd_ctl_ext_ops;
+ ctl->private_data = ext;
+ ctl->poll_fd = ext->poll_fd;
+ if (mode & SND_CTL_NONBLOCK)
+ ext->nonblock = 1;
+
+ return 0;
+}
+
+/**
+ * \brief Delete the external control plugin
+ * \param ext the plugin handle
+ * \return 0 if successful, or a negative error code
+ */
+int snd_ctl_ext_delete(snd_ctl_ext_t *ext)
+{
+ return snd_ctl_close(ext->handle);
+}
diff --git a/alsa-lib/src/control/control_hw.c b/alsa-lib/src/control/control_hw.c
new file mode 100644
index 0000000..e9a6be2
--- /dev/null
+++ b/alsa-lib/src/control/control_hw.c
@@ -0,0 +1,469 @@
+/*
+ * Control Interface - Hardware
+ * Copyright (c) 1998,1999,2000 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "control_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_control_hw = "";
+#endif
+
+#ifndef F_SETSIG
+#define F_SETSIG 10
+#endif
+
+#ifndef DOC_HIDDEN
+#define SNDRV_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
+#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 4)
+
+typedef struct {
+ int card;
+ int fd;
+ unsigned int protocol;
+} snd_ctl_hw_t;
+#endif /* DOC_HIDDEN */
+
+static int snd_ctl_hw_close(snd_ctl_t *handle)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ int res;
+ res = close(hw->fd) < 0 ? -errno : 0;
+ free(hw);
+ return res;
+}
+
+static int snd_ctl_hw_nonblock(snd_ctl_t *handle, int nonblock)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ long flags;
+ int fd = hw->fd;
+ if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ SYSERR("F_GETFL failed");
+ return -errno;
+ }
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, flags) < 0) {
+ SYSERR("F_SETFL for O_NONBLOCK failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
+{
+ long flags;
+ snd_ctl_hw_t *hw = ctl->private_data;
+ int fd = hw->fd;
+
+ if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ SYSERR("F_GETFL failed");
+ return -errno;
+ }
+ if (sig >= 0)
+ flags |= O_ASYNC;
+ else
+ flags &= ~O_ASYNC;
+ if (fcntl(fd, F_SETFL, flags) < 0) {
+ SYSERR("F_SETFL for O_ASYNC failed");
+ return -errno;
+ }
+ if (sig < 0)
+ return 0;
+ if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
+ SYSERR("F_SETSIG failed");
+ return -errno;
+ }
+ if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
+ SYSERR("F_SETOWN failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_ctl_hw_subscribe_events(snd_ctl_t *handle, int subscribe)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS, &subscribe) < 0) {
+ SYSERR("SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_ctl_hw_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CARD_INFO, info) < 0) {
+ SYSERR("SNDRV_CTL_IOCTL_CARD_INFO failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_ctl_hw_elem_list(snd_ctl_t *handle, snd_ctl_elem_list_t *list)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_LIST, list) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_info(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_add(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_ADD, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_replace(snd_ctl_t *handle, snd_ctl_elem_info_t *info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_REPLACE, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_remove(snd_ctl_t *handle, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_REMOVE, id) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_read(snd_ctl_t *handle, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_READ, control) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_write(snd_ctl_t *handle, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, control) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_lock(snd_ctl_t *handle, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_LOCK, id) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_unlock(snd_ctl_t *handle, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_UNLOCK, id) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
+ unsigned int numid,
+ unsigned int *tlv, unsigned int tlv_size)
+{
+ int inum;
+ snd_ctl_hw_t *hw = handle->private_data;
+ struct sndrv_ctl_tlv *xtlv;
+
+ /* we don't support TLV on protocol ver 2.0.3 or earlier */
+ if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ return -ENXIO;
+
+ switch (op_flag) {
+ case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break;
+ case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
+ case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
+ default: return -EINVAL;
+ }
+ xtlv = malloc(sizeof(struct sndrv_ctl_tlv) + tlv_size);
+ if (xtlv == NULL)
+ return -ENOMEM;
+ xtlv->numid = numid;
+ xtlv->length = tlv_size;
+ memcpy(xtlv->tlv, tlv, tlv_size);
+ if (ioctl(hw->fd, inum, xtlv) < 0) {
+ free(xtlv);
+ return -errno;
+ }
+ if (op_flag == 0) {
+ if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size)
+ return -EFAULT;
+ memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int));
+ }
+ free(xtlv);
+ return 0;
+}
+
+static int snd_ctl_hw_hwdep_next_device(snd_ctl_t *handle, int * device)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE, device) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_hwdep_info(snd_ctl_t *handle, snd_hwdep_info_t * info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_HWDEP_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_pcm_next_device(snd_ctl_t *handle, int * device)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE, device) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_pcm_info(snd_ctl_t *handle, snd_pcm_info_t * info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_PCM_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_pcm_prefer_subdevice(snd_ctl_t *handle, int subdev)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE, &subdev) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_rawmidi_next_device(snd_ctl_t *handle, int * device)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE, device) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_rawmidi_info(snd_ctl_t *handle, snd_rawmidi_info_t * info)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_RAWMIDI_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE, &subdev) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_set_power_state(snd_ctl_t *handle, unsigned int state)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_POWER, &state) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_get_power_state(snd_ctl_t *handle, unsigned int *state)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ if (ioctl(hw->fd, SNDRV_CTL_IOCTL_POWER_STATE, state) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
+{
+ snd_ctl_hw_t *hw = handle->private_data;
+ ssize_t res = read(hw->fd, event, sizeof(*event));
+ if (res <= 0)
+ return -errno;
+ if (CHECK_SANITY(res != sizeof(*event))) {
+ SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)\n",
+ sizeof(*event), res);
+ return -EINVAL;
+ }
+ return 1;
+}
+
+static const snd_ctl_ops_t snd_ctl_hw_ops = {
+ .close = snd_ctl_hw_close,
+ .nonblock = snd_ctl_hw_nonblock,
+ .async = snd_ctl_hw_async,
+ .subscribe_events = snd_ctl_hw_subscribe_events,
+ .card_info = snd_ctl_hw_card_info,
+ .element_list = snd_ctl_hw_elem_list,
+ .element_info = snd_ctl_hw_elem_info,
+ .element_add = snd_ctl_hw_elem_add,
+ .element_replace = snd_ctl_hw_elem_replace,
+ .element_remove = snd_ctl_hw_elem_remove,
+ .element_read = snd_ctl_hw_elem_read,
+ .element_write = snd_ctl_hw_elem_write,
+ .element_lock = snd_ctl_hw_elem_lock,
+ .element_unlock = snd_ctl_hw_elem_unlock,
+ .element_tlv = snd_ctl_hw_elem_tlv,
+ .hwdep_next_device = snd_ctl_hw_hwdep_next_device,
+ .hwdep_info = snd_ctl_hw_hwdep_info,
+ .pcm_next_device = snd_ctl_hw_pcm_next_device,
+ .pcm_info = snd_ctl_hw_pcm_info,
+ .pcm_prefer_subdevice = snd_ctl_hw_pcm_prefer_subdevice,
+ .rawmidi_next_device = snd_ctl_hw_rawmidi_next_device,
+ .rawmidi_info = snd_ctl_hw_rawmidi_info,
+ .rawmidi_prefer_subdevice = snd_ctl_hw_rawmidi_prefer_subdevice,
+ .set_power_state = snd_ctl_hw_set_power_state,
+ .get_power_state = snd_ctl_hw_get_power_state,
+ .read = snd_ctl_hw_read,
+};
+
+int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
+{
+ int fd, ver;
+ char filename[sizeof(SNDRV_FILE_CONTROL) + 10];
+ int fmode;
+ snd_ctl_t *ctl;
+ snd_ctl_hw_t *hw;
+ int err;
+
+ *handle = NULL;
+
+ if (CHECK_SANITY(card < 0 || card >= 32)) {
+ SNDMSG("Invalid card index %d", card);
+ return -EINVAL;
+ }
+ sprintf(filename, SNDRV_FILE_CONTROL, card);
+ if (mode & SND_CTL_READONLY)
+ fmode = O_RDONLY;
+ else
+ fmode = O_RDWR;
+ if (mode & SND_CTL_NONBLOCK)
+ fmode |= O_NONBLOCK;
+ if (mode & SND_CTL_ASYNC)
+ fmode |= O_ASYNC;
+ fd = snd_open_device(filename, fmode);
+ if (fd < 0) {
+ snd_card_load(card);
+ fd = snd_open_device(filename, fmode);
+ if (fd < 0)
+ return -errno;
+ }
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ SYSERR("fcntl FD_CLOEXEC failed");
+ err = -errno;
+ close(fd);
+ return err;
+ }
+#endif
+ if (ioctl(fd, SNDRV_CTL_IOCTL_PVERSION, &ver) < 0) {
+ err = -errno;
+ close(fd);
+ return err;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_CTL_VERSION_MAX)) {
+ close(fd);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ hw = calloc(1, sizeof(snd_ctl_hw_t));
+ if (hw == NULL) {
+ close(fd);
+ return -ENOMEM;
+ }
+ hw->card = card;
+ hw->fd = fd;
+ hw->protocol = ver;
+
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name);
+ if (err < 0) {
+ close(fd);
+ free(hw);
+ }
+ ctl->ops = &snd_ctl_hw_ops;
+ ctl->private_data = hw;
+ ctl->poll_fd = fd;
+ *handle = ctl;
+ return 0;
+}
+
+int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ long card = -1;
+ const char *str;
+ int err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0)
+ return -EINVAL;
+ card = snd_card_get_index(str);
+ if (card < 0)
+ return card;
+ }
+ continue;
+ }
+ return -EINVAL;
+ }
+ if (card < 0)
+ return -EINVAL;
+ return snd_ctl_hw_open(handlep, name, card, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION);
diff --git a/alsa-lib/src/control/control_local.h b/alsa-lib/src/control/control_local.h
new file mode 100644
index 0000000..fd9f941
--- /dev/null
+++ b/alsa-lib/src/control/control_local.h
@@ -0,0 +1,100 @@
+/*
+ * Control Interface - local header file
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "local.h"
+
+typedef struct _snd_ctl_ops {
+ int (*close)(snd_ctl_t *handle);
+ int (*nonblock)(snd_ctl_t *handle, int nonblock);
+ int (*async)(snd_ctl_t *handle, int sig, pid_t pid);
+ int (*subscribe_events)(snd_ctl_t *handle, int subscribe);
+ int (*card_info)(snd_ctl_t *handle, snd_ctl_card_info_t *info);
+ int (*element_list)(snd_ctl_t *handle, snd_ctl_elem_list_t *list);
+ int (*element_info)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+ int (*element_add)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+ int (*element_replace)(snd_ctl_t *handle, snd_ctl_elem_info_t *info);
+ int (*element_remove)(snd_ctl_t *handle, snd_ctl_elem_id_t *id);
+ int (*element_read)(snd_ctl_t *handle, snd_ctl_elem_value_t *control);
+ int (*element_write)(snd_ctl_t *handle, snd_ctl_elem_value_t *control);
+ int (*element_lock)(snd_ctl_t *handle, snd_ctl_elem_id_t *lock);
+ int (*element_unlock)(snd_ctl_t *handle, snd_ctl_elem_id_t *unlock);
+ int (*element_tlv)(snd_ctl_t *handle, int op_flag, unsigned int numid,
+ unsigned int *tlv, unsigned int tlv_size);
+ int (*hwdep_next_device)(snd_ctl_t *handle, int *device);
+ int (*hwdep_info)(snd_ctl_t *handle, snd_hwdep_info_t * info);
+ int (*pcm_next_device)(snd_ctl_t *handle, int *device);
+ int (*pcm_info)(snd_ctl_t *handle, snd_pcm_info_t * info);
+ int (*pcm_prefer_subdevice)(snd_ctl_t *handle, int subdev);
+ int (*rawmidi_next_device)(snd_ctl_t *handle, int *device);
+ int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
+ int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
+ int (*set_power_state)(snd_ctl_t *handle, unsigned int state);
+ int (*get_power_state)(snd_ctl_t *handle, unsigned int *state);
+ int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
+ int (*poll_descriptors_count)(snd_ctl_t *handle);
+ int (*poll_descriptors)(snd_ctl_t *handle, struct pollfd *pfds, unsigned int space);
+ int (*poll_revents)(snd_ctl_t *handle, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+} snd_ctl_ops_t;
+
+
+struct _snd_ctl {
+ void *dl_handle;
+ char *name;
+ snd_ctl_type_t type;
+ const snd_ctl_ops_t *ops;
+ void *private_data;
+ int nonblock;
+ int poll_fd;
+ struct list_head async_handlers;
+};
+
+struct _snd_hctl_elem {
+ snd_ctl_elem_id_t id; /* must be always on top */
+ struct list_head list; /* links for list of all helems */
+ int compare_weight; /* compare weight (reversed) */
+ /* event callback */
+ snd_hctl_elem_callback_t callback;
+ void *callback_private;
+ /* links */
+ snd_hctl_t *hctl; /* associated handle */
+};
+
+struct _snd_hctl {
+ snd_ctl_t *ctl;
+ struct list_head elems; /* list of all controls */
+ unsigned int alloc;
+ unsigned int count;
+ snd_hctl_elem_t **pelems;
+ snd_hctl_compare_t compare;
+ snd_hctl_callback_t callback;
+ void *callback_private;
+};
+
+
+/* make local functions really local */
+#define snd_ctl_new snd1_ctl_new
+
+int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name);
+int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
+#define _snd_ctl_async_descriptor _snd_ctl_poll_descriptor
+int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
+int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode);
+int snd_ctl_async(snd_ctl_t *ctl, int sig, pid_t pid);
diff --git a/alsa-lib/src/control/control_shm.c b/alsa-lib/src/control/control_shm.c
new file mode 100644
index 0000000..abab398
--- /dev/null
+++ b/alsa-lib/src/control/control_shm.c
@@ -0,0 +1,679 @@
+/*
+ * Control - SHM Client
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/shm.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <sys/un.h>
+#include <sys/uio.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include "aserver.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_control_shm = "";
+#endif
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ int socket;
+ volatile snd_ctl_shm_ctrl_t *ctrl;
+} snd_ctl_shm_t;
+#endif
+
+static int snd_ctl_shm_action(snd_ctl_t *ctl)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ int err;
+ char buf[1];
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ err = write(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ err = read(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ if (ctrl->cmd) {
+ SNDERR("Server has not done the cmd");
+ return -EBADFD;
+ }
+ return ctrl->result;
+}
+
+static int snd_ctl_shm_action_fd(snd_ctl_t *ctl, int *fd)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ int err;
+ char buf[1];
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ err = write(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ err = snd_receive_fd(shm->socket, buf, 1, fd);
+ if (err != 1)
+ return -EBADFD;
+ if (ctrl->cmd) {
+ SNDERR("Server has not done the cmd");
+ return -EBADFD;
+ }
+ return ctrl->result;
+}
+
+static int snd_ctl_shm_close(snd_ctl_t *ctl)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int result;
+ ctrl->cmd = SND_CTL_IOCTL_CLOSE;
+ result = snd_ctl_shm_action(ctl);
+ shmdt((void *)ctrl);
+ close(shm->socket);
+ free(shm);
+ return result;
+}
+
+static int snd_ctl_shm_nonblock(snd_ctl_t *handle ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_ctl_shm_async(snd_ctl_t *ctl, int sig, pid_t pid)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_CTL_IOCTL_ASYNC;
+ ctrl->u.async.sig = sig;
+ if (pid == 0)
+ pid = getpid();
+ ctrl->u.async.pid = pid;
+ return snd_ctl_shm_action(ctl);
+}
+
+static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int fd, err;
+ ctrl->cmd = SND_CTL_IOCTL_POLL_DESCRIPTOR;
+ err = snd_ctl_shm_action_fd(ctl, &fd);
+ if (err < 0)
+ return err;
+ return fd;
+}
+
+static int snd_ctl_shm_subscribe_events(snd_ctl_t *ctl, int subscribe)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS;
+ ctrl->u.subscribe_events = subscribe;
+ return snd_ctl_shm_action(ctl);
+}
+
+static int snd_ctl_shm_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+// ctrl->u.card_info = *info;
+ ctrl->cmd = SNDRV_CTL_IOCTL_CARD_INFO;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.card_info;
+ return err;
+}
+
+static int snd_ctl_shm_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ size_t maxsize = CTL_SHM_DATA_MAXLEN;
+ size_t bytes = list->space * sizeof(*list->pids);
+ int err;
+ snd_ctl_elem_id_t *pids = list->pids;
+ if (bytes > maxsize)
+ return -EINVAL;
+ ctrl->u.element_list = *list;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_LIST;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *list = ctrl->u.element_list;
+ list->pids = pids;
+ bytes = list->used * sizeof(*list->pids);
+ memcpy(pids, (void *)ctrl->data, bytes);
+ return err;
+}
+
+static int snd_ctl_shm_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_info = *info;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_INFO;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.element_info;
+ return err;
+}
+
+static int snd_ctl_shm_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_read = *control;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_READ;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *control = ctrl->u.element_read;
+ return err;
+}
+
+static int snd_ctl_shm_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *control)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_write = *control;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_WRITE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *control = ctrl->u.element_write;
+ return err;
+}
+
+static int snd_ctl_shm_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_lock = *id;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_LOCK;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *id = ctrl->u.element_lock;
+ return err;
+}
+
+static int snd_ctl_shm_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.element_unlock = *id;
+ ctrl->cmd = SNDRV_CTL_IOCTL_ELEM_UNLOCK;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *id = ctrl->u.element_unlock;
+ return err;
+}
+
+static int snd_ctl_shm_hwdep_next_device(snd_ctl_t *ctl, int * device)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.device = *device;
+ ctrl->cmd = SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *device = ctrl->u.device;
+ return err;
+}
+
+static int snd_ctl_shm_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.hwdep_info = *info;
+ ctrl->cmd = SNDRV_CTL_IOCTL_HWDEP_INFO;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.hwdep_info;
+ return err;
+}
+
+static int snd_ctl_shm_pcm_next_device(snd_ctl_t *ctl, int * device)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.device = *device;
+ ctrl->cmd = SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *device = ctrl->u.device;
+ return err;
+}
+
+static int snd_ctl_shm_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.pcm_info = *info;
+ ctrl->cmd = SNDRV_CTL_IOCTL_PCM_INFO;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.pcm_info;
+ return err;
+}
+
+static int snd_ctl_shm_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.pcm_prefer_subdevice = subdev;
+ ctrl->cmd = SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ return err;
+}
+
+static int snd_ctl_shm_rawmidi_next_device(snd_ctl_t *ctl, int * device)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.device = *device;
+ ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *device = ctrl->u.device;
+ return err;
+}
+
+static int snd_ctl_shm_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.rawmidi_info = *info;
+ ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_INFO;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.rawmidi_info;
+ return err;
+}
+
+static int snd_ctl_shm_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.rawmidi_prefer_subdevice = subdev;
+ ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ return err;
+}
+
+static int snd_ctl_shm_set_power_state(snd_ctl_t *ctl, unsigned int state)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.power_state = state;
+ ctrl->cmd = SNDRV_CTL_IOCTL_POWER;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ return err;
+}
+
+static int snd_ctl_shm_get_power_state(snd_ctl_t *ctl, unsigned int *state)
+{
+ snd_ctl_shm_t *shm = ctl->private_data;
+ volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->cmd = SNDRV_CTL_IOCTL_POWER_STATE;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *state = ctrl->u.power_state;
+ return err;
+}
+
+static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
+{
+ snd_ctl_shm_t *shm;
+ volatile snd_ctl_shm_ctrl_t *ctrl;
+ int err;
+ err = snd_ctl_wait(ctl, -1);
+ if (err < 0)
+ return 0;
+ shm = ctl->private_data;
+ ctrl = shm->ctrl;
+ ctrl->u.read = *event;
+ ctrl->cmd = SND_CTL_IOCTL_READ;
+ err = snd_ctl_shm_action(ctl);
+ if (err < 0)
+ return err;
+ *event = ctrl->u.read;
+ return err;
+}
+
+static const snd_ctl_ops_t snd_ctl_shm_ops = {
+ .close = snd_ctl_shm_close,
+ .nonblock = snd_ctl_shm_nonblock,
+ .async = snd_ctl_shm_async,
+ .subscribe_events = snd_ctl_shm_subscribe_events,
+ .card_info = snd_ctl_shm_card_info,
+ .element_list = snd_ctl_shm_elem_list,
+ .element_info = snd_ctl_shm_elem_info,
+ .element_read = snd_ctl_shm_elem_read,
+ .element_write = snd_ctl_shm_elem_write,
+ .element_lock = snd_ctl_shm_elem_lock,
+ .element_unlock = snd_ctl_shm_elem_unlock,
+ .hwdep_next_device = snd_ctl_shm_hwdep_next_device,
+ .hwdep_info = snd_ctl_shm_hwdep_info,
+ .pcm_next_device = snd_ctl_shm_pcm_next_device,
+ .pcm_info = snd_ctl_shm_pcm_info,
+ .pcm_prefer_subdevice = snd_ctl_shm_pcm_prefer_subdevice,
+ .rawmidi_next_device = snd_ctl_shm_rawmidi_next_device,
+ .rawmidi_info = snd_ctl_shm_rawmidi_info,
+ .rawmidi_prefer_subdevice = snd_ctl_shm_rawmidi_prefer_subdevice,
+ .set_power_state = snd_ctl_shm_set_power_state,
+ .get_power_state = snd_ctl_shm_get_power_state,
+ .read = snd_ctl_shm_read,
+};
+
+static int make_local_socket(const char *filename)
+{
+ size_t l = strlen(filename);
+ size_t size = offsetof(struct sockaddr_un, sun_path) + l;
+ struct sockaddr_un *addr = alloca(size);
+ int sock;
+
+ sock = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (sock < 0)
+ return -errno;
+
+ addr->sun_family = AF_LOCAL;
+ memcpy(addr->sun_path, filename, l);
+
+ if (connect(sock, (struct sockaddr *) addr, size) < 0)
+ return -errno;
+ return sock;
+}
+
+#if 0
+static int make_inet_socket(const char *host, int port)
+{
+ struct sockaddr_in addr;
+ int sock;
+ struct hostent *h = gethostbyname(host);
+ if (!h)
+ return -ENOENT;
+
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0)
+ return -errno;
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ memcpy(&addr.sin_addr, h->h_addr_list[0], sizeof(struct in_addr));
+
+ if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0)
+ return -errno;
+ return sock;
+}
+#endif
+
+int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode)
+{
+ snd_ctl_t *ctl;
+ snd_ctl_shm_t *shm = NULL;
+ snd_client_open_request_t *req;
+ snd_client_open_answer_t ans;
+ size_t snamelen, reqlen;
+ int err;
+ int result;
+ int sock = -1;
+ snd_ctl_shm_ctrl_t *ctrl = NULL;
+ snamelen = strlen(sname);
+ if (snamelen > 255)
+ return -EINVAL;
+
+ result = make_local_socket(sockname);
+ if (result < 0) {
+ SNDERR("server for socket %s is not running", sockname);
+ goto _err;
+ }
+ sock = result;
+
+ reqlen = sizeof(*req) + snamelen;
+ req = alloca(reqlen);
+ memcpy(req->name, sname, snamelen);
+ req->dev_type = SND_DEV_TYPE_CONTROL;
+ req->transport_type = SND_TRANSPORT_TYPE_SHM;
+ req->stream = 0;
+ req->mode = mode;
+ req->namelen = snamelen;
+ err = write(sock, req, reqlen);
+ if (err < 0) {
+ SNDERR("write error");
+ result = -errno;
+ goto _err;
+ }
+ if ((size_t) err != reqlen) {
+ SNDERR("write size error");
+ result = -EINVAL;
+ goto _err;
+ }
+ err = read(sock, &ans, sizeof(ans));
+ if (err < 0) {
+ SNDERR("read error");
+ result = -errno;
+ goto _err;
+ }
+ if (err != sizeof(ans)) {
+ SNDERR("read size error");
+ result = -EINVAL;
+ goto _err;
+ }
+ result = ans.result;
+ if (result < 0)
+ goto _err;
+
+ ctrl = shmat(ans.cookie, 0, 0);
+ if (!ctrl) {
+ result = -errno;
+ goto _err;
+ }
+
+ shm = calloc(1, sizeof(snd_ctl_shm_t));
+ if (!shm) {
+ result = -ENOMEM;
+ goto _err;
+ }
+
+ shm->socket = sock;
+ shm->ctrl = ctrl;
+
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name);
+ if (err < 0) {
+ result = err;
+ goto _err;
+ }
+ ctl->ops = &snd_ctl_shm_ops;
+ ctl->private_data = shm;
+ err = snd_ctl_shm_poll_descriptor(ctl);
+ if (err < 0) {
+ snd_ctl_close(ctl);
+ return err;
+ }
+ ctl->poll_fd = err;
+ *handlep = ctl;
+ return 0;
+
+ _err:
+ close(sock);
+ if (ctrl)
+ shmdt(ctrl);
+ free(shm);
+ return result;
+}
+
+int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ const char *server = NULL;
+ const char *ctl_name = NULL;
+ snd_config_t *sconfig;
+ const char *host = NULL;
+ const char *sockname = NULL;
+ long port = -1;
+ int err;
+ int local;
+ struct hostent *h;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "server") == 0) {
+ err = snd_config_get_string(n, &server);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "ctl") == 0) {
+ err = snd_config_get_string(n, &ctl_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!ctl_name) {
+ SNDERR("ctl is not defined");
+ return -EINVAL;
+ }
+ if (!server) {
+ SNDERR("server is not defined");
+ return -EINVAL;
+ }
+ err = snd_config_search_definition(root, "server", server, &sconfig);
+ if (err < 0) {
+ SNDERR("Unknown server %s", server);
+ return -EINVAL;
+ }
+ if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for server %s definition", server);
+ err = -EINVAL;
+ goto _err;
+ }
+ snd_config_for_each(i, next, sconfig) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &sockname);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+
+ if (!host) {
+ SNDERR("host is not defined");
+ goto _err;
+ }
+ if (!sockname) {
+ SNDERR("socket is not defined");
+ goto _err;
+ }
+ h = gethostbyname(host);
+ if (!h) {
+ SNDERR("Cannot resolve %s", host);
+ goto _err;
+ }
+ local = snd_is_local(h);
+ if (!local) {
+ SNDERR("%s is not the local host", host);
+ goto _err;
+ }
+ err = snd_ctl_shm_open(handlep, name, sockname, ctl_name, mode);
+ _err:
+ snd_config_delete(sconfig);
+ return err;
+}
+SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION);
diff --git a/alsa-lib/src/control/control_symbols.c b/alsa-lib/src/control/control_symbols.c
new file mode 100644
index 0000000..0cccade
--- /dev/null
+++ b/alsa-lib/src/control/control_symbols.c
@@ -0,0 +1,37 @@
+/*
+ * Control Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+extern const char *_snd_module_control_hw;
+extern const char *_snd_module_control_shm;
+extern const char *_snd_module_control_ext;
+
+static const char **snd_control_open_objects[] = {
+ &_snd_module_control_hw,
+#include "ctl_symbols_list.c"
+};
+
+void *snd_control_open_symbols(void)
+{
+ return snd_control_open_objects;
+}
+
+#endif /* !PIC */
diff --git a/alsa-lib/src/control/hcontrol.c b/alsa-lib/src/control/hcontrol.c
new file mode 100644
index 0000000..181e767
--- /dev/null
+++ b/alsa-lib/src/control/hcontrol.c
@@ -0,0 +1,1012 @@
+/**
+ * \file control/hcontrol.c
+ * \brief HCTL Interface - High Level CTL
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000
+ *
+ * HCTL interface is designed to access preloaded and sorted primitive controls.
+ * Callbacks may be used for event handling.
+ * See \ref hcontrol page for more details.
+ */
+/*
+ * Control Interface - high level API
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page hcontrol High level control interface
+
+<P> High level control interface is designed to access preloaded and sorted primitive controls.
+
+\section hcontrol_general_overview General overview
+
+<P> High level control interface caches the accesses to primitive controls
+to reduce overhead accessing the real controls in kernel drivers.
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#ifndef DOC_HIDDEN
+#define __USE_GNU
+#endif
+#include "control_local.h"
+#ifdef HAVE_LIBPTHREAD
+#include <pthread.h>
+#endif
+
+#ifndef DOC_HIDDEN
+#define NOT_FOUND 1000000000
+#endif
+
+static int snd_hctl_compare_default(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2);
+
+/**
+ * \brief Opens an HCTL
+ * \param hctlp Returned HCTL handle
+ * \param name ASCII identifier of the underlying CTL handle
+ * \param mode Open mode (see #SND_CTL_NONBLOCK, #SND_CTL_ASYNC)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_open(snd_hctl_t **hctlp, const char *name, int mode)
+{
+ snd_ctl_t *ctl;
+ int err;
+
+ if ((err = snd_ctl_open(&ctl, name, mode)) < 0)
+ return err;
+ err = snd_hctl_open_ctl(hctlp, ctl);
+ if (err < 0)
+ snd_ctl_close(ctl);
+ return err;
+}
+
+/**
+ * \brief Opens an HCTL
+ * \param hctlp Returned HCTL handle
+ * \param ctl underlying CTL handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl)
+{
+ snd_hctl_t *hctl;
+
+ assert(hctlp);
+ *hctlp = NULL;
+ if ((hctl = (snd_hctl_t *)calloc(1, sizeof(snd_hctl_t))) == NULL)
+ return -ENOMEM;
+ INIT_LIST_HEAD(&hctl->elems);
+ hctl->ctl = ctl;
+ *hctlp = hctl;
+ return 0;
+}
+
+/**
+ * \brief close HCTL handle
+ * \param hctl HCTL handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified HCTL handle and frees all associated
+ * resources.
+ */
+int snd_hctl_close(snd_hctl_t *hctl)
+{
+ int err;
+
+ assert(hctl);
+ err = snd_ctl_close(hctl->ctl);
+ snd_hctl_free(hctl);
+ free(hctl);
+ return err;
+}
+
+/**
+ * \brief get identifier of HCTL handle
+ * \param hctl HCTL handle
+ * \return ascii identifier of HCTL handle
+ *
+ * Returns the ASCII identifier of given HCTL handle. It's the same
+ * identifier specified in snd_hctl_open().
+ */
+const char *snd_hctl_name(snd_hctl_t *hctl)
+{
+ assert(hctl);
+ return snd_ctl_name(hctl->ctl);
+}
+
+/**
+ * \brief set nonblock mode
+ * \param hctl HCTL handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock)
+{
+ assert(hctl);
+ return snd_ctl_nonblock(hctl->ctl, nonblock);
+}
+
+/**
+ * \brief set async mode
+ * \param hctl HCTL handle
+ * \param sig Signal to raise: < 0 disable, 0 default (SIGIO)
+ * \param pid Process ID to signal: 0 current
+ * \return 0 on success otherwise a negative error code
+ *
+ * A signal is raised when a change happens.
+ */
+int snd_hctl_async(snd_hctl_t *hctl, int sig, pid_t pid)
+{
+ assert(hctl);
+ return snd_ctl_async(hctl->ctl, sig, pid);
+}
+
+/**
+ * \brief get count of poll descriptors for HCTL handle
+ * \param hctl HCTL handle
+ * \return count of poll descriptors
+ */
+int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl)
+{
+ assert(hctl);
+ return snd_ctl_poll_descriptors_count(hctl->ctl);
+}
+
+/**
+ * \brief get poll descriptors
+ * \param hctl HCTL handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space)
+{
+ assert(hctl);
+ return snd_ctl_poll_descriptors(hctl->ctl, pfds, space);
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param hctl HCTL handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_hctl_poll_descriptors_revents(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(hctl);
+ return snd_ctl_poll_descriptors_revents(hctl->ctl, pfds, nfds, revents);
+}
+
+static int snd_hctl_throw_event(snd_hctl_t *hctl, unsigned int mask,
+ snd_hctl_elem_t *elem)
+{
+ if (hctl->callback)
+ return hctl->callback(hctl, mask, elem);
+ return 0;
+}
+
+static int snd_hctl_elem_throw_event(snd_hctl_elem_t *elem,
+ unsigned int mask)
+{
+ if (elem->callback)
+ return elem->callback(elem, mask);
+ return 0;
+}
+
+static int snd_hctl_compare_mixer_priority_lookup(const char **name, const char * const *names, int coef)
+{
+ int res;
+
+ for (res = 0; *names; names++, res += coef) {
+ if (!strncmp(*name, *names, strlen(*names))) {
+ *name += strlen(*names);
+ if (**name == ' ')
+ (*name)++;
+ return res+1;
+ }
+ }
+ return NOT_FOUND;
+}
+
+static int get_compare_weight(const snd_ctl_elem_id_t *id)
+{
+ static const char *const names[] = {
+ "Master",
+ "Hardware Master",
+ "Headphone",
+ "Tone Control",
+ "3D Control",
+ "PCM",
+ "Front",
+ "Surround",
+ "Center",
+ "LFE",
+ "Synth",
+ "FM",
+ "Wave",
+ "Music",
+ "DSP",
+ "Line",
+ "CD",
+ "Mic",
+ "Phone",
+ "Video",
+ "Zoom Video",
+ "PC Speaker",
+ "Aux",
+ "Mono",
+ "ADC",
+ "Capture Source",
+ "Capture",
+ "Playback",
+ "Loopback",
+ "Analog Loopback",
+ "Digital Loopback",
+ "I2S",
+ "IEC958",
+ NULL
+ };
+ static const char *const names1[] = {
+ "Switch",
+ "Volume",
+ "Playback",
+ "Capture",
+ "Bypass",
+ "Mono",
+ "Front",
+ "Rear",
+ "Pan",
+ "Output",
+ "-",
+ NULL
+ };
+ static const char *const names2[] = {
+ "Switch",
+ "Volume",
+ "Bypass",
+ "Depth",
+ "Wide",
+ "Space",
+ "Level",
+ "Center",
+ NULL
+ };
+ const char *name = (char *)id->name, *name1;
+ int res, res1;
+
+ if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND)
+ return NOT_FOUND;
+ if (*name == '\0')
+ return res;
+ for (name1 = name; *name1 != '\0'; name1++);
+ for (name1--; name1 != name && *name1 != ' '; name1--);
+ while (name1 != name && *name1 == ' ')
+ name1--;
+ if (name1 != name) {
+ for (; name1 != name && *name1 != ' '; name1--);
+ name = name1;
+ if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names1, 1000)) == NOT_FOUND)
+ return res;
+ res += res1;
+ } else {
+ name = name1;
+ }
+ if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names2, 1)) == NOT_FOUND)
+ return res;
+ return res + res1;
+}
+
+static int _snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id, int *dir)
+{
+ unsigned int l, u;
+ snd_hctl_elem_t el;
+ int c = 0;
+ int idx = -1;
+ assert(hctl && id);
+ assert(hctl->compare);
+ el.id = *id;
+ el.compare_weight = get_compare_weight(id);
+ l = 0;
+ u = hctl->count;
+ while (l < u) {
+ idx = (l + u) / 2;
+ c = hctl->compare(&el, hctl->pelems[idx]);
+ if (c < 0)
+ u = idx;
+ else if (c > 0)
+ l = idx + 1;
+ else
+ break;
+ }
+ *dir = c;
+ return idx;
+}
+
+static int snd_hctl_elem_add(snd_hctl_t *hctl, snd_hctl_elem_t *elem)
+{
+ int dir;
+ int idx;
+ elem->compare_weight = get_compare_weight(&elem->id);
+ if (hctl->count == hctl->alloc) {
+ snd_hctl_elem_t **h;
+ hctl->alloc += 32;
+ h = realloc(hctl->pelems, sizeof(*h) * hctl->alloc);
+ if (!h) {
+ hctl->alloc -= 32;
+ return -ENOMEM;
+ }
+ hctl->pelems = h;
+ }
+ if (hctl->count == 0) {
+ list_add_tail(&elem->list, &hctl->elems);
+ hctl->pelems[0] = elem;
+ } else {
+ idx = _snd_hctl_find_elem(hctl, &elem->id, &dir);
+ assert(dir != 0);
+ if (dir > 0) {
+ list_add(&elem->list, &hctl->pelems[idx]->list);
+ idx++;
+ } else {
+ list_add_tail(&elem->list, &hctl->pelems[idx]->list);
+ }
+ memmove(hctl->pelems + idx + 1,
+ hctl->pelems + idx,
+ (hctl->count - idx) * sizeof(snd_hctl_elem_t *));
+ hctl->pelems[idx] = elem;
+ }
+ hctl->count++;
+ return snd_hctl_throw_event(hctl, SNDRV_CTL_EVENT_MASK_ADD, elem);
+}
+
+static void snd_hctl_elem_remove(snd_hctl_t *hctl, unsigned int idx)
+{
+ snd_hctl_elem_t *elem = hctl->pelems[idx];
+ unsigned int m;
+ snd_hctl_elem_throw_event(elem, SNDRV_CTL_EVENT_MASK_REMOVE);
+ list_del(&elem->list);
+ free(elem);
+ hctl->count--;
+ m = hctl->count - idx;
+ if (m > 0)
+ memmove(hctl->pelems + idx,
+ hctl->pelems + idx + 1,
+ m * sizeof(snd_hctl_elem_t *));
+}
+
+/**
+ * \brief free HCTL loaded elements
+ * \param hctl HCTL handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_free(snd_hctl_t *hctl)
+{
+ while (hctl->count > 0)
+ snd_hctl_elem_remove(hctl, hctl->count - 1);
+ free(hctl->pelems);
+ hctl->pelems = 0;
+ hctl->alloc = 0;
+ INIT_LIST_HEAD(&hctl->elems);
+ return 0;
+}
+
+static snd_hctl_t *compare_hctl;
+static int hctl_compare(const void *a, const void *b) {
+ return compare_hctl->compare(*(const snd_hctl_elem_t * const *) a,
+ *(const snd_hctl_elem_t * const *) b);
+}
+
+static void snd_hctl_sort(snd_hctl_t *hctl)
+{
+ unsigned int k;
+#ifdef HAVE_LIBPTHREAD
+ static pthread_mutex_t sync_lock = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+ assert(hctl);
+ assert(hctl->compare);
+ INIT_LIST_HEAD(&hctl->elems);
+
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_lock(&sync_lock);
+#endif
+ compare_hctl = hctl;
+ qsort(hctl->pelems, hctl->count, sizeof(*hctl->pelems), hctl_compare);
+#ifdef HAVE_LIBPTHREAD
+ pthread_mutex_unlock(&sync_lock);
+#endif
+ for (k = 0; k < hctl->count; k++)
+ list_add_tail(&hctl->pelems[k]->list, &hctl->elems);
+}
+
+/**
+ * \brief Change HCTL compare function and reorder elements
+ * \param hctl HCTL handle
+ * \param compare Element compare function
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t compare)
+{
+ assert(hctl);
+ hctl->compare = compare == NULL ? snd_hctl_compare_default : compare;
+ snd_hctl_sort(hctl);
+ return 0;
+}
+
+/**
+ * \brief A "don't care" fast compare functions that may be used with #snd_hctl_set_compare
+ * \param c1 First HCTL element
+ * \param c2 Second HCTL element
+ * \return -1 if c1 < c2, 0 if c1 == c2, 1 if c1 > c2
+ */
+int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2)
+{
+ return c1->id.numid - c2->id.numid;
+}
+
+static int snd_hctl_compare_default(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2)
+{
+ int res;
+ int d = c1->id.iface - c2->id.iface;
+ if (d != 0)
+ return d;
+ if (c1->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER) {
+ d = c1->compare_weight - c2->compare_weight;
+ if (d != 0)
+ return d;
+ }
+ res = strcmp((const char *)c1->id.name, (const char *)c2->id.name);
+ if (res != 0)
+ return res;
+ d = c1->id.index - c2->id.index;
+ return d;
+}
+
+/**
+ * \brief get first element for an HCTL
+ * \param hctl HCTL handle
+ * \return pointer to first element
+ */
+snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl)
+{
+ assert(hctl);
+ if (list_empty(&hctl->elems))
+ return NULL;
+ return list_entry(hctl->elems.next, snd_hctl_elem_t, list);
+}
+
+/**
+ * \brief get last element for an HCTL
+ * \param hctl HCTL handle
+ * \return pointer to last element
+ */
+snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl)
+{
+ assert(hctl);
+ if (list_empty(&hctl->elems))
+ return NULL;
+ return list_entry(hctl->elems.prev, snd_hctl_elem_t, list);
+}
+
+/**
+ * \brief get next HCTL element
+ * \param elem HCTL element
+ * \return pointer to next element
+ */
+snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem)
+{
+ assert(elem);
+ if (elem->list.next == &elem->hctl->elems)
+ return NULL;
+ return list_entry(elem->list.next, snd_hctl_elem_t, list);
+}
+
+/**
+ * \brief get previous HCTL element
+ * \param elem HCTL element
+ * \return pointer to previous element
+ */
+snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem)
+{
+ assert(elem);
+ if (elem->list.prev == &elem->hctl->elems)
+ return NULL;
+ return list_entry(elem->list.prev, snd_hctl_elem_t, list);
+}
+
+/**
+ * \brief Search an HCTL element
+ * \param hctl HCTL handle
+ * \param id Element identifier
+ * \return pointer to found HCTL element or NULL if it does not exists
+ */
+snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id)
+{
+ int dir;
+ int res = _snd_hctl_find_elem(hctl, id, &dir);
+ if (res < 0 || dir != 0)
+ return NULL;
+ return hctl->pelems[res];
+}
+
+/**
+ * \brief Load an HCTL with all elements and sort them
+ * \param hctl HCTL handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_load(snd_hctl_t *hctl)
+{
+ snd_ctl_elem_list_t list;
+ int err = 0;
+ unsigned int idx;
+
+ assert(hctl);
+ assert(hctl->ctl);
+ assert(hctl->count == 0);
+ assert(list_empty(&hctl->elems));
+ memset(&list, 0, sizeof(list));
+ if ((err = snd_ctl_elem_list(hctl->ctl, &list)) < 0)
+ goto _end;
+ while (list.count != list.used) {
+ err = snd_ctl_elem_list_alloc_space(&list, list.count);
+ if (err < 0)
+ goto _end;
+ if ((err = snd_ctl_elem_list(hctl->ctl, &list)) < 0)
+ goto _end;
+ }
+ if (hctl->alloc < list.count) {
+ hctl->alloc = list.count;
+ free(hctl->pelems);
+ hctl->pelems = malloc(hctl->alloc * sizeof(*hctl->pelems));
+ if (!hctl->pelems) {
+ err = -ENOMEM;
+ goto _end;
+ }
+ }
+ for (idx = 0; idx < list.count; idx++) {
+ snd_hctl_elem_t *elem;
+ elem = calloc(1, sizeof(snd_hctl_elem_t));
+ if (elem == NULL) {
+ snd_hctl_free(hctl);
+ err = -ENOMEM;
+ goto _end;
+ }
+ elem->id = list.pids[idx];
+ elem->hctl = hctl;
+ elem->compare_weight = get_compare_weight(&elem->id);
+ hctl->pelems[idx] = elem;
+ list_add_tail(&elem->list, &hctl->elems);
+ hctl->count++;
+ }
+ if (!hctl->compare)
+ hctl->compare = snd_hctl_compare_default;
+ snd_hctl_sort(hctl);
+ for (idx = 0; idx < hctl->count; idx++) {
+ int res = snd_hctl_throw_event(hctl, SNDRV_CTL_EVENT_MASK_ADD,
+ hctl->pelems[idx]);
+ if (res < 0)
+ return res;
+ }
+ err = snd_ctl_subscribe_events(hctl->ctl, 1);
+ _end:
+ free(list.pids);
+ return err;
+}
+
+/**
+ * \brief Set callback function for an HCTL
+ * \param hctl HCTL handle
+ * \param callback callback function
+ */
+void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback)
+{
+ assert(hctl);
+ hctl->callback = callback;
+}
+
+/**
+ * \brief Set callback private value for an HCTL
+ * \param hctl HCTL handle
+ * \param callback_private callback private value
+ */
+void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *callback_private)
+{
+ assert(hctl);
+ hctl->callback_private = callback_private;
+}
+
+/**
+ * \brief Get callback private value for an HCTL
+ * \param hctl HCTL handle
+ * \return callback private value
+ */
+void *snd_hctl_get_callback_private(snd_hctl_t *hctl)
+{
+ assert(hctl);
+ return hctl->callback_private;
+}
+
+/**
+ * \brief Get number of loaded elements for an HCTL
+ * \param hctl HCTL handle
+ * \return elements count
+ */
+unsigned int snd_hctl_get_count(snd_hctl_t *hctl)
+{
+ return hctl->count;
+}
+
+/**
+ * \brief Wait for a HCTL to become ready (i.e. at least one event pending)
+ * \param hctl HCTL handle
+ * \param timeout maximum time in milliseconds to wait
+ * \return a positive value on success otherwise a negative error code
+ * \retval 0 timeout occurred
+ * \retval 1 an event is pending
+ */
+int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
+{
+ struct pollfd *pfd;
+ unsigned short *revents;
+ int i, npfds, pollio, err, err_poll;
+
+ npfds = snd_hctl_poll_descriptors_count(hctl);
+ if (npfds <= 0 || npfds >= 16) {
+ SNDERR("Invalid poll_fds %d\n", npfds);
+ return -EIO;
+ }
+ pfd = alloca(sizeof(*pfd) * npfds);
+ revents = alloca(sizeof(*revents) * npfds);
+ err = snd_hctl_poll_descriptors(hctl, pfd, npfds);
+ if (err < 0)
+ return err;
+ if (err != npfds) {
+ SNDMSG("invalid poll descriptors %d\n", err);
+ return -EIO;
+ }
+ do {
+ pollio = 0;
+ err_poll = poll(pfd, npfds, timeout);
+ if (err_poll < 0) {
+ if (errno == EINTR)
+ continue;
+ return -errno;
+ }
+ if (! err_poll)
+ break;
+ err = snd_hctl_poll_descriptors_revents(hctl, pfd, npfds, revents);
+ if (err < 0)
+ return err;
+ for (i = 0; i < npfds; i++) {
+ if (revents[i] & (POLLERR | POLLNVAL))
+ return -EIO;
+ if ((revents[i] & (POLLIN | POLLOUT)) == 0)
+ continue;
+ pollio++;
+ }
+ } while (! pollio);
+ return err_poll > 0 ? 1 : 0;
+}
+
+/**
+ * \brief Get a ctl handle associated to the given hctl handle
+ * \param hctl HCTL handle
+ * \return a ctl handle otherwise NULL
+ */
+snd_ctl_t *snd_hctl_ctl(snd_hctl_t *hctl)
+{
+ return hctl->ctl;
+}
+
+static int snd_hctl_handle_event(snd_hctl_t *hctl, snd_ctl_event_t *event)
+{
+ snd_hctl_elem_t *elem;
+ int res;
+
+ assert(hctl);
+ assert(hctl->ctl);
+ switch (event->type) {
+ case SND_CTL_EVENT_ELEM:
+ break;
+ default:
+ return 0;
+ }
+ if (event->data.elem.mask == SNDRV_CTL_EVENT_MASK_REMOVE) {
+ int dir;
+ res = _snd_hctl_find_elem(hctl, &event->data.elem.id, &dir);
+ assert(res >= 0 && dir == 0);
+ if (res < 0 || dir != 0)
+ return -ENOENT;
+ snd_hctl_elem_remove(hctl, (unsigned int) res);
+ return 0;
+ }
+ if (event->data.elem.mask & SNDRV_CTL_EVENT_MASK_ADD) {
+ elem = calloc(1, sizeof(snd_hctl_elem_t));
+ if (elem == NULL)
+ return -ENOMEM;
+ elem->id = event->data.elem.id;
+ elem->hctl = hctl;
+ res = snd_hctl_elem_add(hctl, elem);
+ if (res < 0)
+ return res;
+ }
+ if (event->data.elem.mask & (SNDRV_CTL_EVENT_MASK_VALUE |
+ SNDRV_CTL_EVENT_MASK_INFO)) {
+ elem = snd_hctl_find_elem(hctl, &event->data.elem.id);
+ assert(elem);
+ if (!elem)
+ return -ENOENT;
+ res = snd_hctl_elem_throw_event(elem, event->data.elem.mask &
+ (SNDRV_CTL_EVENT_MASK_VALUE |
+ SNDRV_CTL_EVENT_MASK_INFO));
+ if (res < 0)
+ return res;
+ }
+ return 0;
+}
+
+/**
+ * \brief Handle pending HCTL events invoking callbacks
+ * \param hctl HCTL handle
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_hctl_handle_events(snd_hctl_t *hctl)
+{
+ snd_ctl_event_t event;
+ int res;
+ unsigned int count = 0;
+
+ assert(hctl);
+ assert(hctl->ctl);
+ while ((res = snd_ctl_read(hctl->ctl, &event)) != 0 &&
+ res != -EAGAIN) {
+ if (res < 0)
+ return res;
+ res = snd_hctl_handle_event(hctl, &event);
+ if (res < 0)
+ return res;
+ count++;
+ }
+ return count;
+}
+
+/**
+ * \brief Get information for an HCTL element
+ * \param elem HCTL element
+ * \param info HCTL element information
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t *info)
+{
+ assert(elem);
+ assert(elem->hctl);
+ assert(info);
+ info->id = elem->id;
+ return snd_ctl_elem_info(elem->hctl->ctl, info);
+}
+
+/**
+ * \brief Get value for an HCTL element
+ * \param elem HCTL element
+ * \param value HCTL element value
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value)
+{
+ assert(elem);
+ assert(elem->hctl);
+ assert(value);
+ value->id = elem->id;
+ return snd_ctl_elem_read(elem->hctl->ctl, value);
+}
+
+/**
+ * \brief Set value for an HCTL element
+ * \param elem HCTL element
+ * \param value HCTL element value
+ * \retval 0 on success
+ * \retval >1 on success when value was changed
+ * \retval <0 a negative error code on failure
+ */
+int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value)
+{
+ assert(elem);
+ assert(elem->hctl);
+ assert(value);
+ value->id = elem->id;
+ return snd_ctl_elem_write(elem->hctl->ctl, value);
+}
+
+/**
+ * \brief Get TLV value for an HCTL element
+ * \param elem HCTL element
+ * \param tlv TLV array for value
+ * \param tlv_size size of TLV array in bytes
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_hctl_elem_tlv_read(snd_hctl_elem_t *elem, unsigned int *tlv, unsigned int tlv_size)
+{
+ assert(elem);
+ assert(tlv);
+ assert(tlv_size >= 12);
+ return snd_ctl_elem_tlv_read(elem->hctl->ctl, &elem->id, tlv, tlv_size);
+}
+
+/**
+ * \brief Set TLV value for an HCTL element
+ * \param elem HCTL element
+ * \param tlv TLV array for value
+ * \retval 0 on success
+ * \retval >1 on success when value was changed
+ * \retval <0 a negative error code on failure
+ */
+int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv)
+{
+ assert(elem);
+ assert(tlv);
+ assert(tlv[1] >= 4);
+ return snd_ctl_elem_tlv_write(elem->hctl->ctl, &elem->id, tlv);
+}
+
+/**
+ * \brief Set TLV value for an HCTL element
+ * \param elem HCTL element
+ * \param tlv TLV array for value
+ * \retval 0 on success
+ * \retval >1 on success when value was changed
+ * \retval <0 a negative error code on failure
+ */
+int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv)
+{
+ assert(elem);
+ assert(tlv);
+ assert(tlv[1] >= 4);
+ return snd_ctl_elem_tlv_command(elem->hctl->ctl, &elem->id, tlv);
+}
+
+/**
+ * \brief Get HCTL handle for an HCTL element
+ * \param elem HCTL element
+ * \return HCTL handle
+ */
+snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem)
+{
+ assert(elem);
+ return elem->hctl;
+}
+
+/**
+ * \brief Get CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \param ptr Pointer to returned CTL element identifier
+ */
+void snd_hctl_elem_get_id(const snd_hctl_elem_t *obj, snd_ctl_elem_id_t *ptr)
+{
+ assert(obj && ptr);
+ *ptr = obj->id;
+}
+
+/**
+ * \brief Get element numeric identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return element numeric identifier
+ */
+unsigned int snd_hctl_elem_get_numid(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->id.numid;
+}
+
+/**
+ * \brief Get interface part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return interface part of element identifier
+ */
+snd_ctl_elem_iface_t snd_hctl_elem_get_interface(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->id.iface;
+}
+
+/**
+ * \brief Get device part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return device part of element identifier
+ */
+unsigned int snd_hctl_elem_get_device(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->id.device;
+}
+
+/**
+ * \brief Get subdevice part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return subdevice part of element identifier
+ */
+unsigned int snd_hctl_elem_get_subdevice(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->id.subdevice;
+}
+
+/**
+ * \brief Get name part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return name part of element identifier
+ */
+const char *snd_hctl_elem_get_name(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id.name;
+}
+
+/**
+ * \brief Get index part of CTL element identifier of a CTL element id/value
+ * \param obj CTL element id/value
+ * \return index part of element identifier
+ */
+unsigned int snd_hctl_elem_get_index(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->id.index;
+}
+
+/**
+ * \brief Set callback function for an HCTL element
+ * \param obj HCTL element
+ * \param val callback function
+ */
+void snd_hctl_elem_set_callback(snd_hctl_elem_t *obj, snd_hctl_elem_callback_t val)
+{
+ assert(obj);
+ obj->callback = val;
+}
+
+/**
+ * \brief Set callback private value for an HCTL element
+ * \param obj HCTL element
+ * \param val callback private value
+ */
+void snd_hctl_elem_set_callback_private(snd_hctl_elem_t *obj, void * val)
+{
+ assert(obj);
+ obj->callback_private = val;
+}
+
+/**
+ * \brief Get callback private value for an HCTL element
+ * \param obj HCTL element
+ * \return callback private value
+ */
+void * snd_hctl_elem_get_callback_private(const snd_hctl_elem_t *obj)
+{
+ assert(obj);
+ return obj->callback_private;
+}
+
diff --git a/alsa-lib/src/control/namehint.c b/alsa-lib/src/control/namehint.c
new file mode 100644
index 0000000..e878f83
--- /dev/null
+++ b/alsa-lib/src/control/namehint.c
@@ -0,0 +1,650 @@
+/**
+ * \file control/namehint.c
+ * \brief Give device name hints
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2006
+ */
+/*
+ * Give device name hints - main file
+ * Copyright (c) 2006 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+struct hint_list {
+ char **list;
+ unsigned int count;
+ unsigned int allocated;
+ const char *siface;
+ snd_ctl_elem_iface_t iface;
+ snd_ctl_t *ctl;
+ snd_ctl_card_info_t *info;
+ int card;
+ int device;
+ long device_input;
+ long device_output;
+ int stream;
+ int show_all;
+ char *cardname;
+};
+#endif
+
+static int hint_list_add(struct hint_list *list,
+ const char *name,
+ const char *description)
+{
+ char *x;
+
+ if (list->count == list->allocated) {
+ char **n = realloc(list->list, (list->allocated + 10) * sizeof(char *));
+ if (n == NULL)
+ return -ENOMEM;
+ list->allocated += 10;
+ list->list = n;
+ }
+ if (name == NULL) {
+ x = NULL;
+ } else {
+ x = malloc(4 + strlen(name) + (description != NULL ? (4 + strlen(description) + 1) : 0) + 1);
+ if (x == NULL)
+ return -ENOMEM;
+ memcpy(x, "NAME", 4);
+ strcpy(x + 4, name);
+ if (description != NULL) {
+ strcat(x, "|DESC");
+ strcat(x, description);
+ }
+ }
+ list->list[list->count++] = x;
+ return 0;
+}
+
+static void zero_handler(const char *file ATTRIBUTE_UNUSED,
+ int line ATTRIBUTE_UNUSED,
+ const char *function ATTRIBUTE_UNUSED,
+ int err ATTRIBUTE_UNUSED,
+ const char *fmt ATTRIBUTE_UNUSED, ...)
+{
+}
+
+static int get_dev_name1(struct hint_list *list, char **res, int device,
+ int stream)
+{
+ *res = NULL;
+ if (device < 0)
+ return 0;
+ switch (list->iface) {
+#ifdef BUILD_HWDEP
+ case SND_CTL_ELEM_IFACE_HWDEP:
+ {
+ snd_hwdep_info_t *info;
+ snd_hwdep_info_alloca(&info);
+ snd_hwdep_info_set_device(info, device);
+ if (snd_ctl_hwdep_info(list->ctl, info) < 0)
+ return 0;
+ *res = strdup(snd_hwdep_info_get_name(info));
+ return 0;
+ }
+#endif
+#ifdef BUILD_PCM
+ case SND_CTL_ELEM_IFACE_PCM:
+ {
+ snd_pcm_info_t *info;
+ snd_pcm_info_alloca(&info);
+ snd_pcm_info_set_device(info, device);
+ snd_pcm_info_set_stream(info, stream ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK);
+ if (snd_ctl_pcm_info(list->ctl, info) < 0)
+ return 0;
+ switch (snd_pcm_info_get_class(info)) {
+ case SND_PCM_CLASS_MODEM:
+ case SND_PCM_CLASS_DIGITIZER:
+ return -ENODEV;
+ default:
+ break;
+ }
+ *res = strdup(snd_pcm_info_get_name(info));
+ return 0;
+ }
+#endif
+#ifdef BUILD_RAWMIDI
+ case SND_CTL_ELEM_IFACE_RAWMIDI:
+ {
+ snd_rawmidi_info_t *info;
+ snd_rawmidi_info_alloca(&info);
+ snd_rawmidi_info_set_device(info, device);
+ snd_rawmidi_info_set_stream(info, stream ? SND_RAWMIDI_STREAM_INPUT : SND_RAWMIDI_STREAM_OUTPUT);
+ if (snd_ctl_rawmidi_info(list->ctl, info) < 0)
+ return 0;
+ *res = strdup(snd_rawmidi_info_get_name(info));
+ return 0;
+ }
+#endif
+ default:
+ return 0;
+ }
+}
+
+static char *get_dev_name(struct hint_list *list)
+{
+ char *str1, *str2, *res;
+ int device;
+
+ device = list->device_input >= 0 ? list->device_input : list->device;
+ if (get_dev_name1(list, &str1, device, 1) < 0)
+ return NULL;
+ device = list->device_output >= 0 ? list->device_output : list->device;
+ if (get_dev_name1(list, &str2, device, 0) < 0) {
+ if (str1)
+ free(str1);
+ return NULL;
+ }
+ if (str1 != NULL || str2 != NULL) {
+ if (str1 != NULL && str2 != NULL) {
+ if (strcmp(str1, str2) == 0) {
+ res = malloc(strlen(list->cardname) + strlen(str2) + 3);
+ if (res != NULL) {
+ strcpy(res, list->cardname);
+ strcat(res, ", ");
+ strcat(res, str2);
+ }
+ } else {
+ res = malloc(strlen(list->cardname) + strlen(str2) + strlen(str1) + 6);
+ if (res != NULL) {
+ strcpy(res, list->cardname);
+ strcat(res, ", ");
+ strcat(res, str2);
+ strcat(res, " / ");
+ strcat(res, str1);
+ }
+ }
+ free(str2);
+ free(str1);
+ return res;
+ } else {
+ if (str1 != NULL) {
+ str2 = "Input";
+ } else {
+ str1 = str2;
+ str2 = "Output";
+ }
+ res = malloc(strlen(list->cardname) + strlen(str1) + 19);
+ if (res == NULL) {
+ free(str1);
+ return NULL;
+ }
+ strcpy(res, list->cardname);
+ strcat(res, ", ");
+ strcat(res, str1);
+ strcat(res, "|IOID");
+ strcat(res, str2);
+ free(str1);
+ return res;
+ }
+ }
+ /* if the specified device doesn't exist, skip this entry */
+ if (list->device >= 0 || list->device_input >= 0 || list->device_output >= 0)
+ return NULL;
+ return strdup(list->cardname);
+}
+
+#ifndef DOC_HIDDEN
+#define BUF_SIZE 128
+#endif
+
+static int try_config(struct hint_list *list,
+ const char *base,
+ const char *name)
+{
+ snd_lib_error_handler_t eh;
+ snd_config_t *res = NULL, *cfg, *cfg1, *n;
+ snd_config_iterator_t i, next;
+ char *buf, *buf1 = NULL, *buf2;
+ const char *str;
+ int err = 0, level;
+ long dev = list->device;
+
+ list->device_input = -1;
+ list->device_output = -1;
+ buf = malloc(BUF_SIZE);
+ if (buf == NULL)
+ return -ENOMEM;
+ sprintf(buf, "%s.%s", base, name);
+ /* look for redirection */
+ if (snd_config_search(snd_config, buf, &cfg) >= 0 &&
+ snd_config_get_string(cfg, &str) >= 0 &&
+ ((strncmp(base, str, strlen(base)) == 0 &&
+ str[strlen(base)] == '.') || strchr(str, '.') == NULL))
+ goto __skip_add;
+ if (list->card >= 0 && list->device >= 0)
+ sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
+ else if (list->card >= 0)
+ sprintf(buf, "%s:CARD=%s", name, snd_ctl_card_info_get_id(list->info));
+ else
+ strcpy(buf, name);
+ eh = snd_lib_error;
+ snd_lib_error_set_handler(&zero_handler);
+ err = snd_config_search_definition(snd_config, base, buf, &res);
+ snd_lib_error_set_handler(eh);
+ if (err < 0)
+ goto __skip_add;
+ err = -EINVAL;
+ if (snd_config_get_type(res) != SND_CONFIG_TYPE_COMPOUND)
+ goto __cleanup;
+ if (snd_config_search(res, "type", NULL) < 0)
+ goto __cleanup;
+
+#if 0 /* for debug purposes */
+ {
+ snd_output_t *out;
+ fprintf(stderr, "********* PCM '%s':\n", buf);
+ snd_output_stdio_attach(&out, stderr, 0);
+ snd_config_save(res, out);
+ snd_output_close(out);
+ fprintf(stderr, "\n");
+ }
+#endif
+
+ cfg1 = res;
+ level = 0;
+ __hint:
+ level++;
+ if (snd_config_search(cfg1, "type", &cfg) >= 0 &&
+ snd_config_get_string(cfg, &str) >= 0 &&
+ strcmp(str, "hw") == 0) {
+ dev = 0;
+ list->device_input = -1;
+ list->device_output = -1;
+ if (snd_config_search(cfg1, "device", &cfg) >= 0) {
+ if (snd_config_get_integer(cfg, &dev) < 0) {
+ SNDERR("(%s) device must be an integer", buf);
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ }
+ }
+
+ if (snd_config_search(cfg1, "hint", &cfg) >= 0) {
+ if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("hint (%s) must be a compound", buf);
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ if (level == 1 &&
+ snd_config_search(cfg, "show", &n) >= 0 &&
+ snd_config_get_bool(n) <= 0)
+ goto __skip_add;
+ if (buf1 == NULL &&
+ snd_config_search(cfg, "description", &n) >= 0 &&
+ snd_config_get_string(n, &str) >= 0) {
+ buf1 = strdup(str);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto __cleanup;
+ }
+ }
+ if (snd_config_search(cfg, "device", &n) >= 0) {
+ if (snd_config_get_integer(n, &dev) < 0) {
+ SNDERR("(%s) device must be an integer", buf);
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ list->device_input = dev;
+ list->device_output = dev;
+ }
+ if (snd_config_search(cfg, "device_input", &n) >= 0) {
+ if (snd_config_get_integer(n, &list->device_input) < 0) {
+ SNDERR("(%s) device_input must be an integer", buf);
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ list->device_output = -1;
+ }
+ if (snd_config_search(cfg, "device_output", &n) >= 0) {
+ if (snd_config_get_integer(n, &list->device_output) < 0) {
+ SNDERR("(%s) device_output must be an integer", buf);
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ }
+ } else if (level == 1 && !list->show_all)
+ goto __skip_add;
+ if (snd_config_search(cfg1, "slave", &cfg) >= 0 &&
+ snd_config_search(cfg, base, &cfg1) >= 0)
+ goto __hint;
+ snd_config_delete(res);
+ res = NULL;
+ if (strchr(buf, ':') != NULL)
+ goto __ok;
+ /* find, if all parameters have a default, */
+ /* otherwise filter this definition */
+ eh = snd_lib_error;
+ snd_lib_error_set_handler(&zero_handler);
+ err = snd_config_search_alias_hooks(snd_config, base, buf, &res);
+ snd_lib_error_set_handler(eh);
+ if (err < 0)
+ goto __cleanup;
+ if (snd_config_search(res, "@args", &cfg) >= 0) {
+ snd_config_for_each(i, next, cfg) {
+ if (snd_config_search(snd_config_iterator_entry(i),
+ "default", NULL) < 0) {
+ err = -EINVAL;
+ goto __cleanup;
+ }
+ }
+ }
+ __ok:
+ err = 0;
+ __cleanup:
+ if (err >= 0) {
+ list->device = dev;
+ str = list->card >= 0 ? get_dev_name(list) : NULL;
+ if (str != NULL) {
+ level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
+ buf2 = realloc((char *)str, level + 1);
+ if (buf2 != NULL) {
+ if (buf1 != NULL) {
+ str = strchr(buf2, '|');
+ if (str != NULL)
+ memmove(buf2 + (level - strlen(str)), str, strlen(str));
+ else
+ str = buf2 + strlen(buf2);
+ *(char *)str++ = '\n';
+ memcpy((char *)str, buf1, strlen(buf1));
+ buf2[level] = '\0';
+ free(buf1);
+ }
+ buf1 = buf2;
+ } else {
+ free((char *)str);
+ }
+ } else if (list->device >= 0)
+ goto __skip_add;
+ err = hint_list_add(list, buf, buf1);
+ }
+ __skip_add:
+ if (res)
+ snd_config_delete(res);
+ if (buf1)
+ free(buf1);
+ free(buf);
+ return err;
+}
+
+#ifndef DOC_HIDDEN
+#define IFACE(v, fcn) [SND_CTL_ELEM_IFACE_##v] = (next_devices_t)fcn
+
+typedef int (*next_devices_t)(snd_ctl_t *, int *);
+
+static const next_devices_t next_devices[] = {
+ IFACE(CARD, NULL),
+ IFACE(HWDEP, snd_ctl_hwdep_next_device),
+ IFACE(MIXER, NULL),
+ IFACE(PCM, snd_ctl_pcm_next_device),
+ IFACE(RAWMIDI, snd_ctl_rawmidi_next_device),
+ IFACE(TIMER, NULL),
+ IFACE(SEQUENCER, NULL)
+};
+#endif
+
+static int add_card(struct hint_list *list, int card)
+{
+ int err, ok;
+ snd_config_t *conf, *n;
+ snd_config_iterator_t i, next;
+ const char *str;
+ char ctl_name[16];
+ snd_ctl_card_info_t *info;
+
+ snd_ctl_card_info_alloca(&info);
+ list->info = info;
+ err = snd_config_search(snd_config, list->siface, &conf);
+ if (err < 0)
+ return err;
+ sprintf(ctl_name, "hw:%i", card);
+ err = snd_ctl_open(&list->ctl, ctl_name, 0);
+ if (err < 0)
+ return err;
+ err = snd_ctl_card_info(list->ctl, info);
+ if (err < 0)
+ goto __error;
+ snd_config_for_each(i, next, conf) {
+ n = snd_config_iterator_entry(i);
+ if (snd_config_get_id(n, &str) < 0)
+ continue;
+ if (next_devices[list->iface] != NULL) {
+ list->card = card;
+ list->device = -1;
+ err = next_devices[list->iface](list->ctl, &list->device);
+ if (list->device < 0)
+ err = -EINVAL;
+ ok = 0;
+ while (err >= 0 && list->device >= 0) {
+ err = try_config(list, list->siface, str);
+ if (err < 0)
+ break;
+ err = next_devices[list->iface](list->ctl, &list->device);
+ ok++;
+ }
+ if (ok)
+ continue;
+ } else {
+ err = -EINVAL;
+ }
+ if (err == -EXDEV)
+ continue;
+ if (err < 0) {
+ list->device = -1;
+ err = try_config(list, list->siface, str);
+ }
+ if (err < 0) {
+ list->card = -1;
+ err = try_config(list, list->siface, str);
+ }
+ if (err == -ENOMEM)
+ goto __error;
+ }
+ err = 0;
+ __error:
+ snd_ctl_close(list->ctl);
+ return err;
+}
+
+static int get_card_name(struct hint_list *list, int card)
+{
+ char scard[16], *s;
+ int err;
+
+ err = snd_card_get_name(card, &list->cardname);
+ if (err <= 0)
+ return 0;
+ sprintf(scard, " #%i", card);
+ s = realloc(list->cardname, strlen(list->cardname) + strlen(scard) + 1);
+ if (s == NULL)
+ return -ENOMEM;
+ list->cardname = s;
+ return 0;
+}
+
+/**
+ * \brief Return string list with device name hints.
+ * \param card Card number or -1 (means all cards)
+ * \param iface Interface identification (like "pcm", "rawmidi", "timer", "seq")
+ * \param hints Result - array of string with device name hints
+ * \result zero if success, otherwise a negative error code
+ *
+ * Note: The device description is separated with '|' char.
+ *
+ * User defined hints are gathered from namehint.IFACE tree like:
+ *
+ * <code>
+ * namehint.pcm {<br>
+ * myfile "file:FILE=/tmp/soundwave.raw|Save sound output to /tmp/soundwave.raw"<br>
+ * myplug "plug:front:Do all conversions for front speakers"<br>
+ * }
+ * </code>
+ *
+ * Special variables: defaults.namehint.showall specifies if all device
+ * definitions are accepted (boolean type).
+ */
+int snd_device_name_hint(int card, const char *iface, void ***hints)
+{
+ struct hint_list list;
+ char ehints[24];
+ const char *str;
+ snd_config_t *conf;
+ snd_config_iterator_t i, next;
+ int err;
+
+ if (hints == NULL)
+ return -EINVAL;
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ list.list = NULL;
+ list.count = list.allocated = 0;
+ list.siface = iface;
+ if (strcmp(iface, "card") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_CARD;
+ else if (strcmp(iface, "pcm") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_PCM;
+ else if (strcmp(iface, "rawmidi") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_RAWMIDI;
+ else if (strcmp(iface, "timer") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_TIMER;
+ else if (strcmp(iface, "seq") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_SEQUENCER;
+ else if (strcmp(iface, "hwdep") == 0)
+ list.iface = SND_CTL_ELEM_IFACE_HWDEP;
+ else
+ return -EINVAL;
+ list.show_all = 0;
+ list.cardname = NULL;
+ if (snd_config_search(snd_config, "defaults.namehint.showall", &conf) >= 0)
+ list.show_all = snd_config_get_bool(conf) > 0;
+ if (card >= 0) {
+ err = get_card_name(&list, card);
+ if (err >= 0)
+ err = add_card(&list, card);
+ } else {
+ err = snd_card_next(&card);
+ if (err < 0)
+ goto __error;
+ while (card >= 0) {
+ err = get_card_name(&list, card);
+ if (err < 0)
+ goto __error;
+ err = add_card(&list, card);
+ if (err < 0)
+ goto __error;
+ err = snd_card_next(&card);
+ if (err < 0)
+ goto __error;
+ }
+ }
+ sprintf(ehints, "namehint.%s", list.siface);
+ err = snd_config_search(snd_config, ehints, &conf);
+ if (err >= 0) {
+ snd_config_for_each(i, next, conf) {
+ if (snd_config_get_string(snd_config_iterator_entry(i),
+ &str) < 0)
+ continue;
+ err = hint_list_add(&list, str, NULL);
+ if (err < 0)
+ goto __error;
+ }
+ }
+ err = 0;
+ __error:
+ if (err < 0) {
+ snd_device_name_free_hint((void **)list.list);
+ if (list.cardname)
+ free(list.cardname);
+ return err;
+ } else {
+ err = hint_list_add(&list, NULL, NULL);
+ if (err < 0)
+ goto __error;
+ *hints = (void **)list.list;
+ if (list.cardname)
+ free(list.cardname);
+ }
+ return 0;
+}
+
+/**
+ * \brief Free a string list with device name hints.
+ * \param hints A string list to free
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_device_name_free_hint(void **hints)
+{
+ char **h;
+
+ if (hints == NULL)
+ return 0;
+ h = (char **)hints;
+ while (*h) {
+ free(*h);
+ h++;
+ }
+ free(hints);
+ return 0;
+}
+
+/**
+ * \brief Get a hint Free a string list with device name hints.
+ * \param hint A pointer to hint
+ * \param id Hint ID (see bellow)
+ * \result an allocated ASCII string if success, otherwise NULL
+ *
+ * List of valid IDs:
+ * NAME - name of device
+ * DESC - description of device
+ * IOID - input / output identification (Input or Output strings),
+ * not present (NULL) means both
+ */
+char *snd_device_name_get_hint(const void *hint, const char *id)
+{
+ const char *hint1 = (const char *)hint, *delim;
+ char *res;
+ unsigned size;
+
+ if (strlen(id) != 4)
+ return NULL;
+ while (*hint1 != '\0') {
+ delim = strchr(hint1, '|');
+ if (memcmp(id, hint1, 4) != 0) {
+ if (delim == NULL)
+ return NULL;
+ hint1 = delim + 1;
+ continue;
+ }
+ if (delim == NULL)
+ return strdup(hint1 + 4);
+ size = delim - hint1 - 4;
+ res = malloc(size + 1);
+ if (res != NULL) {
+ memcpy(res, hint1 + 4, size);
+ res[size] = '\0';
+ }
+ return res;
+ }
+ return NULL;
+}
diff --git a/alsa-lib/src/control/setup.c b/alsa-lib/src/control/setup.c
new file mode 100644
index 0000000..408244e
--- /dev/null
+++ b/alsa-lib/src/control/setup.c
@@ -0,0 +1,651 @@
+/**
+ * \file control/setup.c
+ * \brief Routines to setup control primitives from configuration
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2001
+ *
+ * Routines to setup control primitives from configuration
+ */
+/*
+ * Control Interface - routines for setup from configuration
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ unsigned int lock: 1;
+ unsigned int preserve: 1;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *val;
+ snd_ctl_elem_value_t *mask;
+ snd_ctl_elem_value_t *old;
+ struct list_head list;
+} snd_sctl_elem_t;
+
+struct _snd_sctl {
+ int mode;
+ snd_ctl_t *ctl;
+ struct list_head elems;
+};
+#endif /* DOC_HIDDEN */
+
+static int free_elems(snd_sctl_t *h)
+{
+ int err = 0;
+ while (!list_empty(&h->elems)) {
+ snd_sctl_elem_t *elem = list_entry(h->elems.next, snd_sctl_elem_t, list);
+ snd_ctl_elem_id_free(elem->id);
+ snd_ctl_elem_info_free(elem->info);
+ snd_ctl_elem_value_free(elem->val);
+ snd_ctl_elem_value_free(elem->mask);
+ snd_ctl_elem_value_free(elem->old);
+ list_del(&elem->list);
+ free(elem);
+ }
+ if ((h->mode & SND_SCTL_NOFREE) == 0)
+ err = snd_ctl_close(h->ctl);
+ free(h);
+ return err;
+}
+
+/**
+ * \brief Install given values to control elements
+ * \param h Setup control handle
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_sctl_install(snd_sctl_t *h)
+{
+ struct list_head *pos;
+ int err;
+ unsigned int k;
+ assert(h);
+ list_for_each(pos, &h->elems) {
+ snd_sctl_elem_t *elem = list_entry(pos, snd_sctl_elem_t, list);
+ unsigned int count;
+ snd_ctl_elem_type_t type;
+ if (elem->lock) {
+ err = snd_ctl_elem_lock(h->ctl, elem->id);
+ if (err < 0) {
+ SNDERR("Cannot lock ctl elem");
+ return err;
+ }
+ }
+ err = snd_ctl_elem_read(h->ctl, elem->old);
+ if (err < 0) {
+ SNDERR("Cannot read ctl elem");
+ return err;
+ }
+ count = snd_ctl_elem_info_get_count(elem->info);
+ type = snd_ctl_elem_info_get_type(elem->info);
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ for (k = 0; k < count; ++k) {
+ int old, val, mask;
+ old = snd_ctl_elem_value_get_boolean(elem->old, k);
+ mask = snd_ctl_elem_value_get_boolean(elem->mask, k);
+ old &= ~mask;
+ if (old) {
+ val = snd_ctl_elem_value_get_boolean(elem->val, k);
+ val |= old;
+ snd_ctl_elem_value_set_boolean(elem->val, k, val);
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ for (k = 0; k < count; ++k) {
+ long old, val, mask;
+ old = snd_ctl_elem_value_get_integer(elem->old, k);
+ mask = snd_ctl_elem_value_get_integer(elem->mask, k);
+ old &= ~mask;
+ if (old) {
+ val = snd_ctl_elem_value_get_integer(elem->val, k);
+ val |= old;
+ snd_ctl_elem_value_set_integer(elem->val, k, val);
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ for (k = 0; k < count; ++k) {
+ unsigned int old, val, mask;
+ old = snd_ctl_elem_value_get_enumerated(elem->old, k);
+ mask = snd_ctl_elem_value_get_enumerated(elem->mask, k);
+ old &= ~mask;
+ if (old) {
+ val = snd_ctl_elem_value_get_enumerated(elem->val, k);
+ val |= old;
+ snd_ctl_elem_value_set_enumerated(elem->val, k, val);
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_IEC958:
+ count = sizeof(snd_aes_iec958_t);
+ /* Fall through */
+ case SND_CTL_ELEM_TYPE_BYTES:
+ for (k = 0; k < count; ++k) {
+ unsigned char old, val, mask;
+ old = snd_ctl_elem_value_get_byte(elem->old, k);
+ mask = snd_ctl_elem_value_get_byte(elem->mask, k);
+ old &= ~mask;
+ if (old) {
+ val = snd_ctl_elem_value_get_byte(elem->val, k);
+ val |= old;
+ snd_ctl_elem_value_set_byte(elem->val, k, val);
+ }
+ }
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ err = snd_ctl_elem_write(h->ctl, elem->val);
+ if (err < 0) {
+ SNDERR("Cannot write ctl elem");
+ return err;
+ }
+ }
+ return 0;
+}
+
+/**
+ * \brief Remove (restore) previous values from control elements
+ * \param h Setup control handle
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_sctl_remove(snd_sctl_t *h)
+{
+ struct list_head *pos;
+ int err;
+ assert(h);
+ list_for_each(pos, &h->elems) {
+ snd_sctl_elem_t *elem = list_entry(pos, snd_sctl_elem_t, list);
+ if (elem->lock) {
+ err = snd_ctl_elem_unlock(h->ctl, elem->id);
+ if (err < 0) {
+ SNDERR("Cannot unlock ctl elem");
+ return err;
+ }
+ }
+ if (elem->preserve) {
+ err = snd_ctl_elem_write(h->ctl, elem->old);
+ if (err < 0) {
+ SNDERR("Cannot restore ctl elem");
+ return err;
+ }
+ }
+ }
+ return 0;
+}
+
+static int snd_config_get_ctl_elem_enumerated(snd_config_t *n, snd_ctl_t *ctl,
+ snd_ctl_elem_info_t *info)
+{
+ const char *str;
+ long val;
+ unsigned int idx, items;
+ switch (snd_config_get_type(n)) {
+ case SND_CONFIG_TYPE_INTEGER:
+ snd_config_get_integer(n, &val);
+ return val;
+ case SND_CONFIG_TYPE_STRING:
+ snd_config_get_string(n, &str);
+ break;
+ default:
+ return -1;
+ }
+ items = snd_ctl_elem_info_get_items(info);
+ for (idx = 0; idx < items; idx++) {
+ int err;
+ snd_ctl_elem_info_set_item(info, idx);
+ err = snd_ctl_elem_info(ctl, info);
+ if (err < 0) {
+ SNDERR("Cannot obtain info for CTL elem");
+ return err;
+ }
+ if (strcmp(str, snd_ctl_elem_info_get_item_name(info)) == 0)
+ return idx;
+ }
+ return -1;
+}
+
+static int snd_config_get_ctl_elem_value(snd_config_t *conf,
+ snd_ctl_t *ctl,
+ snd_ctl_elem_value_t *val,
+ snd_ctl_elem_value_t *mask,
+ snd_ctl_elem_info_t *info)
+{
+ int err;
+ snd_config_iterator_t i, next;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_type_t type;
+ unsigned int count;
+ long v;
+ long idx;
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_value_get_id(val, id);
+ count = snd_ctl_elem_info_get_count(info);
+ type = snd_ctl_elem_info_get_type(info);
+ if (count == 1) {
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ v = snd_config_get_bool(conf);
+ if (v >= 0) {
+ snd_ctl_elem_value_set_boolean(val, 0, v);
+ if (mask)
+ snd_ctl_elem_value_set_boolean(mask, 0, 1);
+ return 0;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ err = snd_config_get_integer(conf, &v);
+ if (err == 0) {
+ snd_ctl_elem_value_set_integer(val, 0, v);
+ if (mask)
+ snd_ctl_elem_value_set_integer(mask, 0, ~0L);
+ return 0;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ v = snd_config_get_ctl_elem_enumerated(conf, ctl, info);
+ if (v >= 0) {
+ snd_ctl_elem_value_set_enumerated(val, 0, v);
+ if (mask)
+ snd_ctl_elem_value_set_enumerated(mask, 0, ~0);
+ return 0;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ break;
+ default:
+ SNDERR("Unknown control type: %d", type);
+ return -EINVAL;
+ }
+ }
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_IEC958:
+ count = sizeof(snd_aes_iec958_t);
+ /* Fall through */
+ case SND_CTL_ELEM_TYPE_BYTES:
+ {
+ const char *buf;
+ err = snd_config_get_string(conf, &buf);
+ if (err >= 0) {
+ int c1 = 0;
+ unsigned int len = strlen(buf);
+ unsigned int idx = 0;
+ if (len % 2 != 0 || len > count * 2) {
+ _bad_content:
+ SNDERR("bad value content\n");
+ return -EINVAL;
+ }
+ while (*buf) {
+ int c = *buf++;
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else if (c >= 'a' && c <= 'f')
+ c = c - 'a' + 10;
+ else if (c >= 'A' && c <= 'F')
+ c = c - 'A' + 10;
+ else {
+ goto _bad_content;
+ }
+ if (idx % 2 == 1) {
+ snd_ctl_elem_value_set_byte(val, idx / 2, c1 << 4 | c);
+ if (mask)
+ snd_ctl_elem_value_set_byte(mask, idx / 2, 0xff);
+ } else
+ c1 = c;
+ idx++;
+ }
+ return 0;
+ }
+ }
+ default:
+ break;
+ }
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("bad value type");
+ return -EINVAL;
+ }
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &idx);
+ if (err < 0 || idx < 0 || (unsigned int) idx >= count) {
+ SNDERR("bad value index");
+ return -EINVAL;
+ }
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ v = snd_config_get_bool(n);
+ if (v < 0)
+ goto _bad_content;
+ snd_ctl_elem_value_set_boolean(val, idx, v);
+ if (mask)
+ snd_ctl_elem_value_set_boolean(mask, idx, 1);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ err = snd_config_get_integer(n, &v);
+ if (err < 0)
+ goto _bad_content;
+ snd_ctl_elem_value_set_integer(val, idx, v);
+ if (mask)
+ snd_ctl_elem_value_set_integer(mask, idx, ~0L);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ v = snd_config_get_ctl_elem_enumerated(n, ctl, info);
+ if (v < 0)
+ goto _bad_content;
+ snd_ctl_elem_value_set_enumerated(val, idx, v);
+ if (mask)
+ snd_ctl_elem_value_set_enumerated(mask, idx, ~0);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ err = snd_config_get_integer(n, &v);
+ if (err < 0 || v < 0 || v > 255)
+ goto _bad_content;
+ snd_ctl_elem_value_set_byte(val, idx, v);
+ if (mask)
+ snd_ctl_elem_value_set_byte(mask, idx, 0xff);
+ break;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_data)
+{
+ snd_config_t *conf;
+ snd_config_iterator_t i, next;
+ char *tmp;
+ int iface = SND_CTL_ELEM_IFACE_MIXER;
+ const char *name = NULL;
+ long index = 0;
+ long device = -1;
+ long subdevice = -1;
+ int lock = 0;
+ int preserve = 0;
+ int optional = 0;
+ snd_config_t *value = NULL, *mask = NULL;
+ snd_sctl_elem_t *elem = NULL;
+ int err;
+ err = snd_config_expand(_conf, _conf, NULL, private_data, &conf);
+ if (err < 0)
+ return err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
+ const char *ptr;
+ if ((err = snd_config_get_string(n, &ptr)) < 0) {
+ SNDERR("field %s is not a string", id);
+ goto _err;
+ }
+ if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
+ SNDERR("Invalid value for '%s'", id);
+ goto _err;
+ }
+ iface = err;
+ continue;
+ }
+ if (strcmp(id, "name") == 0) {
+ if ((err = snd_config_get_string(n, &name)) < 0) {
+ SNDERR("field %s is not a string", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "index") == 0) {
+ if ((err = snd_config_get_integer(n, &index)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ if ((err = snd_config_get_integer(n, &device)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "lock") == 0) {
+ if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
+ SNDERR("field %s has an invalid type", id);
+ goto _err;
+ }
+ err = snd_config_get_bool_ascii(tmp);
+ if (err < 0) {
+ SNDERR("field %s is not a boolean", id);
+ free(tmp);
+ goto _err;
+ }
+ lock = err;
+ free(tmp);
+ continue;
+ }
+ if (strcmp(id, "preserve") == 0) {
+ if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
+ SNDERR("field %s has an invalid type", id);
+ goto _err;
+ }
+ err = snd_config_get_bool_ascii(tmp);
+ if (err < 0) {
+ SNDERR("field %s is not a boolean", id);
+ free(tmp);
+ goto _err;
+ }
+ preserve = err;
+ free(tmp);
+ continue;
+ }
+ if (strcmp(id, "value") == 0) {
+ value = n;
+ continue;
+ }
+ if (strcmp(id, "mask") == 0) {
+ mask = n;
+ continue;
+ }
+ if (strcmp(id, "optional") == 0) {
+ if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
+ SNDERR("field %s has an invalid type", id);
+ goto _err;
+ }
+ err = snd_config_get_bool_ascii(tmp);
+ if (err < 0) {
+ SNDERR("field %s is not a boolean", id);
+ free(tmp);
+ goto _err;
+ }
+ optional = err;
+ free(tmp);
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (name == NULL) {
+ SNDERR("Missing control name");
+ err = -EINVAL;
+ goto _err;
+ }
+ if (value == NULL) {
+ SNDERR("Missing control value");
+ err = -EINVAL;
+ goto _err;
+ }
+ if (device < 0)
+ device = 0;
+ if (subdevice < 0)
+ subdevice = 0;
+ elem = calloc(1, sizeof(*elem));
+ if (!elem)
+ return -ENOMEM;
+ err = snd_ctl_elem_id_malloc(&elem->id);
+ if (err < 0)
+ goto _err;
+ err = snd_ctl_elem_info_malloc(&elem->info);
+ if (err < 0)
+ goto _err;
+ err = snd_ctl_elem_value_malloc(&elem->val);
+ if (err < 0)
+ goto _err;
+ err = snd_ctl_elem_value_malloc(&elem->mask);
+ if (err < 0)
+ goto _err;
+ err = snd_ctl_elem_value_malloc(&elem->old);
+ if (err < 0)
+ goto _err;
+ elem->lock = lock;
+ elem->preserve = preserve;
+ snd_ctl_elem_id_set_interface(elem->id, iface);
+ snd_ctl_elem_id_set_name(elem->id, name);
+ snd_ctl_elem_id_set_index(elem->id, index);
+ snd_ctl_elem_id_set_device(elem->id, device);
+ snd_ctl_elem_id_set_subdevice(elem->id, subdevice);
+ snd_ctl_elem_info_set_id(elem->info, elem->id);
+ err = snd_ctl_elem_info(h->ctl, elem->info);
+ if (err < 0) {
+ if (! optional)
+ SNDERR("Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
+ goto _err;
+ }
+ snd_ctl_elem_value_set_id(elem->val, elem->id);
+ snd_ctl_elem_value_set_id(elem->old, elem->id);
+ if (mask) {
+ err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, NULL, elem->info);
+ if (err < 0)
+ goto _err;
+ err = snd_config_get_ctl_elem_value(mask, h->ctl, elem->mask, NULL, elem->info);
+ if (err < 0)
+ goto _err;
+ } else {
+ err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info);
+ if (err < 0)
+ goto _err;
+ }
+
+ err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info);
+ if (err < 0)
+ goto _err;
+ list_add_tail(&elem->list, &h->elems);
+
+ _err:
+ if (err < 0 && elem) {
+ if (elem->id)
+ snd_ctl_elem_id_free(elem->id);
+ if (elem->info)
+ snd_ctl_elem_info_free(elem->info);
+ if (elem->val)
+ snd_ctl_elem_value_free(elem->val);
+ if (elem->mask)
+ snd_ctl_elem_value_free(elem->mask);
+ if (elem->old)
+ snd_ctl_elem_value_free(elem->old);
+ free(elem);
+ if (err != -ENOMEM && optional)
+ err = 0; /* ignore the error */
+ }
+ if (conf)
+ snd_config_delete(conf);
+ return err;
+}
+
+/**
+ * \brief Build setup control handle
+ * \param sctl Result - setup control handle
+ * \param handle Master control handle
+ * \param conf Setup configuration
+ * \param private_data Private data for runtime evaluation
+ * \param mode Build mode - SND_SCTL_xxxx
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_sctl_build(snd_sctl_t **sctl, snd_ctl_t *handle, snd_config_t *conf, snd_config_t *private_data, int mode)
+{
+ snd_sctl_t *h;
+ snd_config_iterator_t i, next;
+ int err;
+
+ assert(sctl);
+ assert(handle);
+ assert(conf);
+ *sctl = NULL;
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND)
+ return -EINVAL;
+ h = calloc(1, sizeof(*h));
+ if (!h) {
+ if (mode & SND_SCTL_NOFREE)
+ return -ENOMEM;
+ snd_ctl_close(handle);
+ return -ENOMEM;
+ }
+ h->mode = mode;
+ h->ctl = handle;
+ INIT_LIST_HEAD(&h->elems);
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ err = add_elem(h, n, private_data);
+ if (err < 0) {
+ free_elems(h);
+ return err;
+ }
+ }
+ *sctl = h;
+ return 0;
+}
+
+/**
+ * \brief Free setup control handle
+ * \param sctl Setup control handle
+ * \result zero if success, otherwise a negative error code
+ */
+int snd_sctl_free(snd_sctl_t *sctl)
+{
+ assert(sctl);
+ return free_elems(sctl);
+}
diff --git a/alsa-lib/src/control/tlv.c b/alsa-lib/src/control/tlv.c
new file mode 100644
index 0000000..0006a87
--- /dev/null
+++ b/alsa-lib/src/control/tlv.c
@@ -0,0 +1,429 @@
+/**
+ * \file control/tlv.c
+ * \brief dB conversion functions from control TLV information
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2007
+ */
+/*
+ * Control Interface - dB conversion functions from control TLV information
+ *
+ * Copyright (c) 2007 Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#ifndef HAVE_SOFT_FLOAT
+#include <math.h>
+#endif
+#include "control_local.h"
+
+#ifndef DOC_HIDDEN
+/* convert to index of integer array */
+#define int_index(size) (((size) + sizeof(int) - 1) / sizeof(int))
+/* max size of a TLV entry for dB information (including compound one) */
+#define MAX_TLV_RANGE_SIZE 256
+#endif
+
+/**
+ * \brief Parse TLV stream and retrieve dB information
+ * \param tlv the TLV source
+ * \param tlv_size the byte size of TLV source
+ * \param db_tlvp the pointer stored the dB TLV information
+ * \return the byte size of dB TLV information if found in the given
+ * TLV source, or a negative error code.
+ *
+ * This function parses the given TLV source and stores the TLV start
+ * point if the TLV information regarding dB conversion is found.
+ * The stored TLV pointer can be passed to the convesion functions
+ * #snd_tlv_convert_to_dB(), #snd_tlv_convert_from_dB() and
+ * #snd_tlv_get_dB_range().
+ */
+int snd_tlv_parse_dB_info(unsigned int *tlv,
+ unsigned int tlv_size,
+ unsigned int **db_tlvp)
+{
+ unsigned int type;
+ unsigned int size;
+ int err;
+
+ *db_tlvp = NULL;
+ type = tlv[0];
+ size = tlv[1];
+ tlv_size -= 2 * sizeof(int);
+ if (size > tlv_size) {
+ SNDERR("TLV size error");
+ return -EINVAL;
+ }
+ switch (type) {
+ case SND_CTL_TLVT_CONTAINER:
+ size = int_index(size) * sizeof(int);
+ tlv += 2;
+ while (size > 0) {
+ unsigned int len;
+ err = snd_tlv_parse_dB_info(tlv, size, db_tlvp);
+ if (err < 0)
+ return err; /* error */
+ if (err > 0)
+ return err; /* found */
+ len = int_index(tlv[1]) + 2;
+ size -= len * sizeof(int);
+ tlv += len;
+ }
+ break;
+ case SND_CTL_TLVT_DB_SCALE:
+#ifndef HAVE_SOFT_FLOAT
+ case SND_CTL_TLVT_DB_LINEAR:
+#endif
+ case SND_CTL_TLVT_DB_RANGE: {
+ unsigned int minsize;
+ if (type == SND_CTL_TLVT_DB_RANGE)
+ minsize = 4 * sizeof(int);
+ else
+ minsize = 2 * sizeof(int);
+ if (size < minsize) {
+ SNDERR("Invalid dB_scale TLV size");
+ return -EINVAL;
+ }
+ if (size > MAX_TLV_RANGE_SIZE) {
+ SNDERR("Too big dB_scale TLV size: %d", size);
+ return -EINVAL;
+ }
+ *db_tlvp = tlv;
+ return size + sizeof(int) * 2;
+ }
+ default:
+ break;
+ }
+ return -EINVAL; /* not found */
+}
+
+/**
+ * \brief Get the dB min/max values
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
+ * \param rangemin the minimum value of the raw volume
+ * \param rangemax the maximum value of the raw volume
+ * \param min the pointer to store the minimum dB value (in 0.01dB unit)
+ * \param max the pointer to store the maximum dB value (in 0.01dB unit)
+ * \return 0 if successful, or a negative error code
+ */
+int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
+ long *min, long *max)
+{
+ int err;
+
+ switch (tlv[0]) {
+ case SND_CTL_TLVT_DB_RANGE: {
+ unsigned int pos, len;
+ len = int_index(tlv[1]);
+ if (len > MAX_TLV_RANGE_SIZE)
+ return -EINVAL;
+ pos = 2;
+ while (pos + 4 <= len) {
+ long rmin, rmax;
+ rangemin = (int)tlv[pos];
+ rangemax = (int)tlv[pos + 1];
+ err = snd_tlv_get_dB_range(tlv + pos + 2,
+ rangemin, rangemax,
+ &rmin, &rmax);
+ if (err < 0)
+ return err;
+ if (pos > 2) {
+ if (rmin < *min)
+ *min = rmin;
+ if (rmax > *max)
+ *max = rmax;
+ } else {
+ *min = rmin;
+ *max = rmax;
+ }
+ pos += int_index(tlv[pos + 3]) + 4;
+ }
+ return 0;
+ }
+ case SND_CTL_TLVT_DB_SCALE: {
+ int step;
+ *min = (int)tlv[2];
+ step = (tlv[3] & 0xffff);
+ *max = *min + (long)(step * (rangemax - rangemin));
+ return 0;
+ }
+ case SND_CTL_TLVT_DB_LINEAR:
+ *min = (int)tlv[2];
+ *max = (int)tlv[3];
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Convert the given raw volume value to a dB gain
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
+ * \param rangemin the minimum value of the raw volume
+ * \param rangemax the maximum value of the raw volume
+ * \param volume the raw volume value to convert
+ * \param db_gain the dB gain (in 0.01dB unit)
+ * \return 0 if successful, or a negative error code
+ */
+int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long volume, long *db_gain)
+{
+ switch (tlv[0]) {
+ case SND_CTL_TLVT_DB_RANGE: {
+ unsigned int pos, len;
+ len = int_index(tlv[1]);
+ if (len > MAX_TLV_RANGE_SIZE)
+ return -EINVAL;
+ pos = 2;
+ while (pos + 4 <= len) {
+ rangemin = (int)tlv[pos];
+ rangemax = (int)tlv[pos + 1];
+ if (volume >= rangemin && volume <= rangemax)
+ return snd_tlv_convert_to_dB(tlv + pos + 2,
+ rangemin, rangemax,
+ volume, db_gain);
+ pos += int_index(tlv[pos + 3]) + 4;
+ }
+ return -EINVAL;
+ }
+ case SND_CTL_TLVT_DB_SCALE: {
+ int min, step, mute;
+ min = tlv[2];
+ step = (tlv[3] & 0xffff);
+ mute = (tlv[3] >> 16) & 1;
+ if (mute && volume == rangemin)
+ *db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
+ else
+ *db_gain = (volume - rangemin) * step + min;
+ return 0;
+ }
+#ifndef HAVE_SOFT_FLOAT
+ case SND_CTL_TLVT_DB_LINEAR: {
+ int mindb = tlv[2];
+ int maxdb = tlv[3];
+ if (volume <= rangemin || rangemax <= rangemin)
+ *db_gain = mindb;
+ else if (volume >= rangemax)
+ *db_gain = maxdb;
+ else {
+ double val = (double)(volume - rangemin) /
+ (double)(rangemax - rangemin);
+ if (mindb <= SND_CTL_TLV_DB_GAIN_MUTE)
+ *db_gain = (long)(100.0 * 20.0 * log10(val)) +
+ maxdb;
+ else {
+ /* FIXME: precalculate and cache these values */
+ double lmin = pow(10.0, mindb/2000.0);
+ double lmax = pow(10.0, maxdb/2000.0);
+ val = (lmax - lmin) * val + lmin;
+ *db_gain = (long)(100.0 * 20.0 * log10(val));
+ }
+ }
+ return 0;
+ }
+#endif
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Convert from dB gain to the corresponding raw value
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
+ * \param rangemin the minimum value of the raw volume
+ * \param rangemax the maximum value of the raw volume
+ * \param db_gain the dB gain to convert (in 0.01dB unit)
+ * \param value the pointer to store the converted raw volume value
+ * \param xdir the direction for round-up. The value is round up
+ * when this is positive.
+ * \return 0 if successful, or a negative error code
+ */
+int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
+ long db_gain, long *value, int xdir)
+{
+ switch (tlv[0]) {
+ case SND_CTL_TLVT_DB_RANGE: {
+ unsigned int pos, len;
+ len = int_index(tlv[1]);
+ if (len > MAX_TLV_RANGE_SIZE)
+ return -EINVAL;
+ pos = 2;
+ while (pos + 4 <= len) {
+ long dbmin, dbmax;
+ rangemin = (int)tlv[pos];
+ rangemax = (int)tlv[pos + 1];
+ if (!snd_tlv_get_dB_range(tlv + pos + 2,
+ rangemin, rangemax,
+ &dbmin, &dbmax) &&
+ db_gain >= dbmin && db_gain <= dbmax)
+ return snd_tlv_convert_from_dB(tlv + pos + 2,
+ rangemin, rangemax,
+ db_gain, value, xdir);
+ pos += int_index(tlv[pos + 3]) + 4;
+ }
+ return -EINVAL;
+ }
+ case SND_CTL_TLVT_DB_SCALE: {
+ int min, step, max;
+ min = tlv[2];
+ step = (tlv[3] & 0xffff);
+ max = min + (int)(step * (rangemax - rangemin));
+ if (db_gain <= min)
+ *value = rangemin;
+ else if (db_gain >= max)
+ *value = rangemax;
+ else {
+ long v = (db_gain - min) * (rangemax - rangemin);
+ if (xdir > 0)
+ v += (max - min) - 1;
+ v = v / (max - min) + rangemin;
+ *value = v;
+ }
+ return 0;
+ }
+#ifndef HAVE_SOFT_FLOAT
+ case SND_CTL_TLVT_DB_LINEAR: {
+ int min, max;
+ min = tlv[2];
+ max = tlv[3];
+ if (db_gain <= min)
+ *value = rangemin;
+ else if (db_gain >= max)
+ *value = rangemax;
+ else {
+ /* FIXME: precalculate and cache vmin and vmax */
+ double vmin, vmax, v;
+ vmin = (min <= SND_CTL_TLV_DB_GAIN_MUTE) ? 0.0 :
+ pow(10.0, (double)min / 2000.0);
+ vmax = !max ? 1.0 : pow(10.0, (double)max / 2000.0);
+ v = pow(10.0, (double)db_gain / 2000.0);
+ v = (v - vmin) * (rangemax - rangemin) / (vmax - vmin);
+ if (xdir > 0)
+ v = ceil(v);
+ *value = (long)v + rangemin;
+ }
+ return 0;
+ }
+#endif
+ default:
+ break;
+ }
+ return -EINVAL;
+}
+
+#ifndef DOC_HIDDEN
+#define TEMP_TLV_SIZE 4096
+struct tlv_info {
+ long minval, maxval;
+ unsigned int *tlv;
+ unsigned int buf[TEMP_TLV_SIZE];
+};
+#endif
+
+static int get_tlv_info(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ struct tlv_info *rec)
+{
+ snd_ctl_elem_info_t *info;
+ int err;
+
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_info_set_id(info, id);
+ err = snd_ctl_elem_info(ctl, info);
+ if (err < 0)
+ return err;
+ if (!snd_ctl_elem_info_is_tlv_readable(info))
+ return -EINVAL;
+ if (snd_ctl_elem_info_get_type(info) != SND_CTL_ELEM_TYPE_INTEGER)
+ return -EINVAL;
+ rec->minval = snd_ctl_elem_info_get_min(info);
+ rec->maxval = snd_ctl_elem_info_get_max(info);
+ err = snd_ctl_elem_tlv_read(ctl, id, rec->buf, sizeof(rec->buf));
+ if (err < 0)
+ return err;
+ err = snd_tlv_parse_dB_info(rec->buf, sizeof(rec->buf), &rec->tlv);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+/**
+ * \brief Get the dB min/max values on the given control element
+ * \param ctl the control handler
+ * \param id the element id
+ * \param volume the raw volume value to convert
+ * \param min the pointer to store the minimum dB value (in 0.01dB unit)
+ * \param max the pointer to store the maximum dB value (in 0.01dB unit)
+ * \return 0 if successful, or a negative error code
+ */
+int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long *min, long *max)
+{
+ struct tlv_info info;
+ int err;
+
+ err = get_tlv_info(ctl, id, &info);
+ if (err < 0)
+ return err;
+ return snd_tlv_get_dB_range(info.tlv, info.minval, info.maxval,
+ min, max);
+}
+
+/**
+ * \brief Convert the volume value to dB on the given control element
+ * \param ctl the control handler
+ * \param id the element id
+ * \param volume the raw volume value to convert
+ * \param db_gain the dB gain (in 0.01dB unit)
+ * \return 0 if successful, or a negative error code
+ */
+int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long volume, long *db_gain)
+{
+ struct tlv_info info;
+ int err;
+
+ err = get_tlv_info(ctl, id, &info);
+ if (err < 0)
+ return err;
+ return snd_tlv_convert_to_dB(info.tlv, info.minval, info.maxval,
+ volume, db_gain);
+}
+
+/**
+ * \brief Convert from dB gain to the raw volume value on the given control element
+ * \param ctl the control handler
+ * \param id the element id
+ * \param db_gain the dB gain to convert (in 0.01dB unit)
+ * \param value the pointer to store the converted raw volume value
+ * \param xdir the direction for round-up. The value is round up
+ * when this is positive.
+ * \return 0 if successful, or a negative error code
+ */
+int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
+ long db_gain, long *value, int xdir)
+{
+ struct tlv_info info;
+ int err;
+
+ err = get_tlv_info(ctl, id, &info);
+ if (err < 0)
+ return err;
+ return snd_tlv_convert_from_dB(info.tlv, info.minval, info.maxval,
+ db_gain, value, xdir);
+}
diff --git a/alsa-lib/src/dlmisc.c b/alsa-lib/src/dlmisc.c
new file mode 100644
index 0000000..b84eaf6
--- /dev/null
+++ b/alsa-lib/src/dlmisc.c
@@ -0,0 +1,242 @@
+/**
+ * \file dlmisc.c
+ * \brief dynamic loader helpers
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2001
+ *
+ * Dynamic loader helpers
+ */
+/*
+ * Dynamic loader helpers
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define _GNU_SOURCE
+#include "list.h"
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+#ifndef PIC
+struct snd_dlsym_link *snd_dlsym_start = NULL;
+#endif
+#endif
+
+/**
+ * \brief Opens a dynamic library - ALSA wrapper for \c dlopen.
+ * \param name name of the library, similar to \c dlopen.
+ * \param mode mode flags, similar to \c dlopen.
+ * \return Library handle if successful, otherwise \c NULL.
+ *
+ * This function can emulate dynamic linking for the static build of
+ * the alsa-lib library. In that case, \p name is set to \c NULL.
+ */
+void *snd_dlopen(const char *name, int mode)
+{
+#ifndef PIC
+ if (name == NULL)
+ return &snd_dlsym_start;
+#else
+#ifdef HAVE_LIBDL
+ if (name == NULL) {
+#ifdef ANDROID
+ return RTLD_DEFAULT;
+#else
+ Dl_info dlinfo;
+ if (dladdr(snd_dlopen, &dlinfo) > 0)
+ name = dlinfo.dli_fname;
+#endif
+ }
+#endif
+#endif
+#ifdef HAVE_LIBDL
+ return dlopen(name, mode);
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * \brief Closes a dynamic library - ALSA wrapper for \c dlclose.
+ * \param handle Library handle, similar to \c dlclose.
+ * \return Zero if successful, otherwise an error code.
+ *
+ * This function can emulate dynamic linking for the static build of
+ * the alsa-lib library.
+ */
+int snd_dlclose(void *handle)
+{
+#ifndef PIC
+ if (handle == &snd_dlsym_start)
+ return 0;
+#endif
+#ifdef HAVE_LIBDL
+#ifdef ANDROID
+ if (handle == RTLD_DEFAULT)
+ return 0;
+#endif
+ return dlclose(handle);
+#else
+ return 0;
+#endif
+}
+
+/**
+ * \brief Verifies a dynamically loaded symbol.
+ * \param handle Library handle, similar to \c dlsym.
+ * \param name Symbol name.
+ * \param version Version of the symbol.
+ * \return Zero is successful, otherwise a negative error code.
+ *
+ * This function checks that the symbol with the version appended to its name
+ * does exist in the library.
+ */
+static int snd_dlsym_verify(void *handle, const char *name, const char *version)
+{
+#ifdef HAVE_LIBDL
+ int res;
+ char *vname;
+
+ if (handle == NULL)
+ return -EINVAL;
+ vname = alloca(1 + strlen(name) + strlen(version) + 1);
+ if (vname == NULL)
+ return -ENOMEM;
+ vname[0] = '_';
+ strcpy(vname + 1, name);
+ strcat(vname, version);
+ res = dlsym(handle, vname) == NULL ? -ENOENT : 0;
+ // printf("dlsym verify: %i, vname = '%s'\n", res, vname);
+ if (res < 0)
+ SNDERR("unable to verify version for symbol %s", name);
+ return res;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * \brief Resolves a symbol from a dynamic library - ALSA wrapper for \c dlsym.
+ * \param handle Library handle, similar to \c dlsym.
+ * \param name Symbol name.
+ * \param version Version of the symbol.
+ *
+ * This function can emulate dynamic linking for the static build of
+ * the alsa-lib library.
+ *
+ * This special version of the \c dlsym function checks also the version
+ * of the symbol. A versioned symbol should be defined using the
+ * #SND_DLSYM_BUILD_VERSION macro.
+ */
+void *snd_dlsym(void *handle, const char *name, const char *version)
+{
+ int err;
+
+#ifndef PIC
+ if (handle == &snd_dlsym_start) {
+ /* it's the funny part: */
+ /* we are looking for a symbol in a static library */
+ struct snd_dlsym_link *link = snd_dlsym_start;
+ while (link) {
+ if (!strcmp(name, link->dlsym_name))
+ return (void *)link->dlsym_ptr;
+ link = link->next;
+ }
+ return NULL;
+ }
+#endif
+#ifdef HAVE_LIBDL
+ if (version) {
+ err = snd_dlsym_verify(handle, name, version);
+ if (err < 0)
+ return NULL;
+ }
+ return dlsym(handle, name);
+#else
+ return NULL;
+#endif
+}
+
+/*
+ * dlobj cache
+ *
+ * FIXME: add reference counter and proper locking
+ */
+
+#ifndef DOC_HIDDEN
+struct dlobj_cache {
+ const char *name;
+ void *obj;
+ void *func;
+ struct list_head list;
+};
+
+static LIST_HEAD(pcm_dlobj_list);
+
+void *snd_dlobj_cache_lookup(const char *name)
+{
+ struct list_head *p;
+ struct dlobj_cache *c;
+
+ list_for_each(p, &pcm_dlobj_list) {
+ c = list_entry(p, struct dlobj_cache, list);
+ if (strcmp(c->name, name) == 0)
+ return c->func;
+ }
+ return NULL;
+}
+
+int snd_dlobj_cache_add(const char *name, void *dlobj, void *open_func)
+{
+ struct list_head *p;
+ struct dlobj_cache *c;
+
+ list_for_each(p, &pcm_dlobj_list) {
+ c = list_entry(p, struct dlobj_cache, list);
+ if (strcmp(c->name, name) == 0)
+ return 0; /* already exists */
+ }
+ c = malloc(sizeof(*c));
+ if (! c)
+ return -ENOMEM;
+ c->name = strdup(name);
+ if (! c->name) {
+ free(c);
+ return -ENOMEM;
+ }
+ c->obj = dlobj;
+ c->func = open_func;
+ list_add_tail(&c->list, &pcm_dlobj_list);
+ return 0;
+}
+
+void snd_dlobj_cache_cleanup(void)
+{
+ struct list_head *p;
+ struct dlobj_cache *c;
+
+ while (! list_empty(&pcm_dlobj_list)) {
+ p = pcm_dlobj_list.next;
+ c = list_entry(p, struct dlobj_cache, list);
+ list_del(p);
+ snd_dlclose(c->obj);
+ free((void *)c->name); /* shut up gcc warning */
+ free(c);
+ }
+}
+#endif
diff --git a/alsa-lib/src/error.c b/alsa-lib/src/error.c
new file mode 100644
index 0000000..7d5f509
--- /dev/null
+++ b/alsa-lib/src/error.c
@@ -0,0 +1,150 @@
+/**
+ * \file error.c
+ * \brief Error code handling routines
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 1998-2001
+ *
+ * Error code handling routines.
+ */
+/*
+ * Copyright (c) 1998 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * snd_strerror routine needs to be recoded for the locale support
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include "local.h"
+
+/**
+ * Array of error codes in US ASCII.
+ */
+static const char *snd_error_codes[] =
+{
+ "Sound protocol is not compatible"
+};
+
+/**
+ * \brief Returns the message for an error code.
+ * \param errnum The error code number, which must be a system error code
+ * or an ALSA error code.
+ * \return The ASCII description of the given numeric error code.
+ */
+const char *snd_strerror(int errnum)
+{
+ if (errnum < 0)
+ errnum = -errnum;
+ if (errnum < SND_ERROR_BEGIN)
+ return (const char *) strerror(errnum);
+ errnum -= SND_ERROR_BEGIN;
+ if ((unsigned int) errnum >= sizeof(snd_error_codes) / sizeof(const char *))
+ return "Unknown error";
+ return snd_error_codes[errnum];
+}
+
+/**
+ * \brief The default error handler function.
+ * \param file The filename where the error was hit.
+ * \param line The line number.
+ * \param function The function name.
+ * \param err The error code.
+ * \param fmt The message (including the format characters).
+ * \param ... Optional arguments.
+ *
+ * Prints the error message including location to \c stderr.
+ */
+static void snd_lib_error_default(const char *file, int line, const char *function, int err, const char *fmt, ...)
+{
+ va_list arg;
+ va_start(arg, fmt);
+ fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
+ vfprintf(stderr, fmt, arg);
+ if (err)
+ fprintf(stderr, ": %s", snd_strerror(err));
+ putc('\n', stderr);
+ va_end(arg);
+}
+
+/**
+ * \ingroup Error
+ * Pointer to the error handler function.
+ * For internal use only.
+ */
+snd_lib_error_handler_t snd_lib_error = snd_lib_error_default;
+
+/**
+ * \brief Sets the error handler.
+ * \param handler The pointer to the new error handler function.
+ *
+ * This function sets a new error handler, or (if \c handler is \c NULL)
+ * the default one which prints the error messages to \c stderr.
+ */
+int snd_lib_error_set_handler(snd_lib_error_handler_t handler)
+{
+ snd_lib_error = handler == NULL ? snd_lib_error_default : handler;
+#ifndef NDEBUG
+ if (snd_lib_error != snd_lib_error_default)
+ snd_err_msg = snd_lib_error;
+#endif
+ return 0;
+}
+
+/**
+ * \brief Returns the ALSA sound library version in ASCII format
+ * \return The ASCII description of the used ALSA sound library.
+ */
+const char *snd_asoundlib_version(void)
+{
+ return SND_LIB_VERSION_STR;
+}
+
+#ifndef NDEBUG
+/*
+ * internal error handling
+ */
+static void snd_err_msg_default(const char *file, int line, const char *function, int err, const char *fmt, ...)
+{
+ va_list arg;
+ const char *verbose;
+
+ verbose = getenv("LIBASOUND_DEBUG");
+ if (! verbose || ! *verbose)
+ return;
+ va_start(arg, fmt);
+ fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
+ vfprintf(stderr, fmt, arg);
+ if (err)
+ fprintf(stderr, ": %s", snd_strerror(err));
+ putc('\n', stderr);
+ va_end(arg);
+#ifdef ALSA_DEBUG_ASSERT
+ verbose = getenv("LIBASOUND_DEBUG_ASSERT");
+ if (verbose && *verbose)
+ assert(0);
+#endif
+}
+
+/**
+ * The ALSA error message handler
+ */
+snd_lib_error_handler_t snd_err_msg = snd_err_msg_default;
+
+#endif
diff --git a/alsa-lib/src/hwdep/Makefile.am b/alsa-lib/src/hwdep/Makefile.am
new file mode 100644
index 0000000..0b626b9
--- /dev/null
+++ b/alsa-lib/src/hwdep/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_LTLIBRARIES=libhwdep.la
+
+libhwdep_la_SOURCES = hwdep.c hwdep_hw.c hwdep_symbols.c
+noinst_HEADERS = hwdep_local.h
+all: libhwdep.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/hwdep/Makefile.in b/alsa-lib/src/hwdep/Makefile.in
new file mode 100644
index 0000000..9ae25e7
--- /dev/null
+++ b/alsa-lib/src/hwdep/Makefile.in
@@ -0,0 +1,519 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/hwdep
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libhwdep_la_LIBADD =
+am_libhwdep_la_OBJECTS = hwdep.lo hwdep_hw.lo hwdep_symbols.lo
+libhwdep_la_OBJECTS = $(am_libhwdep_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libhwdep_la_SOURCES)
+DIST_SOURCES = $(libhwdep_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libhwdep.la
+libhwdep_la_SOURCES = hwdep.c hwdep_hw.c hwdep_symbols.c
+noinst_HEADERS = hwdep_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/hwdep/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/hwdep/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libhwdep.la: $(libhwdep_la_OBJECTS) $(libhwdep_la_DEPENDENCIES)
+ $(LINK) $(libhwdep_la_LDFLAGS) $(libhwdep_la_OBJECTS) $(libhwdep_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwdep.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwdep_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hwdep_symbols.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+all: libhwdep.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/hwdep/hwdep.c b/alsa-lib/src/hwdep/hwdep.c
new file mode 100644
index 0000000..b882b35
--- /dev/null
+++ b/alsa-lib/src/hwdep/hwdep.c
@@ -0,0 +1,760 @@
+/**
+ * \file hwdep/hwdep.c
+ * \brief HwDep Interface (hardware dependent)
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ *
+ * HwDep (hardware dependent) Interface is designed for individual hardware
+ * access. This interface does not cover any API specification.
+ */
+/*
+ * Hardware dependent Interface - main file
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "hwdep_local.h"
+
+static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
+ const char *name, snd_config_t *hwdep_root,
+ snd_config_t *hwdep_conf, int mode)
+{
+ const char *str;
+ char buf[256];
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_hwdep_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for HWDEP %s definition", name);
+ else
+ SNDERR("Invalid type for HWDEP definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(hwdep_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(hwdep_root, "hwdep_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for HWDEP type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str);
+ }
+#ifndef PIC
+ snd_hwdep_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (err >= 0) {
+ err = open_func(hwdep, name, hwdep_root, hwdep_conf, mode);
+ if (err >= 0) {
+ (*hwdep)->dl_handle = h;
+ } else {
+ snd_dlclose(h);
+ }
+ }
+ return err;
+}
+
+static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, const char *name, int mode)
+{
+ int err;
+ snd_config_t *hwdep_conf;
+ err = snd_config_search_definition(root, "hwdep", name, &hwdep_conf);
+ if (err < 0) {
+ SNDERR("Unknown HwDep %s", name);
+ return err;
+ }
+ err = snd_hwdep_open_conf(hwdep, name, root, hwdep_conf, mode);
+ snd_config_delete(hwdep_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a new connection to the HwDep interface.
+ * \param hwdep Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the HwDep handle
+ * \param mode Open mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the HwDep interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode)
+{
+ int err;
+ assert(hwdep && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_hwdep_open_noupdate(hwdep, snd_config, name, mode);
+}
+
+/**
+ * \brief Opens a new connection to the HwDep interface using local configuration
+ * \param hwdep Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the HwDep handle
+ * \param mode Open mode
+ * \param lconf The local configuration tree
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the HwDep interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name,
+ int mode, snd_config_t *lconf)
+{
+ assert(hwdep && name && lconf);
+ return snd_hwdep_open_noupdate(hwdep, lconf, name, mode);
+}
+
+/**
+ * \brief close HwDep handle
+ * \param hwdep HwDep handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified HwDep handle and frees all associated
+ * resources.
+ */
+int snd_hwdep_close(snd_hwdep_t *hwdep)
+{
+ int err;
+ assert(hwdep);
+ err = hwdep->ops->close(hwdep);
+ if (hwdep->dl_handle)
+ snd_dlclose(hwdep->dl_handle);
+ free(hwdep->name);
+ free(hwdep);
+ return err;
+}
+
+/**
+ * \brief get identifier of HwDep handle
+ * \param hwdep a Hwdep handle
+ * \return ascii identifier of HwDep handle
+ *
+ * Returns the ASCII identifier of given HwDep handle. It's the same
+ * identifier specified in snd_hwdep_open().
+ */
+const char *snd_hwdep_name(snd_hwdep_t *hwdep)
+{
+ assert(hwdep);
+ return hwdep->name;
+}
+
+/**
+ * \brief get type of HwDep handle
+ * \param hwdep a HwDep handle
+ * \return type of HwDep handle
+ *
+ * Returns the type #snd_hwdep_type_t of given HwDep handle.
+ */
+snd_hwdep_type_t snd_hwdep_type(snd_hwdep_t *hwdep)
+{
+ assert(hwdep);
+ return hwdep->type;
+}
+
+/**
+ * \brief get count of poll descriptors for HwDep handle
+ * \param hwdep HwDep handle
+ * \return count of poll descriptors
+ */
+int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep)
+{
+ assert(hwdep);
+ return 1;
+}
+
+/**
+ * \brief get poll descriptors
+ * \param hwdep HwDep handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space)
+{
+ assert(hwdep);
+ if (space >= 1) {
+ pfds->fd = hwdep->poll_fd;
+ switch (hwdep->mode & O_ACCMODE) {
+ case O_WRONLY:
+ pfds->events = POLLOUT|POLLERR|POLLNVAL;
+ break;
+ case O_RDONLY:
+ pfds->events = POLLIN|POLLERR|POLLNVAL;
+ break;
+ case O_RDWR:
+ pfds->events = POLLOUT|POLLIN|POLLERR|POLLNVAL;
+ break;
+ default:
+ return -EIO;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param hwdep HwDep handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(hwdep && pfds && revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief set nonblock mode
+ * \param hwdep HwDep handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock)
+{
+ int err;
+ assert(hwdep);
+ if ((err = hwdep->ops->nonblock(hwdep, nonblock)) < 0)
+ return err;
+ if (nonblock)
+ hwdep->mode |= SND_HWDEP_OPEN_NONBLOCK;
+ else
+ hwdep->mode &= ~SND_HWDEP_OPEN_NONBLOCK;
+ return 0;
+}
+
+/**
+ * \brief get size of the snd_hwdep_info_t structure in bytes
+ * \return size of the snd_hwdep_info_t structure in bytes
+ */
+size_t snd_hwdep_info_sizeof()
+{
+ return sizeof(snd_hwdep_info_t);
+}
+
+/**
+ * \brief allocate a new snd_hwdep_info_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_hwdep_info_t structure using the standard
+ * malloc C library function.
+ */
+int snd_hwdep_info_malloc(snd_hwdep_info_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_hwdep_info_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_hwdep_info_t structure
+ * \param info pointer to the snd_hwdep_info_t structure to free
+ *
+ * Frees the given snd_hwdep_info_t structure using the standard
+ * free C library function.
+ */
+void snd_hwdep_info_free(snd_hwdep_info_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_hwdep_info_t structure to another
+ * \param dst destination snd_hwdep_info_t structure
+ * \param src source snd_hwdep_info_t structure
+ */
+void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief get hwdep card number
+ * \param obj pointer to a snd_hwdep_info_t structure
+ * \return hwdep card number
+ */
+int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj)
+{
+ assert(obj);
+ return obj->card;
+}
+
+/**
+ * \brief get hwdep device number
+ * \param info pointer to a snd_hwdep_info_t structure
+ * \return hwdep device number
+ */
+unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *info)
+{
+ assert(info);
+ return info->device;
+}
+
+/**
+ * \brief get hwdep driver identifier
+ * \param obj pointer to a snd_hwdep_info_t structure
+ * \return hwdep driver identifier
+ */
+const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id;
+}
+
+/**
+ * \brief get hwdep driver name
+ * \param obj pointer to a snd_hwdep_info_t structure
+ * \return hwdep driver name
+ */
+const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->name;
+}
+
+/**
+ * \brief get hwdep protocol interface
+ * \param obj pointer to a snd_hwdep_info_t structure
+ * \return hwdep protocol interface
+ */
+snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj)
+{
+ assert(obj);
+ return obj->iface;
+}
+
+/**
+ * \brief set hwdep device number
+ * \param obj pointer to a snd_hwdep_info_t structure
+ * \param val hwdep device
+ */
+void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->device = val;
+}
+
+/**
+ * \brief get information about HwDep handle
+ * \param hwdep HwDep handle
+ * \param info pointer to a snd_hwdep_info_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info)
+{
+ assert(hwdep);
+ assert(info);
+ return hwdep->ops->info(hwdep, info);
+}
+
+/**
+ * \brief do hardware dependent ioctl
+ * \param hwdep HwDep handle
+ * \param request ioctl command
+ * \param arg ioctl argument
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg)
+{
+ assert(hwdep);
+ return hwdep->ops->ioctl(hwdep, request, arg);
+}
+
+/**
+ * \brief write bytes using HwDep handle
+ * \param hwdep HwDep handle
+ * \param buffer buffer containing bytes to write
+ * \param size output buffer size in bytes
+ */
+ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size)
+{
+ assert(hwdep);
+ assert(((hwdep->mode & O_ACCMODE) == O_WRONLY) || ((hwdep->mode & O_ACCMODE) == O_RDWR));
+ assert(buffer || size == 0);
+ return hwdep->ops->write(hwdep, buffer, size);
+}
+
+/**
+ * \brief read bytes using HwDep handle
+ * \param hwdep HwDep handle
+ * \param buffer buffer to store the input bytes
+ * \param size input buffer size in bytes
+ */
+ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size)
+{
+ assert(hwdep);
+ assert(((hwdep->mode & O_ACCMODE) == O_RDONLY) || ((hwdep->mode & O_ACCMODE) == O_RDWR));
+ assert(buffer || size == 0);
+ return (hwdep->ops->read)(hwdep, buffer, size);
+}
+
+/**
+ * \brief get the DSP status information
+ * \param hwdep HwDep handle
+ * \param info pointer to a snd_hwdep_dsp_status_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *info)
+{
+ assert(hwdep);
+ assert(info);
+ return hwdep->ops->ioctl(hwdep, SNDRV_HWDEP_IOCTL_DSP_STATUS, (void*)info);
+}
+
+/**
+ * \brief load the DSP block
+ * \param hwdep HwDep handle
+ * \param block pointer to a snd_hwdep_dsp_image_t structure to transfer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block)
+{
+ assert(hwdep);
+ assert(block);
+ return hwdep->ops->ioctl(hwdep, SNDRV_HWDEP_IOCTL_DSP_LOAD, (void*)block);
+}
+
+/**
+ * \brief get size of the snd_hwdep_dsp_status_t structure in bytes
+ * \return size of the snd_hwdep_dsp_status_t structure in bytes
+ */
+size_t snd_hwdep_dsp_status_sizeof()
+{
+ return sizeof(snd_hwdep_dsp_status_t);
+}
+
+/**
+ * \brief allocate a new snd_hwdep_dsp_status_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_hwdep_dsp_status_t structure using the standard
+ * malloc C library function.
+ */
+int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_hwdep_dsp_status_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_hwdep_dsp_status_t structure
+ * \param info pointer to the snd_hwdep_dsp_status_t structure to free
+ *
+ * Frees the given snd_hwdep_dsp_status_t structure using the standard
+ * free C library function.
+ */
+void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_hwdep_dsp_status_t structure to another
+ * \param dst destination snd_hwdep_dsp_status_t structure
+ * \param src source snd_hwdep_dsp_status_t structure
+ */
+void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief get the driver version of dsp loader
+ * \param obj pointer to a snd_hwdep_dsp_status_t structure
+ * \return the driver version
+ */
+unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj)
+{
+ assert(obj);
+ return obj->version;
+}
+
+/**
+ * \brief get the driver id of dsp loader
+ * \param obj pointer to a snd_hwdep_dsp_status_t structure
+ * \return the driver id string
+ */
+const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id;
+}
+
+/**
+ * \brief get number of dsp blocks
+ * \param obj pointer to a snd_hwdep_dsp_status_t structure
+ * \return number of dsp blocks
+ */
+unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj)
+{
+ assert(obj);
+ return obj->num_dsps;
+}
+
+/**
+ * \brief get the bit flags of the loaded dsp blocks
+ * \param info pointer to a snd_hwdep_dsp_status_t structure
+ * \return the big flags of the loaded dsp blocks
+ */
+unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *info)
+{
+ assert(info);
+ return info->dsp_loaded;
+}
+
+/**
+ * \brief get the chip status of dsp loader
+ * \param obj pointer to a snd_hwdep_dsp_status_t structure
+ * \return non-zero if all DSP blocks are loaded and the chip is ready
+ */
+unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj)
+{
+ assert(obj);
+ return obj->chip_ready;
+}
+
+/**
+ * \brief get size of the snd_hwdep_dsp_image_t structure in bytes
+ * \return size of the snd_hwdep_dsp_image_t structure in bytes
+ */
+size_t snd_hwdep_dsp_image_sizeof()
+{
+ return sizeof(snd_hwdep_dsp_image_t);
+}
+
+/**
+ * \brief allocate a new snd_hwdep_dsp_image_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_hwdep_dsp_image_t structure using the standard
+ * malloc C library function.
+ */
+int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_hwdep_dsp_image_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_hwdep_dsp_image_t structure
+ * \param info pointer to the snd_hwdep_dsp_image_t structure to free
+ *
+ * Frees the given snd_hwdep_dsp_image_t structure using the standard
+ * free C library function.
+ */
+void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_hwdep_dsp_image_t structure to another
+ * \param dst destination snd_hwdep_dsp_image_t structure
+ * \param src source snd_hwdep_dsp_image_t structure
+ */
+void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief get the DSP block index
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \return the index of the DSP block
+ */
+unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj)
+{
+ assert(obj);
+ return obj->index;
+}
+
+/**
+ * \brief get the name of the DSP block
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \return the name string of the DSP block
+ */
+const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->name;
+}
+
+/**
+ * \brief get the length of the DSP block
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \return the length of the DSP block in bytes
+ */
+size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj)
+{
+ assert(obj);
+ return obj->length;
+}
+
+/**
+ * \brief get the image pointer of the DSP block
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \return the image pointer of the DSP block
+ */
+const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj)
+{
+ assert(obj);
+ return obj->image;
+}
+
+/**
+ * \brief set the DSP block index
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \param index the index value to set
+ */
+void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int index)
+{
+ assert(obj);
+ obj->index = index;
+}
+
+/**
+ * \brief set the name of the DSP block
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \param name the name string
+ */
+void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name)
+{
+ assert(obj && name);
+ strncpy((char *)obj->name, name, sizeof(obj->name));
+ obj->name[sizeof(obj->name)-1] = 0;
+}
+
+/**
+ * \brief set the DSP block length
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \param length the length of the DSP block
+ */
+void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length)
+{
+ assert(obj);
+ obj->length = length;
+}
+
+/**
+ * \brief set the DSP block image pointer
+ * \param obj pointer to a snd_hwdep_dsp_image_t structure
+ * \param image the DSP image pointer
+ */
+void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *image)
+{
+ assert(obj);
+ obj->image = image;
+}
+
diff --git a/alsa-lib/src/hwdep/hwdep_hw.c b/alsa-lib/src/hwdep/hwdep_hw.c
new file mode 100644
index 0000000..238a507
--- /dev/null
+++ b/alsa-lib/src/hwdep/hwdep_hw.c
@@ -0,0 +1,201 @@
+/*
+ * Hardware dependent Interface - main file for hardware access
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "hwdep_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_hwdep_hw = "";
+#endif
+
+#define SNDRV_FILE_HWDEP ALSA_DEVICE_DIRECTORY "hwC%iD%i"
+#define SNDRV_HWDEP_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
+static int snd_hwdep_hw_close(snd_hwdep_t *hwdep)
+{
+ int res;
+ assert(hwdep);
+ res = close(hwdep->poll_fd) < 0 ? -errno : 0;
+ return res;
+}
+
+static int snd_hwdep_hw_nonblock(snd_hwdep_t *hwdep, int nonblock)
+{
+ long flags;
+ assert(hwdep);
+ if ((flags = fcntl(hwdep->poll_fd, F_GETFL)) < 0)
+ return -errno;
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(hwdep->poll_fd, F_SETFL, flags) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_hwdep_hw_info(snd_hwdep_t *hwdep, snd_hwdep_info_t *info)
+{
+ assert(hwdep && info);
+ if (ioctl(hwdep->poll_fd, SNDRV_HWDEP_IOCTL_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_hwdep_hw_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg)
+{
+ assert(hwdep);
+ if (ioctl(hwdep->poll_fd, request, arg) < 0)
+ return -errno;
+ return 0;
+}
+
+static ssize_t snd_hwdep_hw_write(snd_hwdep_t *hwdep, const void *buffer, size_t size)
+{
+ ssize_t result;
+ assert(hwdep && (buffer || size == 0));
+ result = write(hwdep->poll_fd, buffer, size);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static ssize_t snd_hwdep_hw_read(snd_hwdep_t *hwdep, void *buffer, size_t size)
+{
+ ssize_t result;
+ assert(hwdep && (buffer || size == 0));
+ result = read(hwdep->poll_fd, buffer, size);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static const snd_hwdep_ops_t snd_hwdep_hw_ops = {
+ .close = snd_hwdep_hw_close,
+ .nonblock = snd_hwdep_hw_nonblock,
+ .info = snd_hwdep_hw_info,
+ .ioctl = snd_hwdep_hw_ioctl,
+ .write = snd_hwdep_hw_write,
+ .read = snd_hwdep_hw_read,
+};
+
+int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int device, int mode)
+{
+ int fd, ver, ret;
+ char filename[sizeof(SNDRV_FILE_HWDEP) + 20];
+ snd_hwdep_t *hwdep;
+ assert(handle);
+
+ *handle = NULL;
+
+ if (card < 0 || card >= 32)
+ return -EINVAL;
+ sprintf(filename, SNDRV_FILE_HWDEP, card, device);
+ fd = snd_open_device(filename, mode);
+ if (fd < 0) {
+ snd_card_load(card);
+ fd = snd_open_device(filename, mode);
+ if (fd < 0)
+ return -errno;
+ }
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ SYSERR("fcntl FD_CLOEXEC failed");
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+#endif
+ if (ioctl(fd, SNDRV_HWDEP_IOCTL_PVERSION, &ver) < 0) {
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_HWDEP_VERSION_MAX)) {
+ close(fd);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ hwdep = (snd_hwdep_t *) calloc(1, sizeof(snd_hwdep_t));
+ if (hwdep == NULL) {
+ close(fd);
+ return -ENOMEM;
+ }
+ hwdep->name = strdup(name);
+ hwdep->poll_fd = fd;
+ hwdep->mode = mode;
+ hwdep->type = SND_HWDEP_TYPE_HW;
+ hwdep->ops = &snd_hwdep_hw_ops;
+ *handle = hwdep;
+ return 0;
+}
+
+int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ long card = -1, device = 0;
+ const char *str;
+ int err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0)
+ return -EINVAL;
+ card = snd_card_get_index(str);
+ if (card < 0)
+ return card;
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ SNDERR("Unexpected field %s", id);
+ return -EINVAL;
+ }
+ if (card < 0)
+ return -EINVAL;
+ return snd_hwdep_hw_open(hwdep, name, card, device, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);
diff --git a/alsa-lib/src/hwdep/hwdep_local.h b/alsa-lib/src/hwdep/hwdep_local.h
new file mode 100644
index 0000000..47467f9
--- /dev/null
+++ b/alsa-lib/src/hwdep/hwdep_local.h
@@ -0,0 +1,46 @@
+/*
+ * HwDep interface - local header file
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "local.h"
+
+typedef struct {
+ int (*close)(snd_hwdep_t *hwdep);
+ int (*nonblock)(snd_hwdep_t *hwdep, int nonblock);
+ int (*info)(snd_hwdep_t *hwdep, snd_hwdep_info_t *info);
+ int (*ioctl)(snd_hwdep_t *hwdep, unsigned int request, void * arg);
+ ssize_t (*write)(snd_hwdep_t *hwdep, const void *buffer, size_t size);
+ ssize_t (*read)(snd_hwdep_t *hwdep, void *buffer, size_t size);
+} snd_hwdep_ops_t;
+
+struct _snd_hwdep {
+ void *dl_handle;
+ char *name;
+ snd_hwdep_type_t type;
+ int mode;
+ int poll_fd;
+ const snd_hwdep_ops_t *ops;
+ void *private_data;
+};
+
+int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int device, int mode);
diff --git a/alsa-lib/src/hwdep/hwdep_symbols.c b/alsa-lib/src/hwdep/hwdep_symbols.c
new file mode 100644
index 0000000..aaa5667
--- /dev/null
+++ b/alsa-lib/src/hwdep/hwdep_symbols.c
@@ -0,0 +1,34 @@
+/*
+ * HwDep Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+extern const char *_snd_module_hwdep_hw;
+
+static const char **snd_hwdep_open_objects[] = {
+ &_snd_module_hwdep_hw
+};
+
+void *snd_hwdep_open_symbols(void)
+{
+ return snd_hwdep_open_objects;
+}
+
+#endif
diff --git a/alsa-lib/src/input.c b/alsa-lib/src/input.c
new file mode 100644
index 0000000..7cfbe56
--- /dev/null
+++ b/alsa-lib/src/input.c
@@ -0,0 +1,337 @@
+/**
+ * \file input.c
+ * \brief Generic stdio-like input interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000
+ *
+ * Generic stdio-like input interface
+ */
+/*
+ * Input object
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+
+typedef struct _snd_input_ops {
+ int (*close)(snd_input_t *input);
+ int (*scan)(snd_input_t *input, const char *format, va_list args);
+ char *(*(gets))(snd_input_t *input, char *str, size_t size);
+ int (*getch)(snd_input_t *input);
+ int (*ungetch)(snd_input_t *input, int c);
+} snd_input_ops_t;
+
+struct _snd_input {
+ snd_input_type_t type;
+ const snd_input_ops_t *ops;
+ void *private_data;
+};
+#endif
+
+/**
+ * \brief Closes an input handle.
+ * \param input The input handle to be closed.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_input_close(snd_input_t *input)
+{
+ int err = input->ops->close(input);
+ free(input);
+ return err;
+}
+
+/**
+ * \brief Reads formatted input (like \c fscanf(3)) from an input handle.
+ * \param input The input handle.
+ * \param format Format string in \c fscanf format.
+ * \param ... Other \c fscanf arguments.
+ * \return The number of input items assigned, or \c EOF.
+ *
+ * \bug Reading from a memory buffer doesn't work.
+ */
+int snd_input_scanf(snd_input_t *input, const char *format, ...)
+{
+ int result;
+ va_list args;
+ va_start(args, format);
+ result = input->ops->scan(input, format, args);
+ va_end(args);
+ return result;
+}
+
+/**
+ * \brief Reads a line from an input handle (like \c fgets(3)).
+ * \param input The input handle.
+ * \param str Address of the destination buffer.
+ * \param size The size of the destination buffer.
+ * \return Pointer to the buffer if successful, otherwise \c NULL.
+ *
+ * Like \c fgets, the returned string is zero-terminated, and contains
+ * the new-line character \c '\\n' if the line fits into the buffer.
+ */
+char *snd_input_gets(snd_input_t *input, char *str, size_t size)
+{
+ return (input->ops->gets)(input, str, size);
+}
+
+/**
+ * \brief Reads a character from an input handle (like \c fgetc(3)).
+ * \param input The input handle.
+ * \return The character read, or \c EOF on end of file or error.
+ */
+int snd_input_getc(snd_input_t *input)
+{
+ return input->ops->getch(input);
+}
+
+/**
+ * \brief Puts the last character read back to an input handle (like \c ungetc(3)).
+ * \param input The input handle.
+ * \param c The character to push back.
+ * \return The character pushed back, or \c EOF on error.
+ */
+int snd_input_ungetc(snd_input_t *input, int c)
+{
+ return input->ops->ungetch(input, c);
+}
+
+#ifndef DOC_HIDDEN
+typedef struct _snd_input_stdio {
+ int close;
+ FILE *fp;
+} snd_input_stdio_t;
+
+static int snd_input_stdio_close(snd_input_t *input ATTRIBUTE_UNUSED)
+{
+ snd_input_stdio_t *stdio = input->private_data;
+ if (stdio->close)
+ fclose(stdio->fp);
+ free(stdio);
+ return 0;
+}
+
+static int snd_input_stdio_scan(snd_input_t *input, const char *format, va_list args)
+{
+ snd_input_stdio_t *stdio = input->private_data;
+ extern int vfscanf(FILE *, const char *, va_list);
+ return vfscanf(stdio->fp, format, args);
+}
+
+static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size)
+{
+ snd_input_stdio_t *stdio = input->private_data;
+ return fgets(str, (int) size, stdio->fp);
+}
+
+static int snd_input_stdio_getc(snd_input_t *input)
+{
+ snd_input_stdio_t *stdio = input->private_data;
+ return getc(stdio->fp);
+}
+
+static int snd_input_stdio_ungetc(snd_input_t *input, int c)
+{
+ snd_input_stdio_t *stdio = input->private_data;
+ return ungetc(c, stdio->fp);
+}
+
+static const snd_input_ops_t snd_input_stdio_ops = {
+ .close = snd_input_stdio_close,
+ .scan = snd_input_stdio_scan,
+ .gets = snd_input_stdio_gets,
+ .getch = snd_input_stdio_getc,
+ .ungetch = snd_input_stdio_ungetc,
+};
+#endif
+
+/**
+ * \brief Creates a new input object using an existing stdio \c FILE pointer.
+ * \param inputp The function puts the pointer to the new input object
+ * at the address specified by \p inputp.
+ * \param fp The \c FILE pointer to read from.
+ * Reading begins at the current file position.
+ * \param _close Close flag. Set this to 1 if #snd_input_close should close
+ * \p fp by calling \c fclose.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close)
+{
+ snd_input_t *input;
+ snd_input_stdio_t *stdio;
+ assert(inputp && fp);
+ stdio = calloc(1, sizeof(*stdio));
+ if (!stdio)
+ return -ENOMEM;
+ input = calloc(1, sizeof(*input));
+ if (!input) {
+ free(stdio);
+ return -ENOMEM;
+ }
+ stdio->fp = fp;
+ stdio->close = _close;
+ input->type = SND_INPUT_STDIO;
+ input->ops = &snd_input_stdio_ops;
+ input->private_data = stdio;
+ *inputp = input;
+ return 0;
+}
+
+/**
+ * \brief Creates a new input object reading from a file.
+ * \param inputp The functions puts the pointer to the new input object
+ * at the address specified by \p inputp.
+ * \param file The name of the file to read from.
+ * \param mode The open mode, like \c fopen(3).
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode)
+{
+ int err;
+ FILE *fp = fopen(file, mode);
+ if (!fp) {
+ //SYSERR("fopen");
+ return -errno;
+ }
+ err = snd_input_stdio_attach(inputp, fp, 1);
+ if (err < 0)
+ fclose(fp);
+ return err;
+}
+
+#ifndef DOC_HIDDEN
+
+typedef struct _snd_input_buffer {
+ unsigned char *buf;
+ unsigned char *ptr;
+ size_t size;
+} snd_input_buffer_t;
+
+static int snd_input_buffer_close(snd_input_t *input)
+{
+ snd_input_buffer_t *buffer = input->private_data;
+ free(buffer->buf);
+ free(buffer);
+ return 0;
+}
+
+static int snd_input_buffer_scan(snd_input_t *input, const char *format, va_list args)
+{
+ snd_input_buffer_t *buffer = input->private_data;
+ extern int vsscanf(const char *, const char *, va_list);
+ /* FIXME: how can I obtain consumed chars count? */
+ assert(0);
+ return vsscanf((char *)buffer->ptr, format, args);
+}
+
+static char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size)
+{
+ snd_input_buffer_t *buffer = input->private_data;
+ size_t bsize = buffer->size;
+ while (--size > 0 && bsize > 0) {
+ unsigned char c = *buffer->ptr++;
+ bsize--;
+ *str++ = c;
+ if (c == '\n')
+ break;
+ }
+ if (bsize == buffer->size)
+ return NULL;
+ buffer->size = bsize;
+ *str = '\0';
+ return str;
+}
+
+static int snd_input_buffer_getc(snd_input_t *input)
+{
+ snd_input_buffer_t *buffer = input->private_data;
+ if (buffer->size == 0)
+ return EOF;
+ buffer->size--;
+ return *buffer->ptr++;
+}
+
+static int snd_input_buffer_ungetc(snd_input_t *input, int c)
+{
+ snd_input_buffer_t *buffer = input->private_data;
+ if (buffer->ptr == buffer->buf)
+ return EOF;
+ buffer->ptr--;
+ assert(*buffer->ptr == (unsigned char) c);
+ buffer->size++;
+ return c;
+}
+
+static const snd_input_ops_t snd_input_buffer_ops = {
+ .close = snd_input_buffer_close,
+ .scan = snd_input_buffer_scan,
+ .gets = snd_input_buffer_gets,
+ .getch = snd_input_buffer_getc,
+ .ungetch = snd_input_buffer_ungetc,
+};
+#endif
+
+/**
+ * \brief Creates a new input object from a memory buffer.
+ * \param inputp The function puts the pointer to the new input object
+ * at the address specified by \p inputp.
+ * \param buf Address of the input buffer.
+ * \param size Size of the input buffer.
+ * \return Zero if successful, otherwise a negative error code.
+ *
+ * This functions creates a copy of the input buffer, so the application is
+ * not required to preserve the buffer after this function has been called.
+ */
+int snd_input_buffer_open(snd_input_t **inputp, const char *buf, ssize_t size)
+{
+ snd_input_t *input;
+ snd_input_buffer_t *buffer;
+ assert(inputp);
+ buffer = calloc(1, sizeof(*buffer));
+ if (!buffer)
+ return -ENOMEM;
+ input = calloc(1, sizeof(*input));
+ if (!input) {
+ free(buffer);
+ return -ENOMEM;
+ }
+ if (size < 0)
+ size = strlen(buf);
+ buffer->buf = malloc((size_t)size + 1);
+ if (!buffer->buf) {
+ free(input);
+ free(buffer);
+ return -ENOMEM;
+ }
+ memcpy(buffer->buf, buf, (size_t) size);
+ buffer->buf[size] = 0;
+ buffer->ptr = buffer->buf;
+ buffer->size = size;
+ input->type = SND_INPUT_BUFFER;
+ input->ops = &snd_input_buffer_ops;
+ input->private_data = buffer;
+ *inputp = input;
+ return 0;
+}
+
diff --git a/alsa-lib/src/mixer/Makefile.am b/alsa-lib/src/mixer/Makefile.am
new file mode 100644
index 0000000..bb466ed
--- /dev/null
+++ b/alsa-lib/src/mixer/Makefile.am
@@ -0,0 +1,10 @@
+EXTRA_LTLIBRARIES=libmixer.la
+
+libmixer_la_SOURCES = bag.c mixer.c simple.c simple_none.c simple_abst.c
+
+noinst_HEADERS = mixer_local.h mixer_simple.h
+
+all: libmixer.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/mixer/Makefile.in b/alsa-lib/src/mixer/Makefile.in
new file mode 100644
index 0000000..b6866ca
--- /dev/null
+++ b/alsa-lib/src/mixer/Makefile.in
@@ -0,0 +1,523 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/mixer
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libmixer_la_LIBADD =
+am_libmixer_la_OBJECTS = bag.lo mixer.lo simple.lo simple_none.lo \
+ simple_abst.lo
+libmixer_la_OBJECTS = $(am_libmixer_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libmixer_la_SOURCES)
+DIST_SOURCES = $(libmixer_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libmixer.la
+libmixer_la_SOURCES = bag.c mixer.c simple.c simple_none.c simple_abst.c
+noinst_HEADERS = mixer_local.h mixer_simple.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/mixer/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/mixer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libmixer.la: $(libmixer_la_OBJECTS) $(libmixer_la_DEPENDENCIES)
+ $(LINK) $(libmixer_la_LDFLAGS) $(libmixer_la_OBJECTS) $(libmixer_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bag.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mixer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_abst.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_none.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+all: libmixer.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/mixer/bag.c b/alsa-lib/src/mixer/bag.c
new file mode 100644
index 0000000..d88a900
--- /dev/null
+++ b/alsa-lib/src/mixer/bag.c
@@ -0,0 +1,73 @@
+/*
+ * Bag of pointers
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "mixer_local.h"
+
+int bag_new(bag_t **bag)
+{
+ bag_t *b = malloc(sizeof(*b));
+ if (!b)
+ return -ENOMEM;
+ INIT_LIST_HEAD(b);
+ *bag = b;
+ return 0;
+}
+
+void bag_free(bag_t *bag)
+{
+ assert(list_empty(bag));
+ free(bag);
+}
+
+int bag_empty(bag_t *bag)
+{
+ return list_empty(bag);
+}
+
+int bag_add(bag_t *bag, void *ptr)
+{
+ bag1_t *b = malloc(sizeof(*b));
+ if (!b)
+ return -ENOMEM;
+ b->ptr = ptr;
+ list_add_tail(&b->list, bag);
+ return 0;
+}
+
+int bag_del(bag_t *bag, void *ptr)
+{
+ struct list_head *pos;
+ list_for_each(pos, bag) {
+ bag1_t *b = list_entry(pos, bag1_t, list);
+ if (b->ptr == ptr) {
+ list_del(&b->list);
+ free(b);
+ return 0;
+ }
+ }
+ return -ENOENT;
+}
+
+void bag_del_all(bag_t *bag)
+{
+ while (!list_empty(bag))
+ list_del(bag->next);
+}
diff --git a/alsa-lib/src/mixer/mixer.c b/alsa-lib/src/mixer/mixer.c
new file mode 100644
index 0000000..85d843f
--- /dev/null
+++ b/alsa-lib/src/mixer/mixer.c
@@ -0,0 +1,1083 @@
+/**
+ * \file mixer/mixer.c
+ * \brief Mixer Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2001
+ *
+ * Mixer interface is designed to access mixer elements.
+ * Callbacks may be used for event handling.
+ */
+/*
+ * Mixer Interface - main file
+ * Copyright (c) 1998/1999/2000 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page mixer Mixer interface
+
+<P>Mixer interface is designed to access the abstracted mixer controls.
+This is an abstraction layer over the hcontrol layer.
+
+\section mixer_general_overview General overview
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "mixer_local.h"
+
+#ifndef DOC_HIDDEN
+typedef struct _snd_mixer_slave {
+ snd_hctl_t *hctl;
+ struct list_head list;
+} snd_mixer_slave_t;
+
+#endif
+
+static int snd_mixer_compare_default(const snd_mixer_elem_t *c1,
+ const snd_mixer_elem_t *c2);
+
+
+/**
+ * \brief Opens an empty mixer
+ * \param mixerp Returned mixer handle
+ * \param mode Open mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_open(snd_mixer_t **mixerp, int mode ATTRIBUTE_UNUSED)
+{
+ snd_mixer_t *mixer;
+ assert(mixerp);
+ mixer = calloc(1, sizeof(*mixer));
+ if (mixer == NULL)
+ return -ENOMEM;
+ INIT_LIST_HEAD(&mixer->slaves);
+ INIT_LIST_HEAD(&mixer->classes);
+ INIT_LIST_HEAD(&mixer->elems);
+ mixer->compare = snd_mixer_compare_default;
+ *mixerp = mixer;
+ return 0;
+}
+
+/**
+ * \brief Attach an HCTL element to a mixer element
+ * \param melem Mixer element
+ * \param helem HCTL element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_attach(snd_mixer_elem_t *melem,
+ snd_hctl_elem_t *helem)
+{
+ bag_t *bag = snd_hctl_elem_get_callback_private(helem);
+ int err;
+ err = bag_add(bag, melem);
+ if (err < 0)
+ return err;
+ return bag_add(&melem->helems, helem);
+}
+
+/**
+ * \brief Detach an HCTL element from a mixer element
+ * \param melem Mixer element
+ * \param helem HCTL element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_detach(snd_mixer_elem_t *melem,
+ snd_hctl_elem_t *helem)
+{
+ bag_t *bag = snd_hctl_elem_get_callback_private(helem);
+ int err;
+ err = bag_del(bag, melem);
+ assert(err >= 0);
+ err = bag_del(&melem->helems, helem);
+ assert(err >= 0);
+ return 0;
+}
+
+/**
+ * \brief Return true if a mixer element does not contain any HCTL elements
+ * \param melem Mixer element
+ * \return 0 if not empty, 1 if empty
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_empty(snd_mixer_elem_t *melem)
+{
+ return bag_empty(&melem->helems);
+}
+
+static int hctl_elem_event_handler(snd_hctl_elem_t *helem,
+ unsigned int mask)
+{
+ bag_t *bag = snd_hctl_elem_get_callback_private(helem);
+ if (mask == SND_CTL_EVENT_MASK_REMOVE) {
+ int res = 0;
+ int err;
+ bag_iterator_t i, n;
+ bag_for_each_safe(i, n, bag) {
+ snd_mixer_elem_t *melem = bag_iterator_entry(i);
+ snd_mixer_class_t *class = melem->class;
+ err = class->event(class, mask, helem, melem);
+ if (err < 0)
+ res = err;
+ }
+ assert(bag_empty(bag));
+ bag_free(bag);
+ return res;
+ }
+ if (mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)) {
+ int err = 0;
+ bag_iterator_t i, n;
+ bag_for_each_safe(i, n, bag) {
+ snd_mixer_elem_t *melem = bag_iterator_entry(i);
+ snd_mixer_class_t *class = melem->class;
+ err = class->event(class, mask, helem, melem);
+ if (err < 0)
+ return err;
+ }
+ }
+ return 0;
+}
+
+static int hctl_event_handler(snd_hctl_t *hctl, unsigned int mask,
+ snd_hctl_elem_t *elem)
+{
+ snd_mixer_t *mixer = snd_hctl_get_callback_private(hctl);
+ int res = 0;
+ if (mask & SND_CTL_EVENT_MASK_ADD) {
+ struct list_head *pos;
+ bag_t *bag;
+ int err = bag_new(&bag);
+ if (err < 0)
+ return err;
+ snd_hctl_elem_set_callback(elem, hctl_elem_event_handler);
+ snd_hctl_elem_set_callback_private(elem, bag);
+ list_for_each(pos, &mixer->classes) {
+ snd_mixer_class_t *c;
+ c = list_entry(pos, snd_mixer_class_t, list);
+ err = c->event(c, mask, elem, NULL);
+ if (err < 0)
+ res = err;
+ }
+ }
+ return res;
+}
+
+
+/**
+ * \brief Attach an HCTL specified with the CTL device name to an opened mixer
+ * \param mixer Mixer handle
+ * \param name HCTL name (see #snd_hctl_open)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_attach(snd_mixer_t *mixer, const char *name)
+{
+ snd_hctl_t *hctl;
+ int err;
+
+ err = snd_hctl_open(&hctl, name, 0);
+ if (err < 0)
+ return err;
+ err = snd_mixer_attach_hctl(mixer, hctl);
+ if (err < 0) {
+ snd_hctl_close(hctl);
+ return err;
+ }
+ return 0;
+}
+
+/**
+ * \brief Attach an HCTL to an opened mixer
+ * \param mixer Mixer handle
+ * \param hctl the HCTL to be attached
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl)
+{
+ snd_mixer_slave_t *slave;
+ int err;
+
+ assert(hctl);
+ slave = calloc(1, sizeof(*slave));
+ if (slave == NULL)
+ return -ENOMEM;
+ err = snd_hctl_nonblock(hctl, 1);
+ if (err < 0) {
+ snd_hctl_close(hctl);
+ free(slave);
+ return err;
+ }
+ snd_hctl_set_callback(hctl, hctl_event_handler);
+ snd_hctl_set_callback_private(hctl, mixer);
+ slave->hctl = hctl;
+ list_add_tail(&slave->list, &mixer->slaves);
+ return 0;
+}
+
+/**
+ * \brief Detach a previously attached HCTL to an opened mixer freeing all related resources
+ * \param mixer Mixer handle
+ * \param name HCTL previously attached
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_detach(snd_mixer_t *mixer, const char *name)
+{
+ struct list_head *pos;
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ if (strcmp(name, snd_hctl_name(s->hctl)) == 0) {
+ snd_hctl_close(s->hctl);
+ list_del(pos);
+ free(s);
+ return 0;
+ }
+ }
+ return -ENOENT;
+}
+
+/**
+ * \brief Detach a previously attached HCTL to an opened mixer freeing all related resources
+ * \param mixer Mixer handle
+ * \param hctl HCTL previously attached
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note: The hctl handle is not closed!
+ */
+int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl)
+{
+ struct list_head *pos;
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ if (hctl == s->hctl) {
+ list_del(pos);
+ free(s);
+ return 0;
+ }
+ }
+ return -ENOENT;
+}
+
+/**
+ * \brief Obtain a HCTL pointer associated to given name
+ * \param mixer Mixer handle
+ * \param name HCTL previously attached
+ * \param hctl HCTL pointer
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl)
+{
+ struct list_head *pos;
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ if (strcmp(name, snd_hctl_name(s->hctl)) == 0) {
+ *hctl = s->hctl;
+ return 0;
+ }
+ }
+ return -ENOENT;
+}
+
+static int snd_mixer_throw_event(snd_mixer_t *mixer, unsigned int mask,
+ snd_mixer_elem_t *elem)
+{
+ mixer->events++;
+ if (mixer->callback)
+ return mixer->callback(mixer, mask, elem);
+ return 0;
+}
+
+static int snd_mixer_elem_throw_event(snd_mixer_elem_t *elem, unsigned int mask)
+{
+ elem->class->mixer->events++;
+ if (elem->callback)
+ return elem->callback(elem, mask);
+ return 0;
+}
+
+static int _snd_mixer_find_elem(snd_mixer_t *mixer, snd_mixer_elem_t *elem, int *dir)
+{
+ unsigned int l, u;
+ int c = 0;
+ int idx = -1;
+ assert(mixer && elem);
+ assert(mixer->compare);
+ l = 0;
+ u = mixer->count;
+ while (l < u) {
+ idx = (l + u) / 2;
+ c = mixer->compare(elem, mixer->pelems[idx]);
+ if (c < 0)
+ u = idx;
+ else if (c > 0)
+ l = idx + 1;
+ else
+ break;
+ }
+ *dir = c;
+ return idx;
+}
+
+/**
+ * \brief Get private data associated to give mixer element
+ * \param elem Mixer element
+ * \return private data
+ *
+ * For use by mixer element class specific code.
+ */
+void *snd_mixer_elem_get_private(const snd_mixer_elem_t *elem)
+{
+ return elem->private_data;
+}
+
+/**
+ * \brief Allocate a new mixer element
+ * \param elem Returned mixer element
+ * \param type Mixer element type
+ * \param compare_weight Mixer element compare weight
+ * \param private_data Private data
+ * \param private_free Private data free callback
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_new(snd_mixer_elem_t **elem,
+ snd_mixer_elem_type_t type,
+ int compare_weight,
+ void *private_data,
+ void (*private_free)(snd_mixer_elem_t *elem))
+{
+ snd_mixer_elem_t *melem = calloc(1, sizeof(*melem));
+ if (melem == NULL)
+ return -ENOMEM;
+ melem->type = type;
+ melem->compare_weight = compare_weight;
+ melem->private_data = private_data;
+ melem->private_free = private_free;
+ INIT_LIST_HEAD(&melem->helems);
+ *elem = melem;
+ return 0;
+}
+
+/**
+ * \brief Add an element for a registered mixer element class
+ * \param elem Mixer element
+ * \param class Mixer element class
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class)
+{
+ int dir, idx;
+ snd_mixer_t *mixer = class->mixer;
+ elem->class = class;
+
+ if (mixer->count == mixer->alloc) {
+ snd_mixer_elem_t **m;
+ mixer->alloc += 32;
+ m = realloc(mixer->pelems, sizeof(*m) * mixer->alloc);
+ if (!m) {
+ mixer->alloc -= 32;
+ return -ENOMEM;
+ }
+ mixer->pelems = m;
+ }
+ if (mixer->count == 0) {
+ list_add_tail(&elem->list, &mixer->elems);
+ mixer->pelems[0] = elem;
+ } else {
+ idx = _snd_mixer_find_elem(mixer, elem, &dir);
+ assert(dir != 0);
+ if (dir > 0) {
+ list_add(&elem->list, &mixer->pelems[idx]->list);
+ idx++;
+ } else {
+ list_add_tail(&elem->list, &mixer->pelems[idx]->list);
+ }
+ memmove(mixer->pelems + idx + 1,
+ mixer->pelems + idx,
+ (mixer->count - idx) * sizeof(snd_mixer_elem_t *));
+ mixer->pelems[idx] = elem;
+ }
+ mixer->count++;
+ return snd_mixer_throw_event(mixer, SND_CTL_EVENT_MASK_ADD, elem);
+}
+
+/**
+ * \brief Remove a mixer element
+ * \param elem Mixer element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_remove(snd_mixer_elem_t *elem)
+{
+ snd_mixer_t *mixer = elem->class->mixer;
+ bag_iterator_t i, n;
+ int err, idx, dir;
+ unsigned int m;
+ assert(elem);
+ assert(mixer->count);
+ idx = _snd_mixer_find_elem(mixer, elem, &dir);
+ if (dir != 0)
+ return -EINVAL;
+ bag_for_each_safe(i, n, &elem->helems) {
+ snd_hctl_elem_t *helem = bag_iterator_entry(i);
+ snd_mixer_elem_detach(elem, helem);
+ }
+ err = snd_mixer_elem_throw_event(elem, SND_CTL_EVENT_MASK_REMOVE);
+ list_del(&elem->list);
+ snd_mixer_elem_free(elem);
+ mixer->count--;
+ m = mixer->count - idx;
+ if (m > 0)
+ memmove(mixer->pelems + idx,
+ mixer->pelems + idx + 1,
+ m * sizeof(snd_mixer_elem_t *));
+ return err;
+}
+
+/**
+ * \brief Free a mixer element
+ * \param elem Mixer element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+void snd_mixer_elem_free(snd_mixer_elem_t *elem)
+{
+ if (elem->private_free)
+ elem->private_free(elem);
+ free(elem);
+}
+
+/**
+ * \brief Mixer element informations are changed
+ * \param elem Mixer element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_info(snd_mixer_elem_t *elem)
+{
+ return snd_mixer_elem_throw_event(elem, SND_CTL_EVENT_MASK_INFO);
+}
+
+/**
+ * \brief Mixer element values is changed
+ * \param elem Mixer element
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_elem_value(snd_mixer_elem_t *elem)
+{
+ return snd_mixer_elem_throw_event(elem, SND_CTL_EVENT_MASK_VALUE);
+}
+
+/**
+ * \brief Register mixer element class
+ * \param class Mixer element class
+ * \param mixer Mixer handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * For use by mixer element class specific code.
+ */
+int snd_mixer_class_register(snd_mixer_class_t *class, snd_mixer_t *mixer)
+{
+ struct list_head *pos;
+ class->mixer = mixer;
+ list_add_tail(&class->list, &mixer->classes);
+ if (!class->event)
+ return 0;
+ list_for_each(pos, &mixer->slaves) {
+ int err;
+ snd_mixer_slave_t *slave;
+ snd_hctl_elem_t *elem;
+ slave = list_entry(pos, snd_mixer_slave_t, list);
+ elem = snd_hctl_first_elem(slave->hctl);
+ while (elem) {
+ err = class->event(class, SND_CTL_EVENT_MASK_ADD, elem, NULL);
+ if (err < 0)
+ return err;
+ elem = snd_hctl_elem_next(elem);
+ }
+ }
+ return 0;
+}
+
+/**
+ * \brief Unregister mixer element class and remove all its elements
+ * \param class Mixer element class
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note that the class structure is also deallocated!
+ */
+int snd_mixer_class_unregister(snd_mixer_class_t *class)
+{
+ unsigned int k;
+ snd_mixer_elem_t *e;
+ snd_mixer_t *mixer = class->mixer;
+ for (k = mixer->count; k > 0; k--) {
+ e = mixer->pelems[k-1];
+ if (e->class == class)
+ snd_mixer_elem_remove(e);
+ }
+ if (class->private_free)
+ class->private_free(class);
+ list_del(&class->list);
+ free(class);
+ return 0;
+}
+
+/**
+ * \brief Load a mixer elements
+ * \param mixer Mixer handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_load(snd_mixer_t *mixer)
+{
+ struct list_head *pos;
+ list_for_each(pos, &mixer->slaves) {
+ int err;
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ err = snd_hctl_load(s->hctl);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+/**
+ * \brief Unload all mixer elements and free all related resources
+ * \param mixer Mixer handle
+ */
+void snd_mixer_free(snd_mixer_t *mixer)
+{
+ struct list_head *pos;
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ snd_hctl_free(s->hctl);
+ }
+}
+
+/**
+ * \brief Close a mixer and free all related resources
+ * \param mixer Mixer handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_close(snd_mixer_t *mixer)
+{
+ int res = 0;
+ assert(mixer);
+ while (!list_empty(&mixer->classes)) {
+ snd_mixer_class_t *c;
+ c = list_entry(mixer->classes.next, snd_mixer_class_t, list);
+ snd_mixer_class_unregister(c);
+ }
+ assert(list_empty(&mixer->elems));
+ assert(mixer->count == 0);
+ free(mixer->pelems);
+ mixer->pelems = NULL;
+ while (!list_empty(&mixer->slaves)) {
+ int err;
+ snd_mixer_slave_t *s;
+ s = list_entry(mixer->slaves.next, snd_mixer_slave_t, list);
+ err = snd_hctl_close(s->hctl);
+ if (err < 0)
+ res = err;
+ list_del(&s->list);
+ free(s);
+ }
+ free(mixer);
+ return res;
+}
+
+static int snd_mixer_compare_default(const snd_mixer_elem_t *c1,
+ const snd_mixer_elem_t *c2)
+{
+ int d = c1->compare_weight - c2->compare_weight;
+ if (d)
+ return d;
+ assert(c1->class && c1->class->compare);
+ assert(c2->class && c2->class->compare);
+ assert(c1->class == c2->class);
+ return c1->class->compare(c1, c2);
+}
+
+static int mixer_compare(const void *a, const void *b)
+{
+ snd_mixer_t *mixer;
+
+ mixer = (*((const snd_mixer_elem_t * const *)a))->class->mixer;
+ return mixer->compare(*(const snd_mixer_elem_t * const *)a, *(const snd_mixer_elem_t * const *)b);
+}
+
+static int snd_mixer_sort(snd_mixer_t *mixer)
+{
+ unsigned int k;
+ assert(mixer);
+ assert(mixer->compare);
+ INIT_LIST_HEAD(&mixer->elems);
+ qsort(mixer->pelems, mixer->count, sizeof(snd_mixer_elem_t *), mixer_compare);
+ for (k = 0; k < mixer->count; k++)
+ list_add_tail(&mixer->pelems[k]->list, &mixer->elems);
+ return 0;
+}
+
+/**
+ * \brief Change mixer compare function and reorder elements
+ * \param mixer Mixer handle
+ * \param compare Element compare function
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t compare)
+{
+ snd_mixer_compare_t compare_old;
+ int err;
+
+ assert(mixer);
+ compare_old = mixer->compare;
+ mixer->compare = compare == NULL ? snd_mixer_compare_default : compare;
+ if ((err = snd_mixer_sort(mixer)) < 0) {
+ mixer->compare = compare_old;
+ return err;
+ }
+ return 0;
+}
+
+/**
+ * \brief get count of poll descriptors for mixer handle
+ * \param mixer Mixer handle
+ * \return count of poll descriptors
+ */
+int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer)
+{
+ struct list_head *pos;
+ unsigned int c = 0;
+ assert(mixer);
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ int n;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ n = snd_hctl_poll_descriptors_count(s->hctl);
+ if (n < 0)
+ return n;
+ c += n;
+ }
+ return c;
+}
+
+/**
+ * \brief get poll descriptors
+ * \param mixer Mixer handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space)
+{
+ struct list_head *pos;
+ unsigned int count = 0;
+ assert(mixer);
+ list_for_each(pos, &mixer->slaves) {
+ snd_mixer_slave_t *s;
+ int n;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ n = snd_hctl_poll_descriptors(s->hctl, pfds, space);
+ if (n < 0)
+ return n;
+ if (space >= (unsigned int) n) {
+ count += n;
+ space -= n;
+ pfds += n;
+ } else
+ space = 0;
+ }
+ return count;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param mixer Mixer handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ unsigned int idx;
+ unsigned short res;
+ assert(mixer && pfds && revents);
+ if (nfds == 0)
+ return -EINVAL;
+ res = 0;
+ for (idx = 0; idx < nfds; idx++)
+ res |= pfds->revents & (POLLIN|POLLERR|POLLNVAL);
+ *revents = res;
+ return 0;
+}
+
+/**
+ * \brief Wait for a mixer to become ready (i.e. at least one event pending)
+ * \param mixer Mixer handle
+ * \param timeout maximum time in milliseconds to wait
+ * \return 0 otherwise a negative error code on failure
+ */
+int snd_mixer_wait(snd_mixer_t *mixer, int timeout)
+{
+ struct pollfd spfds[16];
+ struct pollfd *pfds = spfds;
+ int err;
+ int count;
+ count = snd_mixer_poll_descriptors(mixer, pfds, sizeof(spfds) / sizeof(spfds[0]));
+ if (count < 0)
+ return count;
+ if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) {
+ pfds = malloc(count * sizeof(*pfds));
+ if (!pfds)
+ return -ENOMEM;
+ err = snd_mixer_poll_descriptors(mixer, pfds,
+ (unsigned int) count);
+ assert(err == count);
+ }
+ err = poll(pfds, (unsigned int) count, timeout);
+ if (err < 0)
+ return -errno;
+ return 0;
+}
+
+/**
+ * \brief get first element for a mixer
+ * \param mixer Mixer handle
+ * \return pointer to first element
+ */
+snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer)
+{
+ assert(mixer);
+ if (list_empty(&mixer->elems))
+ return NULL;
+ return list_entry(mixer->elems.next, snd_mixer_elem_t, list);
+}
+
+/**
+ * \brief get last element for a mixer
+ * \param mixer Mixer handle
+ * \return pointer to last element
+ */
+snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer)
+{
+ assert(mixer);
+ if (list_empty(&mixer->elems))
+ return NULL;
+ return list_entry(mixer->elems.prev, snd_mixer_elem_t, list);
+}
+
+/**
+ * \brief get next mixer element
+ * \param elem mixer element
+ * \return pointer to next element
+ */
+snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem)
+{
+ assert(elem);
+ if (elem->list.next == &elem->class->mixer->elems)
+ return NULL;
+ return list_entry(elem->list.next, snd_mixer_elem_t, list);
+}
+
+/**
+ * \brief get previous mixer element
+ * \param elem mixer element
+ * \return pointer to previous element
+ */
+snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem)
+{
+ assert(elem);
+ if (elem->list.prev == &elem->class->mixer->elems)
+ return NULL;
+ return list_entry(elem->list.prev, snd_mixer_elem_t, list);
+}
+
+/**
+ * \brief Handle pending mixer events invoking callbacks
+ * \param mixer Mixer handle
+ * \return Number of events that occured on success, otherwise a negative error code on failure
+ */
+int snd_mixer_handle_events(snd_mixer_t *mixer)
+{
+ struct list_head *pos;
+ assert(mixer);
+ mixer->events = 0;
+ list_for_each(pos, &mixer->slaves) {
+ int err;
+ snd_mixer_slave_t *s;
+ s = list_entry(pos, snd_mixer_slave_t, list);
+ err = snd_hctl_handle_events(s->hctl);
+ if (err < 0)
+ return err;
+ }
+ return mixer->events;
+}
+
+/**
+ * \brief Set callback function for a mixer
+ * \param obj mixer handle
+ * \param val callback function
+ */
+void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val)
+{
+ assert(obj);
+ obj->callback = val;
+}
+
+/**
+ * \brief Set callback private value for a mixer
+ * \param mixer mixer handle
+ * \param val callback private value
+ */
+void snd_mixer_set_callback_private(snd_mixer_t *mixer, void * val)
+{
+ assert(mixer);
+ mixer->callback_private = val;
+}
+
+/**
+ * \brief Get callback private value for a mixer
+ * \param mixer mixer handle
+ * \return callback private value
+ */
+void * snd_mixer_get_callback_private(const snd_mixer_t *mixer)
+{
+ assert(mixer);
+ return mixer->callback_private;
+}
+
+/**
+ * \brief Get elements count for a mixer
+ * \param mixer mixer handle
+ * \return elements count
+ */
+unsigned int snd_mixer_get_count(const snd_mixer_t *mixer)
+{
+ assert(mixer);
+ return mixer->count;
+}
+
+/**
+ * \brief Set callback function for a mixer element
+ * \param mixer mixer element
+ * \param val callback function
+ */
+void snd_mixer_elem_set_callback(snd_mixer_elem_t *mixer, snd_mixer_elem_callback_t val)
+{
+ assert(mixer);
+ mixer->callback = val;
+}
+
+/**
+ * \brief Set callback private value for a mixer element
+ * \param mixer mixer element
+ * \param val callback private value
+ */
+void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *mixer, void * val)
+{
+ assert(mixer);
+ mixer->callback_private = val;
+}
+
+/**
+ * \brief Get callback private value for a mixer element
+ * \param mixer mixer element
+ * \return callback private value
+ */
+void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *mixer)
+{
+ assert(mixer);
+ return mixer->callback_private;
+}
+
+/**
+ * \brief Get type for a mixer element
+ * \param mixer mixer element
+ * \return mixer element type
+ */
+snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *mixer)
+{
+ assert(mixer);
+ return mixer->type;
+}
+
+
+/**
+ * \brief get size of #snd_mixer_class_t
+ * \return size in bytes
+ */
+size_t snd_mixer_class_sizeof()
+{
+ return sizeof(snd_mixer_class_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_mixer_class_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_mixer_class_malloc(snd_mixer_class_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_mixer_class_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_mixer_class_t
+ * \param obj pointer to object to free
+ */
+void snd_mixer_class_free(snd_mixer_class_t *obj)
+{
+ if (obj->private_free)
+ obj->private_free(obj);
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_mixer_class_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get a mixer associated to given mixer class
+ * \param obj Mixer simple class identifier
+ * \return mixer pointer
+ */
+snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *obj)
+{
+ assert(obj);
+ return obj->mixer;
+}
+
+/**
+ * \brief Get mixer event callback associated to given mixer class
+ * \param obj Mixer simple class identifier
+ * \return event callback pointer
+ */
+snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *obj)
+{
+ assert(obj);
+ return obj->event;
+}
+
+/**
+ * \brief Get mixer private data associated to given mixer class
+ * \param obj Mixer simple class identifier
+ * \return event callback pointer
+ */
+void *snd_mixer_class_get_private(const snd_mixer_class_t *obj)
+{
+ assert(obj);
+ return obj->private_data;
+}
+
+
+/**
+ * \brief Get mixer compare callback associated to given mixer class
+ * \param obj Mixer simple class identifier
+ * \return event callback pointer
+ */
+snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *obj)
+{
+ assert(obj);
+ return obj->compare;
+}
+
+/**
+ * \brief Set mixer event callback to given mixer class
+ * \param obj Mixer simple class identifier
+ * \param event Event callback
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_mixer_class_set_event(snd_mixer_class_t *obj, snd_mixer_event_t event)
+{
+ assert(obj);
+ obj->event = event;
+ return 0;
+}
+
+/**
+ * \brief Set mixer private data to given mixer class
+ * \param obj Mixer simple class identifier
+ * \param private_data class private data
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_mixer_class_set_private(snd_mixer_class_t *obj, void *private_data)
+{
+ assert(obj);
+ obj->private_data = private_data;
+ return 0;
+}
+
+/**
+ * \brief Set mixer private data free callback to given mixer class
+ * \param obj Mixer simple class identifier
+ * \param private_free Mixer class private data free callback
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_mixer_class_set_private_free(snd_mixer_class_t *obj, void (*private_free)(snd_mixer_class_t *class))
+{
+ assert(obj);
+ obj->private_free = private_free;
+ return 0;
+}
+
+/**
+ * \brief Set mixer compare callback to given mixer class
+ * \param obj Mixer simple class identifier
+ * \param compare the compare callback to be used
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_mixer_class_set_compare(snd_mixer_class_t *obj, snd_mixer_compare_t compare)
+{
+ assert(obj);
+ obj->compare = compare;
+ return 0;
+}
diff --git a/alsa-lib/src/mixer/mixer_local.h b/alsa-lib/src/mixer/mixer_local.h
new file mode 100644
index 0000000..27b4a3b
--- /dev/null
+++ b/alsa-lib/src/mixer/mixer_local.h
@@ -0,0 +1,82 @@
+/*
+ * Mixer Interface - local header file
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "local.h"
+
+typedef struct _bag1 {
+ void *ptr;
+ struct list_head list;
+} bag1_t;
+
+typedef struct list_head bag_t;
+
+int bag_new(bag_t **bag);
+void bag_free(bag_t *bag);
+int bag_add(bag_t *bag, void *ptr);
+int bag_del(bag_t *bag, void *ptr);
+int bag_empty(bag_t *bag);
+void bag_del_all(bag_t *bag);
+
+typedef struct list_head *bag_iterator_t;
+
+#define bag_iterator_entry(i) (list_entry((i), bag1_t, list)->ptr)
+#define bag_for_each(pos, bag) list_for_each(pos, bag)
+#define bag_for_each_safe(pos, next, bag) list_for_each_safe(pos, next, bag)
+
+struct _snd_mixer_class {
+ struct list_head list;
+ snd_mixer_t *mixer;
+ snd_mixer_event_t event;
+ void *private_data;
+ void (*private_free)(snd_mixer_class_t *class);
+ snd_mixer_compare_t compare;
+};
+
+struct _snd_mixer_elem {
+ snd_mixer_elem_type_t type;
+ struct list_head list; /* links for list of all elems */
+ snd_mixer_class_t *class;
+ void *private_data;
+ void (*private_free)(snd_mixer_elem_t *elem);
+ snd_mixer_elem_callback_t callback;
+ void *callback_private;
+ bag_t helems;
+ int compare_weight; /* compare weight (reversed) */
+};
+
+struct _snd_mixer {
+ struct list_head slaves; /* list of all slaves */
+ struct list_head classes; /* list of all elem classes */
+ struct list_head elems; /* list of all elems */
+ snd_mixer_elem_t **pelems; /* array of all elems */
+ unsigned int count;
+ unsigned int alloc;
+ unsigned int events;
+ snd_mixer_callback_t callback;
+ void *callback_private;
+ snd_mixer_compare_t compare;
+};
+
+struct _snd_mixer_selem_id {
+ char name[60];
+ unsigned int index;
+};
diff --git a/alsa-lib/src/mixer/mixer_simple.h b/alsa-lib/src/mixer/mixer_simple.h
new file mode 100644
index 0000000..e88b007
--- /dev/null
+++ b/alsa-lib/src/mixer/mixer_simple.h
@@ -0,0 +1,31 @@
+/*
+ * Mixer Simple Interface - local header file
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "mixer_abst.h"
+
+/* make local functions really local */
+#define snd_mixer_simple_none_register \
+ snd1_mixer_simple_none_register
+#define snd_mixer_simple_basic_register \
+ snd1_mixer_simple_basic_register
+
+int snd_mixer_simple_none_register(snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp);
+int snd_mixer_simple_basic_register(snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp);
diff --git a/alsa-lib/src/mixer/simple.c b/alsa-lib/src/mixer/simple.c
new file mode 100644
index 0000000..39790b2
--- /dev/null
+++ b/alsa-lib/src/mixer/simple.c
@@ -0,0 +1,1056 @@
+/**
+ * \file mixer/simple.c
+ * \brief Mixer Simple Element Class Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2001-2004
+ *
+ * Mixer simple element class interface.
+ */
+/*
+ * Mixer Interface - simple controls
+ * Copyright (c) 2000,2004 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include "mixer_local.h"
+#include "mixer_simple.h"
+
+/**
+ * \brief Register mixer simple element class
+ * \param mixer Mixer handle
+ * \param options Options container
+ * \param classp Pointer to returned mixer simple element class handle (or NULL)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_register(snd_mixer_t *mixer,
+ struct snd_mixer_selem_regopt *options,
+ snd_mixer_class_t **classp)
+{
+ if (options && options->ver == 1) {
+ if (options->device != NULL &&
+ (options->playback_pcm != NULL ||
+ options->capture_pcm != NULL))
+ return -EINVAL;
+ if (options->device == NULL &&
+ options->playback_pcm == NULL &&
+ options->capture_pcm == NULL)
+ return -EINVAL;
+ }
+ if (options == NULL ||
+ (options->ver == 1 && options->abstract == SND_MIXER_SABSTRACT_NONE)) {
+ int err = snd_mixer_simple_none_register(mixer, options, classp);
+ if (err < 0)
+ return err;
+ if (options != NULL) {
+ err = snd_mixer_attach(mixer, options->device);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+ } else if (options->ver == 1) {
+ if (options->abstract == SND_MIXER_SABSTRACT_BASIC)
+ return snd_mixer_simple_basic_register(mixer, options, classp);
+ }
+ return -ENXIO;
+}
+
+#ifndef DOC_HIDDEN
+
+#define CHECK_BASIC(xelem) \
+{ \
+ assert(xelem); \
+ assert((xelem)->type == SND_MIXER_ELEM_SIMPLE); \
+}
+
+#define CHECK_DIR(xelem, xwhat) \
+{ \
+ unsigned int xcaps = ((sm_selem_t *)(elem)->private_data)->caps; \
+ if (! (xcaps & (xwhat))) \
+ return -EINVAL; \
+}
+
+#define CHECK_DIR_CHN(xelem, xwhat, xjoin, xchannel) \
+{ \
+ unsigned int xcaps = ((sm_selem_t *)(elem)->private_data)->caps; \
+ if (! (xcaps & (xwhat))) \
+ return -EINVAL; \
+ if (xcaps & (xjoin)) \
+ xchannel = 0; \
+}
+
+#define CHECK_ENUM(xelem) \
+ if (!((sm_selem_t *)(elem)->private_data)->caps & (SM_CAP_PENUM|SM_CAP_CENUM)) \
+ return -EINVAL;
+
+#define COND_CAPS(xelem, what) \
+ !!(((sm_selem_t *)(elem)->private_data)->caps & (what))
+
+#endif /* !DOC_HIDDEN */
+
+#ifndef DOC_HIDDEN
+int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2)
+{
+ sm_selem_t *s1 = c1->private_data;
+ sm_selem_t *s2 = c2->private_data;
+ int res = strcmp(s1->id->name, s2->id->name);
+ if (res)
+ return res;
+ return s1->id->index - s2->id->index;
+}
+#endif
+
+/**
+ * \brief Find a mixer simple element
+ * \param mixer Mixer handle
+ * \param id Mixer simple element identifier
+ * \return mixer simple element handle or NULL if not found
+ */
+snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
+ const snd_mixer_selem_id_t *id)
+{
+ struct list_head *list;
+ snd_mixer_elem_t *e;
+ sm_selem_t *s;
+
+ list_for_each(list, &mixer->elems) {
+ e = list_entry(list, snd_mixer_elem_t, list);
+ if (e->type != SND_MIXER_ELEM_SIMPLE)
+ continue;
+ s = e->private_data;
+ if (!strcmp(s->id->name, id->name) && s->id->index == id->index)
+ return e;
+ }
+ return NULL;
+}
+
+/**
+ * \brief Get mixer simple element identifier
+ * \param elem Mixer simple element handle
+ * \param id returned mixer simple element identifier
+ */
+void snd_mixer_selem_get_id(snd_mixer_elem_t *elem,
+ snd_mixer_selem_id_t *id)
+{
+ sm_selem_t *s;
+ assert(id);
+ CHECK_BASIC(elem);
+ s = elem->private_data;
+ *id = *s->id;
+}
+
+/**
+ * \brief Get name part of mixer simple element identifier
+ * \param elem Mixer simple element handle
+ * \return name part of simple element identifier
+ */
+const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem)
+{
+ sm_selem_t *s;
+ CHECK_BASIC(elem);
+ s = elem->private_data;
+ return s->id->name;
+}
+
+/**
+ * \brief Get index part of mixer simple element identifier
+ * \param elem Mixer simple element handle
+ * \return index part of simple element identifier
+ */
+unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem)
+{
+ sm_selem_t *s;
+ CHECK_BASIC(elem);
+ s = elem->private_data;
+ return s->id->index;
+}
+
+/**
+ * \brief Return true if mixer simple element has only one volume control for both playback and capture
+ * \param elem Mixer simple element handle
+ * \return 0 separated control, 1 common control
+ */
+int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_GVOLUME);
+}
+
+/**
+ * \brief Return true if mixer simple element has only one switch control for both playback and capture
+ * \param elem Mixer simple element handle
+ * \return 0 separated control, 1 common control
+ */
+int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_GSWITCH);
+}
+
+/**
+ * \brief Return name of mixer simple element channel
+ * \param channel mixer simple element channel identifier
+ * \return channel name
+ */
+const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel)
+{
+ static const char *const array[SND_MIXER_SCHN_LAST + 1] = {
+ [SND_MIXER_SCHN_FRONT_LEFT] = "Front Left",
+ [SND_MIXER_SCHN_FRONT_RIGHT] = "Front Right",
+ [SND_MIXER_SCHN_REAR_LEFT] = "Rear Left",
+ [SND_MIXER_SCHN_REAR_RIGHT] = "Rear Right",
+ [SND_MIXER_SCHN_FRONT_CENTER] = "Front Center",
+ [SND_MIXER_SCHN_WOOFER] = "Woofer",
+ [SND_MIXER_SCHN_SIDE_LEFT] = "Side Left",
+ [SND_MIXER_SCHN_SIDE_RIGHT] = "Side Right",
+ [SND_MIXER_SCHN_REAR_CENTER] = "Rear Center"
+ };
+ const char *p;
+ assert(channel <= SND_MIXER_SCHN_LAST);
+ p = array[channel];
+ if (!p)
+ return "?";
+ return p;
+}
+
+/**
+ * \brief Get info about the active state of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if not active, 1 if active
+ */
+int snd_mixer_selem_is_active(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_ACTIVE, 0);
+}
+
+/**
+ * \brief Get info about channels of playback stream of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if not mono, 1 if mono
+ */
+int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_MONO, 0);
+}
+
+/**
+ * \brief Get info about channels of playback stream of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel Mixer simple element channel identifier
+ * \return 0 if channel is not present, 1 if present
+ */
+int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel)
+{
+ CHECK_BASIC(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_CHANNEL, (int)channel);
+}
+
+/**
+ * \brief Get range for playback volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min Pointer to returned minimum
+ * \param max Pointer to returned maximum
+ */
+int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_PVOLUME);
+ return sm_selem_ops(elem)->get_range(elem, SM_PLAY, min, max);
+}
+
+/**
+ * \brief Get range in dB for playback volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min Pointer to returned minimum (dB * 100)
+ * \param max Pointer to returned maximum (dB * 100)
+ */
+int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_PVOLUME);
+ return sm_selem_ops(elem)->get_dB_range(elem, SM_PLAY, min, max);
+}
+
+/**
+ * \brief Set range for playback volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min minimum volume value
+ * \param max maximum volume value
+ */
+int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
+ long min, long max)
+{
+ CHECK_BASIC(elem);
+ assert(min < max);
+ CHECK_DIR(elem, SM_CAP_PVOLUME);
+ return sm_selem_ops(elem)->set_range(elem, SM_PLAY, min, max);
+}
+
+/**
+ * \brief Return info about playback volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if no control is present, 1 if it's present
+ */
+int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_PVOLUME);
+}
+
+/**
+ * \brief Return info about playback volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if control is separated per channel, 1 if control acts on all channels together
+ */
+int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_PVOLUME_JOIN);
+}
+
+/**
+ * \brief Return info about playback switch control existence of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if no control is present, 1 if it's present
+ */
+int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_PSWITCH);
+}
+
+/**
+ * \brief Return info about playback switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if control is separated per channel, 1 if control acts on all channels together
+ */
+int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_PSWITCH_JOIN);
+}
+
+/**
+ * \brief Return corresponding dB value to an integer playback volume for a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value value to be converted to dB range
+ * \param dBvalue pointer to returned dB value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_PVOLUME);
+ return sm_selem_ops(elem)->ask_vol_dB(elem, SM_PLAY, value, dBvalue);
+}
+
+/**
+ * \brief Return corresponding integer playback volume for given dB value for a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value value to be converted to dB range
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \param dBvalue pointer to returned dB value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_PVOLUME);
+ return sm_selem_ops(elem)->ask_dB_vol(elem, SM_PLAY, dBvalue, value, dir);
+}
+
+/**
+ * \brief Return value of playback volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_PVOLUME, SM_CAP_PVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->get_volume(elem, SM_PLAY, channel, value);
+}
+
+/**
+ * \brief Return value of playback volume in dB control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value (dB * 100)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
+{
+ unsigned int caps;
+
+ CHECK_BASIC(elem);
+ caps = ((sm_selem_t *)elem->private_data)->caps;
+ if (!(caps & SM_CAP_PVOLUME))
+ return -EINVAL;
+ if (caps & SM_CAP_PVOLUME_JOIN)
+ channel = 0;
+ return sm_selem_ops(elem)->get_dB(elem, SM_PLAY, channel, value);
+}
+
+/**
+ * \brief Return value of playback switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_PSWITCH, SM_CAP_PSWITCH_JOIN, channel);
+ return sm_selem_ops(elem)->get_switch(elem, SM_PLAY, channel, value);
+}
+
+/**
+ * \brief Set value of playback volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_PVOLUME, SM_CAP_PVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->set_volume(elem, SM_PLAY, channel, value);
+}
+
+/**
+ * \brief Set value in dB of playback volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value in dB * 100
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_PVOLUME, SM_CAP_PVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->set_dB(elem, SM_PLAY, channel, value, dir);
+}
+
+/**
+ * \brief Set value of playback volume control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_playback_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_playback_volume(elem, chn, value);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_playback_volume_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Set value in dB of playback volume control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value in dB * 100
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_playback_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_playback_dB(elem, chn, value, dir);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_playback_volume_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Set value of playback switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_PSWITCH, SM_CAP_PSWITCH_JOIN, channel);
+ return sm_selem_ops(elem)->set_switch(elem, SM_PLAY, channel, value);
+}
+
+/**
+ * \brief Set value of playback switch control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ CHECK_BASIC(elem);
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_playback_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_playback_switch(elem, chn, value);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_playback_switch_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Get info about channels of capture stream of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if not mono, 1 if mono
+ */
+int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME|SM_CAP_CSWITCH);
+ return sm_selem_ops(elem)->is(elem, SM_CAPT, SM_OPS_IS_MONO, 0);
+}
+
+/**
+ * \brief Get info about channels of capture stream of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel Mixer simple element channel identifier
+ * \return 0 if channel is not present, 1 if present
+ */
+int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME|SM_CAP_CSWITCH);
+ return sm_selem_ops(elem)->is(elem, SM_CAPT, SM_OPS_IS_CHANNEL, channel);
+}
+
+/**
+ * \brief Get range for capture volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min Pointer to returned minimum
+ * \param max Pointer to returned maximum
+ */
+int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
+ long *min, long *max)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME);
+ return sm_selem_ops(elem)->get_range(elem, SM_CAPT, min, max);
+}
+
+/**
+ * \brief Get range in dB for capture volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min Pointer to returned minimum (dB * 100)
+ * \param max Pointer to returned maximum (dB * 100)
+ */
+int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
+ long *min, long *max)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME);
+ return sm_selem_ops(elem)->get_dB_range(elem, SM_CAPT, min, max);
+}
+
+/**
+ * \brief Set range for capture volume of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param min minimum volume value
+ * \param max maximum volume value
+ */
+int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
+ long min, long max)
+{
+ CHECK_BASIC(elem);
+ assert(min < max);
+ CHECK_DIR(elem, SM_CAP_CVOLUME);
+ return sm_selem_ops(elem)->set_range(elem, SM_CAPT, min, max);
+}
+
+/**
+ * \brief Return info about capture volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if no control is present, 1 if it's present
+ */
+int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_CVOLUME);
+}
+
+/**
+ * \brief Return info about capture volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if control is separated per channel, 1 if control acts on all channels together
+ */
+int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_CVOLUME_JOIN);
+}
+
+/**
+ * \brief Return info about capture switch control existence of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if no control is present, 1 if it's present
+ */
+int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_CSWITCH);
+}
+
+/**
+ * \brief Return info about capture switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if control is separated per channel, 1 if control acts on all channels together
+ */
+int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_CSWITCH_JOIN);
+}
+
+/**
+ * \brief Return info about capture switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return 0 if control is separated per element, 1 if control acts on other elements too (i.e. only one active at a time inside a group)
+ */
+int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ return COND_CAPS(elem, SM_CAP_CSWITCH_EXCL);
+}
+
+/**
+ * \brief Return info about capture switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \return group for switch exclusivity (see #snd_mixer_selem_has_capture_switch_exclusive)
+ */
+int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem)
+{
+ sm_selem_t *s;
+ CHECK_BASIC(elem);
+ s = elem->private_data;
+ if (! (s->caps & SM_CAP_CSWITCH_EXCL))
+ return -EINVAL;
+ return s->capture_group;
+}
+
+/**
+ * \brief Return corresponding dB value to an integer capture volume for a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value value to be converted to dB range
+ * \param dBvalue pointer to returned dB value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME);
+ return sm_selem_ops(elem)->ask_vol_dB(elem, SM_CAPT, value, dBvalue);
+}
+
+/**
+ * \brief Return corresponding integer capture volume for given dB value for a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param dBvalue dB value to be converted to integer range
+ * \param value pointer to returned integer value
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR(elem, SM_CAP_CVOLUME);
+ return sm_selem_ops(elem)->ask_dB_vol(elem, SM_CAPT, dBvalue, value, dir);
+}
+
+/**
+ * \brief Return value of capture volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CVOLUME, SM_CAP_CVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->get_volume(elem, SM_CAPT, channel, value);
+}
+
+/**
+ * \brief Return value of capture volume in dB control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value (dB * 100)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CVOLUME, SM_CAP_CVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->get_dB(elem, SM_CAPT, channel, value);
+}
+
+/**
+ * \brief Return value of capture switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value pointer to returned value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CSWITCH, SM_CAP_CSWITCH_JOIN, channel);
+ return sm_selem_ops(elem)->get_switch(elem, SM_CAPT, channel, value);
+}
+
+/**
+ * \brief Set value of capture volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CVOLUME, SM_CAP_CVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->set_volume(elem, SM_CAPT, channel, value);
+}
+
+/**
+ * \brief Set value in dB of capture volume control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value in dB * 100
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CVOLUME, SM_CAP_CVOLUME_JOIN, channel);
+ return sm_selem_ops(elem)->set_dB(elem, SM_CAPT, channel, value, dir);
+}
+
+/**
+ * \brief Set value of capture volume control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_capture_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_capture_volume(elem, chn, value);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_capture_volume_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Set value in dB of capture volume control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value in dB * 100
+ * \param dir select direction (-1 = accurate or first bellow, 0 = accurate, 1 = accurate or first above)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_capture_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_capture_dB(elem, chn, value, dir);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_capture_volume_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Set value of capture switch control of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value)
+{
+ CHECK_BASIC(elem);
+ CHECK_DIR_CHN(elem, SM_CAP_CSWITCH, SM_CAP_CSWITCH_JOIN, channel);
+ return sm_selem_ops(elem)->set_switch(elem, SM_CAPT, channel, value);
+}
+
+/**
+ * \brief Set value of capture switch control for all channels of a mixer simple element
+ * \param elem Mixer simple element handle
+ * \param value control value
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value)
+{
+ snd_mixer_selem_channel_id_t chn;
+ int err;
+
+ for (chn = 0; chn < 32; chn++) {
+ if (!snd_mixer_selem_has_capture_channel(elem, chn))
+ continue;
+ err = snd_mixer_selem_set_capture_switch(elem, chn, value);
+ if (err < 0)
+ return err;
+ if (chn == 0 && snd_mixer_selem_has_capture_switch_joined(elem))
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Return true if mixer simple element is an enumerated control
+ * \param elem Mixer simple element handle
+ * \return 0 normal volume/switch control, 1 enumerated control
+ */
+int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_ENUMERATED, 0);
+}
+
+/**
+ * \brief Return true if mixer simple enumerated element belongs to the playback direction
+ * \param elem Mixer simple element handle
+ * \return 0 no playback direction, 1 playback direction
+ */
+int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_ENUMERATED, 1);
+}
+
+/**
+ * \brief Return true if mixer simple enumerated element belongs to the capture direction
+ * \param elem Mixer simple element handle
+ * \return 0 no capture direction, 1 capture direction
+ */
+int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->is(elem, SM_CAPT, SM_OPS_IS_ENUMERATED, 1);
+}
+
+/**
+ * \brief Return the number of enumerated items of the given mixer simple element
+ * \param elem Mixer simple element handle
+ * \return the number of enumerated items, otherwise a negative error code
+ */
+int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->is(elem, SM_PLAY, SM_OPS_IS_ENUMCNT, 0);
+}
+
+/**
+ * \brief get the enumerated item string for the given mixer simple element
+ * \param elem Mixer simple element handle
+ * \param item the index of the enumerated item to query
+ * \param maxlen the maximal length to be stored
+ * \param buf the buffer to store the name string
+ * \return 0 if successful, otherwise a negative error code
+ */
+int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem,
+ unsigned int item,
+ size_t maxlen, char *buf)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->enum_item_name(elem, item, maxlen, buf);
+}
+
+/**
+ * \brief get the current selected enumerated item for the given mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param itemp the pointer to store the index of the enumerated item
+ * \return 0 if successful, otherwise a negative error code
+ */
+int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int *itemp)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->get_enum_item(elem, channel, itemp);
+}
+
+/**
+ * \brief set the current selected enumerated item for the given mixer simple element
+ * \param elem Mixer simple element handle
+ * \param channel mixer simple element channel identifier
+ * \param item the enumerated item index
+ * \return 0 if successful, otherwise a negative error code
+ */
+int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int item)
+{
+ CHECK_BASIC(elem);
+ CHECK_ENUM(elem);
+ return sm_selem_ops(elem)->set_enum_item(elem, channel, item);
+}
+
+/**
+ * \brief get size of #snd_mixer_selem_id_t
+ * \return size in bytes
+ */
+size_t snd_mixer_selem_id_sizeof()
+{
+ return sizeof(snd_mixer_selem_id_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_mixer_selem_id_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_mixer_selem_id_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_mixer_selem_id_t
+ * \param obj pointer to object to free
+ */
+void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_mixer_selem_id_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get name part of a mixer simple element identifier
+ * \param obj Mixer simple element identifier
+ * \return name part
+ */
+const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj)
+{
+ assert(obj);
+ return obj->name;
+}
+
+/**
+ * \brief Get index part of a mixer simple element identifier
+ * \param obj Mixer simple element identifier
+ * \return index part
+ */
+unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj)
+{
+ assert(obj);
+ return obj->index;
+}
+
+/**
+ * \brief Set name part of a mixer simple element identifier
+ * \param obj Mixer simple element identifier
+ * \param val name part
+ */
+void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val)
+{
+ assert(obj);
+ strncpy(obj->name, val, sizeof(obj->name));
+ obj->name[sizeof(obj->name)-1] = '\0';
+}
+
+/**
+ * \brief Set index part of a mixer simple element identifier
+ * \param obj Mixer simple element identifier
+ * \param val index part
+ */
+void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->index = val;
+}
diff --git a/alsa-lib/src/mixer/simple_abst.c b/alsa-lib/src/mixer/simple_abst.c
new file mode 100644
index 0000000..9e9aaf5
--- /dev/null
+++ b/alsa-lib/src/mixer/simple_abst.c
@@ -0,0 +1,420 @@
+/**
+ * \file mixer/simple_abst.c
+ * \brief Mixer Simple Element Class Interface - Module Abstraction
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2005
+ *
+ * Mixer simple element class interface.
+ */
+/*
+ * Mixer Interface - simple controls - abstraction module
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <math.h>
+#include <dlfcn.h>
+#include "config.h"
+#include "asoundlib.h"
+#include "mixer_simple.h"
+
+#ifndef DOC_HIDDEN
+
+#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
+
+typedef struct _class_priv {
+ char *device;
+ snd_ctl_t *ctl;
+ snd_hctl_t *hctl;
+ int attach_flag;
+ snd_ctl_card_info_t *info;
+ void *dlhandle;
+ void *private_data;
+ void (*private_free)(snd_mixer_class_t *class);
+} class_priv_t;
+
+typedef int (*snd_mixer_sbasic_init_t)(snd_mixer_class_t *class);
+typedef int (*snd_mixer_sfbasic_init_t)(snd_mixer_class_t *class,
+ snd_mixer_t *mixer,
+ const char *device);
+
+#endif /* !DOC_HIDDEN */
+
+static int try_open(snd_mixer_class_t *class, const char *lib)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+ snd_mixer_event_t event_func;
+ snd_mixer_sbasic_init_t init_func = NULL;
+ char *xlib, *path;
+ void *h;
+ int err = 0;
+
+ path = getenv("ALSA_MIXER_SIMPLE_MODULES");
+ if (!path)
+ path = SO_PATH;
+ xlib = malloc(strlen(lib) + strlen(path) + 1 + 1);
+ if (xlib == NULL)
+ return -ENOMEM;
+ strcpy(xlib, path);
+ strcat(xlib, "/");
+ strcat(xlib, lib);
+ h = snd_dlopen(xlib, RTLD_NOW);
+ if (h == NULL) {
+ SNDERR("Unable to open library '%s'", xlib);
+ free(xlib);
+ return -ENXIO;
+ }
+ priv->dlhandle = h;
+ event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
+ if (event_func == NULL) {
+ SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
+ err = -ENXIO;
+ }
+ if (err == 0) {
+ init_func = snd_dlsym(h, "alsa_mixer_simple_init", NULL);
+ if (init_func == NULL) {
+ SNDERR("Symbol 'alsa_mixer_simple_init' was not found in '%s'", xlib);
+ err = -ENXIO;
+ }
+ }
+ free(xlib);
+ err = err == 0 ? init_func(class) : err;
+ if (err < 0)
+ return err;
+ snd_mixer_class_set_event(class, event_func);
+ return 1;
+}
+
+static int try_open_full(snd_mixer_class_t *class, snd_mixer_t *mixer,
+ const char *lib, const char *device)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+ snd_mixer_event_t event_func;
+ snd_mixer_sfbasic_init_t init_func = NULL;
+ char *xlib, *path;
+ void *h;
+ int err = 0;
+
+ path = getenv("ALSA_MIXER_SIMPLE_MODULES");
+ if (!path)
+ path = SO_PATH;
+ xlib = malloc(strlen(lib) + strlen(path) + 1 + 1);
+ if (xlib == NULL)
+ return -ENOMEM;
+ strcpy(xlib, path);
+ strcat(xlib, "/");
+ strcat(xlib, lib);
+ /* note python modules requires RTLD_GLOBAL */
+ h = snd_dlopen(xlib, RTLD_NOW|RTLD_GLOBAL);
+ if (h == NULL) {
+ SNDERR("Unable to open library '%s'", xlib);
+ free(xlib);
+ return -ENXIO;
+ }
+ priv->dlhandle = h;
+ event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
+ if (event_func == NULL) {
+ SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
+ err = -ENXIO;
+ }
+ if (err == 0) {
+ init_func = snd_dlsym(h, "alsa_mixer_simple_finit", NULL);
+ if (init_func == NULL) {
+ SNDERR("Symbol 'alsa_mixer_simple_finit' was not found in '%s'", xlib);
+ err = -ENXIO;
+ }
+ }
+ free(xlib);
+ err = err == 0 ? init_func(class, mixer, device) : err;
+ if (err < 0)
+ return err;
+ snd_mixer_class_set_event(class, event_func);
+ return 1;
+}
+
+static int match(snd_mixer_class_t *class, const char *lib, const char *searchl)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+ const char *components;
+
+ if (searchl == NULL)
+ return try_open(class, lib);
+ components = snd_ctl_card_info_get_components(priv->info);
+ while (*components != '\0') {
+ if (!strncmp(components, searchl, strlen(searchl)))
+ return try_open(class, lib);
+ while (*components != ' ' && *components != '\0')
+ components++;
+ while (*components == ' ' && *components != '\0')
+ components++;
+ }
+ return 0;
+}
+
+static int find_full(snd_mixer_class_t *class, snd_mixer_t *mixer,
+ snd_config_t *top, const char *device)
+{
+ snd_config_iterator_t i, next;
+ char *lib;
+ const char *id;
+ int err;
+
+ snd_config_for_each(i, next, top) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "_full"))
+ continue;
+ err = snd_config_get_string(n, (const char **)&lib);
+ if (err < 0)
+ return err;
+ err = try_open_full(class, mixer, lib, device);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+ return -ENOENT;
+}
+
+static int find_module(snd_mixer_class_t *class, snd_config_t *top)
+{
+ snd_config_iterator_t i, next;
+ snd_config_iterator_t j, jnext;
+ char *lib, *searchl;
+ const char *id;
+ int err;
+
+ snd_config_for_each(i, next, top) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (*id == '_')
+ continue;
+ searchl = NULL;
+ lib = NULL;
+ snd_config_for_each(j, jnext, n) {
+ snd_config_t *m = snd_config_iterator_entry(j);
+ if (snd_config_get_id(m, &id) < 0)
+ continue;
+ if (!strcmp(id, "searchl")) {
+ err = snd_config_get_string(m, (const char **)&searchl);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (!strcmp(id, "lib")) {
+ err = snd_config_get_string(m, (const char **)&lib);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ }
+ err = match(class, lib, searchl);
+ if (err == 1)
+ return 0;
+ if (err < 0)
+ return err;
+ }
+ return -ENOENT;
+}
+
+static void private_free(snd_mixer_class_t *class)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+
+ if (priv->private_free)
+ priv->private_free(class);
+ if (priv->dlhandle)
+ snd_dlclose(priv->dlhandle);
+ if (priv->info)
+ snd_ctl_card_info_free(priv->info);
+ if (priv->hctl) {
+ if (priv->attach_flag)
+ snd_mixer_detach_hctl(snd_mixer_class_get_mixer(class), priv->hctl);
+ snd_hctl_close(priv->hctl);
+ } else if (priv->ctl)
+ snd_ctl_close(priv->ctl);
+ free(priv->device);
+ free(priv);
+}
+
+/**
+ * \brief Register mixer simple element class - basic abstraction
+ * \param mixer Mixer handle
+ * \param options Options container
+ * \param classp Pointer to returned mixer simple element class handle (or NULL
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
+ struct snd_mixer_selem_regopt *options,
+ snd_mixer_class_t **classp)
+{
+ snd_mixer_class_t *class;
+ class_priv_t *priv = calloc(1, sizeof(*priv));
+ const char *file;
+ snd_input_t *input;
+ snd_config_t *top = NULL;
+ int err;
+
+ if (priv == NULL)
+ return -ENOMEM;
+ if (options->device == NULL) {
+ free(priv);
+ return -EINVAL;
+ }
+ if (snd_mixer_class_malloc(&class)) {
+ free(priv);
+ return -ENOMEM;
+ }
+ priv->device = strdup(options->device);
+ if (priv->device == NULL) {
+ free(priv);
+ snd_mixer_class_free(class);
+ return -ENOMEM;
+ }
+ snd_mixer_class_set_compare(class, snd_mixer_selem_compare);
+ snd_mixer_class_set_private(class, priv);
+ snd_mixer_class_set_private_free(class, private_free);
+ file = getenv("ALSA_MIXER_SIMPLE");
+ if (!file)
+ file = ALSA_CONFIG_DIR "/smixer.conf";
+ err = snd_config_top(&top);
+ if (err >= 0) {
+ err = snd_input_stdio_open(&input, file, "r");
+ if (err < 0) {
+ SNDERR("unable to open simple mixer configuration file '%s'", file);
+ goto __error;
+ }
+ err = snd_config_load(top, input);
+ snd_input_close(input);
+ if (err < 0) {
+ SNDERR("%s may be old or corrupted: consider to remove or fix it", file);
+ goto __error;
+ }
+ err = find_full(class, mixer, top, priv->device);
+ if (err >= 0)
+ goto __full;
+ }
+ if (err >= 0) {
+ err = snd_ctl_open(&priv->ctl, priv->device, 0);
+ if (err < 0) {
+ SNDERR("unable to open control device '%s': %s", priv->device, snd_strerror(err));
+ goto __error;
+ }
+ err = snd_hctl_open_ctl(&priv->hctl, priv->ctl);
+ if (err < 0)
+ goto __error;
+ err = snd_ctl_card_info_malloc(&priv->info);
+ if (err < 0)
+ goto __error;
+ err = snd_ctl_card_info(priv->ctl, priv->info);
+ if (err < 0)
+ goto __error;
+ }
+ if (err >= 0)
+ err = find_module(class, top);
+ if (err >= 0)
+ err = snd_mixer_attach_hctl(mixer, priv->hctl);
+ if (err >= 0) {
+ priv->attach_flag = 1;
+ err = snd_mixer_class_register(class, mixer);
+ }
+ __full:
+ if (err < 0) {
+ __error:
+ if (top)
+ snd_config_delete(top);
+ if (class)
+ snd_mixer_class_free(class);
+ return err;
+ }
+ if (top)
+ snd_config_delete(top);
+ if (classp)
+ *classp = class;
+ return 0;
+}
+
+/**
+ * \brief Basic Mixer Abstraction - Get information about device
+ * \param class Mixer class
+ * \param info Info structure
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_sbasic_info(const snd_mixer_class_t *class, sm_class_basic_t *info)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+
+ if (class == NULL || info == NULL)
+ return -EINVAL;
+ info->device = priv->device;
+ info->ctl = priv->ctl;
+ info->hctl = priv->hctl;
+ info->info = priv->info;
+ return 0;
+}
+
+/**
+ * \brief Get private data for basic abstraction
+ * \param class Mixer class
+ * \return private data
+ */
+void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class)
+{
+ class_priv_t *priv = snd_mixer_class_get_private(class);
+
+ if (class == NULL)
+ return NULL;
+ return priv->private_data;
+}
+
+/**
+ * \brief Set private data for basic abstraction
+ * \param class Mixer class
+ * \param private_data Private data
+ */
+void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data)
+{
+ class_priv_t *priv;
+
+ if (class == NULL)
+ return;
+ priv = snd_mixer_class_get_private(class);
+ priv->private_data = private_data;
+}
+
+/**
+ * \brief Set private data free callback for basic abstraction
+ * \param class Mixer class
+ * \param private_free free callback for private data
+ */
+void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class))
+{
+ class_priv_t *priv;
+
+ if (class == NULL)
+ return;
+ priv = snd_mixer_class_get_private(class);
+ priv->private_free = private_free;
+}
diff --git a/alsa-lib/src/mixer/simple_none.c b/alsa-lib/src/mixer/simple_none.c
new file mode 100644
index 0000000..0f4dd3a
--- /dev/null
+++ b/alsa-lib/src/mixer/simple_none.c
@@ -0,0 +1,1717 @@
+/**
+ * \file mixer/simple_none.c
+ * \brief Mixer Simple Element Class Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2001-2004
+ *
+ * Mixer simple element class interface.
+ */
+/*
+ * Mixer Interface - simple controls
+ * Copyright (c) 2000,2004 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <assert.h>
+#include <math.h>
+#include <limits.h>
+#include <alsa/asoundlib.h>
+#include "mixer_simple.h"
+
+#ifndef DOC_HIDDEN
+
+#define MIXER_COMPARE_WEIGHT_SIMPLE_BASE 0
+#define MIXER_COMPARE_WEIGHT_NEXT_BASE 10000000
+#define MIXER_COMPARE_WEIGHT_NOT_FOUND 1000000000
+
+typedef enum _selem_ctl_type {
+ CTL_SINGLE,
+ CTL_GLOBAL_ENUM,
+ CTL_GLOBAL_SWITCH,
+ CTL_GLOBAL_VOLUME,
+ CTL_GLOBAL_ROUTE,
+ CTL_PLAYBACK_ENUM,
+ CTL_PLAYBACK_SWITCH,
+ CTL_PLAYBACK_VOLUME,
+ CTL_PLAYBACK_ROUTE,
+ CTL_CAPTURE_ENUM,
+ CTL_CAPTURE_SWITCH,
+ CTL_CAPTURE_VOLUME,
+ CTL_CAPTURE_ROUTE,
+ CTL_CAPTURE_SOURCE,
+ CTL_LAST = CTL_CAPTURE_SOURCE,
+} selem_ctl_type_t;
+
+typedef struct _selem_ctl {
+ snd_hctl_elem_t *elem;
+ snd_ctl_elem_type_t type;
+ unsigned int inactive: 1;
+ unsigned int values;
+ long min, max;
+} selem_ctl_t;
+
+typedef struct _selem_none {
+ sm_selem_t selem;
+ selem_ctl_t ctls[CTL_LAST + 1];
+ unsigned int capture_item;
+ struct selem_str {
+ unsigned int range: 1; /* Forced range */
+ unsigned int db_initialized: 1;
+ unsigned int db_init_error: 1;
+ long min, max;
+ unsigned int channels;
+ long vol[32];
+ unsigned int sw;
+ unsigned int *db_info;
+ } str[2];
+} selem_none_t;
+
+static const struct mixer_name_table {
+ const char *longname;
+ const char *shortname;
+} name_table[] = {
+ {"Tone Control - Switch", "Tone"},
+ {"Tone Control - Bass", "Bass"},
+ {"Tone Control - Treble", "Treble"},
+ {"Synth Tone Control - Switch", "Synth Tone"},
+ {"Synth Tone Control - Bass", "Synth Bass"},
+ {"Synth Tone Control - Treble", "Synth Treble"},
+ {0, 0},
+};
+
+#endif /* !DOC_HIDDEN */
+
+static const char *get_short_name(const char *lname)
+{
+ const struct mixer_name_table *p;
+ for (p = name_table; p->longname; p++) {
+ if (!strcmp(lname, p->longname))
+ return p->shortname;
+ }
+ return lname;
+}
+
+static int compare_mixer_priority_lookup(const char **name, const char * const *names, int coef)
+{
+ int res;
+
+ for (res = 0; *names; names++, res += coef) {
+ if (!strncmp(*name, *names, strlen(*names))) {
+ *name += strlen(*names);
+ if (**name == ' ')
+ (*name)++;
+ return res+1;
+ }
+ }
+ return MIXER_COMPARE_WEIGHT_NOT_FOUND;
+}
+
+static int get_compare_weight(const char *name, unsigned int idx)
+{
+ static const char *const names[] = {
+ "Master",
+ "Headphone",
+ "Tone",
+ "Bass",
+ "Treble",
+ "3D Control",
+ "PCM",
+ "Front",
+ "Surround",
+ "Center",
+ "LFE",
+ "Side",
+ "Synth",
+ "FM",
+ "Wave",
+ "Music",
+ "DSP",
+ "Line",
+ "CD",
+ "Mic",
+ "Video",
+ "Zoom Video",
+ "Phone",
+ "I2S",
+ "IEC958",
+ "PC Speaker",
+ "Aux",
+ "Mono",
+ "Playback",
+ "Capture",
+ "Mix",
+ NULL
+ };
+ static const char *const names1[] = {
+ "-",
+ NULL,
+ };
+ static const char *const names2[] = {
+ "Mono",
+ "Digital",
+ "Switch",
+ "Depth",
+ "Wide",
+ "Space",
+ "Level",
+ "Center",
+ "Output",
+ "Boost",
+ "Tone",
+ "Bass",
+ "Treble",
+ NULL,
+ };
+ const char *name1;
+ int res, res1;
+
+ if ((res = compare_mixer_priority_lookup((const char **)&name, names, 1000)) == MIXER_COMPARE_WEIGHT_NOT_FOUND)
+ return MIXER_COMPARE_WEIGHT_NOT_FOUND;
+ if (*name == '\0')
+ goto __res;
+ for (name1 = name; *name1 != '\0'; name1++);
+ for (name1--; name1 != name && *name1 != ' '; name1--);
+ while (name1 != name && *name1 == ' ')
+ name1--;
+ if (name1 != name) {
+ for (; name1 != name && *name1 != ' '; name1--);
+ name = name1;
+ if ((res1 = compare_mixer_priority_lookup((const char **)&name, names1, 200)) == MIXER_COMPARE_WEIGHT_NOT_FOUND)
+ return res;
+ res += res1;
+ } else {
+ name = name1;
+ }
+ if ((res1 = compare_mixer_priority_lookup((const char **)&name, names2, 20)) == MIXER_COMPARE_WEIGHT_NOT_FOUND)
+ return res;
+ __res:
+ return MIXER_COMPARE_WEIGHT_SIMPLE_BASE + res + idx;
+}
+
+static long to_user(selem_none_t *s, int dir, selem_ctl_t *c, long value)
+{
+ int64_t n;
+ if (c->max == c->min)
+ return s->str[dir].min;
+ n = (int64_t) (value - c->min) * (s->str[dir].max - s->str[dir].min);
+ return s->str[dir].min + (n + (c->max - c->min) / 2) / (c->max - c->min);
+}
+
+static long from_user(selem_none_t *s, int dir, selem_ctl_t *c, long value)
+{
+ int64_t n;
+ if (s->str[dir].max == s->str[dir].min)
+ return c->min;
+ n = (int64_t) (value - s->str[dir].min) * (c->max - c->min);
+ return c->min + (n + (s->str[dir].max - s->str[dir].min) / 2) / (s->str[dir].max - s->str[dir].min);
+}
+
+static int elem_read_volume(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < s->str[dir].channels; idx++) {
+ unsigned int idx1 = idx;
+ if (idx >= c->values)
+ idx1 = 0;
+ s->str[dir].vol[idx] = to_user(s, dir, c, snd_ctl_elem_value_get_integer(ctl, idx1));
+ }
+ return 0;
+}
+
+static int elem_read_switch(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < s->str[dir].channels; idx++) {
+ unsigned int idx1 = idx;
+ if (idx >= c->values)
+ idx1 = 0;
+ if (!snd_ctl_elem_value_get_integer(ctl, idx1))
+ s->str[dir].sw &= ~(1 << idx);
+ }
+ return 0;
+}
+
+static int elem_read_route(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < s->str[dir].channels; idx++) {
+ unsigned int idx1 = idx;
+ if (idx >= c->values)
+ idx1 = 0;
+ if (!snd_ctl_elem_value_get_integer(ctl, idx1 * c->values + idx1))
+ s->str[dir].sw &= ~(1 << idx);
+ }
+ return 0;
+}
+
+static int elem_read_enum(selem_none_t *s)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ int type;
+ selem_ctl_t *c;
+ type = CTL_GLOBAL_ENUM;
+ if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) )
+ type = CTL_GLOBAL_ENUM;
+ else if (s->selem.caps & SM_CAP_PENUM)
+ type = CTL_PLAYBACK_ENUM;
+ else if (s->selem.caps & SM_CAP_CENUM)
+ type = CTL_CAPTURE_ENUM;
+ c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < s->str[0].channels; idx++) {
+ unsigned int idx1 = idx;
+ if (idx >= c->values)
+ idx1 = 0;
+ s->str[0].vol[idx] = snd_ctl_elem_value_get_enumerated(ctl, idx1);
+ }
+ return 0;
+}
+
+static int selem_read(snd_mixer_elem_t *elem)
+{
+ selem_none_t *s;
+ unsigned int idx;
+ int err = 0;
+ long pvol[32], cvol[32];
+ unsigned int psw, csw;
+
+ assert(snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE);
+ s = snd_mixer_elem_get_private(elem);
+
+ memcpy(pvol, s->str[SM_PLAY].vol, sizeof(pvol));
+ memset(&s->str[SM_PLAY].vol, 0, sizeof(s->str[SM_PLAY].vol));
+ psw = s->str[SM_PLAY].sw;
+ s->str[SM_PLAY].sw = ~0U;
+ memcpy(cvol, s->str[SM_CAPT].vol, sizeof(cvol));
+ memset(&s->str[SM_CAPT].vol, 0, sizeof(s->str[SM_CAPT].vol));
+ csw = s->str[SM_CAPT].sw;
+ s->str[SM_CAPT].sw = ~0U;
+
+ if (s->ctls[CTL_GLOBAL_ENUM].elem) {
+ err = elem_read_enum(s);
+ if (err < 0)
+ return err;
+ goto __skip_cswitch;
+ }
+
+ if (s->ctls[CTL_CAPTURE_ENUM].elem) {
+ err = elem_read_enum(s);
+ if (err < 0)
+ return err;
+ goto __skip_cswitch;
+ }
+
+ if (s->ctls[CTL_PLAYBACK_ENUM].elem) {
+ err = elem_read_enum(s);
+ if (err < 0)
+ return err;
+ goto __skip_cswitch;
+ }
+
+
+ if (s->ctls[CTL_PLAYBACK_VOLUME].elem)
+ err = elem_read_volume(s, SM_PLAY, CTL_PLAYBACK_VOLUME);
+ else if (s->ctls[CTL_GLOBAL_VOLUME].elem)
+ err = elem_read_volume(s, SM_PLAY, CTL_GLOBAL_VOLUME);
+ else if (s->ctls[CTL_SINGLE].elem &&
+ s->ctls[CTL_SINGLE].type == SND_CTL_ELEM_TYPE_INTEGER)
+ err = elem_read_volume(s, SM_PLAY, CTL_SINGLE);
+ if (err < 0)
+ return err;
+
+ if ((s->selem.caps & (SM_CAP_GSWITCH|SM_CAP_PSWITCH)) == 0) {
+ s->str[SM_PLAY].sw = 0;
+ goto __skip_pswitch;
+ }
+ if (s->ctls[CTL_PLAYBACK_SWITCH].elem) {
+ err = elem_read_switch(s, SM_PLAY, CTL_PLAYBACK_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_SWITCH].elem) {
+ err = elem_read_switch(s, SM_PLAY, CTL_GLOBAL_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_SINGLE].elem &&
+ s->ctls[CTL_SINGLE].type == SND_CTL_ELEM_TYPE_BOOLEAN) {
+ err = elem_read_switch(s, SM_PLAY, CTL_SINGLE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_PLAYBACK_ROUTE].elem) {
+ err = elem_read_route(s, SM_PLAY, CTL_PLAYBACK_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_ROUTE].elem) {
+ err = elem_read_route(s, SM_PLAY, CTL_GLOBAL_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ __skip_pswitch:
+
+ if (s->ctls[CTL_CAPTURE_VOLUME].elem)
+ err = elem_read_volume(s, SM_CAPT, CTL_CAPTURE_VOLUME);
+ else if (s->ctls[CTL_GLOBAL_VOLUME].elem)
+ err = elem_read_volume(s, SM_CAPT, CTL_GLOBAL_VOLUME);
+ else if (s->ctls[CTL_SINGLE].elem &&
+ s->ctls[CTL_SINGLE].type == SND_CTL_ELEM_TYPE_INTEGER)
+ err = elem_read_volume(s, SM_CAPT, CTL_SINGLE);
+ if (err < 0)
+ return err;
+
+ if ((s->selem.caps & (SM_CAP_GSWITCH|SM_CAP_CSWITCH)) == 0) {
+ s->str[SM_CAPT].sw = 0;
+ goto __skip_cswitch;
+ }
+ if (s->ctls[CTL_CAPTURE_SWITCH].elem) {
+ err = elem_read_switch(s, SM_CAPT, CTL_CAPTURE_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_SWITCH].elem) {
+ err = elem_read_switch(s, SM_CAPT, CTL_GLOBAL_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_SINGLE].elem &&
+ s->ctls[CTL_SINGLE].type == SND_CTL_ELEM_TYPE_BOOLEAN) {
+ err = elem_read_switch(s, SM_CAPT, CTL_SINGLE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_ROUTE].elem) {
+ err = elem_read_route(s, SM_CAPT, CTL_CAPTURE_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_ROUTE].elem) {
+ err = elem_read_route(s, SM_CAPT, CTL_GLOBAL_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_SOURCE].elem) {
+ snd_ctl_elem_value_t *ctl;
+ selem_ctl_t *c = &s->ctls[CTL_CAPTURE_SOURCE];
+ snd_ctl_elem_value_alloca(&ctl);
+ err = snd_hctl_elem_read(c->elem, ctl);
+ if (err < 0)
+ return err;
+ for (idx = 0; idx < s->str[SM_CAPT].channels; idx++) {
+ unsigned int idx1 = idx;
+ if (idx >= c->values)
+ idx1 = 0;
+ if (snd_ctl_elem_value_get_enumerated(ctl, idx1) != s->capture_item)
+ s->str[SM_CAPT].sw &= ~(1 << idx);
+ }
+ }
+ __skip_cswitch:
+
+ if (memcmp(pvol, s->str[SM_PLAY].vol, sizeof(pvol)) ||
+ psw != s->str[SM_PLAY].sw ||
+ memcmp(cvol, s->str[SM_CAPT].vol, sizeof(cvol)) ||
+ csw != s->str[SM_CAPT].sw)
+ return 1;
+ return 0;
+}
+
+static int elem_write_volume(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values; idx++)
+ snd_ctl_elem_value_set_integer(ctl, idx, from_user(s, dir, c, s->str[dir].vol[idx]));
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ return 0;
+}
+
+static int elem_write_switch(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values; idx++)
+ snd_ctl_elem_value_set_integer(ctl, idx, !!(s->str[dir].sw & (1 << idx)));
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ return 0;
+}
+
+static int elem_write_switch_constant(selem_none_t *s, selem_ctl_type_t type, int val)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values; idx++)
+ snd_ctl_elem_value_set_integer(ctl, idx, !!val);
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ return 0;
+}
+
+static int elem_write_route(selem_none_t *s, int dir, selem_ctl_type_t type)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ selem_ctl_t *c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values * c->values; idx++)
+ snd_ctl_elem_value_set_integer(ctl, idx, 0);
+ for (idx = 0; idx < c->values; idx++)
+ snd_ctl_elem_value_set_integer(ctl, idx * c->values + idx, !!(s->str[dir].sw & (1 << idx)));
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ return 0;
+}
+
+static int elem_write_enum(selem_none_t *s)
+{
+ snd_ctl_elem_value_t *ctl;
+ unsigned int idx;
+ int err;
+ int type;
+ selem_ctl_t *c;
+ type = CTL_GLOBAL_ENUM;
+ if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) ) == (SM_CAP_CENUM | SM_CAP_PENUM) )
+ type = CTL_GLOBAL_ENUM;
+ else if (s->selem.caps & SM_CAP_PENUM)
+ type = CTL_PLAYBACK_ENUM;
+ else if (s->selem.caps & SM_CAP_CENUM)
+ type = CTL_CAPTURE_ENUM;
+ c = &s->ctls[type];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values; idx++)
+ snd_ctl_elem_value_set_enumerated(ctl, idx, (unsigned int)s->str[0].vol[idx]);
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ return 0;
+}
+
+static int selem_write_main(snd_mixer_elem_t *elem)
+{
+ selem_none_t *s;
+ unsigned int idx;
+ int err;
+
+ assert(snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE);
+ s = snd_mixer_elem_get_private(elem);
+
+ if (s->ctls[CTL_GLOBAL_ENUM].elem)
+ return elem_write_enum(s);
+
+ if (s->ctls[CTL_PLAYBACK_ENUM].elem)
+ return elem_write_enum(s);
+
+ if (s->ctls[CTL_CAPTURE_ENUM].elem)
+ return elem_write_enum(s);
+
+ if (s->ctls[CTL_SINGLE].elem) {
+ if (s->ctls[CTL_SINGLE].type == SND_CTL_ELEM_TYPE_INTEGER)
+ err = elem_write_volume(s, SM_PLAY, CTL_SINGLE);
+ else
+ err = elem_write_switch(s, SM_PLAY, CTL_SINGLE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_VOLUME].elem) {
+ err = elem_write_volume(s, SM_PLAY, CTL_GLOBAL_VOLUME);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_GLOBAL_SWITCH].elem) {
+ if (s->ctls[CTL_PLAYBACK_SWITCH].elem && s->ctls[CTL_CAPTURE_SWITCH].elem)
+ err = elem_write_switch_constant(s, CTL_GLOBAL_SWITCH, 1);
+ else
+ err = elem_write_switch(s, SM_PLAY, CTL_GLOBAL_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_PLAYBACK_VOLUME].elem) {
+ err = elem_write_volume(s, SM_PLAY, CTL_PLAYBACK_VOLUME);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_PLAYBACK_SWITCH].elem) {
+ err = elem_write_switch(s, SM_PLAY, CTL_PLAYBACK_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_PLAYBACK_ROUTE].elem) {
+ err = elem_write_route(s, SM_PLAY, CTL_PLAYBACK_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_VOLUME].elem) {
+ err = elem_write_volume(s, SM_CAPT, CTL_CAPTURE_VOLUME);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_SWITCH].elem) {
+ err = elem_write_switch(s, SM_CAPT, CTL_CAPTURE_SWITCH);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_ROUTE].elem) {
+ err = elem_write_route(s, SM_CAPT, CTL_CAPTURE_ROUTE);
+ if (err < 0)
+ return err;
+ }
+ if (s->ctls[CTL_CAPTURE_SOURCE].elem) {
+ snd_ctl_elem_value_t *ctl;
+ selem_ctl_t *c = &s->ctls[CTL_CAPTURE_SOURCE];
+ snd_ctl_elem_value_alloca(&ctl);
+ if ((err = snd_hctl_elem_read(c->elem, ctl)) < 0)
+ return err;
+ for (idx = 0; idx < c->values; idx++) {
+ if (s->str[SM_CAPT].sw & (1 << idx))
+ snd_ctl_elem_value_set_enumerated(ctl, idx, s->capture_item);
+ }
+ if ((err = snd_hctl_elem_write(c->elem, ctl)) < 0)
+ return err;
+ /* update the element, don't remove */
+ err = selem_read(elem);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static int selem_write(snd_mixer_elem_t *elem)
+{
+ int err;
+
+ err = selem_write_main(elem);
+ if (err < 0)
+ selem_read(elem);
+ return err;
+}
+
+static void selem_free(snd_mixer_elem_t *elem)
+{
+ selem_none_t *simple = snd_mixer_elem_get_private(elem);
+ assert(snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE);
+ if (simple->selem.id)
+ snd_mixer_selem_id_free(simple->selem.id);
+ /* free db range information */
+ free(simple->str[0].db_info);
+ free(simple->str[1].db_info);
+ free(simple);
+}
+
+static int simple_update(snd_mixer_elem_t *melem)
+{
+ selem_none_t *simple;
+ unsigned int caps, pchannels, cchannels;
+ long pmin, pmax, cmin, cmax;
+ selem_ctl_t *ctl;
+ const char *name;
+
+ caps = 0;
+ pchannels = 0;
+ pmin = LONG_MAX;
+ pmax = LONG_MIN;
+ cchannels = 0;
+ cmin = LONG_MAX;
+ cmax = LONG_MIN;
+ assert(snd_mixer_elem_get_type(melem) == SND_MIXER_ELEM_SIMPLE);
+ simple = snd_mixer_elem_get_private(melem);
+ name = snd_mixer_selem_get_name(melem);
+ ctl = &simple->ctls[CTL_SINGLE];
+ if (ctl->elem) {
+ pchannels = cchannels = ctl->values;
+ if (ctl->type == SND_CTL_ELEM_TYPE_INTEGER) {
+ caps |= SM_CAP_GVOLUME;
+ pmin = cmin = ctl->min;
+ pmax = cmax = ctl->max;
+ } else
+ caps |= SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_GLOBAL_SWITCH];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ caps |= SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_GLOBAL_ROUTE];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ caps |= SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_GLOBAL_VOLUME];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ if (pmin > ctl->min)
+ pmin = ctl->min;
+ if (pmax < ctl->max)
+ pmax = ctl->max;
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ if (cmin > ctl->min)
+ cmin = ctl->min;
+ if (cmax < ctl->max)
+ cmax = ctl->max;
+ caps |= SM_CAP_GVOLUME;
+ }
+ ctl = &simple->ctls[CTL_PLAYBACK_SWITCH];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ caps |= SM_CAP_PSWITCH;
+ caps &= ~SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_PLAYBACK_ROUTE];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ caps |= SM_CAP_PSWITCH;
+ caps &= ~SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_CAPTURE_SWITCH];
+ if (ctl->elem) {
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ caps |= SM_CAP_CSWITCH;
+ caps &= ~SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_CAPTURE_ROUTE];
+ if (ctl->elem) {
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ caps |= SM_CAP_CSWITCH;
+ caps &= ~SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_PLAYBACK_VOLUME];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ if (pmin > ctl->min)
+ pmin = ctl->min;
+ if (pmax < ctl->max)
+ pmax = ctl->max;
+ caps |= SM_CAP_PVOLUME;
+ caps &= ~SM_CAP_GVOLUME;
+ }
+ ctl = &simple->ctls[CTL_CAPTURE_VOLUME];
+ if (ctl->elem) {
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ if (cmin > ctl->min)
+ cmin = ctl->min;
+ if (cmax < ctl->max)
+ cmax = ctl->max;
+ caps |= SM_CAP_CVOLUME;
+ caps &= ~SM_CAP_GVOLUME;
+ }
+ ctl = &simple->ctls[CTL_CAPTURE_SOURCE];
+ if (ctl->elem) {
+ if (cchannels < ctl->values)
+ cchannels = ctl->values;
+ caps |= SM_CAP_CSWITCH | SM_CAP_CSWITCH_EXCL;
+ caps &= ~SM_CAP_GSWITCH;
+ }
+ ctl = &simple->ctls[CTL_GLOBAL_ENUM];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ caps |= SM_CAP_PENUM | SM_CAP_CENUM;
+ }
+ ctl = &simple->ctls[CTL_PLAYBACK_ENUM];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ caps |= SM_CAP_PENUM;
+ }
+ ctl = &simple->ctls[CTL_CAPTURE_ENUM];
+ if (ctl->elem) {
+ if (pchannels < ctl->values)
+ pchannels = ctl->values;
+ caps |= SM_CAP_CENUM;
+ }
+ if (pchannels > 32)
+ pchannels = 32;
+ if (cchannels > 32)
+ cchannels = 32;
+ if (caps & (SM_CAP_GSWITCH|SM_CAP_PSWITCH))
+ caps |= SM_CAP_PSWITCH_JOIN;
+ if (caps & (SM_CAP_GVOLUME|SM_CAP_PVOLUME))
+ caps |= SM_CAP_PVOLUME_JOIN;
+ if (caps & (SM_CAP_GSWITCH|SM_CAP_CSWITCH))
+ caps |= SM_CAP_CSWITCH_JOIN;
+ if (caps & (SM_CAP_GVOLUME|SM_CAP_CVOLUME))
+ caps |= SM_CAP_CVOLUME_JOIN;
+ if (pchannels > 1 || cchannels > 1) {
+ if (simple->ctls[CTL_SINGLE].elem &&
+ simple->ctls[CTL_SINGLE].values > 1) {
+ if (caps & SM_CAP_GSWITCH)
+ caps &= ~(SM_CAP_PSWITCH_JOIN|SM_CAP_CSWITCH_JOIN);
+ else
+ caps &= ~(SM_CAP_PVOLUME_JOIN|SM_CAP_CVOLUME_JOIN);
+ }
+ if (simple->ctls[CTL_GLOBAL_ROUTE].elem ||
+ (simple->ctls[CTL_GLOBAL_SWITCH].elem &&
+ simple->ctls[CTL_GLOBAL_SWITCH].values > 1)) {
+ caps &= ~(SM_CAP_PSWITCH_JOIN|SM_CAP_CSWITCH_JOIN);
+ }
+ if (simple->ctls[CTL_GLOBAL_VOLUME].elem &&
+ simple->ctls[CTL_GLOBAL_VOLUME].values > 1) {
+ caps &= ~(SM_CAP_PVOLUME_JOIN|SM_CAP_CVOLUME_JOIN);
+ }
+ }
+ if (pchannels > 1) {
+ if (simple->ctls[CTL_PLAYBACK_ROUTE].elem ||
+ (simple->ctls[CTL_PLAYBACK_SWITCH].elem &&
+ simple->ctls[CTL_PLAYBACK_SWITCH].values > 1)) {
+ caps &= ~SM_CAP_PSWITCH_JOIN;
+ }
+ if (simple->ctls[CTL_PLAYBACK_VOLUME].elem &&
+ simple->ctls[CTL_PLAYBACK_VOLUME].values > 1) {
+ caps &= ~SM_CAP_PVOLUME_JOIN;
+ }
+ }
+ if (cchannels > 1) {
+ if (simple->ctls[CTL_CAPTURE_ROUTE].elem ||
+ (simple->ctls[CTL_CAPTURE_SWITCH].elem &&
+ simple->ctls[CTL_CAPTURE_SWITCH].values > 1) ||
+ (simple->ctls[CTL_CAPTURE_SOURCE].elem &&
+ simple->ctls[CTL_CAPTURE_SOURCE].values > 1)) {
+ caps &= ~SM_CAP_CSWITCH_JOIN;
+ }
+ if (simple->ctls[CTL_CAPTURE_VOLUME].elem &&
+ simple->ctls[CTL_CAPTURE_VOLUME].values > 1) {
+ caps &= ~SM_CAP_CVOLUME_JOIN;
+ }
+ }
+
+ /* exceptions */
+ if ((caps & (SM_CAP_GSWITCH|SM_CAP_PSWITCH|SM_CAP_CSWITCH)) &&
+ (caps & (SM_CAP_GSWITCH|SM_CAP_PSWITCH|SM_CAP_CSWITCH)) == (caps & SM_CAP_GSWITCH)) {
+ caps &= ~(SM_CAP_GSWITCH|SM_CAP_CSWITCH_JOIN|SM_CAP_CSWITCH_EXCL);
+ caps |= SM_CAP_PSWITCH;
+ }
+
+ if ((caps & SM_CAP_GSWITCH) &&
+ (caps & (SM_CAP_PSWITCH|SM_CAP_CSWITCH)) == 0)
+ caps |= SM_CAP_PSWITCH|SM_CAP_CSWITCH;
+
+ if ((caps & SM_CAP_GVOLUME) &&
+ (caps & (SM_CAP_PVOLUME|SM_CAP_CVOLUME)) == 0)
+ caps |= SM_CAP_PVOLUME|SM_CAP_CVOLUME;
+
+ simple->selem.caps = caps;
+ simple->str[SM_PLAY].channels = pchannels;
+ if (!simple->str[SM_PLAY].range) {
+ simple->str[SM_PLAY].min = pmin != LONG_MAX ? pmin : 0;
+ simple->str[SM_PLAY].max = pmax != LONG_MIN ? pmax : 0;
+ }
+ simple->str[SM_CAPT].channels = cchannels;
+ if (!simple->str[SM_CAPT].range) {
+ simple->str[SM_CAPT].min = cmin != LONG_MAX ? cmin : 0;
+ simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0;
+ }
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+static const struct suf {
+ const char *suffix;
+ selem_ctl_type_t type;
+} suffixes[] = {
+ {" Playback Enum", CTL_PLAYBACK_ENUM},
+ {" Playback Switch", CTL_PLAYBACK_SWITCH},
+ {" Playback Route", CTL_PLAYBACK_ROUTE},
+ {" Playback Volume", CTL_PLAYBACK_VOLUME},
+ {" Capture Enum", CTL_CAPTURE_ENUM},
+ {" Capture Switch", CTL_CAPTURE_SWITCH},
+ {" Capture Route", CTL_CAPTURE_ROUTE},
+ {" Capture Volume", CTL_CAPTURE_VOLUME},
+ {" Enum", CTL_GLOBAL_ENUM},
+ {" Switch", CTL_GLOBAL_SWITCH},
+ {" Route", CTL_GLOBAL_ROUTE},
+ {" Volume", CTL_GLOBAL_VOLUME},
+ {NULL, 0}
+};
+#endif
+
+/* Return base length or 0 on failure */
+static int base_len(const char *name, selem_ctl_type_t *type)
+{
+ const struct suf *p;
+ size_t nlen = strlen(name);
+ p = suffixes;
+ while (p->suffix) {
+ size_t slen = strlen(p->suffix);
+ size_t l;
+ if (nlen > slen) {
+ l = nlen - slen;
+ if (strncmp(name + l, p->suffix, slen) == 0 &&
+ (l < 1 || name[l-1] != '-')) { /* 3D Control - Switch */
+ *type = p->type;
+ return l;
+ }
+ }
+ p++;
+ }
+
+ /* Special case - handle "Input Source" as a capture route.
+ * Note that it's *NO* capture source. A capture source is split over
+ * sub-elements, and multiple capture-sources will result in an error.
+ * That's why some drivers use "Input Source" as a workaround.
+ * Hence, this is a workaround for a workaround to get the things
+ * straight back again. Sigh.
+ */
+ if (!strcmp(name, "Input Source")) {
+ *type = CTL_CAPTURE_ROUTE;
+ return strlen(name);
+ }
+
+ return 0;
+}
+
+
+/*
+ * Simple Mixer Operations
+ */
+
+static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ if ((unsigned int) channel >= s->str[dir].channels)
+ return 0;
+ if (value < s->str[dir].min || value > s->str[dir].max)
+ return 0;
+ if (s->selem.caps &
+ (dir == SM_PLAY ? SM_CAP_PVOLUME_JOIN : SM_CAP_CVOLUME_JOIN))
+ channel = 0;
+ if (value != s->str[dir].vol[channel]) {
+ s->str[dir].vol[channel] = value;
+ return 1;
+ }
+ return 0;
+}
+
+static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ if ((unsigned int) channel >= s->str[dir].channels)
+ return 0;
+ if (s->selem.caps &
+ (dir == SM_PLAY ? SM_CAP_PSWITCH_JOIN : SM_CAP_CSWITCH_JOIN))
+ channel = 0;
+ if (value) {
+ if (!(s->str[dir].sw & (1 << channel))) {
+ s->str[dir].sw |= 1 << channel;
+ return 1;
+ }
+ } else {
+ if (s->str[dir].sw & (1 << channel)) {
+ s->str[dir].sw &= ~(1 << channel);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+
+ switch (cmd) {
+
+ case SM_OPS_IS_ACTIVE: {
+ selem_ctl_type_t ctl;
+ for (ctl = CTL_SINGLE; ctl <= CTL_LAST; ctl++)
+ if (s->ctls[ctl].elem != NULL && s->ctls[ctl].inactive)
+ return 0;
+ return 1;
+ }
+
+ case SM_OPS_IS_MONO:
+ return s->str[dir].channels == 1;
+
+ case SM_OPS_IS_CHANNEL:
+ return (unsigned int) val < s->str[dir].channels;
+
+ case SM_OPS_IS_ENUMERATED:
+ if (val == 1) {
+ if (dir == SM_PLAY && (s->selem.caps & SM_CAP_PENUM) && !(s->selem.caps & SM_CAP_CENUM) )
+ return 1;
+ if (dir == SM_CAPT && (s->selem.caps & SM_CAP_CENUM) && !(s->selem.caps & SM_CAP_PENUM) )
+ return 1;
+ return 0;
+ }
+ if (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) )
+ return 1;
+ return 0;
+
+ case SM_OPS_IS_ENUMCNT:
+ /* Both */
+ if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) ) {
+ if (! s->ctls[CTL_GLOBAL_ENUM].elem)
+ return -EINVAL;
+ return s->ctls[CTL_GLOBAL_ENUM].max;
+ /* Only Playback */
+ } else if (s->selem.caps & SM_CAP_PENUM ) {
+ if (! s->ctls[CTL_PLAYBACK_ENUM].elem)
+ return -EINVAL;
+ return s->ctls[CTL_PLAYBACK_ENUM].max;
+ /* Only Capture */
+ } else if (s->selem.caps & SM_CAP_CENUM ) {
+ if (! s->ctls[CTL_CAPTURE_ENUM].elem)
+ return -EINVAL;
+ return s->ctls[CTL_CAPTURE_ENUM].max;
+ }
+
+ }
+
+ return 1;
+}
+
+static int get_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ *min = s->str[dir].min;
+ *max = s->str[dir].max;
+ return 0;
+}
+
+static int set_range_ops(snd_mixer_elem_t *elem, int dir,
+ long min, long max)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ int err;
+
+ s->str[dir].range = 1;
+ s->str[dir].min = min;
+ s->str[dir].max = max;
+ if ((err = selem_read(elem)) < 0)
+ return err;
+ return 0;
+}
+
+static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, long *value)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ if ((unsigned int) channel >= s->str[dir].channels)
+ return -EINVAL;
+ *value = s->str[dir].vol[channel];
+ return 0;
+}
+
+static int init_db_range(snd_hctl_elem_t *ctl, struct selem_str *rec);
+
+static int convert_to_dB(snd_hctl_elem_t *ctl, struct selem_str *rec,
+ long volume, long *db_gain)
+{
+ if (init_db_range(ctl, rec) < 0)
+ return -EINVAL;
+ return snd_tlv_convert_to_dB(rec->db_info, rec->min, rec->max,
+ volume, db_gain);
+}
+
+/* initialize dB range information, reading TLV via hcontrol
+ */
+static int init_db_range(snd_hctl_elem_t *ctl, struct selem_str *rec)
+{
+ snd_ctl_elem_info_t *info;
+ unsigned int *tlv = NULL;
+ const unsigned int tlv_size = 4096;
+ unsigned int *dbrec;
+ int db_size;
+
+ if (rec->db_init_error)
+ return -EINVAL;
+ if (rec->db_initialized)
+ return 0;
+
+ snd_ctl_elem_info_alloca(&info);
+ if (snd_hctl_elem_info(ctl, info) < 0)
+ goto error;
+ if (! snd_ctl_elem_info_is_tlv_readable(info))
+ goto error;
+ tlv = malloc(tlv_size);
+ if (! tlv)
+ return -ENOMEM;
+ if (snd_hctl_elem_tlv_read(ctl, tlv, tlv_size) < 0)
+ goto error;
+ db_size = snd_tlv_parse_dB_info(tlv, tlv_size, &dbrec);
+ if (db_size < 0)
+ goto error;
+ rec->db_info = malloc(db_size);
+ if (!rec->db_info)
+ goto error;
+ memcpy(rec->db_info, dbrec, db_size);
+ free(tlv);
+ rec->db_initialized = 1;
+ return 0;
+
+ error:
+ free(tlv);
+ rec->db_init_error = 1;
+ return -EINVAL;
+}
+
+/* get selem_ctl for TLV access */
+static selem_ctl_t *get_selem_ctl(selem_none_t *s, int dir)
+{
+ selem_ctl_t *c;
+ if (dir == SM_PLAY)
+ c = &s->ctls[CTL_PLAYBACK_VOLUME];
+ else if (dir == SM_CAPT)
+ c = &s->ctls[CTL_CAPTURE_VOLUME];
+ else
+ return NULL;
+ if (! c->elem) {
+ c = &s->ctls[CTL_GLOBAL_VOLUME];
+ if (! c->elem)
+ return NULL;
+ }
+ if (c->type != SND_CTL_ELEM_TYPE_INTEGER)
+ return NULL;
+ return c;
+}
+
+static int get_dB_range(snd_hctl_elem_t *ctl, struct selem_str *rec,
+ long *min, long *max)
+{
+ if (init_db_range(ctl, rec) < 0)
+ return -EINVAL;
+
+ return snd_tlv_get_dB_range(rec->db_info, rec->min, rec->max, min, max);
+}
+
+static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
+ long *min, long *max)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ selem_ctl_t *c;
+
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ c = get_selem_ctl(s, dir);
+ if (! c)
+ return -EINVAL;
+ return get_dB_range(c->elem, &s->str[dir], min, max);
+}
+
+static int convert_from_dB(snd_hctl_elem_t *ctl, struct selem_str *rec,
+ long db_gain, long *value, int xdir)
+{
+ if (init_db_range(ctl, rec) < 0)
+ return -EINVAL;
+
+ return snd_tlv_convert_from_dB(rec->db_info, rec->min, rec->max,
+ db_gain, value, xdir);
+}
+
+static int ask_vol_dB_ops(snd_mixer_elem_t *elem,
+ int dir,
+ long value,
+ long *dBvalue)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ selem_ctl_t *c;
+
+ c = get_selem_ctl(s, dir);
+ if (! c)
+ return -EINVAL;
+ int res = convert_to_dB(c->elem, &s->str[dir], value, dBvalue);
+ return res;
+}
+
+static int get_dB_ops(snd_mixer_elem_t *elem,
+ int dir,
+ snd_mixer_selem_channel_id_t channel,
+ long *value)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ selem_ctl_t *c;
+ int err;
+ long volume, db_gain;
+
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ c = get_selem_ctl(s, dir);
+ if (! c)
+ return -EINVAL;
+ if ((err = get_volume_ops(elem, dir, channel, &volume)) < 0)
+ goto _err;
+ if ((err = convert_to_dB(c->elem, &s->str[dir], volume, &db_gain)) < 0)
+ goto _err;
+ err = 0;
+ *value = db_gain;
+ _err:
+ return err;
+}
+
+static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, int *value)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ if (s->selem.caps & SM_CAP_GSWITCH)
+ dir = SM_PLAY;
+ if ((unsigned int) channel >= s->str[dir].channels)
+ return -EINVAL;
+ *value = !!(s->str[dir].sw & (1 << channel));
+ return 0;
+}
+
+static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, long value)
+{
+ int changed;
+ changed = _snd_mixer_selem_set_volume(elem, dir, channel, value);
+ if (changed < 0)
+ return changed;
+ if (changed)
+ return selem_write(elem);
+ return 0;
+}
+
+static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir,
+ long dbValue, long *value, int xdir)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ selem_ctl_t *c;
+
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ c = get_selem_ctl(s, dir);
+ if (! c)
+ return -EINVAL;
+ return convert_from_dB(c->elem, &s->str[dir], dbValue, value, xdir);
+}
+
+static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel,
+ long db_gain, int xdir)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ selem_ctl_t *c;
+ long value;
+ int err;
+
+ if (s->selem.caps & SM_CAP_GVOLUME)
+ dir = SM_PLAY;
+ c = get_selem_ctl(s, dir);
+ if (! c)
+ return -EINVAL;
+ err = convert_from_dB(c->elem, &s->str[dir], db_gain, &value, xdir);
+ if (err < 0)
+ return err;
+ return set_volume_ops(elem, dir, channel, value);
+}
+
+static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
+ snd_mixer_selem_channel_id_t channel, int value)
+{
+ int changed;
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ if (s->selem.caps & SM_CAP_GSWITCH)
+ dir = SM_PLAY;
+ if (dir == SM_PLAY) {
+ if (! (s->selem.caps & (SM_CAP_GSWITCH|SM_CAP_PSWITCH)))
+ return -EINVAL;
+ } else {
+ if (! (s->selem.caps & (SM_CAP_GSWITCH|SM_CAP_CSWITCH)))
+ return -EINVAL;
+ }
+ changed = _snd_mixer_selem_set_switch(elem, dir, channel, value);
+ if (changed < 0)
+ return changed;
+ if (changed)
+ return selem_write(elem);
+ return 0;
+}
+
+static int enum_item_name_ops(snd_mixer_elem_t *elem,
+ unsigned int item,
+ size_t maxlen, char *buf)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ snd_ctl_elem_info_t *info;
+ snd_hctl_elem_t *helem;
+ int type;
+
+ type = CTL_GLOBAL_ENUM;
+ helem = s->ctls[type].elem;
+ if (!helem) {
+ type = CTL_PLAYBACK_ENUM;
+ helem = s->ctls[type].elem;
+ }
+ if (!helem) {
+ type = CTL_CAPTURE_ENUM;
+ helem = s->ctls[type].elem;
+ }
+ assert(helem);
+ if (item >= (unsigned int)s->ctls[type].max)
+ return -EINVAL;
+ snd_ctl_elem_info_alloca(&info);
+ snd_hctl_elem_info(helem, info);
+ snd_ctl_elem_info_set_item(info, item);
+ snd_hctl_elem_info(helem, info);
+ strncpy(buf, snd_ctl_elem_info_get_item_name(info), maxlen);
+ return 0;
+}
+
+static int get_enum_item_ops(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int *itemp)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ snd_ctl_elem_value_t *ctl;
+ snd_hctl_elem_t *helem;
+ int err;
+
+ if ((unsigned int) channel >= s->str[0].channels)
+ return -EINVAL;
+ helem = s->ctls[CTL_GLOBAL_ENUM].elem;
+ if (!helem) helem = s->ctls[CTL_PLAYBACK_ENUM].elem;
+ if (!helem) helem = s->ctls[CTL_CAPTURE_ENUM].elem;
+ assert(helem);
+ snd_ctl_elem_value_alloca(&ctl);
+ err = snd_hctl_elem_read(helem, ctl);
+ if (! err)
+ *itemp = snd_ctl_elem_value_get_enumerated(ctl, channel);
+ return err;
+}
+
+static int set_enum_item_ops(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t channel,
+ unsigned int item)
+{
+ selem_none_t *s = snd_mixer_elem_get_private(elem);
+ snd_ctl_elem_value_t *ctl;
+ snd_hctl_elem_t *helem;
+ int err;
+ int type;
+
+ if ((unsigned int) channel >= s->str[0].channels) {
+ return -EINVAL;
+ }
+ type = CTL_GLOBAL_ENUM;
+ helem = s->ctls[type].elem;
+ if (!helem) {
+ type = CTL_PLAYBACK_ENUM;
+ helem = s->ctls[type].elem;
+ }
+ if (!helem) {
+ type = CTL_CAPTURE_ENUM;
+ helem = s->ctls[type].elem;
+ }
+ assert(helem);
+ if (item >= (unsigned int)s->ctls[type].max) {
+ return -EINVAL;
+ }
+ snd_ctl_elem_value_alloca(&ctl);
+ err = snd_hctl_elem_read(helem, ctl);
+ if (err < 0) {
+ return err;
+ }
+ snd_ctl_elem_value_set_enumerated(ctl, channel, item);
+ return snd_hctl_elem_write(helem, ctl);
+}
+
+static struct sm_elem_ops simple_none_ops = {
+ .is = is_ops,
+ .get_range = get_range_ops,
+ .get_dB_range = get_dB_range_ops,
+ .set_range = set_range_ops,
+ .ask_vol_dB = ask_vol_dB_ops,
+ .ask_dB_vol = ask_dB_vol_ops,
+ .get_volume = get_volume_ops,
+ .get_dB = get_dB_ops,
+ .set_volume = set_volume_ops,
+ .set_dB = set_dB_ops,
+ .get_switch = get_switch_ops,
+ .set_switch = set_switch_ops,
+ .enum_item_name = enum_item_name_ops,
+ .get_enum_item = get_enum_item_ops,
+ .set_enum_item = set_enum_item_ops
+};
+
+static int simple_add1(snd_mixer_class_t *class, const char *name,
+ snd_hctl_elem_t *helem, selem_ctl_type_t type,
+ unsigned int value)
+{
+ snd_mixer_elem_t *melem;
+ snd_mixer_selem_id_t *id;
+ int new = 0;
+ int err;
+ snd_ctl_elem_info_t *info;
+ selem_none_t *simple;
+ const char *name1;
+ snd_ctl_elem_type_t ctype;
+ unsigned long values;
+
+ snd_ctl_elem_info_alloca(&info);
+ err = snd_hctl_elem_info(helem, info);
+ if (err < 0)
+ return err;
+ ctype = snd_ctl_elem_info_get_type(info);
+ values = snd_ctl_elem_info_get_count(info);
+ switch (type) {
+ case CTL_SINGLE:
+ if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED)
+ type = CTL_GLOBAL_ENUM;
+ else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN &&
+ ctype != SND_CTL_ELEM_TYPE_INTEGER)
+ return 0;
+ break;
+ case CTL_GLOBAL_ROUTE:
+ case CTL_PLAYBACK_ROUTE:
+ case CTL_CAPTURE_ROUTE:
+ {
+ unsigned int n;
+ if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
+ if (type == CTL_PLAYBACK_ROUTE)
+ type = CTL_PLAYBACK_ENUM;
+ else if (type == CTL_CAPTURE_ROUTE)
+ type = CTL_CAPTURE_ENUM;
+ else
+ type = CTL_GLOBAL_ENUM;
+ break;
+ }
+ if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN)
+ return 0;
+ n = sqrt((double)values);
+ if (n * n != values)
+ return 0;
+ values = n;
+ break;
+ }
+ case CTL_GLOBAL_SWITCH:
+ case CTL_PLAYBACK_SWITCH:
+ case CTL_CAPTURE_SWITCH:
+ if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
+ if (type == CTL_PLAYBACK_SWITCH)
+ type = CTL_PLAYBACK_ENUM;
+ else if (type == CTL_CAPTURE_SWITCH)
+ type = CTL_CAPTURE_ENUM;
+ else
+ type = CTL_GLOBAL_ENUM;
+ break;
+ }
+ if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN)
+ return 0;
+ break;
+ case CTL_GLOBAL_VOLUME:
+ case CTL_PLAYBACK_VOLUME:
+ case CTL_CAPTURE_VOLUME:
+ if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) {
+ if (type == CTL_PLAYBACK_VOLUME)
+ type = CTL_PLAYBACK_ENUM;
+ else if (type == CTL_CAPTURE_VOLUME)
+ type = CTL_CAPTURE_ENUM;
+ else
+ type = CTL_GLOBAL_ENUM;
+ break;
+ }
+ if (ctype != SND_CTL_ELEM_TYPE_INTEGER)
+ return 0;
+ break;
+ case CTL_CAPTURE_SOURCE:
+ if (ctype != SND_CTL_ELEM_TYPE_ENUMERATED)
+ return 0;
+ break;
+ case CTL_GLOBAL_ENUM:
+ case CTL_PLAYBACK_ENUM:
+ case CTL_CAPTURE_ENUM:
+ if (ctype != SND_CTL_ELEM_TYPE_ENUMERATED)
+ return 0;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ name1 = get_short_name(name);
+ if (snd_mixer_selem_id_malloc(&id))
+ return -ENOMEM;
+ snd_mixer_selem_id_set_name(id, name1);
+ snd_mixer_selem_id_set_index(id, snd_hctl_elem_get_index(helem));
+ melem = snd_mixer_find_selem(snd_mixer_class_get_mixer(class), id);
+ if (!melem) {
+ simple = calloc(1, sizeof(*simple));
+ if (!simple) {
+ snd_mixer_selem_id_free(id);
+ return -ENOMEM;
+ }
+ simple->selem.id = id;
+ simple->selem.ops = &simple_none_ops;
+ err = snd_mixer_elem_new(&melem, SND_MIXER_ELEM_SIMPLE,
+ get_compare_weight(snd_mixer_selem_id_get_name(simple->selem.id), snd_mixer_selem_id_get_index(simple->selem.id)),
+ simple, selem_free);
+ if (err < 0) {
+ snd_mixer_selem_id_free(id);
+ free(simple);
+ return err;
+ }
+ new = 1;
+ } else {
+ simple = snd_mixer_elem_get_private(melem);
+ snd_mixer_selem_id_free(id);
+ }
+ if (simple->ctls[type].elem) {
+ SNDERR("helem (%s,'%s',%u,%u,%u) appears twice or more",
+ snd_ctl_elem_iface_name(snd_hctl_elem_get_interface(helem)),
+ snd_hctl_elem_get_name(helem),
+ snd_hctl_elem_get_index(helem),
+ snd_hctl_elem_get_device(helem),
+ snd_hctl_elem_get_subdevice(helem));
+ err = -EINVAL;
+ goto __error;
+ }
+ simple->ctls[type].elem = helem;
+ simple->ctls[type].type = snd_ctl_elem_info_get_type(info);
+ simple->ctls[type].inactive = snd_ctl_elem_info_is_inactive(info);
+ simple->ctls[type].values = values;
+ if ( (type == CTL_GLOBAL_ENUM) ||
+ (type == CTL_PLAYBACK_ENUM) ||
+ (type == CTL_CAPTURE_ENUM) ) {
+ simple->ctls[type].min = 0;
+ simple->ctls[type].max = snd_ctl_elem_info_get_items(info);
+ } else {
+ if (ctype == SND_CTL_ELEM_TYPE_INTEGER) {
+ simple->ctls[type].min = snd_ctl_elem_info_get_min(info);
+ simple->ctls[type].max = snd_ctl_elem_info_get_max(info);
+ }
+ }
+ switch (type) {
+ case CTL_CAPTURE_SOURCE:
+ simple->capture_item = value;
+ break;
+ default:
+ break;
+ }
+ err = snd_mixer_elem_attach(melem, helem);
+ if (err < 0)
+ goto __error;
+ err = simple_update(melem);
+ if (err < 0) {
+ if (new)
+ goto __error;
+ return err;
+ }
+ if (new)
+ err = snd_mixer_elem_add(melem, class);
+ else
+ err = snd_mixer_elem_info(melem);
+ if (err < 0)
+ return err;
+ err = selem_read(melem);
+ if (err < 0)
+ return err;
+ if (err)
+ err = snd_mixer_elem_value(melem);
+ return err;
+ __error:
+ if (new)
+ snd_mixer_elem_free(melem);
+ return -EINVAL;
+}
+
+static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
+{
+ const char *name = snd_hctl_elem_get_name(helem);
+ size_t len;
+ selem_ctl_type_t type = CTL_SINGLE; /* to shut up warning */
+ if (snd_hctl_elem_get_interface(helem) != SND_CTL_ELEM_IFACE_MIXER)
+ return 0;
+ if (strcmp(name, "Capture Source") == 0) {
+ snd_ctl_elem_info_t *info;
+ unsigned int k, items;
+ int err;
+ snd_ctl_elem_info_alloca(&info);
+ err = snd_hctl_elem_info(helem, info);
+ assert(err >= 0);
+ if (snd_ctl_elem_info_get_type(info) != SND_CTL_ELEM_TYPE_ENUMERATED)
+ return 0;
+ items = snd_ctl_elem_info_get_items(info);
+ for (k = 0; k < items; ++k) {
+ const char *n;
+ snd_ctl_elem_info_set_item(info, k);
+ err = snd_hctl_elem_info(helem, info);
+ if (err < 0)
+ return err;
+ n = snd_ctl_elem_info_get_item_name(info);
+ err = simple_add1(class, n, helem, CTL_CAPTURE_SOURCE, k);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+ }
+ len = base_len(name, &type);
+ if (len == 0) {
+ return simple_add1(class, name, helem, CTL_SINGLE, 0);
+ } else {
+ char ename[128];
+ if (len >= sizeof(ename))
+ len = sizeof(ename) - 1;
+ memcpy(ename, name, len);
+ ename[len] = 0;
+ /* exception: Capture Volume and Capture Switch */
+ if (type == CTL_GLOBAL_VOLUME && !strcmp(ename, "Capture"))
+ type = CTL_CAPTURE_VOLUME;
+ else if (type == CTL_GLOBAL_SWITCH && !strcmp(ename, "Capture"))
+ type = CTL_CAPTURE_SWITCH;
+ return simple_add1(class, ename, helem, type, 0);
+ }
+}
+
+static int simple_event_remove(snd_hctl_elem_t *helem,
+ snd_mixer_elem_t *melem)
+{
+ selem_none_t *simple = snd_mixer_elem_get_private(melem);
+ int err;
+ int k;
+ for (k = 0; k <= CTL_LAST; k++) {
+ if (simple->ctls[k].elem == helem)
+ break;
+ }
+ assert(k <= CTL_LAST);
+ simple->ctls[k].elem = NULL;
+ err = snd_mixer_elem_detach(melem, helem);
+ if (err < 0)
+ return err;
+ if (snd_mixer_elem_empty(melem))
+ return snd_mixer_elem_remove(melem);
+ err = simple_update(melem);
+ return snd_mixer_elem_info(melem);
+}
+
+static int simple_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+{
+ int err;
+ if (mask == SND_CTL_EVENT_MASK_REMOVE)
+ return simple_event_remove(helem, melem);
+ if (mask & SND_CTL_EVENT_MASK_ADD) {
+ err = simple_event_add(class, helem);
+ if (err < 0)
+ return err;
+ }
+ if (mask & SND_CTL_EVENT_MASK_INFO) {
+ err = simple_event_remove(helem, melem);
+ if (err < 0)
+ return err;
+ err = simple_event_add(class, helem);
+ if (err < 0)
+ return err;
+ return 0;
+ }
+ if (mask & SND_CTL_EVENT_MASK_VALUE) {
+ err = selem_read(melem);
+ if (err < 0)
+ return err;
+ if (err) {
+ err = snd_mixer_elem_value(melem);
+ if (err < 0)
+ return err;
+ }
+ }
+ return 0;
+}
+
+/**
+ * \brief Register mixer simple element class - none abstraction
+ * \param mixer Mixer handle
+ * \param options Options container
+ * \param classp Pointer to returned mixer simple element class handle (or NULL)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_mixer_simple_none_register(snd_mixer_t *mixer,
+ struct snd_mixer_selem_regopt *options ATTRIBUTE_UNUSED,
+ snd_mixer_class_t **classp)
+{
+ snd_mixer_class_t *class;
+ int err;
+
+ if (snd_mixer_class_malloc(&class))
+ return -ENOMEM;
+ snd_mixer_class_set_event(class, simple_event);
+ snd_mixer_class_set_compare(class, snd_mixer_selem_compare);
+ err = snd_mixer_class_register(class, mixer);
+ if (err < 0) {
+ free(class);
+ return err;
+ }
+ if (classp)
+ *classp = class;
+ return 0;
+}
diff --git a/alsa-lib/src/names.c b/alsa-lib/src/names.c
new file mode 100644
index 0000000..e7a6887
--- /dev/null
+++ b/alsa-lib/src/names.c
@@ -0,0 +1,65 @@
+/**
+ * \file names.c
+ * \ingroup Configuration
+ * \brief Configuration helper functions - device names
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2005
+ *
+ * Provide a list of device names for applications.
+ *
+ * See the \ref conf page for more details.
+ */
+/*
+ * Configuration helper functions - device names
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdarg.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include "local.h"
+
+/**
+ * \brief Give a list of device names and associated comments for selected interface
+ * \param iface a string identifying interface ("pcm", "ctl", "seq", "rawmidi")
+ * \param list result - a pointer to list
+ * \return A non-negative value if successful, otherwise a negative error code.
+ * \deprecated Since 1.0.14
+ *
+ * The global configuration files are specified in the environment variable
+ * \c ALSA_NAMES_FILE.
+ */
+int snd_names_list(const char *iface ATTRIBUTE_UNUSED,
+ snd_devname_t **list ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+link_warning(snd_names_list, "Warning: snd_names_list is deprecated, use snd_device_name_hint");
+
+/**
+ * \brief Release the list of device names
+ * \param list the name list to release
+ * \deprecated Since 1.0.14
+ *
+ * Releases the list of device names allocated via #snd_names_list().
+ */
+void snd_names_list_free(snd_devname_t *list ATTRIBUTE_UNUSED)
+{
+}
+link_warning(snd_names_list_free, "Warning: snd_names_list_free is deprecated, use snd_device_name_free_hint");
diff --git a/alsa-lib/src/output.c b/alsa-lib/src/output.c
new file mode 100644
index 0000000..8a723f8
--- /dev/null
+++ b/alsa-lib/src/output.c
@@ -0,0 +1,380 @@
+/**
+ * \file output.c
+ * \brief Generic stdio-like output interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000
+ *
+ * Generic stdio-like output interface
+ */
+/*
+ * Output object
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+typedef struct _snd_output_ops {
+ int (*close)(snd_output_t *output);
+ int (*print)(snd_output_t *output, const char *format, va_list args);
+ int (*puts)(snd_output_t *output, const char *str);
+ int (*putch)(snd_output_t *output, int c);
+ int (*flush)(snd_output_t *output);
+} snd_output_ops_t;
+
+struct _snd_output {
+ snd_output_type_t type;
+ const snd_output_ops_t *ops;
+ void *private_data;
+};
+#endif
+
+/**
+ * \brief Closes an output handle.
+ * \param output The output handle to be closed.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_output_close(snd_output_t *output)
+{
+ int err = output->ops->close(output);
+ free(output);
+ return err;
+}
+
+/**
+ * \brief Writes formatted output (like \c fprintf(3)) to an output handle.
+ * \param output The output handle.
+ * \param format Format string in \c fprintf format.
+ * \param ... Other \c fprintf arguments.
+ * \return The number of characters written, or a negative error code.
+ */
+int snd_output_printf(snd_output_t *output, const char *format, ...)
+{
+ int result;
+ va_list args;
+ va_start(args, format);
+ result = output->ops->print(output, format, args);
+ va_end(args);
+ return result;
+}
+
+/**
+ * \brief Writes formatted output (like \c fprintf(3)) to an output handle.
+ * \param output The output handle.
+ * \param format Format string in \c fprintf format.
+ * \param args Other \c fprintf arguments.
+ * \return The number of characters written, or a negative error code.
+ */
+int snd_output_vprintf(snd_output_t *output, const char *format, va_list args)
+{
+ return output->ops->print(output, format, args);
+}
+
+/**
+ * \brief Writes a string to an output handle (like \c fputs(3)).
+ * \param output The output handle.
+ * \param str Pointer to the string.
+ * \return Zero if successful, otherwise a negative error code or \c EOF.
+ */
+int snd_output_puts(snd_output_t *output, const char *str)
+{
+ return output->ops->puts(output, str);
+}
+
+/**
+ * \brief Writes a character to an output handle (like \c putc(3)).
+ * \param output The output handle.
+ * \param c The character.
+ * \return Zero if successful, otherwise a negative error code or \c EOF.
+ */
+int snd_output_putc(snd_output_t *output, int c)
+{
+ return output->ops->putch(output, c);
+}
+
+/**
+ * \brief Flushes an output handle (like fflush(3)).
+ * \param output The output handle.
+ * \return Zero if successful, otherwise \c EOF.
+ *
+ * If the underlying destination is a stdio stream, this function calls
+ * \c fflush. If the underlying destination is a memory buffer, the write
+ * position is reset to the beginning of the buffer. \c =:-o
+ */
+int snd_output_flush(snd_output_t *output)
+{
+ return output->ops->flush(output);
+}
+
+#ifndef DOC_HIDDEN
+typedef struct _snd_output_stdio {
+ int close;
+ FILE *fp;
+} snd_output_stdio_t;
+
+static int snd_output_stdio_close(snd_output_t *output)
+{
+ snd_output_stdio_t *stdio = output->private_data;
+ if (stdio->close)
+ fclose(stdio->fp);
+ free(stdio);
+ return 0;
+}
+
+static int snd_output_stdio_print(snd_output_t *output, const char *format, va_list args)
+{
+ snd_output_stdio_t *stdio = output->private_data;
+ return vfprintf(stdio->fp, format, args);
+}
+
+static int snd_output_stdio_puts(snd_output_t *output, const char *str)
+{
+ snd_output_stdio_t *stdio = output->private_data;
+ return fputs(str, stdio->fp);
+}
+
+static int snd_output_stdio_putc(snd_output_t *output, int c)
+{
+ snd_output_stdio_t *stdio = output->private_data;
+ return putc(c, stdio->fp);
+}
+
+static int snd_output_stdio_flush(snd_output_t *output)
+{
+ snd_output_stdio_t *stdio = output->private_data;
+ return fflush(stdio->fp);
+}
+
+static const snd_output_ops_t snd_output_stdio_ops = {
+ .close = snd_output_stdio_close,
+ .print = snd_output_stdio_print,
+ .puts = snd_output_stdio_puts,
+ .putch = snd_output_stdio_putc,
+ .flush = snd_output_stdio_flush,
+};
+
+#endif
+
+/**
+ * \brief Creates a new output object using an existing stdio \c FILE pointer.
+ * \param outputp The function puts the pointer to the new output object
+ * at the address specified by \p outputp.
+ * \param fp The \c FILE pointer to write to. Characters are written
+ * to the file starting at the current file position.
+ * \param _close Close flag. Set this to 1 if #snd_output_close should close
+ * \p fp by calling \c fclose.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close)
+{
+ snd_output_t *output;
+ snd_output_stdio_t *stdio;
+ assert(outputp && fp);
+ stdio = calloc(1, sizeof(*stdio));
+ if (!stdio)
+ return -ENOMEM;
+ output = calloc(1, sizeof(*output));
+ if (!output) {
+ free(stdio);
+ return -ENOMEM;
+ }
+ stdio->fp = fp;
+ stdio->close = _close;
+ output->type = SND_OUTPUT_STDIO;
+ output->ops = &snd_output_stdio_ops;
+ output->private_data = stdio;
+ *outputp = output;
+ return 0;
+}
+
+/**
+ * \brief Creates a new output object writing to a file.
+ * \param outputp The function puts the pointer to the new output object
+ * at the address specified by \p outputp.
+ * \param file The name of the file to open.
+ * \param mode The open mode, like \c fopen(3).
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode)
+{
+ int err;
+ FILE *fp = fopen(file, mode);
+ if (!fp) {
+ //SYSERR("fopen");
+ return -errno;
+ }
+ err = snd_output_stdio_attach(outputp, fp, 1);
+ if (err < 0)
+ fclose(fp);
+ return err;
+}
+
+#ifndef DOC_HIDDEN
+
+typedef struct _snd_output_buffer {
+ unsigned char *buf;
+ size_t alloc;
+ size_t size;
+} snd_output_buffer_t;
+
+static int snd_output_buffer_close(snd_output_t *output)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ free(buffer->buf);
+ free(buffer);
+ return 0;
+}
+
+static int snd_output_buffer_need(snd_output_t *output, size_t size)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ size_t _free = buffer->alloc - buffer->size;
+ size_t alloc;
+ unsigned char *buf;
+
+ if (_free >= size)
+ return _free;
+ if (buffer->alloc == 0)
+ alloc = 256;
+ else
+ alloc = buffer->alloc;
+ while (alloc < buffer->size + size)
+ alloc *= 2;
+ buf = realloc(buffer->buf, alloc);
+ if (!buf)
+ return -ENOMEM;
+ buffer->buf = buf;
+ buffer->alloc = alloc;
+ return buffer->alloc - buffer->size;
+}
+
+static int snd_output_buffer_print(snd_output_t *output, const char *format, va_list args)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ size_t size = 256;
+ int result;
+ result = snd_output_buffer_need(output, size);
+ if (result < 0)
+ return result;
+ result = vsnprintf((char *)buffer->buf + buffer->size, size, format, args);
+ assert(result >= 0);
+ if ((size_t)result <= size) {
+ buffer->size += result;
+ return result;
+ }
+ size = result;
+ result = snd_output_buffer_need(output, size);
+ if (result < 0)
+ return result;
+ result = vsnprintf((char *)buffer->buf + buffer->size, result, format, args);
+ assert(result == (int)size);
+ buffer->size += result;
+ return result;
+}
+
+static int snd_output_buffer_puts(snd_output_t *output, const char *str)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ size_t size = strlen(str);
+ int err;
+ err = snd_output_buffer_need(output, size);
+ if (err < 0)
+ return err;
+ memcpy(buffer->buf + buffer->size, str, size);
+ buffer->size += size;
+ return size;
+}
+
+static int snd_output_buffer_putc(snd_output_t *output, int c)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ int err;
+ err = snd_output_buffer_need(output, 1);
+ if (err < 0)
+ return err;
+ buffer->buf[buffer->size++] = c;
+ return 0;
+}
+
+static int snd_output_buffer_flush(snd_output_t *output ATTRIBUTE_UNUSED)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ buffer->size = 0;
+ return 0;
+}
+
+static const snd_output_ops_t snd_output_buffer_ops = {
+ .close = snd_output_buffer_close,
+ .print = snd_output_buffer_print,
+ .puts = snd_output_buffer_puts,
+ .putch = snd_output_buffer_putc,
+ .flush = snd_output_buffer_flush,
+};
+#endif
+
+/**
+ * \brief Returns the address of the buffer of a #SND_OUTPUT_TYPE_BUFFER output handle.
+ * \param output The output handle.
+ * \param buf The functions puts the current address of the buffer at the
+ * address specified by \p buf.
+ * \return The current size of valid data in the buffer.
+ *
+ * The address of the buffer may become invalid when output functions or
+ * #snd_output_close are called.
+ */
+size_t snd_output_buffer_string(snd_output_t *output, char **buf)
+{
+ snd_output_buffer_t *buffer = output->private_data;
+ *buf = (char *)buffer->buf;
+ return buffer->size;
+}
+
+/**
+ * \brief Creates a new output object with an auto-extending memory buffer.
+ * \param outputp The function puts the pointer to the new output object
+ * at the address specified by \p outputp.
+ * \return Zero if successful, otherwise a negative error code.
+ */
+int snd_output_buffer_open(snd_output_t **outputp)
+{
+ snd_output_t *output;
+ snd_output_buffer_t *buffer;
+ assert(outputp);
+ buffer = calloc(1, sizeof(*buffer));
+ if (!buffer)
+ return -ENOMEM;
+ output = calloc(1, sizeof(*output));
+ if (!output) {
+ free(buffer);
+ return -ENOMEM;
+ }
+ buffer->buf = NULL;
+ buffer->alloc = 0;
+ buffer->size = 0;
+ output->type = SND_OUTPUT_BUFFER;
+ output->ops = &snd_output_buffer_ops;
+ output->private_data = buffer;
+ *outputp = output;
+ return 0;
+}
+
diff --git a/alsa-lib/src/pcm/Makefile.am b/alsa-lib/src/pcm/Makefile.am
new file mode 100644
index 0000000..28faa54
--- /dev/null
+++ b/alsa-lib/src/pcm/Makefile.am
@@ -0,0 +1,117 @@
+SUBDIRS =
+DIST_SUBDIRS = scopes
+
+EXTRA_LTLIBRARIES = libpcm.la
+
+libpcm_la_SOURCES = atomic.c mask.c interval.c \
+ pcm.c pcm_params.c pcm_simple.c \
+ pcm_hw.c pcm_misc.c pcm_mmap.c pcm_symbols.c
+
+if BUILD_PCM_PLUGIN
+libpcm_la_SOURCES += pcm_generic.c pcm_plugin.c
+endif
+if BUILD_PCM_PLUGIN_COPY
+libpcm_la_SOURCES += pcm_copy.c
+endif
+if BUILD_PCM_PLUGIN_LINEAR
+libpcm_la_SOURCES += pcm_linear.c
+endif
+if BUILD_PCM_PLUGIN_ROUTE
+libpcm_la_SOURCES += pcm_route.c
+endif
+if BUILD_PCM_PLUGIN_MULAW
+libpcm_la_SOURCES += pcm_mulaw.c
+endif
+if BUILD_PCM_PLUGIN_ALAW
+libpcm_la_SOURCES += pcm_alaw.c
+endif
+if BUILD_PCM_PLUGIN_ADPCM
+libpcm_la_SOURCES += pcm_adpcm.c
+endif
+if BUILD_PCM_PLUGIN_RATE
+libpcm_la_SOURCES += pcm_rate.c pcm_rate_linear.c
+endif
+if BUILD_PCM_PLUGIN_PLUG
+libpcm_la_SOURCES += pcm_plug.c
+endif
+if BUILD_PCM_PLUGIN_MULTI
+libpcm_la_SOURCES += pcm_multi.c
+endif
+if BUILD_PCM_PLUGIN_SHM
+libpcm_la_SOURCES += pcm_shm.c
+endif
+if BUILD_PCM_PLUGIN_FILE
+libpcm_la_SOURCES += pcm_file.c
+endif
+if BUILD_PCM_PLUGIN_NULL
+libpcm_la_SOURCES += pcm_null.c
+endif
+if BUILD_PCM_PLUGIN_EMPTY
+libpcm_la_SOURCES += pcm_empty.c
+endif
+if BUILD_PCM_PLUGIN_SHARE
+libpcm_la_SOURCES += pcm_share.c
+endif
+if BUILD_PCM_PLUGIN_METER
+libpcm_la_SOURCES += pcm_meter.c
+endif
+if BUILD_PCM_PLUGIN_HOOKS
+libpcm_la_SOURCES += pcm_hooks.c
+endif
+if BUILD_PCM_PLUGIN_LFLOAT
+libpcm_la_SOURCES += pcm_lfloat.c
+endif
+if BUILD_PCM_PLUGIN_LADSPA
+libpcm_la_SOURCES += pcm_ladspa.c
+endif
+if BUILD_PCM_PLUGIN_DMIX
+libpcm_la_SOURCES += pcm_dmix.c
+endif
+if BUILD_PCM_PLUGIN_DSHARE
+libpcm_la_SOURCES += pcm_dshare.c
+endif
+if BUILD_PCM_PLUGIN_DSNOOP
+libpcm_la_SOURCES += pcm_dsnoop.c
+endif
+if BUILD_PCM_PLUGIN_DMIX
+libpcm_la_SOURCES += pcm_direct.c
+else
+if BUILD_PCM_PLUGIN_DSHARE
+libpcm_la_SOURCES += pcm_direct.c
+else
+if BUILD_PCM_PLUGIN_DSNOOP
+libpcm_la_SOURCES += pcm_direct.c
+endif
+endif
+endif
+if BUILD_PCM_PLUGIN_ASYM
+libpcm_la_SOURCES += pcm_asym.c
+endif
+if BUILD_PCM_PLUGIN_IEC958
+libpcm_la_SOURCES += pcm_iec958.c
+endif
+if BUILD_PCM_PLUGIN_SOFTVOL
+libpcm_la_SOURCES += pcm_softvol.c
+endif
+if BUILD_PCM_PLUGIN_EXTPLUG
+libpcm_la_SOURCES += pcm_extplug.c
+endif
+if BUILD_PCM_PLUGIN_IOPLUG
+libpcm_la_SOURCES += pcm_ioplug.c
+endif
+if BUILD_PCM_PLUGIN_MMAP_EMUL
+libpcm_la_SOURCES += pcm_mmap_emul.c
+endif
+
+EXTRA_DIST = pcm_dmix_i386.c pcm_dmix_x86_64.c pcm_dmix_generic.c
+
+noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \
+ interval.h interval_inline.h plugin_ops.h ladspa.h \
+ pcm_direct.h pcm_dmix_i386.h pcm_dmix_x86_64.h \
+ pcm_generic.h pcm_ext_parm.h
+
+alsadir = $(datadir)/alsa
+
+all: libpcm.la
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/pcm/Makefile.in b/alsa-lib/src/pcm/Makefile.in
new file mode 100644
index 0000000..db0320d
--- /dev/null
+++ b/alsa-lib/src/pcm/Makefile.in
@@ -0,0 +1,773 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_PCM_PLUGIN_TRUE@am__append_1 = pcm_generic.c pcm_plugin.c
+@BUILD_PCM_PLUGIN_COPY_TRUE@am__append_2 = pcm_copy.c
+@BUILD_PCM_PLUGIN_LINEAR_TRUE@am__append_3 = pcm_linear.c
+@BUILD_PCM_PLUGIN_ROUTE_TRUE@am__append_4 = pcm_route.c
+@BUILD_PCM_PLUGIN_MULAW_TRUE@am__append_5 = pcm_mulaw.c
+@BUILD_PCM_PLUGIN_ALAW_TRUE@am__append_6 = pcm_alaw.c
+@BUILD_PCM_PLUGIN_ADPCM_TRUE@am__append_7 = pcm_adpcm.c
+@BUILD_PCM_PLUGIN_RATE_TRUE@am__append_8 = pcm_rate.c pcm_rate_linear.c
+@BUILD_PCM_PLUGIN_PLUG_TRUE@am__append_9 = pcm_plug.c
+@BUILD_PCM_PLUGIN_MULTI_TRUE@am__append_10 = pcm_multi.c
+@BUILD_PCM_PLUGIN_SHM_TRUE@am__append_11 = pcm_shm.c
+@BUILD_PCM_PLUGIN_FILE_TRUE@am__append_12 = pcm_file.c
+@BUILD_PCM_PLUGIN_NULL_TRUE@am__append_13 = pcm_null.c
+@BUILD_PCM_PLUGIN_EMPTY_TRUE@am__append_14 = pcm_empty.c
+@BUILD_PCM_PLUGIN_SHARE_TRUE@am__append_15 = pcm_share.c
+@BUILD_PCM_PLUGIN_METER_TRUE@am__append_16 = pcm_meter.c
+@BUILD_PCM_PLUGIN_HOOKS_TRUE@am__append_17 = pcm_hooks.c
+@BUILD_PCM_PLUGIN_LFLOAT_TRUE@am__append_18 = pcm_lfloat.c
+@BUILD_PCM_PLUGIN_LADSPA_TRUE@am__append_19 = pcm_ladspa.c
+@BUILD_PCM_PLUGIN_DMIX_TRUE@am__append_20 = pcm_dmix.c
+@BUILD_PCM_PLUGIN_DSHARE_TRUE@am__append_21 = pcm_dshare.c
+@BUILD_PCM_PLUGIN_DSNOOP_TRUE@am__append_22 = pcm_dsnoop.c
+@BUILD_PCM_PLUGIN_DMIX_TRUE@am__append_23 = pcm_direct.c
+@BUILD_PCM_PLUGIN_DMIX_FALSE@@BUILD_PCM_PLUGIN_DSHARE_TRUE@am__append_24 = pcm_direct.c
+@BUILD_PCM_PLUGIN_DMIX_FALSE@@BUILD_PCM_PLUGIN_DSHARE_FALSE@@BUILD_PCM_PLUGIN_DSNOOP_TRUE@am__append_25 = pcm_direct.c
+@BUILD_PCM_PLUGIN_ASYM_TRUE@am__append_26 = pcm_asym.c
+@BUILD_PCM_PLUGIN_IEC958_TRUE@am__append_27 = pcm_iec958.c
+@BUILD_PCM_PLUGIN_SOFTVOL_TRUE@am__append_28 = pcm_softvol.c
+@BUILD_PCM_PLUGIN_EXTPLUG_TRUE@am__append_29 = pcm_extplug.c
+@BUILD_PCM_PLUGIN_IOPLUG_TRUE@am__append_30 = pcm_ioplug.c
+@BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@am__append_31 = pcm_mmap_emul.c
+subdir = src/pcm
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libpcm_la_LIBADD =
+am__libpcm_la_SOURCES_DIST = atomic.c mask.c interval.c pcm.c \
+ pcm_params.c pcm_simple.c pcm_hw.c pcm_misc.c pcm_mmap.c \
+ pcm_symbols.c pcm_generic.c pcm_plugin.c pcm_copy.c \
+ pcm_linear.c pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \
+ pcm_rate.c pcm_rate_linear.c pcm_plug.c pcm_multi.c pcm_shm.c \
+ pcm_file.c pcm_null.c pcm_empty.c pcm_share.c pcm_meter.c \
+ pcm_hooks.c pcm_lfloat.c pcm_ladspa.c pcm_dmix.c pcm_dshare.c \
+ pcm_dsnoop.c pcm_direct.c pcm_asym.c pcm_iec958.c \
+ pcm_softvol.c pcm_extplug.c pcm_ioplug.c pcm_mmap_emul.c
+@BUILD_PCM_PLUGIN_TRUE@am__objects_1 = pcm_generic.lo pcm_plugin.lo
+@BUILD_PCM_PLUGIN_COPY_TRUE@am__objects_2 = pcm_copy.lo
+@BUILD_PCM_PLUGIN_LINEAR_TRUE@am__objects_3 = pcm_linear.lo
+@BUILD_PCM_PLUGIN_ROUTE_TRUE@am__objects_4 = pcm_route.lo
+@BUILD_PCM_PLUGIN_MULAW_TRUE@am__objects_5 = pcm_mulaw.lo
+@BUILD_PCM_PLUGIN_ALAW_TRUE@am__objects_6 = pcm_alaw.lo
+@BUILD_PCM_PLUGIN_ADPCM_TRUE@am__objects_7 = pcm_adpcm.lo
+@BUILD_PCM_PLUGIN_RATE_TRUE@am__objects_8 = pcm_rate.lo \
+@BUILD_PCM_PLUGIN_RATE_TRUE@ pcm_rate_linear.lo
+@BUILD_PCM_PLUGIN_PLUG_TRUE@am__objects_9 = pcm_plug.lo
+@BUILD_PCM_PLUGIN_MULTI_TRUE@am__objects_10 = pcm_multi.lo
+@BUILD_PCM_PLUGIN_SHM_TRUE@am__objects_11 = pcm_shm.lo
+@BUILD_PCM_PLUGIN_FILE_TRUE@am__objects_12 = pcm_file.lo
+@BUILD_PCM_PLUGIN_NULL_TRUE@am__objects_13 = pcm_null.lo
+@BUILD_PCM_PLUGIN_EMPTY_TRUE@am__objects_14 = pcm_empty.lo
+@BUILD_PCM_PLUGIN_SHARE_TRUE@am__objects_15 = pcm_share.lo
+@BUILD_PCM_PLUGIN_METER_TRUE@am__objects_16 = pcm_meter.lo
+@BUILD_PCM_PLUGIN_HOOKS_TRUE@am__objects_17 = pcm_hooks.lo
+@BUILD_PCM_PLUGIN_LFLOAT_TRUE@am__objects_18 = pcm_lfloat.lo
+@BUILD_PCM_PLUGIN_LADSPA_TRUE@am__objects_19 = pcm_ladspa.lo
+@BUILD_PCM_PLUGIN_DMIX_TRUE@am__objects_20 = pcm_dmix.lo
+@BUILD_PCM_PLUGIN_DSHARE_TRUE@am__objects_21 = pcm_dshare.lo
+@BUILD_PCM_PLUGIN_DSNOOP_TRUE@am__objects_22 = pcm_dsnoop.lo
+@BUILD_PCM_PLUGIN_DMIX_TRUE@am__objects_23 = pcm_direct.lo
+@BUILD_PCM_PLUGIN_DMIX_FALSE@@BUILD_PCM_PLUGIN_DSHARE_TRUE@am__objects_24 = pcm_direct.lo
+@BUILD_PCM_PLUGIN_DMIX_FALSE@@BUILD_PCM_PLUGIN_DSHARE_FALSE@@BUILD_PCM_PLUGIN_DSNOOP_TRUE@am__objects_25 = pcm_direct.lo
+@BUILD_PCM_PLUGIN_ASYM_TRUE@am__objects_26 = pcm_asym.lo
+@BUILD_PCM_PLUGIN_IEC958_TRUE@am__objects_27 = pcm_iec958.lo
+@BUILD_PCM_PLUGIN_SOFTVOL_TRUE@am__objects_28 = pcm_softvol.lo
+@BUILD_PCM_PLUGIN_EXTPLUG_TRUE@am__objects_29 = pcm_extplug.lo
+@BUILD_PCM_PLUGIN_IOPLUG_TRUE@am__objects_30 = pcm_ioplug.lo
+@BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@am__objects_31 = pcm_mmap_emul.lo
+am_libpcm_la_OBJECTS = atomic.lo mask.lo interval.lo pcm.lo \
+ pcm_params.lo pcm_simple.lo pcm_hw.lo pcm_misc.lo pcm_mmap.lo \
+ pcm_symbols.lo $(am__objects_1) $(am__objects_2) \
+ $(am__objects_3) $(am__objects_4) $(am__objects_5) \
+ $(am__objects_6) $(am__objects_7) $(am__objects_8) \
+ $(am__objects_9) $(am__objects_10) $(am__objects_11) \
+ $(am__objects_12) $(am__objects_13) $(am__objects_14) \
+ $(am__objects_15) $(am__objects_16) $(am__objects_17) \
+ $(am__objects_18) $(am__objects_19) $(am__objects_20) \
+ $(am__objects_21) $(am__objects_22) $(am__objects_23) \
+ $(am__objects_24) $(am__objects_25) $(am__objects_26) \
+ $(am__objects_27) $(am__objects_28) $(am__objects_29) \
+ $(am__objects_30) $(am__objects_31)
+libpcm_la_OBJECTS = $(am_libpcm_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libpcm_la_SOURCES)
+DIST_SOURCES = $(am__libpcm_la_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS =
+DIST_SUBDIRS = scopes
+EXTRA_LTLIBRARIES = libpcm.la
+libpcm_la_SOURCES = atomic.c mask.c interval.c pcm.c pcm_params.c \
+ pcm_simple.c pcm_hw.c pcm_misc.c pcm_mmap.c pcm_symbols.c \
+ $(am__append_1) $(am__append_2) $(am__append_3) \
+ $(am__append_4) $(am__append_5) $(am__append_6) \
+ $(am__append_7) $(am__append_8) $(am__append_9) \
+ $(am__append_10) $(am__append_11) $(am__append_12) \
+ $(am__append_13) $(am__append_14) $(am__append_15) \
+ $(am__append_16) $(am__append_17) $(am__append_18) \
+ $(am__append_19) $(am__append_20) $(am__append_21) \
+ $(am__append_22) $(am__append_23) $(am__append_24) \
+ $(am__append_25) $(am__append_26) $(am__append_27) \
+ $(am__append_28) $(am__append_29) $(am__append_30) \
+ $(am__append_31)
+EXTRA_DIST = pcm_dmix_i386.c pcm_dmix_x86_64.c pcm_dmix_generic.c
+noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \
+ interval.h interval_inline.h plugin_ops.h ladspa.h \
+ pcm_direct.h pcm_dmix_i386.h pcm_dmix_x86_64.h \
+ pcm_generic.h pcm_ext_parm.h
+
+alsadir = $(datadir)/alsa
+INCLUDES = -I$(top_srcdir)/include
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/pcm/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/pcm/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libpcm.la: $(libpcm_la_OBJECTS) $(libpcm_la_DEPENDENCIES)
+ $(LINK) $(libpcm_la_LDFLAGS) $(libpcm_la_OBJECTS) $(libpcm_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interval.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mask.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_adpcm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_alaw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_asym.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_copy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_direct.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_dmix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_dshare.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_dsnoop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_empty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_extplug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_generic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_hooks.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_iec958.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_ioplug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_ladspa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_lfloat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_linear.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_meter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_misc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_mmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_mmap_emul.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_mulaw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_multi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_null.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_params.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_plug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_rate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_rate_linear.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_route.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_share.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_shm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_simple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_softvol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_symbols.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am
+
+
+all: libpcm.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/pcm/atomic.c b/alsa-lib/src/pcm/atomic.c
new file mode 100644
index 0000000..7565945
--- /dev/null
+++ b/alsa-lib/src/pcm/atomic.c
@@ -0,0 +1,43 @@
+/*
+ * Atomic read/write
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdlib.h>
+#include <time.h>
+#include <sched.h>
+#include "iatomic.h"
+
+void snd_atomic_read_wait(snd_atomic_read_t *t)
+{
+ volatile const snd_atomic_write_t *w = t->write;
+ unsigned int loops = 0;
+ struct timespec ts;
+ while (w->begin != w->end) {
+ if (loops < MAX_SPIN_COUNT) {
+ sched_yield();
+ loops++;
+ continue;
+ }
+ loops = 0;
+ ts.tv_sec = 0;
+ ts.tv_nsec = SPIN_SLEEP_DURATION;
+ nanosleep(&ts, NULL);
+ }
+}
+
diff --git a/alsa-lib/src/pcm/interval.c b/alsa-lib/src/pcm/interval.c
new file mode 100644
index 0000000..6e39808
--- /dev/null
+++ b/alsa-lib/src/pcm/interval.c
@@ -0,0 +1,441 @@
+/*
+ * Interval functions
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define SND_INTERVAL_C
+#define SND_INTERVAL_INLINE
+
+#include <sys/types.h>
+#include <limits.h>
+#include "pcm_local.h"
+
+static inline void div64_32(u_int64_t *n, u_int32_t d, u_int32_t *rem)
+{
+ *rem = *n % d;
+ *n /= d;
+}
+
+static inline unsigned int div32(unsigned int a, unsigned int b,
+ unsigned int *r)
+{
+ if (b == 0) {
+ *r = 0;
+ return UINT_MAX;
+ }
+ *r = a % b;
+ return a / b;
+}
+
+static inline unsigned int div_down(unsigned int a, unsigned int b)
+{
+ if (b == 0)
+ return UINT_MAX;
+ return a / b;
+}
+
+static inline unsigned int div_up(unsigned int a, unsigned int b)
+{
+ unsigned int r;
+ unsigned int q;
+ if (b == 0)
+ return UINT_MAX;
+ q = div32(a, b, &r);
+ if (r)
+ ++q;
+ return q;
+}
+
+static inline unsigned int mul(unsigned int a, unsigned int b)
+{
+ if (a == 0)
+ return 0;
+ if (div_down(UINT_MAX, a) < b)
+ return UINT_MAX;
+ return a * b;
+}
+
+static inline unsigned int add(unsigned int a, unsigned int b)
+{
+ if (a >= UINT_MAX - b)
+ return UINT_MAX;
+ return a + b;
+}
+
+static inline unsigned int sub(unsigned int a, unsigned int b)
+{
+ if (a > b)
+ return a - b;
+ return 0;
+}
+
+static inline unsigned int muldiv32(unsigned int a, unsigned int b,
+ unsigned int c, unsigned int *r)
+{
+ u_int64_t n = (u_int64_t) a * b;
+ if (c == 0) {
+ assert(n > 0);
+ *r = 0;
+ return UINT_MAX;
+ }
+ div64_32(&n, c, r);
+ if (n >= UINT_MAX) {
+ *r = 0;
+ return UINT_MAX;
+ }
+ return n;
+}
+
+int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int openmin)
+{
+ int changed = 0;
+ if (snd_interval_empty(i))
+ return -ENOENT;
+ if (i->min < min) {
+ i->min = min;
+ i->openmin = openmin;
+ changed = 1;
+ } else if (i->min == min && !i->openmin && openmin) {
+ i->openmin = 1;
+ changed = 1;
+ }
+ if (i->integer) {
+ if (i->openmin) {
+ i->min++;
+ i->openmin = 0;
+ }
+ }
+ if (snd_interval_checkempty(i)) {
+ snd_interval_none(i);
+ return -EINVAL;
+ }
+ return changed;
+}
+
+int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int openmax)
+{
+ int changed = 0;
+ if (snd_interval_empty(i))
+ return -ENOENT;
+ if (i->max > max) {
+ i->max = max;
+ i->openmax = openmax;
+ changed = 1;
+ } else if (i->max == max && !i->openmax && openmax) {
+ i->openmax = 1;
+ changed = 1;
+ }
+ if (i->integer) {
+ if (i->openmax) {
+ i->max--;
+ i->openmax = 0;
+ }
+ }
+ if (snd_interval_checkempty(i)) {
+ snd_interval_none(i);
+ return -EINVAL;
+ }
+ return changed;
+}
+
+/* r <- v */
+int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v)
+{
+ int changed = 0;
+ if (snd_interval_empty(i))
+ return -ENOENT;
+ if (i->min < v->min) {
+ i->min = v->min;
+ i->openmin = v->openmin;
+ changed = 1;
+ } else if (i->min == v->min && !i->openmin && v->openmin) {
+ i->openmin = 1;
+ changed = 1;
+ }
+ if (i->max > v->max) {
+ i->max = v->max;
+ i->openmax = v->openmax;
+ changed = 1;
+ } else if (i->max == v->max && !i->openmax && v->openmax) {
+ i->openmax = 1;
+ changed = 1;
+ }
+ if (!i->integer && v->integer) {
+ i->integer = 1;
+ changed = 1;
+ }
+ if (i->integer) {
+ if (i->openmin) {
+ i->min++;
+ i->openmin = 0;
+ }
+ if (i->openmax) {
+ i->max--;
+ i->openmax = 0;
+ }
+ } else if (!i->openmin && !i->openmax && i->min == i->max)
+ i->integer = 1;
+ if (snd_interval_checkempty(i)) {
+ snd_interval_none(i);
+ return -EINVAL;
+ }
+ return changed;
+}
+
+int snd_interval_refine_first(snd_interval_t *i)
+{
+ if (snd_interval_empty(i))
+ return -ENOENT;
+ if (snd_interval_single(i))
+ return 0;
+ i->max = i->min;
+ i->openmax = i->openmin;
+ if (i->openmax)
+ i->max++;
+ return 1;
+}
+
+int snd_interval_refine_last(snd_interval_t *i)
+{
+ if (snd_interval_empty(i))
+ return -ENOENT;
+ if (snd_interval_single(i))
+ return 0;
+ i->min = i->max;
+ i->openmin = i->openmax;
+ if (i->openmin)
+ i->min--;
+ return 1;
+}
+
+int snd_interval_refine_set(snd_interval_t *i, unsigned int val)
+{
+ snd_interval_t t;
+ t.empty = 0;
+ t.min = t.max = val;
+ t.openmin = t.openmax = 0;
+ t.integer = 1;
+ return snd_interval_refine(i, &t);
+}
+
+void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c)
+{
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = add(a->min, b->min);
+ c->openmin = (a->openmin || b->openmin);
+ c->max = add(a->max, b->max);
+ c->openmax = (a->openmax || b->openmax);
+ c->integer = (a->integer && b->integer);
+}
+
+void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c)
+{
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = sub(a->min, b->max);
+ c->openmin = (a->openmin || b->openmax);
+ c->max = add(a->max, b->min);
+ c->openmax = (a->openmax || b->openmin);
+ c->integer = (a->integer && b->integer);
+}
+
+void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c)
+{
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = mul(a->min, b->min);
+ c->openmin = (a->openmin || b->openmin);
+ c->max = mul(a->max, b->max);
+ c->openmax = (a->openmax || b->openmax);
+ c->integer = (a->integer && b->integer);
+}
+
+void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c)
+{
+ unsigned int r;
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = div32(a->min, b->max, &r);
+ c->openmin = (r || a->openmin || b->openmax);
+ if (b->min > 0) {
+ c->max = div32(a->max, b->min, &r);
+ if (r) {
+ c->max++;
+ c->openmax = 1;
+ } else
+ c->openmax = (a->openmax || b->openmin);
+ } else {
+ c->max = UINT_MAX;
+ c->openmax = 0;
+ }
+ c->integer = 0;
+}
+
+/* a * b / c */
+void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b,
+ const snd_interval_t *c, snd_interval_t *d)
+{
+ unsigned int r;
+ if (a->empty || b->empty || c->empty) {
+ snd_interval_none(d);
+ return;
+ }
+ d->empty = 0;
+ d->min = muldiv32(a->min, b->min, c->max, &r);
+ d->openmin = (r || a->openmin || b->openmin || c->openmax);
+ d->max = muldiv32(a->max, b->max, c->min, &r);
+ if (r) {
+ d->max++;
+ d->openmax = 1;
+ } else
+ d->openmax = (a->openmax || b->openmax || c->openmin);
+ d->integer = 0;
+}
+
+/* a * b / k */
+void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
+ unsigned int k, snd_interval_t *c)
+{
+ unsigned int r;
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = muldiv32(a->min, b->min, k, &r);
+ c->openmin = (r || a->openmin || b->openmin);
+ c->max = muldiv32(a->max, b->max, k, &r);
+ if (r) {
+ c->max++;
+ c->openmax = 1;
+ } else
+ c->openmax = (a->openmax || b->openmax);
+ c->integer = 0;
+}
+
+/* a * k / b */
+void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
+ const snd_interval_t *b, snd_interval_t *c)
+{
+ unsigned int r;
+ if (a->empty || b->empty) {
+ snd_interval_none(c);
+ return;
+ }
+ c->empty = 0;
+ c->min = muldiv32(a->min, k, b->max, &r);
+ c->openmin = (r || a->openmin || b->openmax);
+ if (b->min > 0) {
+ c->max = muldiv32(a->max, k, b->min, &r);
+ if (r) {
+ c->max++;
+ c->openmax = 1;
+ } else
+ c->openmax = (a->openmax || b->openmin);
+ } else {
+ c->max = UINT_MAX;
+ c->openmax = 0;
+ }
+ c->integer = 0;
+}
+
+void snd_interval_print(const snd_interval_t *i, snd_output_t *out)
+{
+ if (snd_interval_empty(i))
+ snd_output_printf(out, "NONE");
+ else if (i->min == 0 && i->openmin == 0 &&
+ i->max == UINT_MAX && i->openmax == 0)
+ snd_output_printf(out, "ALL");
+ else if (snd_interval_single(i) && i->integer)
+ snd_output_printf(out, "%u", snd_interval_value(i));
+ else
+ snd_output_printf(out, "%c%u %u%c",
+ i->openmin ? '(' : '[',
+ i->min, i->max,
+ i->openmax ? ')' : ']');
+}
+
+#if 0
+static void boundary_abs(int a, int adir, int *b, int *bdir)
+{
+ if (a < 0 || (a == 0 && adir < 0)) {
+ *b = -a;
+ *bdir = -adir;
+ } else {
+ *b = a;
+ *bdir = adir;
+ }
+}
+#endif
+
+void boundary_sub(int a, int adir, int b, int bdir, int *c, int *cdir)
+{
+ adir = adir < 0 ? -1 : (adir > 0 ? 1 : 0);
+ bdir = bdir < 0 ? -1 : (bdir > 0 ? 1 : 0);
+ *c = a - b;
+ *cdir = adir - bdir;
+ if (*cdir == -2) {
+ assert(*c > INT_MIN);
+ (*c)--;
+ } else if (*cdir == 2) {
+ assert(*c < INT_MAX);
+ (*c)++;
+ }
+}
+
+int boundary_lt(unsigned int a, int adir, unsigned int b, int bdir)
+{
+ assert(a > 0 || adir >= 0);
+ assert(b > 0 || bdir >= 0);
+ if (adir < 0) {
+ a--;
+ adir = 1;
+ } else if (adir > 0)
+ adir = 1;
+ if (bdir < 0) {
+ b--;
+ bdir = 1;
+ } else if (bdir > 0)
+ bdir = 1;
+ return a < b || (a == b && adir < bdir);
+}
+
+/* Return 1 if min is nearer to best than max */
+int boundary_nearer(int min, int mindir, int best, int bestdir, int max, int maxdir)
+{
+ int dmin, dmindir;
+ int dmax, dmaxdir;
+ boundary_sub(best, bestdir, min, mindir, &dmin, &dmindir);
+ boundary_sub(max, maxdir, best, bestdir, &dmax, &dmaxdir);
+ return boundary_lt(dmin, dmindir, dmax, dmaxdir);
+}
+
diff --git a/alsa-lib/src/pcm/interval.h b/alsa-lib/src/pcm/interval.h
new file mode 100644
index 0000000..330b056
--- /dev/null
+++ b/alsa-lib/src/pcm/interval.h
@@ -0,0 +1,80 @@
+/*
+ * Interval header
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+typedef struct _snd_interval snd_interval_t;
+
+#ifdef SND_INTERVAL_INLINE
+#include "interval_inline.h"
+#else
+void snd_interval_any(snd_interval_t *i);
+void snd_interval_none(snd_interval_t *i);
+int snd_interval_setinteger(snd_interval_t *i);
+int snd_interval_empty(const snd_interval_t *i);
+int snd_interval_single(const snd_interval_t *i);
+int snd_interval_value(const snd_interval_t *i);
+void snd_interval_set_value(snd_interval_t *i, unsigned int val);
+int snd_interval_min(const snd_interval_t *i);
+int snd_interval_max(const snd_interval_t *i);
+void snd_interval_set_minmax(snd_interval_t *i, unsigned int min, unsigned int max);
+int snd_interval_test(const snd_interval_t *i, unsigned int val);
+void snd_interval_copy(snd_interval_t *dst, const snd_interval_t *src);
+void snd_interval_floor(snd_interval_t *i);
+void snd_interval_unfloor(snd_interval_t *i);
+int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2);
+int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2);
+#endif
+
+/* make local functions really local */
+#define snd_interval_add snd1_interval_add
+#define snd_interval_sub snd1_interval_sub
+#define snd_interval_mul snd1_interval_mul
+#define snd_interval_div snd1_interval_div
+#define snd_interval_muldiv snd1_interval_muldiv
+#define snd_interval_muldivk snd1_interval_muldivk
+#define snd_interval_mulkdiv snd1_interval_mulkdiv
+#define snd_interval_print snd1_interval_print
+#define snd_interval_refine_min snd1_interval_refine_min
+#define snd_interval_refine_max snd1_interval_refine_max
+#define snd_interval_refine snd1_interval_refine
+#define snd_interval_refine_first snd1_interval_refine_first
+#define snd_interval_refine_last snd1_interval_refine_last
+#define snd_interval_refine_set snd1_interval_refine_set
+
+void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
+void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
+void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
+void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
+void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b,
+ const snd_interval_t *c, snd_interval_t *d);
+void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
+ unsigned int k, snd_interval_t *c);
+void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
+ const snd_interval_t *b, snd_interval_t *c);
+void snd_interval_print(const snd_interval_t *i, snd_output_t *out);
+int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int openmin);
+int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int openmax);
+int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v);
+int snd_interval_refine_first(snd_interval_t *i);
+int snd_interval_refine_last(snd_interval_t *i);
+int snd_interval_refine_set(snd_interval_t *i, unsigned int val);
+void boundary_sub(int a, int adir, int b, int bdir, int *c, int *cdir);
+int boundary_lt(unsigned int a, int adir, unsigned int b, int bdir);
+int boundary_nearer(int min, int mindir, int best, int bestdir, int max, int maxdir);
diff --git a/alsa-lib/src/pcm/interval_inline.h b/alsa-lib/src/pcm/interval_inline.h
new file mode 100644
index 0000000..bf6b784
--- /dev/null
+++ b/alsa-lib/src/pcm/interval_inline.h
@@ -0,0 +1,157 @@
+/*
+ * Interval inlines
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define INTERVAL_INLINE static inline
+
+INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
+{
+ i->min = 0;
+ i->openmin = 0;
+ i->max = UINT_MAX;
+ i->openmax = 0;
+ i->integer = 0;
+ i->empty = 0;
+}
+
+INTERVAL_INLINE void snd_interval_none(snd_interval_t *i)
+{
+ i->empty = 1;
+}
+
+INTERVAL_INLINE int snd_interval_checkempty(const snd_interval_t *i)
+{
+ return (i->min > i->max ||
+ (i->min == i->max && (i->openmin || i->openmax)));
+}
+
+INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i)
+{
+ return i->empty;
+}
+
+INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
+{
+ assert(!snd_interval_empty(i));
+ return (i->min == i->max ||
+ (i->min + 1 == i->max && i->openmax));
+}
+
+INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i)
+{
+ assert(snd_interval_single(i));
+ return i->min;
+}
+
+INTERVAL_INLINE void snd_interval_set_value(snd_interval_t *i, unsigned int val)
+{
+ i->openmax = i->openmin = 0;
+ i->min = i->max = val;
+ i->integer = 0;
+ i->empty = 0;
+}
+
+INTERVAL_INLINE int snd_interval_min(const snd_interval_t *i)
+{
+ assert(!snd_interval_empty(i));
+ return i->min;
+}
+
+INTERVAL_INLINE int snd_interval_max(const snd_interval_t *i)
+{
+ assert(!snd_interval_empty(i));
+ return i->max;
+}
+
+INTERVAL_INLINE void snd_interval_set_minmax(snd_interval_t *i, unsigned int min, unsigned int max)
+{
+ i->openmax = i->openmin = 0;
+ i->min = min;
+ i->max = max;
+ i->integer = 0;
+ i->empty = 0;
+}
+
+INTERVAL_INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val)
+{
+ return !((i->min > val || (i->min == val && i->openmin) ||
+ i->max < val || (i->max == val && i->openmax)));
+}
+
+INTERVAL_INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s)
+{
+ *d = *s;
+}
+
+INTERVAL_INLINE int snd_interval_setinteger(snd_interval_t *i)
+{
+ if (i->integer)
+ return 0;
+ if (i->openmin && i->openmax && i->min == i->max)
+ return -EINVAL;
+ i->integer = 1;
+ return 1;
+}
+
+INTERVAL_INLINE void snd_interval_floor(snd_interval_t *i)
+{
+ if (i->integer || snd_interval_empty(i))
+ return;
+ i->openmin = 0;
+ if (i->openmax) {
+ i->max--;
+ i->openmax = 0;
+ }
+ i->integer = 1;
+}
+
+INTERVAL_INLINE void snd_interval_unfloor(snd_interval_t *i)
+{
+ if (snd_interval_empty(i))
+ return;
+ if (i->max == UINT_MAX)
+ return;
+ if (i->openmax)
+ return;
+ i->max++;
+ i->openmax = 1;
+ i->integer = 0;
+}
+
+
+INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2)
+{
+ return snd_interval_single(i1) && snd_interval_single(i2) &&
+ snd_interval_value(i1) == snd_interval_value(i2);
+}
+
+INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
+{
+
+ return (i1->max < i2->min ||
+ (i1->max == i2->min &&
+ (i1->openmax || i1->openmin)) ||
+ i1->min > i2->max ||
+ (i1->min == i2->max &&
+ (i1->openmin || i2->openmax)));
+}
+
+
+
diff --git a/alsa-lib/src/pcm/ladspa.h b/alsa-lib/src/pcm/ladspa.h
new file mode 100644
index 0000000..5c30a8a
--- /dev/null
+++ b/alsa-lib/src/pcm/ladspa.h
@@ -0,0 +1,603 @@
+/* ladspa.h
+
+ Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
+ Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
+ Stefan Westerfeld.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License
+ as published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA. */
+
+#ifndef LADSPA_INCLUDED
+#define LADSPA_INCLUDED
+
+#define LADSPA_VERSION "1.1"
+#define LADSPA_VERSION_MAJOR 1
+#define LADSPA_VERSION_MINOR 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************/
+
+/* Overview:
+
+ There is a large number of synthesis packages in use or development
+ on the Linux platform at this time. This API (`The Linux Audio
+ Developer's Simple Plugin API') attempts to give programmers the
+ ability to write simple `plugin' audio processors in C/C++ and link
+ them dynamically (`plug') into a range of these packages (`hosts').
+ It should be possible for any host and any plugin to communicate
+ completely through this interface.
+
+ This API is deliberately short and simple. To achieve compatibility
+ with a range of promising Linux sound synthesis packages it
+ attempts to find the `greatest common divisor' in their logical
+ behaviour. Having said this, certain limiting decisions are
+ implicit, notably the use of a fixed type (LADSPA_Data) for all
+ data transfer and absence of a parameterised `initialisation'
+ phase. See below for the LADSPA_Data typedef.
+
+ Plugins are expected to distinguish between control and audio
+ data. Plugins have `ports' that are inputs or outputs for audio or
+ control data and each plugin is `run' for a `block' corresponding
+ to a short time interval measured in samples. Audio data is
+ communicated using arrays of LADSPA_Data, allowing a block of audio
+ to be processed by the plugin in a single pass. Control data is
+ communicated using single LADSPA_Data values. Control data has a
+ single value at the start of a call to the `run()' or `run_adding()'
+ function, and may be considered to remain this value for its
+ duration. The plugin may assume that all its input and output ports
+ have been connected to the relevant data location (see the
+ `connect_port()' function below) before it is asked to run.
+
+ Plugins will reside in shared object files suitable for dynamic
+ linking by dlopen() and family. The file will provide a number of
+ `plugin types' that can be used to instantiate actual plugins
+ (sometimes known as `plugin instances') that can be connected
+ together to perform tasks.
+
+ This API contains very limited error-handling. */
+
+/*****************************************************************************/
+
+/* Fundamental data type passed in and out of plugin. This data type
+ is used to communicate audio samples and control values. It is
+ assumed that the plugin will work sensibly given any numeric input
+ value although it may have a preferred range (see hints below).
+
+ For audio it is generally assumed that 1.0f is the `0dB' reference
+ amplitude and is a `normal' signal level. */
+
+typedef float LADSPA_Data;
+
+/*****************************************************************************/
+
+/* Special Plugin Properties:
+
+ Optional features of the plugin type are encapsulated in the
+ LADSPA_Properties type. This is assembled by ORing individual
+ properties together. */
+
+typedef int LADSPA_Properties;
+
+/* Property LADSPA_PROPERTY_REALTIME indicates that the plugin has a
+ real-time dependency (e.g. listens to a MIDI device) and so its
+ output must not be cached or subject to significant latency. */
+#define LADSPA_PROPERTY_REALTIME 0x1
+
+/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
+ may cease to work correctly if the host elects to use the same data
+ location for both input and output (see connect_port()). This
+ should be avoided as enabling this flag makes it impossible for
+ hosts to use the plugin to process audio `in-place.' */
+#define LADSPA_PROPERTY_INPLACE_BROKEN 0x2
+
+/* Property LADSPA_PROPERTY_HARD_RT_CAPABLE indicates that the plugin
+ is capable of running not only in a conventional host but also in a
+ `hard real-time' environment. To qualify for this the plugin must
+ satisfy all of the following:
+
+ (1) The plugin must not use malloc(), free() or other heap memory
+ management within its run() or run_adding() functions. All new
+ memory used in run() must be managed via the stack. These
+ restrictions only apply to the run() function.
+
+ (2) The plugin will not attempt to make use of any library
+ functions with the exceptions of functions in the ANSI standard C
+ and C maths libraries, which the host is expected to provide.
+
+ (3) The plugin will not access files, devices, pipes, sockets, IPC
+ or any other mechanism that might result in process or thread
+ blocking.
+
+ (4) The plugin will take an amount of time to execute a run() or
+ run_adding() call approximately of form (A+B*SampleCount) where A
+ and B depend on the machine and host in use. This amount of time
+ may not depend on input signals or plugin state. The host is left
+ the responsibility to perform timings to estimate upper bounds for
+ A and B. */
+#define LADSPA_PROPERTY_HARD_RT_CAPABLE 0x4
+
+#define LADSPA_IS_REALTIME(x) ((x) & LADSPA_PROPERTY_REALTIME)
+#define LADSPA_IS_INPLACE_BROKEN(x) ((x) & LADSPA_PROPERTY_INPLACE_BROKEN)
+#define LADSPA_IS_HARD_RT_CAPABLE(x) ((x) & LADSPA_PROPERTY_HARD_RT_CAPABLE)
+
+/*****************************************************************************/
+
+/* Plugin Ports:
+
+ Plugins have `ports' that are inputs or outputs for audio or
+ data. Ports can communicate arrays of LADSPA_Data (for audio
+ inputs/outputs) or single LADSPA_Data values (for control
+ input/outputs). This information is encapsulated in the
+ LADSPA_PortDescriptor type which is assembled by ORing individual
+ properties together.
+
+ Note that a port must be an input or an output port but not both
+ and that a port must be a control or audio port but not both. */
+
+typedef int LADSPA_PortDescriptor;
+
+/* Property LADSPA_PORT_INPUT indicates that the port is an input. */
+#define LADSPA_PORT_INPUT 0x1
+
+/* Property LADSPA_PORT_OUTPUT indicates that the port is an output. */
+#define LADSPA_PORT_OUTPUT 0x2
+
+/* Property LADSPA_PORT_CONTROL indicates that the port is a control
+ port. */
+#define LADSPA_PORT_CONTROL 0x4
+
+/* Property LADSPA_PORT_AUDIO indicates that the port is a audio
+ port. */
+#define LADSPA_PORT_AUDIO 0x8
+
+#define LADSPA_IS_PORT_INPUT(x) ((x) & LADSPA_PORT_INPUT)
+#define LADSPA_IS_PORT_OUTPUT(x) ((x) & LADSPA_PORT_OUTPUT)
+#define LADSPA_IS_PORT_CONTROL(x) ((x) & LADSPA_PORT_CONTROL)
+#define LADSPA_IS_PORT_AUDIO(x) ((x) & LADSPA_PORT_AUDIO)
+
+/*****************************************************************************/
+
+/* Plugin Port Range Hints:
+
+ The host may wish to provide a representation of data entering or
+ leaving a plugin (e.g. to generate a GUI automatically). To make
+ this more meaningful, the plugin should provide `hints' to the host
+ describing the usual values taken by the data.
+
+ Note that these are only hints. The host may ignore them and the
+ plugin must not assume that data supplied to it is meaningful. If
+ the plugin receives invalid input data it is expected to continue
+ to run without failure and, where possible, produce a sensible
+ output (e.g. a high-pass filter given a negative cutoff frequency
+ might switch to an all-pass mode).
+
+ Hints are meaningful for all input and output ports but hints for
+ input control ports are expected to be particularly useful.
+
+ More hint information is encapsulated in the
+ LADSPA_PortRangeHintDescriptor type which is assembled by ORing
+ individual hint types together. Hints may require further
+ LowerBound and UpperBound information.
+
+ All the hint information for a particular port is aggregated in the
+ LADSPA_PortRangeHint structure. */
+
+typedef int LADSPA_PortRangeHintDescriptor;
+
+/* Hint LADSPA_HINT_BOUNDED_BELOW indicates that the LowerBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) lower
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of LowerBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_BELOW 0x1
+
+/* Hint LADSPA_HINT_BOUNDED_ABOVE indicates that the UpperBound field
+ of the LADSPA_PortRangeHint should be considered meaningful. The
+ value in this field should be considered the (inclusive) upper
+ bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
+ specified then the value of UpperBound should be multiplied by the
+ sample rate. */
+#define LADSPA_HINT_BOUNDED_ABOVE 0x2
+
+/* Hint LADSPA_HINT_TOGGLED indicates that the data item should be
+ considered a Boolean toggle. Data less than or equal to zero should
+ be considered `off' or `false,' and data above zero should be
+ considered `on' or `true.' LADSPA_HINT_TOGGLED may not be used in
+ conjunction with any other hint except LADSPA_HINT_DEFAULT_0 or
+ LADSPA_HINT_DEFAULT_1. */
+#define LADSPA_HINT_TOGGLED 0x4
+
+/* Hint LADSPA_HINT_SAMPLE_RATE indicates that any bounds specified
+ should be interpreted as multiples of the sample rate. For
+ instance, a frequency range from 0Hz to the Nyquist frequency (half
+ the sample rate) could be requested by this hint in conjunction
+ with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds
+ at all must support this hint to retain meaning. */
+#define LADSPA_HINT_SAMPLE_RATE 0x8
+
+/* Hint LADSPA_HINT_LOGARITHMIC indicates that it is likely that the
+ user will find it more intuitive to view values using a logarithmic
+ scale. This is particularly useful for frequencies and gains. */
+#define LADSPA_HINT_LOGARITHMIC 0x10
+
+/* Hint LADSPA_HINT_INTEGER indicates that a user interface would
+ probably wish to provide a stepped control taking only integer
+ values. Any bounds set should be slightly wider than the actual
+ integer range required to avoid floating point rounding errors. For
+ instance, the integer set {0,1,2,3} might be described as [-0.1,
+ 3.1]. */
+#define LADSPA_HINT_INTEGER 0x20
+
+/* The various LADSPA_HINT_HAS_DEFAULT_* hints indicate a `normal'
+ value for the port that is sensible as a default. For instance,
+ this value is suitable for use as an initial value in a user
+ interface or as a value the host might assign to a control port
+ when the user has not provided one. Defaults are encoded using a
+ mask so only one default may be specified for a port. Some of the
+ hints make use of lower and upper bounds, in which case the
+ relevant bound or bounds must be available and
+ LADSPA_HINT_SAMPLE_RATE must be applied as usual. The resulting
+ default must be rounded if LADSPA_HINT_INTEGER is present. Default
+ values were introduced in LADSPA v1.1. */
+#define LADSPA_HINT_DEFAULT_MASK 0x3C0
+
+/* This default values indicates that no default is provided. */
+#define LADSPA_HINT_DEFAULT_NONE 0x0
+
+/* This default hint indicates that the suggested lower bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MINIMUM 0x40
+
+/* This default hint indicates that a low value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.75 +
+ log(upper) * 0.25). Otherwise, this should be (lower * 0.75 + upper
+ * 0.25). */
+#define LADSPA_HINT_DEFAULT_LOW 0x80
+
+/* This default hint indicates that a middle value between the
+ suggested lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.5 +
+ log(upper) * 0.5). Otherwise, this should be (lower * 0.5 + upper *
+ 0.5). */
+#define LADSPA_HINT_DEFAULT_MIDDLE 0xC0
+
+/* This default hint indicates that a high value between the suggested
+ lower and upper bounds should be chosen. For ports with
+ LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.25 +
+ log(upper) * 0.75). Otherwise, this should be (lower * 0.25 + upper
+ * 0.75). */
+#define LADSPA_HINT_DEFAULT_HIGH 0x100
+
+/* This default hint indicates that the suggested upper bound for the
+ port should be used. */
+#define LADSPA_HINT_DEFAULT_MAXIMUM 0x140
+
+/* This default hint indicates that the number 0 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_0 0x200
+
+/* This default hint indicates that the number 1 should be used. Note
+ that this default may be used in conjunction with
+ LADSPA_HINT_TOGGLED. */
+#define LADSPA_HINT_DEFAULT_1 0x240
+
+/* This default hint indicates that the number 100 should be used. */
+#define LADSPA_HINT_DEFAULT_100 0x280
+
+/* This default hint indicates that the Hz frequency of `concert A'
+ should be used. This will be 440 unless the host uses an unusual
+ tuning convention, in which case it may be within a few Hz. */
+#define LADSPA_HINT_DEFAULT_440 0x2C0
+
+#define LADSPA_IS_HINT_BOUNDED_BELOW(x) ((x) & LADSPA_HINT_BOUNDED_BELOW)
+#define LADSPA_IS_HINT_BOUNDED_ABOVE(x) ((x) & LADSPA_HINT_BOUNDED_ABOVE)
+#define LADSPA_IS_HINT_TOGGLED(x) ((x) & LADSPA_HINT_TOGGLED)
+#define LADSPA_IS_HINT_SAMPLE_RATE(x) ((x) & LADSPA_HINT_SAMPLE_RATE)
+#define LADSPA_IS_HINT_LOGARITHMIC(x) ((x) & LADSPA_HINT_LOGARITHMIC)
+#define LADSPA_IS_HINT_INTEGER(x) ((x) & LADSPA_HINT_INTEGER)
+
+#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
+#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MINIMUM)
+#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_LOW)
+#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MIDDLE)
+#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_HIGH)
+#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_MAXIMUM)
+#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_0)
+#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_1)
+#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_100)
+#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
+ == LADSPA_HINT_DEFAULT_440)
+
+typedef struct _LADSPA_PortRangeHint {
+
+ /* Hints about the port. */
+ LADSPA_PortRangeHintDescriptor HintDescriptor;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_BELOW is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data LowerBound;
+
+ /* Meaningful when hint LADSPA_HINT_BOUNDED_ABOVE is active. When
+ LADSPA_HINT_SAMPLE_RATE is also active then this value should be
+ multiplied by the relevant sample rate. */
+ LADSPA_Data UpperBound;
+
+} LADSPA_PortRangeHint;
+
+/*****************************************************************************/
+
+/* Plugin Handles:
+
+ This plugin handle indicates a particular instance of the plugin
+ concerned. It is valid to compare this to NULL (0 for C++) but
+ otherwise the host should not attempt to interpret it. The plugin
+ may use it to reference internal instance data. */
+
+typedef void * LADSPA_Handle;
+
+/*****************************************************************************/
+
+/* Descriptor for a Type of Plugin:
+
+ This structure is used to describe a plugin type. It provides a
+ number of functions to examine the type, instantiate it, link it to
+ buffers and workspaces and to run it. */
+
+typedef struct _LADSPA_Descriptor {
+
+ /* This numeric identifier indicates the plugin type
+ uniquely. Plugin programmers may reserve ranges of IDs from a
+ central body to avoid clashes. Hosts may assume that IDs are
+ below 0x1000000. */
+ unsigned long UniqueID;
+
+ /* This identifier can be used as a unique, case-sensitive
+ identifier for the plugin type within the plugin file. Plugin
+ types should be identified by file and label rather than by index
+ or plugin name, which may be changed in new plugin
+ versions. Labels must not contain white-space characters. */
+ const char * Label;
+
+ /* This indicates a number of properties of the plugin. */
+ LADSPA_Properties Properties;
+
+ /* This member points to the null-terminated name of the plugin
+ (e.g. "Sine Oscillator"). */
+ const char * Name;
+
+ /* This member points to the null-terminated string indicating the
+ maker of the plugin. This can be an empty string but not NULL. */
+ const char * Maker;
+
+ /* This member points to the null-terminated string indicating any
+ copyright applying to the plugin. If no Copyright applies the
+ string "None" should be used. */
+ const char * Copyright;
+
+ /* This indicates the number of ports (input AND output) present on
+ the plugin. */
+ unsigned long PortCount;
+
+ /* This member indicates an array of port descriptors. Valid indices
+ vary from 0 to PortCount-1. */
+ const LADSPA_PortDescriptor * PortDescriptors;
+
+ /* This member indicates an array of null-terminated strings
+ describing ports (e.g. "Frequency (Hz)"). Valid indices vary from
+ 0 to PortCount-1. */
+ const char * const * PortNames;
+
+ /* This member indicates an array of range hints for each port (see
+ above). Valid indices vary from 0 to PortCount-1. */
+ const LADSPA_PortRangeHint * PortRangeHints;
+
+ /* This may be used by the plugin developer to pass any custom
+ implementation data into an instantiate call. It must not be used
+ or interpreted by the host. It is expected that most plugin
+ writers will not use this facility as LADSPA_Handle should be
+ used to hold instance data. */
+ void * ImplementationData;
+
+ /* This member is a function pointer that instantiates a plugin. A
+ handle is returned indicating the new plugin instance. The
+ instantiation function accepts a sample rate as a parameter. The
+ plugin descriptor from which this instantiate function was found
+ must also be passed. This function must return NULL if
+ instantiation fails.
+
+ Note that instance initialisation should generally occur in
+ activate() rather than here. */
+ LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
+ unsigned long SampleRate);
+
+ /* This member is a function pointer that connects a port on an
+ instantiated plugin to a memory location at which a block of data
+ for the port will be read/written. The data location is expected
+ to be an array of LADSPA_Data for audio ports or a single
+ LADSPA_Data value for control ports. Memory issues will be
+ managed by the host. The plugin must read/write the data at these
+ locations every time run() or run_adding() is called and the data
+ present at the time of this connection call should not be
+ considered meaningful.
+
+ connect_port() may be called more than once for a plugin instance
+ to allow the host to change the buffers that the plugin is
+ reading or writing. These calls may be made before or after
+ activate() or deactivate() calls.
+
+ connect_port() must be called at least once for each port before
+ run() or run_adding() is called. When working with blocks of
+ LADSPA_Data the plugin should pay careful attention to the block
+ size passed to the run function as the block allocated may only
+ just be large enough to contain the block of samples.
+
+ Plugin writers should be aware that the host may elect to use the
+ same buffer for more than one port and even use the same buffer
+ for both input and output (see LADSPA_PROPERTY_INPLACE_BROKEN).
+ However, overlapped buffers or use of a single buffer for both
+ audio and control data may result in unexpected behaviour. */
+ void (*connect_port)(LADSPA_Handle Instance,
+ unsigned long Port,
+ LADSPA_Data * DataLocation);
+
+ /* This member is a function pointer that initialises a plugin
+ instance and activates it for use. This is separated from
+ instantiate() to aid real-time support and so that hosts can
+ reinitialise a plugin instance by calling deactivate() and then
+ activate(). In this case the plugin instance must reset all state
+ information dependent on the history of the plugin instance
+ except for any data locations provided by connect_port() and any
+ gain set by set_run_adding_gain(). If there is nothing for
+ activate() to do then the plugin writer may provide a NULL rather
+ than an empty function.
+
+ When present, hosts must call this function once before run() (or
+ run_adding()) is called for the first time. This call should be
+ made as close to the run() call as possible and indicates to
+ real-time plugins that they are now live. Plugins should not rely
+ on a prompt call to run() after activate(). activate() may not be
+ called again unless deactivate() is called first. Note that
+ connect_port() may be called before or after a call to
+ activate(). */
+ void (*activate)(LADSPA_Handle Instance);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. Two parameters are required: the first is a
+ handle to the particular instance to be run and the second
+ indicates the block size (in samples) for which the plugin
+ instance may run.
+
+ Note that if an activate() function exists then it must be called
+ before run() or run_adding(). If deactivate() is called for a
+ plugin instance then the plugin instance may not be reused until
+ activate() has been called again.
+
+ If the plugin has the property LADSPA_PROPERTY_HARD_RT_CAPABLE
+ then there are various things that the plugin should not do
+ within the run() or run_adding() functions (see above). */
+ void (*run)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that runs an instance of a
+ plugin for a block. This has identical behaviour to run() except
+ in the way data is output from the plugin. When run() is used,
+ values are written directly to the memory areas associated with
+ the output ports. However when run_adding() is called, values
+ must be added to the values already present in the memory
+ areas. Furthermore, output values written must be scaled by the
+ current gain set by set_run_adding_gain() (see below) before
+ addition.
+
+ run_adding() is optional. When it is not provided by a plugin,
+ this function pointer must be set to NULL. When it is provided,
+ the function set_run_adding_gain() must be provided also. */
+ void (*run_adding)(LADSPA_Handle Instance,
+ unsigned long SampleCount);
+
+ /* This method is a function pointer that sets the output gain for
+ use when run_adding() is called (see above). If this function is
+ never called the gain is assumed to default to 1. Gain
+ information should be retained when activate() or deactivate()
+ are called.
+
+ This function should be provided by the plugin if and only if the
+ run_adding() function is provided. When it is absent this
+ function pointer must be set to NULL. */
+ void (*set_run_adding_gain)(LADSPA_Handle Instance,
+ LADSPA_Data Gain);
+
+ /* This is the counterpart to activate() (see above). If there is
+ nothing for deactivate() to do then the plugin writer may provide
+ a NULL rather than an empty function.
+
+ Hosts must deactivate all activated units after they have been
+ run() (or run_adding()) for the last time. This call should be
+ made as close to the last run() call as possible and indicates to
+ real-time plugins that they are no longer live. Plugins should
+ not rely on prompt deactivation. Note that connect_port() may be
+ called before or after a call to deactivate().
+
+ Deactivation is not similar to pausing as the plugin instance
+ will be reinitialised when activate() is called to reuse it. */
+ void (*deactivate)(LADSPA_Handle Instance);
+
+ /* Once an instance of a plugin has been finished with it can be
+ deleted using the following function. The instance handle passed
+ ceases to be valid after this call.
+
+ If activate() was called for a plugin instance then a
+ corresponding call to deactivate() must be made before cleanup()
+ is called. */
+ void (*cleanup)(LADSPA_Handle Instance);
+
+} LADSPA_Descriptor;
+
+/**********************************************************************/
+
+/* Accessing a Plugin: */
+
+/* The exact mechanism by which plugins are loaded is host-dependent,
+ however all most hosts will need to know is the name of shared
+ object file containing the plugin types. To allow multiple hosts to
+ share plugin types, hosts may wish to check for environment
+ variable LADSPA_PATH. If present, this should contain a
+ colon-separated path indicating directories that should be searched
+ (in order) when loading plugin types.
+
+ A plugin programmer must include a function called
+ "ladspa_descriptor" with the following function prototype within
+ the shared object file. This function will have C-style linkage (if
+ you are using C++ this is taken care of by the `extern "C"' clause
+ at the top of the file).
+
+ A host will find the plugin shared object file by one means or
+ another, find the ladspa_descriptor() function, call it, and
+ proceed from there.
+
+ Plugin types are accessed by index (not ID) using values from 0
+ upwards. Out of range indexes must result in this function
+ returning NULL, so the plugin count can be determined by checking
+ for the least index that results in NULL being returned. */
+
+const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
+
+/* Datatype corresponding to the ladspa_descriptor() function. */
+typedef const LADSPA_Descriptor *
+(*LADSPA_Descriptor_Function)(unsigned long Index);
+
+/**********************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LADSPA_INCLUDED */
+
+/* EOF */
diff --git a/alsa-lib/src/pcm/mask.c b/alsa-lib/src/pcm/mask.c
new file mode 100644
index 0000000..ebf1072
--- /dev/null
+++ b/alsa-lib/src/pcm/mask.c
@@ -0,0 +1,28 @@
+/*
+ * Mask functions
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define SND_MASK_C
+#define SND_MASK_INLINE
+
+#include <sys/types.h>
+#include <limits.h>
+#include "pcm_local.h"
+
diff --git a/alsa-lib/src/pcm/mask.h b/alsa-lib/src/pcm/mask.h
new file mode 100644
index 0000000..ab80f20
--- /dev/null
+++ b/alsa-lib/src/pcm/mask.h
@@ -0,0 +1,57 @@
+/*
+ * Mask header
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+typedef struct _snd_mask snd_mask_t;
+
+#define SND_MASK_MAX 64
+
+#ifdef SND_MASK_INLINE
+#include "mask_inline.h"
+#else
+void snd_mask_none(snd_mask_t *mask);
+void snd_mask_any(snd_mask_t *mask);
+void snd_mask_load(snd_mask_t *mask, unsigned int msk);
+int snd_mask_empty(const snd_mask_t *mask);
+int snd_mask_full(const snd_mask_t *mask);
+void snd_mask_set(snd_mask_t *mask, unsigned int val);
+void snd_mask_reset(snd_mask_t *mask, unsigned int val);
+void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v);
+int snd_mask_test(const snd_mask_t *mask, unsigned int val);
+void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v);
+void snd_mask_union(snd_mask_t *mask, const snd_mask_t *v);
+unsigned int snd_mask_count(const snd_mask_t *mask);
+unsigned int snd_mask_min(const snd_mask_t *mask);
+unsigned int snd_mask_max(const snd_mask_t *mask);
+void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to);
+void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to);
+void snd_mask_leave(snd_mask_t *mask, unsigned int val);
+int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v);
+int snd_mask_single(const snd_mask_t *mask);
+int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v);
+int snd_mask_refine_first(snd_mask_t *mask);
+int snd_mask_refine_last(snd_mask_t *mask);
+int snd_mask_refine_min(snd_mask_t *mask, unsigned int val);
+int snd_mask_refine_max(snd_mask_t *mask, unsigned int val);
+int snd_mask_refine_set(snd_mask_t *mask, unsigned int val);
+int snd_mask_value(const snd_mask_t *mask);
+int snd_mask_always_eq(const snd_mask_t *m1, const snd_mask_t *m2);
+int snd_mask_never_eq(const snd_mask_t *m1, const snd_mask_t *m2);
+#endif
diff --git a/alsa-lib/src/pcm/mask_inline.h b/alsa-lib/src/pcm/mask_inline.h
new file mode 100644
index 0000000..f656568
--- /dev/null
+++ b/alsa-lib/src/pcm/mask_inline.h
@@ -0,0 +1,299 @@
+/*
+ * Mask inlines
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <sys/types.h>
+
+#define MASK_INLINE static inline
+
+#define MASK_MAX SND_MASK_MAX
+#define MASK_SIZE (MASK_MAX / 32)
+
+#define MASK_OFS(i) ((i) >> 5)
+#define MASK_BIT(i) (1U << ((i) & 31))
+
+MASK_INLINE unsigned int ld2(u_int32_t v)
+{
+ unsigned r = 0;
+
+ if (v >= 0x10000) {
+ v >>= 16;
+ r += 16;
+ }
+ if (v >= 0x100) {
+ v >>= 8;
+ r += 8;
+ }
+ if (v >= 0x10) {
+ v >>= 4;
+ r += 4;
+ }
+ if (v >= 4) {
+ v >>= 2;
+ r += 2;
+ }
+ if (v >= 2)
+ r++;
+ return r;
+}
+
+MASK_INLINE unsigned int hweight32(u_int32_t v)
+{
+ v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
+ v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
+ v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
+ v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
+ return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
+}
+
+MASK_INLINE size_t snd_mask_sizeof(void)
+{
+ return sizeof(snd_mask_t);
+}
+
+MASK_INLINE void snd_mask_none(snd_mask_t *mask)
+{
+ memset(mask, 0, sizeof(*mask));
+}
+
+MASK_INLINE void snd_mask_any(snd_mask_t *mask)
+{
+ memset(mask, 0xff, MASK_SIZE * sizeof(u_int32_t));
+}
+
+MASK_INLINE int snd_mask_empty(const snd_mask_t *mask)
+{
+ int i;
+ for (i = 0; i < MASK_SIZE; i++)
+ if (mask->bits[i])
+ return 0;
+ return 1;
+}
+
+MASK_INLINE int snd_mask_full(const snd_mask_t *mask)
+{
+ int i;
+ for (i = 0; i < MASK_SIZE; i++)
+ if (mask->bits[i] != 0xffffffff)
+ return 0;
+ return 1;
+}
+
+MASK_INLINE unsigned int snd_mask_count(const snd_mask_t *mask)
+{
+ int i, w = 0;
+ for (i = 0; i < MASK_SIZE; i++)
+ w += hweight32(mask->bits[i]);
+ return w;
+}
+
+MASK_INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
+{
+ int i;
+ assert(!snd_mask_empty(mask));
+ for (i = 0; i < MASK_SIZE; i++) {
+ if (mask->bits[i])
+ return ffs(mask->bits[i]) - 1 + (i << 5);
+ }
+ return 0;
+}
+
+MASK_INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
+{
+ int i;
+ assert(!snd_mask_empty(mask));
+ for (i = MASK_SIZE - 1; i >= 0; i--) {
+ if (mask->bits[i])
+ return ld2(mask->bits[i]) + (i << 5);
+ }
+ return 0;
+}
+
+MASK_INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val)
+{
+ assert(val <= SND_MASK_MAX);
+ mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
+}
+
+MASK_INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val)
+{
+ assert(val <= SND_MASK_MAX);
+ mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
+}
+
+MASK_INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to)
+{
+ unsigned int i;
+ assert(to <= SND_MASK_MAX && from <= to);
+ for (i = from; i <= to; i++)
+ mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
+}
+
+MASK_INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to)
+{
+ unsigned int i;
+ assert(to <= SND_MASK_MAX && from <= to);
+ for (i = from; i <= to; i++)
+ mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
+}
+
+MASK_INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
+{
+ unsigned int v;
+ assert(val <= SND_MASK_MAX);
+ v = mask->bits[MASK_OFS(val)] & MASK_BIT(val);
+ snd_mask_none(mask);
+ mask->bits[MASK_OFS(val)] = v;
+}
+
+MASK_INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v)
+{
+ int i;
+ for (i = 0; i < MASK_SIZE; i++)
+ mask->bits[i] &= v->bits[i];
+}
+
+MASK_INLINE void snd_mask_union(snd_mask_t *mask, const snd_mask_t *v)
+{
+ int i;
+ for (i = 0; i < MASK_SIZE; i++)
+ mask->bits[i] |= v->bits[i];
+}
+
+MASK_INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v)
+{
+ return ! memcmp(mask, v, MASK_SIZE * 4);
+}
+
+MASK_INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v)
+{
+ *mask = *v;
+}
+
+MASK_INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val)
+{
+ assert(val <= SND_MASK_MAX);
+ return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
+}
+
+MASK_INLINE int snd_mask_single(const snd_mask_t *mask)
+{
+ int i, c = 0;
+ assert(!snd_mask_empty(mask));
+ for (i = 0; i < MASK_SIZE; i++) {
+ if (! mask->bits[i])
+ continue;
+ if (mask->bits[i] & (mask->bits[i] - 1))
+ return 0;
+ if (c)
+ return 0;
+ c++;
+ }
+ return 1;
+}
+
+MASK_INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
+{
+ snd_mask_t old;
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ snd_mask_copy(&old, mask);
+ snd_mask_intersect(mask, v);
+ if (snd_mask_empty(mask))
+ return -EINVAL;
+ return !snd_mask_eq(mask, &old);
+}
+
+MASK_INLINE int snd_mask_refine_first(snd_mask_t *mask)
+{
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ if (snd_mask_single(mask))
+ return 0;
+ snd_mask_leave(mask, snd_mask_min(mask));
+ return 1;
+}
+
+MASK_INLINE int snd_mask_refine_last(snd_mask_t *mask)
+{
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ if (snd_mask_single(mask))
+ return 0;
+ snd_mask_leave(mask, snd_mask_max(mask));
+ return 1;
+}
+
+MASK_INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
+{
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ if (snd_mask_min(mask) >= val)
+ return 0;
+ snd_mask_reset_range(mask, 0, val - 1);
+ if (snd_mask_empty(mask))
+ return -EINVAL;
+ return 1;
+}
+
+MASK_INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
+{
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ if (snd_mask_max(mask) <= val)
+ return 0;
+ snd_mask_reset_range(mask, val + 1, SND_MASK_MAX);
+ if (snd_mask_empty(mask))
+ return -EINVAL;
+ return 1;
+}
+
+MASK_INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
+{
+ int changed;
+ if (snd_mask_empty(mask))
+ return -ENOENT;
+ changed = !snd_mask_single(mask);
+ snd_mask_leave(mask, val);
+ if (snd_mask_empty(mask))
+ return -EINVAL;
+ return changed;
+}
+
+MASK_INLINE int snd_mask_value(const snd_mask_t *mask)
+{
+ assert(!snd_mask_empty(mask));
+ return snd_mask_min(mask);
+}
+
+MASK_INLINE int snd_mask_always_eq(const snd_mask_t *m1, const snd_mask_t *m2)
+{
+ return snd_mask_single(m1) && snd_mask_single(m2) &&
+ snd_mask_value(m1) == snd_mask_value(m2);
+}
+
+MASK_INLINE int snd_mask_never_eq(const snd_mask_t *m1, const snd_mask_t *m2)
+{
+ int i;
+ for (i = 0; i < MASK_SIZE; i++)
+ if (m1->bits[i] & m2->bits[i])
+ return 0;
+ return 1;
+}
diff --git a/alsa-lib/src/pcm/pcm.c b/alsa-lib/src/pcm/pcm.c
new file mode 100644
index 0000000..2016dd4
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm.c
@@ -0,0 +1,7439 @@
+/**
+ * \file pcm/pcm.c
+ * \ingroup PCM
+ * \brief PCM Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ *
+ * PCM Interface is designed to write or read digital audio frames. A
+ * frame is the data unit converted into/from sound in one time unit
+ * (1/rate seconds), by example if you set your playback PCM rate to
+ * 44100 you'll hear 44100 frames per second. The size in bytes of a
+ * frame may be obtained from bits needed to store a sample and
+ * channels count.
+ *
+ * See the \ref pcm page for more details.
+ */
+/*
+ * PCM Interface - main file
+ * Copyright (c) 1998 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page pcm PCM (digital audio) interface
+
+<P>Although abbreviation PCM stands for Pulse Code Modulation, we are
+understanding it as general digital audio processing with volume samples
+generated in continuous time periods.</P>
+
+<P>The analog signal is recorded via analog to digital converters (ADC).
+The digital value (de-facto a volume at a specific time) obtained
+from ADC can be further processed. The following picture shows a perfect
+sinus waveform:</P>
+
+<BR>
+\image html wave1.gif
+
+<P>Next image shows digitized representation:</P>
+
+<BR>
+\image html wave2.gif
+
+<P>As you may see, the quality of digital audio signal depends on the time
+(recording rate) and voltage resolution (usually in an linear integer
+representation with basic unit one bit).</P>
+
+<P>The stored digital signal can be converted back to voltage (analog)
+representation via digital to analog converters (DAC).</P>
+
+<P>One digital value is called sample. More samples are collected to frames
+(frame is terminology for ALSA) depending on count of converters used at one
+specific time. One frame might contain one sample (when only one converter is
+used - mono) or more samples (for example: stereo has signals from two converters
+recorded at same time). Digital audio stream contains collection of frames
+recorded at boundaries of continuous time periods.</P>
+
+\section pcm_general_overview General overview
+
+ALSA uses the ring buffer to store outgoing (playback) and incoming (capture,
+record) samples. There are two pointers being maintained to allow
+a precise communication between application and device pointing to current
+processed sample by hardware and last processed sample by application.
+The modern audio chips allow to program the transfer time periods.
+It means that the stream of samples is divided to small chunks. Device
+acknowledges to application when the transfer of a chunk is complete.
+
+\section pcm_transfer Transfer methods in UNIX environments
+
+In the UNIX environment, data chunk acknowledges are received via standard I/O
+calls or event waiting routines (poll or select function). To accomplish
+this list, the asynchronous notification of acknowledges should be listed
+here. The ALSA implementation for these methods is described in
+the \ref alsa_transfers section.
+
+\subsection pcm_transfer_io Standard I/O transfers
+
+The standard I/O transfers are using the read (see 'man 2 read') and write
+(see 'man 2 write') C functions. There are two basic behaviours of these
+functions - blocked and non-blocked (see the O_NONBLOCK flag for the
+standard C open function - see 'man 2 open'). In non-blocked behaviour,
+these I/O functions never stops, they return -EAGAIN error code, when no
+data can be transferred (the ring buffer is full in our case). In blocked
+behaviour, these I/O functions stop and wait until there is a room in the
+ring buffer (playback) or until there are a new samples (capture). The ALSA
+implementation can be found in the \ref alsa_pcm_rw section.
+
+\subsection pcm_transfer_event Event waiting routines
+
+The poll or select functions (see 'man 2 poll' or 'man 2 select' for further
+details) allows to receive requests/events from the device while
+an application is waiting on events from other sources (like keyboard, screen,
+network etc.), too. \ref snd_pcm_poll_descriptors can be used to get a file
+descriptor to poll or select on. The implemented
+transfer routines can be found in the \ref alsa_transfers section.
+
+\subsection pcm_transfer_async Asynchronous notification
+
+ALSA driver and library knows to handle the asynchronous notifications over
+the SIGIO signal. This signal allows to interrupt application and transfer
+data in the signal handler. For further details see the sigaction function
+('man 2 sigaction'). The section \ref pcm_async describes the ALSA API for
+this extension. The implemented transfer routines can be found in the
+\ref alsa_transfers section.
+
+\section pcm_open_behaviour Blocked and non-blocked open
+
+The ALSA PCM API uses a different behaviour when the device is opened
+with blocked or non-blocked mode. The mode can be specified with
+\a mode argument in #snd_pcm_open() function.
+The blocked mode is the default (without #SND_PCM_NONBLOCK mode).
+In this mode, the behaviour is that if the resources have already used
+with another application, then it blocks the caller, until resources are
+free. The non-blocked behaviour (with #SND_PCM_NONBLOCK)
+doesn't block the caller in any way and returns -EBUSY error when the
+resources are not available. Note that the mode also determines the
+behaviour of standard I/O calls, returning -EAGAIN when non-blocked mode is
+used and the ring buffer is full (playback) or empty (capture).
+The operation mode for I/O calls can be changed later with
+the #snd_pcm_nonblock() function.
+
+\section pcm_async Asynchronous mode
+
+There is also possibility to receive asynchronous notification after
+specified time periods. You may see the #SND_PCM_ASYNC
+mode for #snd_pcm_open() function and
+#snd_async_add_pcm_handler() function for further details.
+
+\section pcm_handshake Handshake between application and library
+
+The ALSA PCM API design uses the states to determine the communication
+phase between application and library. The actual state can be determined
+using #snd_pcm_state() call. There are these states:
+
+\par SND_PCM_STATE_OPEN
+The PCM device is in the open state. After the #snd_pcm_open() open call,
+the device is in this state. Also, when #snd_pcm_hw_params() call fails,
+then this state is entered to force application calling
+#snd_pcm_hw_params() function to set right communication
+parameters.
+
+\par SND_PCM_STATE_SETUP
+The PCM device has accepted communication parameters and it is waiting
+for #snd_pcm_prepare() call to prepare the hardware for
+selected operation (playback or capture).
+
+\par SND_PCM_STATE_PREPARE
+The PCM device is prepared for operation. Application can use
+#snd_pcm_start() call, write or read data to start
+the operation.
+
+\par SND_PCM_STATE_RUNNING
+The PCM device is running. It processes the samples. The stream can
+be stopped using the #snd_pcm_drop() or
+#snd_pcm_drain calls.
+
+\par SND_PCM_STATE_XRUN
+The PCM device reached overrun (capture) or underrun (playback).
+You can use the -EPIPE return code from I/O functions
+(#snd_pcm_writei(), #snd_pcm_writen(), #snd_pcm_readi(), #snd_pcm_readn())
+to determine this state without checking
+the actual state via #snd_pcm_state() call. You can recover from
+this state with #snd_pcm_prepare(),
+#snd_pcm_drop() or #snd_pcm_drain() calls.
+
+\par SND_PCM_STATE_DRAINING
+The device is in this state when application using the capture mode
+called #snd_pcm_drain() function. Until all data are
+read from the internal ring buffer using I/O routines
+(#snd_pcm_readi(), #snd_pcm_readn()),
+then the device stays in this state.
+
+\par SND_PCM_STATE_PAUSED
+The device is in this state when application called
+the #snd_pcm_pause() function until the pause is released.
+Not all hardware supports this feature. Application should check the
+capability with the #snd_pcm_hw_params_can_pause().
+
+\par SND_PCM_STATE_SUSPENDED
+The device is in the suspend state provoked with the power management
+system. The stream can be resumed using #snd_pcm_resume()
+call, but not all hardware supports this feature. Application should check
+the capability with the #snd_pcm_hw_params_can_resume().
+In other case, the calls #snd_pcm_prepare(),
+#snd_pcm_drop(), #snd_pcm_drain() can be used
+to leave this state.
+
+\par SND_PCM_STATE_DISCONNECTED
+The device is physicaly disconnected. It does not accept any I/O calls in this state.
+
+\section pcm_formats PCM formats
+
+The full list of formats present the #snd_pcm_format_t type.
+The 24-bit linear samples uses 32-bit physical space, but the sample is
+stored in low three bits. Some hardware does not support processing of full
+range, thus you may get the significant bits for linear samples via
+#snd_pcm_hw_params_get_sbits() function. The example: ICE1712
+chips support 32-bit sample processing, but low byte is ignored (playback)
+or zero (capture). The function snd_pcm_hw_params_get_sbits()
+returns 24 in the case.
+
+\section alsa_transfers ALSA transfers
+
+There are two methods to transfer samples in application. The first method
+is the standard read / write one. The second method, uses the direct audio
+buffer to communicate with the device while ALSA library manages this space
+itself. You can find examples of all communication schemes for playback
+in \ref example_test_pcm "Sine-wave generator example". To complete the
+list, we should note that #snd_pcm_wait() function contains
+embedded poll waiting implementation.
+
+\subsection alsa_pcm_rw Read / Write transfer
+
+There are two versions of read / write routines. The first expects the
+interleaved samples at input (#SND_PCM_ACCESS_RW_INTERLEAVED access method),
+and the second one expects non-interleaved (samples in separated buffers -
+#SND_PCM_ACCESS_RW_NONINTERLEAVED access method) at input. There are these
+functions for interleaved transfers: #snd_pcm_writei()
+#snd_pcm_readi(). For non-interleaved transfers, there are
+these functions: #snd_pcm_writen() and #snd_pcm_readn().
+
+\subsection alsa_mmap_rw Direct Read / Write transfer (via mmap'ed areas)
+
+Three kinds of organization of ring buffer memory areas exist in ALSA API.
+Access #SND_PCM_ACCESS_MMAP_INTERLEAVED has interleaved samples. Access
+#SND_PCM_ACCESS_MMAP_NONINTERLEAVED expects continous sample areas for
+one channel. Access #SND_PCM_ACCESS_MMAP_COMPLEX does not fit to interleaved
+and non-interleaved ring buffer organization.
+
+There are two functions for this kind of transfer. Application can get an
+access to memory areas via #snd_pcm_mmap_begin() function.
+This function returns the areas (single area is equal to a channel)
+containing the direct pointers to memory and sample position description
+in #snd_pcm_channel_area_t structure. After application
+transfers the data in the memory areas, then it must be acknowledged
+the end of transfer via #snd_pcm_mmap_commit() function
+to allow the ALSA library update the pointers to ring buffer. This kind of
+communication is also called "zero-copy", because the device does not require
+to copy the samples from application to another place in system memory.
+
+If you like to use the compatibility functions in mmap mode, there are
+read / write routines equaling to standard read / write transfers. Using
+these functions discards the benefits of direct access to memory region.
+See the #snd_pcm_mmap_readi(),
+#snd_pcm_writei(), #snd_pcm_readn()
+and #snd_pcm_writen() functions.
+
+\section pcm_errors Error codes
+
+\par -EPIPE
+
+This error means xrun (underrun for playback or overrun for capture).
+The underrun can happen when an application does not feed new samples
+in time to alsa-lib (due CPU usage). The overrun can happen when
+an application does not take new captured samples in time from alsa-lib.
+
+\par -ESTRPIPE
+
+This error means that system has suspended drivers. The application
+should wait in loop when snd_pcm_resume() != -EAGAIN and then
+call snd_pcm_prepare() when snd_pcm_resume() return an error code.
+If snd_pcm_resume() does not fail (a zero value is returned), driver
+supports resume and the snd_pcm_prepare() call can be ommited.
+
+\par -EBADFD
+
+This error means that the device is in a bad state. It means that
+the handskahe between application and alsa-lib is corrupted.
+
+\par -ENOTTY, -ENODEV
+
+This error can happen when device is physically removed (for example
+some hotplug devices like USB or PCMCIA, CardBus or ExpressCard
+can be removed on the fly).
+
+\section pcm_params Managing parameters
+
+The ALSA PCM device uses two groups of PCM related parameters. The hardware
+parameters contains the stream description like format, rate, count of
+channels, ring buffer size etc. The software parameters contains the
+software (driver) related parameters. The communication behaviour can be
+controlled via these parameters, like automatic start, automatic stop,
+interrupting (chunk acknowledge) etc. The software parameters can be
+modified at any time (when valid hardware parameters are set). It includes
+the running state as well.
+
+\subsection pcm_hw_params Hardware related parameters
+
+The ALSA PCM devices use the parameter refining system for hardware
+parameters - #snd_pcm_hw_params_t. It means, that
+application choose the full-range of configurations at first and then
+application sets single parameters until all parameters are elementary
+(definite).
+
+\par Access modes
+
+ALSA knows about five access modes. The first three can be used for direct
+communication. The access mode #SND_PCM_ACCESS_MMAP_INTERLEAVED
+determines the direct memory area and interleaved sample organization.
+Interleaved organization means, that samples from channels are mixed together.
+The access mode #SND_PCM_ACCESS_MMAP_NONINTERLEAVED
+determines the direct memory area and non-interleaved sample organization.
+Each channel has a separate buffer in the case. The complex direct memory
+organization represents the #SND_PCM_ACCESS_MMAP_COMPLEX
+access mode. The sample organization does not fit the interleaved or
+non-interleaved access modes in the case. The last two access modes
+describes the read / write access methods.
+The #SND_PCM_ACCESS_RW_INTERLEAVED access represents the read /
+write interleaved access and the #SND_PCM_ACCESS_RW_NONINTERLEAVED
+represents the non-interleaved access.
+
+\par Formats
+
+The full list of formats is available in #snd_pcm_format_t
+enumeration.
+
+\subsection pcm_sw_params Software related parameters
+
+These parameters - #snd_pcm_sw_params_t can be modified at
+any time including the running state.
+
+\par Minimum available count of samples
+
+This parameter controls the wakeup point. If the count of available samples
+is equal or greater than this value, then application will be activated.
+
+\par Timestamp mode
+
+The timestamp mode specifies, if timestamps are activated. Currently, only
+#SND_PCM_TSTAMP_NONE and #SND_PCM_TSTAMP_MMAP
+modes are known. The mmap mode means that timestamp is taken
+on every period time boundary. Corresponding position in the ring buffer
+assigned to timestamp can be obtained using #snd_pcm_htimestamp() function.
+
+\par Transfer align
+
+The read / write transfers can be aligned to this sample count. The modulo
+is ignored by device. Usually, this value is set to one (no align).
+
+\par Start threshold
+
+The start threshold parameter is used to determine the start point in
+stream. For playback, if samples in ring buffer is equal or greater than
+the start threshold parameters and the stream is not running, the stream will
+be started automatically from the device. For capture, if the application wants
+to read count of samples equal or greater then the stream will be started.
+If you want to use explicit start (#snd_pcm_start), you can
+set this value greater than ring buffer size (in samples), but use the
+constant MAXINT is not a bad idea.
+
+\par Stop threshold
+
+Similarly, the stop threshold parameter is used to automatically stop
+the running stream, when the available samples crosses this boundary.
+It means, for playback, the empty samples in ring buffer and for capture,
+the filled (used) samples in ring buffer.
+
+\par Silence threshold
+
+The silence threshold specifies count of samples filled with silence
+ahead of the current application pointer for playback. It is usable
+for applications when an overrun is possible (like tasks depending on
+network I/O etc.). If application wants to manage the ahead samples itself,
+the #snd_pcm_rewind() function allows to forget the last
+samples in the stream.
+
+\section pcm_status Obtaining stream status
+
+The stream status is stored in #snd_pcm_status_t structure.
+These parameters can be obtained: the current stream state -
+#snd_pcm_status_get_state(), timestamp of trigger -
+#snd_pcm_status_get_trigger_tstamp(), timestamp of last
+pointer update #snd_pcm_status_get_tstamp(), delay in samples -
+#snd_pcm_status_get_delay(), available count in samples -
+#snd_pcm_status_get_avail(), maximum available samples -
+#snd_pcm_status_get_avail_max(), ADC over-range count in
+samples - #snd_pcm_status_get_overrange(). The last two
+parameters - avail_max and overrange are reset to zero after the status
+call.
+
+\subsection pcm_status_fast Obtaining stream state fast and update r/w pointer
+
+<p>
+The function #snd_pcm_avail_update() updates the current
+available count of samples for writing (playback) or filled samples for
+reading (capture). This call is mandatory for updating actual r/w pointer.
+Using standalone, it is a light method to obtain current stream position,
+because it does not require the user <-> kernel context switch, but the value
+is less accurate, because ring buffer pointers are updated in kernel drivers
+only when an interrupt occurs. If you want to get accurate stream state,
+use functions #snd_pcm_avail(), #snd_pcm_delay() or #snd_pcm_avail_delay().
+</p>
+<p>
+The function #snd_pcm_avail() reads the current hardware pointer
+in the ring buffer from hardware and calls #snd_pcm_avail_update() then.
+</p>
+<p>
+The function #snd_pcm_delay() returns the delay in samples.
+For playback, it means count of samples in the ring buffer before
+the next sample will be sent to DAC. For capture, it means count of samples
+in the ring buffer before the next sample will be captured from ADC. It works
+only when the stream is in the running or draining (playback only) state.
+Note that this function does not update the current r/w pointer for applications,
+so the function #snd_pcm_avail_update() must be called afterwards
+before any read/write begin+commit operations.
+</p>
+<p>
+The function #snd_pcm_avail_delay() combines #snd_pcm_avail() and
+#snd_pcm_delay() and returns both values in sync.
+</p>
+
+\section pcm_action Managing the stream state
+
+The following functions directly and indirectly affect the stream state:
+
+\par snd_pcm_hw_params
+The #snd_pcm_hw_params() function brings the stream state
+to #SND_PCM_STATE_SETUP
+if successfully finishes, otherwise the state #SND_PCM_STATE_OPEN
+is entered.
+When it is brought to SETUP state, this function automatically
+calls #snd_pcm_prepare() function to bring to the PREPARE state
+as below.
+
+\par snd_pcm_prepare
+The #snd_pcm_prepare() function enters from #SND_PCM_STATE_SETUP
+to the #SND_PCM_STATE_PREPARED after a successful finish.
+
+\par snd_pcm_start
+The #snd_pcm_start() function enters
+the #SND_PCM_STATE_RUNNING after a successful finish.
+
+\par snd_pcm_drop
+The #snd_pcm_drop() function enters the
+#SND_PCM_STATE_SETUP state.
+
+\par snd_pcm_drain
+The #snd_pcm_drain() function enters the
+#SND_PCM_STATE_DRAINING, if
+the capture device has some samples in the ring buffer otherwise
+#SND_PCM_STATE_SETUP state is entered.
+
+\par snd_pcm_pause
+The #snd_pcm_pause() function enters the
+#SND_PCM_STATE_PAUSED or #SND_PCM_STATE_RUNNING.
+
+\par snd_pcm_writei, snd_pcm_writen
+The #snd_pcm_writei() and #snd_pcm_writen()
+functions can conditionally start the stream -
+#SND_PCM_STATE_RUNNING. They depend on the start threshold
+software parameter.
+
+\par snd_pcm_readi, snd_pcm_readn
+The #snd_pcm_readi() and #snd_pcm_readn()
+functions can conditionally start the stream -
+#SND_PCM_STATE_RUNNING. They depend on the start threshold
+software parameter.
+
+\section pcm_sync Streams synchronization
+
+There are two functions allowing link multiple streams together. In the
+case, the linking means that all operations are synchronized. Because the
+drivers cannot guarantee the synchronization (sample resolution) on hardware
+lacking this feature, the #snd_pcm_info_get_sync() function
+returns synchronization ID - #snd_pcm_sync_id_t, which is equal
+for hardware synchronized streams. When the #snd_pcm_link()
+function is called, all operations managing the stream state for these two
+streams are joined. The opposite function is #snd_pcm_unlink().
+
+\section pcm_dev_names PCM naming conventions
+
+The ALSA library uses a generic string representation for names of devices.
+The devices might be virtual, physical or a mix of both. The generic string
+is passed to #snd_pcm_open() or #snd_pcm_open_lconf().
+It contains two parts: device name and arguments. Devices and arguments are described
+in configuration files. The usual place for default definitions is at /usr/share/alsa/alsa.conf.
+For detailed descriptions about integrated PCM plugins look to \ref pcm_plugins.
+
+\subsection pcm_dev_names_default Default device
+
+The default device is equal to plug plugin with hw plugin as slave. The defaults are
+used:
+
+\code
+defaults.pcm.card 0
+defaults.pcm.device 0
+defaults.pcm.subdevice -1
+\endcode
+
+These defaults can be freely overwritten in local configuration files.
+
+Example:
+
+\code
+default
+\endcode
+
+\subsection pcm_dev_names_hw HW device
+
+The hw device description uses the hw plugin. The three arguments (in order: CARD,DEV,SUBDEV)
+specify card number or identifier, device number and subdevice number (-1 means any).
+
+Example:
+
+\code
+hw
+hw:0
+hw:0,0
+hw:supersonic,1
+hw:soundwave,1,2
+hw:DEV=1,CARD=soundwave,SUBDEV=2
+\endcode
+
+\subsection pcm_dev_names_plughw Plug->HW device
+
+The plughw device description uses the plug plugin and hw plugin as slave. The arguments
+are same as for hw device.
+
+Example:
+
+\code
+plughw
+plughw:0
+plughw:0,0
+plughw:supersonic,1
+plughw:soundwave,1,2
+plughw:DEV=1,CARD=soundwave,SUBDEV=2
+\endcode
+
+\subsection pcm_dev_names_plug Plug device
+
+The plug device uses the plug plugin. The one SLAVE argument specifies the slave plugin.
+
+Example:
+
+\code
+plug:mypcmdef
+plug:hw
+plug:'hw:0,0'
+plug:SLAVE=hw
+\endcode
+
+\subsection pcm_dev_names_shm Shared memory device
+
+The shm device uses the shm plugin. The two arguments (in order: SOCKET,PCM) specify
+UNIX socket name (for example /tmp/alsa.socket) for server communication and server's PCM name.
+
+Example:
+
+\code
+shm:'/tmp/alsa.sock',default
+shm:SOCKET='/tmp/alsa.sock',PCM=default
+\endcode
+
+\subsection pcm_dev_names_tee Tee device
+
+The tee device stores contents of a stream to given file plus transfers it to given slave plugin.
+The three arguments (in order: SLAVE,FILE,FORMAT) specify slave plugin, filename and file format.
+
+Example:
+
+\code
+tee:hw,'/tmp/out.raw',raw
+\endcode
+
+\subsection pcm_dev_names_file File device
+
+The file device is file plugin with null plugin as slave. The arguments (in order: FILE,FORMAT)
+specify filename and file format.
+
+Example:
+
+\code
+file:'/tmp/out.raw',raw
+\endcode
+
+\subsection pcm_dev_names_null Null device
+
+The null device is null plugin. This device has not any arguments.
+
+
+\section pcm_examples Examples
+
+The full featured examples with cross-links can be found in Examples section
+(see top of page):
+
+\anchor example_test_pcm
+\par Sine-wave generator
+\par
+alsa-lib/test/pcm.c example shows various transfer methods for the playback direction.
+
+\par Minimalistic PCM playback code
+\par
+alsa-lib/test/pcm_min.c example shows the minimal code to produce a sound.
+
+\par Latency measuring tool
+\par
+alsa-lib/test/latency.c example shows the measuring of minimal latency between capture and
+playback devices.
+
+*/
+
+/**
+\example ../../test/pcm.c
+*/
+/**
+\example ../../test/pcm_min.c
+*/
+/**
+\example ../../test/latency.c
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <sys/poll.h>
+#include <sys/mman.h>
+#include <limits.h>
+#include "pcm_local.h"
+
+/**
+ * \brief get identifier of PCM handle
+ * \param pcm PCM handle
+ * \return ascii identifier of PCM handle
+ *
+ * Returns the ASCII identifier of given PCM handle. It's the same
+ * identifier specified in snd_pcm_open().
+ */
+const char *snd_pcm_name(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return pcm->name;
+}
+
+/**
+ * \brief get type of PCM handle
+ * \param pcm PCM handle
+ * \return type of PCM handle
+ *
+ * Returns the type #snd_pcm_type_t of given PCM handle.
+ */
+snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return pcm->type;
+}
+
+/**
+ * \brief get stream for a PCM handle
+ * \param pcm PCM handle
+ * \return stream of PCM handle
+ *
+ * Returns the type #snd_pcm_stream_t of given PCM handle.
+ */
+snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return pcm->stream;
+}
+
+/**
+ * \brief close PCM handle
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified PCM handle and frees all associated
+ * resources.
+ */
+int snd_pcm_close(snd_pcm_t *pcm)
+{
+ int res = 0, err;
+ assert(pcm);
+ if (pcm->setup && !pcm->donot_close) {
+ snd_pcm_drop(pcm);
+ err = snd_pcm_hw_free(pcm);
+ if (err < 0)
+ res = err;
+ }
+ if (pcm->mmap_channels)
+ snd_pcm_munmap(pcm);
+ while (!list_empty(&pcm->async_handlers)) {
+ snd_async_handler_t *h = list_entry(pcm->async_handlers.next, snd_async_handler_t, hlist);
+ snd_async_del_handler(h);
+ }
+ err = pcm->ops->close(pcm->op_arg);
+ if (err < 0)
+ res = err;
+ err = snd_pcm_free(pcm);
+ if (err < 0)
+ res = err;
+ return res;
+}
+
+/**
+ * \brief set nonblock mode
+ * \param pcm PCM handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock)
+{
+ int err;
+ assert(pcm);
+ if ((err = pcm->ops->nonblock(pcm->op_arg, nonblock)) < 0)
+ return err;
+ if (nonblock)
+ pcm->mode |= SND_PCM_NONBLOCK;
+ else
+ pcm->mode &= ~SND_PCM_NONBLOCK;
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+/**
+ * \brief set async mode
+ * \param pcm PCM handle
+ * \param sig Signal to raise: < 0 disable, 0 default (SIGIO)
+ * \param pid Process ID to signal: 0 current
+ * \return 0 on success otherwise a negative error code
+ *
+ * A signal is raised every period.
+ */
+int snd_pcm_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ assert(pcm);
+ if (sig == 0)
+ sig = SIGIO;
+ if (pid == 0)
+ pid = getpid();
+ return pcm->ops->async(pcm->op_arg, sig, pid);
+}
+#endif
+
+/**
+ * \brief Obtain general (static) information for PCM handle
+ * \param pcm PCM handle
+ * \param info Information container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
+{
+ assert(pcm && info);
+ return pcm->ops->info(pcm->op_arg, info);
+}
+
+/** \brief Retreive current PCM hardware configuration chosen with #snd_pcm_hw_params
+ * \param pcm PCM handle
+ * \param params Configuration space definition container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ unsigned int frame_bits;
+
+ assert(pcm && params);
+ if (!pcm->setup)
+ return -EBADFD;
+ memset(params, 0, snd_pcm_hw_params_sizeof());
+ params->flags = pcm->hw_flags;
+ snd_mask_set(&params->masks[SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK], pcm->access);
+ snd_mask_set(&params->masks[SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK], pcm->format);
+ snd_mask_set(&params->masks[SND_PCM_HW_PARAM_SUBFORMAT - SND_PCM_HW_PARAM_FIRST_MASK], pcm->subformat);
+ frame_bits = snd_pcm_format_physical_width(pcm->format) * pcm->channels;
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_FRAME_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL], frame_bits);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_CHANNELS - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->channels);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_RATE - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->rate);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_PERIOD_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->period_time);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_PERIOD_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->period_size);
+ snd_interval_copy(&params->intervals[SND_PCM_HW_PARAM_PERIODS - SND_PCM_HW_PARAM_FIRST_INTERVAL], &pcm->periods);
+ snd_interval_copy(&params->intervals[SND_PCM_HW_PARAM_BUFFER_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL], &pcm->buffer_time);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_BUFFER_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->buffer_size);
+ snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_BUFFER_BYTES - SND_PCM_HW_PARAM_FIRST_INTERVAL], (pcm->buffer_size * frame_bits) / 8);
+ params->info = pcm->info;
+ params->msbits = pcm->msbits;
+ params->rate_num = pcm->rate_num;
+ params->rate_den = pcm->rate_den;
+ params->fifo_size = pcm->fifo_size;
+ return 0;
+}
+
+/** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it
+ * \param pcm PCM handle
+ * \param params Configuration space definition container
+ * \return 0 on success otherwise a negative error code
+ *
+ * The configuration is chosen fixing single parameters in this order:
+ * first access, first format, first subformat, min channels, min rate,
+ * min period time, max buffer size, min tick time
+ *
+ * After this call, #snd_pcm_prepare() is called automatically and
+ * the stream is brought to \c #SND_PCM_STATE_PREPARED state.
+ *
+ * The hardware parameters cannot be changed when the stream is
+ * running (active). The software parameters can be changed
+ * at any time.
+ */
+int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int err;
+ assert(pcm && params);
+ err = _snd_pcm_hw_params(pcm, params);
+ if (err < 0)
+ return err;
+ err = snd_pcm_prepare(pcm);
+ return err;
+}
+
+/** \brief Remove PCM hardware configuration and free associated resources
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_hw_free(snd_pcm_t *pcm)
+{
+ int err;
+ if (! pcm->setup)
+ return 0;
+ if (pcm->mmap_channels) {
+ err = snd_pcm_munmap(pcm);
+ if (err < 0)
+ return err;
+ }
+ // assert(snd_pcm_state(pcm) == SND_PCM_STATE_SETUP ||
+ // snd_pcm_state(pcm) == SND_PCM_STATE_PREPARED);
+ err = pcm->ops->hw_free(pcm->op_arg);
+ pcm->setup = 0;
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+/** \brief Install PCM software configuration defined by params
+ * \param pcm PCM handle
+ * \param params Configuration container
+ * \return 0 on success otherwise a negative error code
+ *
+ * The software parameters can be changed at any time.
+ * The hardware parameters cannot be changed when the stream is
+ * running (active).
+ */
+int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ int err;
+ /* the hw_params must be set at first!!! */
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (! params->avail_min) {
+ SNDMSG("params->avail_min is 0");
+ return -EINVAL;
+ }
+#if 0
+ /* disable the check below - it looks too restrictive
+ * (start_threshold is basically independent from avail_min)
+ */
+ if (params->start_threshold <= pcm->buffer_size &&
+ params->start_threshold > (pcm->buffer_size / params->avail_min) * params->avail_min) {
+ SNDMSG("params->avail_min problem for start_threshold");
+ return -EINVAL;
+ }
+#endif
+ err = pcm->ops->sw_params(pcm->op_arg, params);
+ if (err < 0)
+ return err;
+ pcm->tstamp_mode = params->tstamp_mode;
+ pcm->period_step = params->period_step;
+ pcm->avail_min = params->avail_min;
+ pcm->period_event = params->period_event;
+ pcm->start_threshold = params->start_threshold;
+ pcm->stop_threshold = params->stop_threshold;
+ pcm->silence_threshold = params->silence_threshold;
+ pcm->silence_size = params->silence_size;
+ pcm->boundary = params->boundary;
+ return 0;
+}
+
+/**
+ * \brief Obtain status (runtime) information for PCM handle
+ * \param pcm PCM handle
+ * \param status Status container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
+{
+ assert(pcm && status);
+ return pcm->fast_ops->status(pcm->fast_op_arg, status);
+}
+
+/**
+ * \brief Return PCM state
+ * \param pcm PCM handle
+ * \return PCM state #snd_pcm_state_t of given PCM handle
+ *
+ * This is a faster way to obtain only the PCM state without calling
+ * \link ::snd_pcm_status() \endlink.
+ */
+snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return pcm->fast_ops->state(pcm->fast_op_arg);
+}
+
+/**
+ * \brief (DEPRECATED) Synchronize stream position with hardware
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note this function does not update the actual r/w pointer
+ * for applications. The function #snd_pcm_avail_update()
+ * have to be called before any mmap begin+commit operation.
+ */
+int snd_pcm_hwsync(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->hwsync(pcm->fast_op_arg);
+}
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_hwsync, "Warning: snd_pcm_hwsync() is deprecated, consider to use snd_pcm_avail()");
+#endif
+
+/**
+ * \brief Obtain delay for a running PCM handle
+ * \param pcm PCM handle
+ * \param delayp Returned delay in frames
+ * \return 0 on success otherwise a negative error code
+ *
+ * For playback the delay is defined as the time that a frame that is written
+ * to the PCM stream shortly after this call will take to be actually
+ * audible. It is as such the overall latency from the write call to the final
+ * DAC.
+ *
+ * For capture the delay is defined as the time that a frame that was
+ * digitized by the audio device takes until it can be read from the PCM
+ * stream shortly after this call returns. It is as such the overall latency
+ * from the initial ADC to the read call.
+ *
+ * Please note that hence in case of a playback underrun this value will not
+ * necessarily got down to 0.
+ *
+ * If the application is interested in the fill level of the playback buffer
+ * of the device, it should use #snd_pcm_avail*() functions. The
+ * value returned by that call is not directly related to the delay, since the
+ * latter might include some additional, fixed latencies the former does not.
+ *
+ * Note this function does not update the actual r/w pointer
+ * for applications. The function #snd_pcm_avail_update()
+ * have to be called before any begin+commit operation.
+ */
+int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->delay(pcm->fast_op_arg, delayp);
+}
+
+/**
+ * \brief Resume from suspend, no samples are lost
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ * \retval -EAGAIN resume can't be proceed immediately (audio hardware is probably still suspended)
+ * \retval -ENOSYS hardware doesn't support this feature
+ *
+ * This function can be used when the stream is in the suspend state
+ * to do the fine resume from this state. Not all hardware supports
+ * this feature, when an -ENOSYS error is returned, use the \link ::snd_pcm_prepare() \endlink
+ * function to recovery.
+ */
+int snd_pcm_resume(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->resume(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Obtain last position update hi-res timestamp
+ * \param pcm PCM handle
+ * \param avail Number of available frames when timestamp was grabbed
+ * \param tstamp Hi-res timestamp
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note this function does not update the actual r/w pointer
+ * for applications.
+ */
+int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->htimestamp(pcm->fast_op_arg, avail, tstamp);
+}
+
+/**
+ * \brief Prepare PCM for use
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_prepare(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->prepare(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Reset PCM position
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Reduce PCM delay to 0.
+ */
+int snd_pcm_reset(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->reset(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Start a PCM
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_start(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->start(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Stop a PCM dropping pending frames
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * This function stops the PCM <i>immediately</i>.
+ * The pending samples on the buffer are ignored.
+ *
+ * For processing all pending samples, use \link ::snd_pcm_drain() \endlink
+ * instead.
+ */
+int snd_pcm_drop(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->drop(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Stop a PCM preserving pending frames
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ * \retval -ESTRPIPE a suspend event occurred
+ *
+ * For playback wait for all pending frames to be played and then stop
+ * the PCM.
+ * For capture stop PCM permitting to retrieve residual frames.
+ *
+ * For stopping the PCM stream immediately, use \link ::snd_pcm_drop() \endlink
+ * instead.
+ */
+int snd_pcm_drain(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->drain(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Pause/resume PCM
+ * \param pcm PCM handle
+ * \param enable 0 = resume, 1 = pause
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note that this function works only on the hardware which supports
+ * pause feature. You can check it via \link ::snd_pcm_hw_params_can_pause() \endlink
+ * function.
+ */
+int snd_pcm_pause(snd_pcm_t *pcm, int enable)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->pause(pcm->fast_op_arg, enable);
+}
+
+/**
+ * \brief Get safe count of frames which can be rewinded
+ * \param pcm PCM handle
+ * \return a positive number of frames or negative error code
+ *
+ * Note: The snd_pcm_rewind() can accept bigger value than returned
+ * by this function. But it is not guaranteed that output stream
+ * will be consistent with bigger value.
+ */
+snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->rewindable(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Move application frame position backward
+ * \param pcm PCM handle
+ * \param frames wanted displacement in frames
+ * \return a positive number for actual displacement otherwise a
+ * negative error code
+ */
+snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (frames == 0)
+ return 0;
+ return pcm->fast_ops->rewind(pcm->fast_op_arg, frames);
+}
+
+/**
+ * \brief Get safe count of frames which can be forwarded
+ * \param pcm PCM handle
+ * \return a positive number of frames or negative error code
+ *
+ * Note: The snd_pcm_forward() can accept bigger value than returned
+ * by this function. But it is not guaranteed that output stream
+ * will be consistent with bigger value.
+ */
+snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->forwardable(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Move application frame position forward
+ * \param pcm PCM handle
+ * \param frames wanted skip in frames
+ * \return a positive number for actual skip otherwise a negative error code
+ * \retval 0 means no action
+ */
+#ifndef DOXYGEN
+snd_pcm_sframes_t INTERNAL(snd_pcm_forward)(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+#else
+snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+#endif
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (frames == 0)
+ return 0;
+ return pcm->fast_ops->forward(pcm->fast_op_arg, frames);
+}
+use_default_symbol_version(__snd_pcm_forward, snd_pcm_forward, ALSA_0.9.0rc8);
+
+/**
+ * \brief Write interleaved frames to a PCM
+ * \param pcm PCM handle
+ * \param buffer frames containing buffer
+ * \param size frames to be written
+ * \return a positive number of frames actually written otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an underrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour is selected, then routine waits until
+ * all requested bytes are played or put to the playback ring buffer.
+ * The count of bytes can be less only if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ assert(pcm);
+ assert(size == 0 || buffer);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
+ SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ return -EINVAL;
+ }
+ return _snd_pcm_writei(pcm, buffer, size);
+}
+
+/**
+ * \brief Write non interleaved frames to a PCM
+ * \param pcm PCM handle
+ * \param bufs frames containing buffers (one for each channel)
+ * \param size frames to be written
+ * \return a positive number of frames actually written otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an underrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour is selected, then routine waits until
+ * all requested bytes are played or put to the playback ring buffer.
+ * The count of bytes can be less only if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ assert(pcm);
+ assert(size == 0 || bufs);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
+ SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ return -EINVAL;
+ }
+ return _snd_pcm_writen(pcm, bufs, size);
+}
+
+/**
+ * \brief Read interleaved frames from a PCM
+ * \param pcm PCM handle
+ * \param buffer frames containing buffer
+ * \param size frames to be read
+ * \return a positive number of frames actually read otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an overrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour was selected, then routine waits until
+ * all requested bytes are filled. The count of bytes can be less only
+ * if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ assert(pcm);
+ assert(size == 0 || buffer);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
+ SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ return -EINVAL;
+ }
+ return _snd_pcm_readi(pcm, buffer, size);
+}
+
+/**
+ * \brief Read non interleaved frames to a PCM
+ * \param pcm PCM handle
+ * \param bufs frames containing buffers (one for each channel)
+ * \param size frames to be read
+ * \return a positive number of frames actually read otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an overrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour was selected, then routine waits until
+ * all requested bytes are filled. The count of bytes can be less only
+ * if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ assert(pcm);
+ assert(size == 0 || bufs);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
+ SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ return -EINVAL;
+ }
+ return _snd_pcm_readn(pcm, bufs, size);
+}
+
+/**
+ * \brief Link two PCMs
+ * \param pcm1 first PCM handle
+ * \param pcm2 first PCM handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * The two PCMs will start/stop/prepare in sync.
+ */
+int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
+{
+ assert(pcm1);
+ assert(pcm2);
+ if (pcm1->fast_ops->link)
+ return pcm1->fast_ops->link(pcm1, pcm2);
+ return -ENOSYS;
+}
+
+/**
+ * \brief Remove a PCM from a linked group
+ * \param pcm PCM handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_unlink(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (pcm->fast_ops->unlink)
+ return pcm->fast_ops->unlink(pcm);
+ return -ENOSYS;
+}
+
+/**
+ * \brief get count of poll descriptors for PCM handle
+ * \param pcm PCM handle
+ * \return count of poll descriptors
+ */
+int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ if (pcm->fast_ops->poll_descriptors_count)
+ return pcm->fast_ops->poll_descriptors_count(pcm->fast_op_arg);
+ return pcm->poll_fd_count;
+}
+
+
+/**
+ * \brief get poll descriptors
+ * \param pcm PCM handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ *
+ * This function fills the given poll descriptor structs for the specified
+ * PCM handle. The poll desctiptor array should have the size returned by
+ * \link ::snd_pcm_poll_descriptors_count() \endlink function.
+ *
+ * The result is intended for direct use with the poll() syscall.
+ *
+ * For reading the returned events of poll descriptor after poll() system
+ * call, use \link ::snd_pcm_poll_descriptors_revents() \endlink function.
+ * The field values in pollfd structs may be bogus regarding the stream
+ * direction from the application perspective (POLLIN might not imply read
+ * direction and POLLOUT might not imply write), but
+ * the \link ::snd_pcm_poll_descriptors_revents() \endlink function
+ * does the right "demangling".
+ *
+ * You can use output from this function as arguments for the select()
+ * syscall, too.
+ */
+int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
+{
+ assert(pcm && pfds);
+ if (pcm->fast_ops->poll_descriptors)
+ return pcm->fast_ops->poll_descriptors(pcm->fast_op_arg, pfds, space);
+ if (pcm->poll_fd < 0) {
+ SNDMSG("poll_fd < 0");
+ return -EIO;
+ }
+ if (space >= 1 && pfds) {
+ pfds->fd = pcm->poll_fd;
+ pfds->events = pcm->poll_events | POLLERR | POLLNVAL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param pcm PCM handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ *
+ * This function does "demangling" of the revents mask returned from
+ * the poll() syscall to correct semantics (POLLIN = read, POLLOUT = write).
+ *
+ * Note: The null event also exists. Even if poll() or select()
+ * syscall returned that some events are waiting, this function might
+ * return empty set of events. In this case, application should
+ * do next event waiting using poll() or select().
+ */
+int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(pcm && pfds && revents);
+ if (pcm->fast_ops->poll_revents)
+ return pcm->fast_ops->poll_revents(pcm->fast_op_arg, pfds, nfds, revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+#ifndef DOC_HIDDEN
+#define PCMTYPE(v) [SND_PCM_TYPE_##v] = #v
+#define STATE(v) [SND_PCM_STATE_##v] = #v
+#define STREAM(v) [SND_PCM_STREAM_##v] = #v
+#define READY(v) [SND_PCM_READY_##v] = #v
+#define XRUN(v) [SND_PCM_XRUN_##v] = #v
+#define SILENCE(v) [SND_PCM_SILENCE_##v] = #v
+#define TSTAMP(v) [SND_PCM_TSTAMP_##v] = #v
+#define ACCESS(v) [SND_PCM_ACCESS_##v] = #v
+#define START(v) [SND_PCM_START_##v] = #v
+#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
+#define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v
+#define FORMAT(v) [SND_PCM_FORMAT_##v] = #v
+#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v
+
+#define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
+#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
+
+
+static const char *const snd_pcm_stream_names[] = {
+ STREAM(PLAYBACK),
+ STREAM(CAPTURE),
+};
+
+static const char *const snd_pcm_state_names[] = {
+ STATE(OPEN),
+ STATE(SETUP),
+ STATE(PREPARED),
+ STATE(RUNNING),
+ STATE(XRUN),
+ STATE(DRAINING),
+ STATE(PAUSED),
+ STATE(SUSPENDED),
+ STATE(DISCONNECTED),
+};
+
+static const char *const snd_pcm_access_names[] = {
+ ACCESS(MMAP_INTERLEAVED),
+ ACCESS(MMAP_NONINTERLEAVED),
+ ACCESS(MMAP_COMPLEX),
+ ACCESS(RW_INTERLEAVED),
+ ACCESS(RW_NONINTERLEAVED),
+};
+
+static const char *const snd_pcm_format_names[] = {
+ FORMAT(S8),
+ FORMAT(U8),
+ FORMAT(S16_LE),
+ FORMAT(S16_BE),
+ FORMAT(U16_LE),
+ FORMAT(U16_BE),
+ FORMAT(S24_LE),
+ FORMAT(S24_BE),
+ FORMAT(U24_LE),
+ FORMAT(U24_BE),
+ FORMAT(S32_LE),
+ FORMAT(S32_BE),
+ FORMAT(U32_LE),
+ FORMAT(U32_BE),
+ FORMAT(FLOAT_LE),
+ FORMAT(FLOAT_BE),
+ FORMAT(FLOAT64_LE),
+ FORMAT(FLOAT64_BE),
+ FORMAT(IEC958_SUBFRAME_LE),
+ FORMAT(IEC958_SUBFRAME_BE),
+ FORMAT(MU_LAW),
+ FORMAT(A_LAW),
+ FORMAT(IMA_ADPCM),
+ FORMAT(MPEG),
+ FORMAT(GSM),
+ FORMAT(SPECIAL),
+ FORMAT(S24_3LE),
+ FORMAT(S24_3BE),
+ FORMAT(U24_3LE),
+ FORMAT(U24_3BE),
+ FORMAT(S20_3LE),
+ FORMAT(S20_3BE),
+ FORMAT(U20_3LE),
+ FORMAT(U20_3BE),
+ FORMAT(S18_3LE),
+ FORMAT(S18_3BE),
+ FORMAT(U18_3LE),
+ FORMAT(U18_3BE),
+};
+
+static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = {
+ FORMAT(S16),
+ FORMAT(U16),
+ FORMAT(S24),
+ FORMAT(U24),
+ FORMAT(S32),
+ FORMAT(U32),
+ FORMAT(FLOAT),
+ FORMAT(FLOAT64),
+ FORMAT(IEC958_SUBFRAME),
+};
+
+static const char *const snd_pcm_format_descriptions[] = {
+ FORMATD(S8, "Signed 8 bit"),
+ FORMATD(U8, "Unsigned 8 bit"),
+ FORMATD(S16_LE, "Signed 16 bit Little Endian"),
+ FORMATD(S16_BE, "Signed 16 bit Big Endian"),
+ FORMATD(U16_LE, "Unsigned 16 bit Little Endian"),
+ FORMATD(U16_BE, "Unsigned 16 bit Big Endian"),
+ FORMATD(S24_LE, "Signed 24 bit Little Endian"),
+ FORMATD(S24_BE, "Signed 24 bit Big Endian"),
+ FORMATD(U24_LE, "Unsigned 24 bit Little Endian"),
+ FORMATD(U24_BE, "Unsigned 24 bit Big Endian"),
+ FORMATD(S32_LE, "Signed 32 bit Little Endian"),
+ FORMATD(S32_BE, "Signed 32 bit Big Endian"),
+ FORMATD(U32_LE, "Unsigned 32 bit Little Endian"),
+ FORMATD(U32_BE, "Unsigned 32 bit Big Endian"),
+ FORMATD(FLOAT_LE, "Float 32 bit Little Endian"),
+ FORMATD(FLOAT_BE, "Float 32 bit Big Endian"),
+ FORMATD(FLOAT64_LE, "Float 64 bit Little Endian"),
+ FORMATD(FLOAT64_BE, "Float 64 bit Big Endian"),
+ FORMATD(IEC958_SUBFRAME_LE, "IEC-958 Little Endian"),
+ FORMATD(IEC958_SUBFRAME_BE, "IEC-958 Big Endian"),
+ FORMATD(MU_LAW, "Mu-Law"),
+ FORMATD(A_LAW, "A-Law"),
+ FORMATD(IMA_ADPCM, "Ima-ADPCM"),
+ FORMATD(MPEG, "MPEG"),
+ FORMATD(GSM, "GSM"),
+ FORMATD(SPECIAL, "Special"),
+ FORMATD(S24_3LE, "Signed 24 bit Little Endian in 3bytes"),
+ FORMATD(S24_3BE, "Signed 24 bit Big Endian in 3bytes"),
+ FORMATD(U24_3LE, "Unsigned 24 bit Little Endian in 3bytes"),
+ FORMATD(U24_3BE, "Unsigned 24 bit Big Endian in 3bytes"),
+ FORMATD(S20_3LE, "Signed 20 bit Little Endian in 3bytes"),
+ FORMATD(S20_3BE, "Signed 20 bit Big Endian in 3bytes"),
+ FORMATD(U20_3LE, "Unsigned 20 bit Little Endian in 3bytes"),
+ FORMATD(U20_3BE, "Unsigned 20 bit Big Endian in 3bytes"),
+ FORMATD(S18_3LE, "Signed 18 bit Little Endian in 3bytes"),
+ FORMATD(S18_3BE, "Signed 18 bit Big Endian in 3bytes"),
+ FORMATD(U18_3LE, "Unsigned 18 bit Little Endian in 3bytes"),
+ FORMATD(U18_3BE, "Unsigned 18 bit Big Endian in 3bytes"),
+};
+
+static const char *const snd_pcm_type_names[] = {
+ PCMTYPE(HW),
+ PCMTYPE(HOOKS),
+ PCMTYPE(MULTI),
+ PCMTYPE(FILE),
+ PCMTYPE(NULL),
+ PCMTYPE(SHM),
+ PCMTYPE(INET),
+ PCMTYPE(COPY),
+ PCMTYPE(LINEAR),
+ PCMTYPE(ALAW),
+ PCMTYPE(MULAW),
+ PCMTYPE(ADPCM),
+ PCMTYPE(RATE),
+ PCMTYPE(ROUTE),
+ PCMTYPE(PLUG),
+ PCMTYPE(SHARE),
+ PCMTYPE(METER),
+ PCMTYPE(MIX),
+ PCMTYPE(DROUTE),
+ PCMTYPE(LBSERVER),
+ PCMTYPE(LINEAR_FLOAT),
+ PCMTYPE(LADSPA),
+ PCMTYPE(DMIX),
+ PCMTYPE(JACK),
+ PCMTYPE(DSNOOP),
+ PCMTYPE(IEC958),
+ PCMTYPE(SOFTVOL),
+ PCMTYPE(IOPLUG),
+ PCMTYPE(EXTPLUG),
+};
+
+static const char *const snd_pcm_subformat_names[] = {
+ SUBFORMAT(STD),
+};
+
+static const char *const snd_pcm_subformat_descriptions[] = {
+ SUBFORMATD(STD, "Standard"),
+};
+
+static const char *const snd_pcm_start_mode_names[] = {
+ START(EXPLICIT),
+ START(DATA),
+};
+
+static const char *const snd_pcm_xrun_mode_names[] = {
+ XRUN(NONE),
+ XRUN(STOP),
+};
+
+static const char *const snd_pcm_tstamp_mode_names[] = {
+ TSTAMP(NONE),
+ TSTAMP(ENABLE),
+};
+#endif
+
+/**
+ * \brief get name of PCM stream type
+ * \param stream PCM stream type
+ * \return ascii name of PCM stream type
+ */
+const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
+{
+ if (stream > SND_PCM_STREAM_LAST)
+ return NULL;
+ return snd_pcm_stream_names[stream];
+}
+
+/**
+ * \brief get name of PCM access type
+ * \param acc PCM access type
+ * \return ascii name of PCM access type
+ */
+const char *snd_pcm_access_name(snd_pcm_access_t acc)
+{
+ if (acc > SND_PCM_ACCESS_LAST)
+ return NULL;
+ return snd_pcm_access_names[acc];
+}
+
+/**
+ * \brief get name of PCM sample format
+ * \param format PCM sample format
+ * \return ascii name of PCM sample format
+ */
+const char *snd_pcm_format_name(snd_pcm_format_t format)
+{
+ if (format > SND_PCM_FORMAT_LAST)
+ return NULL;
+ return snd_pcm_format_names[format];
+}
+
+/**
+ * \brief get description of PCM sample format
+ * \param format PCM sample format
+ * \return ascii description of PCM sample format
+ */
+const char *snd_pcm_format_description(snd_pcm_format_t format)
+{
+ if (format > SND_PCM_FORMAT_LAST)
+ return NULL;
+ return snd_pcm_format_descriptions[format];
+}
+
+/**
+ * \brief get PCM sample format from name
+ * \param name PCM sample format name (case insensitive)
+ * \return PCM sample format
+ */
+snd_pcm_format_t snd_pcm_format_value(const char* name)
+{
+ snd_pcm_format_t format;
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (snd_pcm_format_names[format] &&
+ strcasecmp(name, snd_pcm_format_names[format]) == 0) {
+ return format;
+ }
+ if (snd_pcm_format_aliases[format] &&
+ strcasecmp(name, snd_pcm_format_aliases[format]) == 0) {
+ return format;
+ }
+ }
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (snd_pcm_format_descriptions[format] &&
+ strcasecmp(name, snd_pcm_format_descriptions[format]) == 0) {
+ return format;
+ }
+ }
+ return SND_PCM_FORMAT_UNKNOWN;
+}
+
+/**
+ * \brief get name of PCM sample subformat
+ * \param subformat PCM sample subformat
+ * \return ascii name of PCM sample subformat
+ */
+const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
+{
+ if (subformat > SND_PCM_SUBFORMAT_LAST)
+ return NULL;
+ return snd_pcm_subformat_names[subformat];
+}
+
+/**
+ * \brief get description of PCM sample subformat
+ * \param subformat PCM sample subformat
+ * \return ascii description of PCM sample subformat
+ */
+const char *snd_pcm_subformat_description(snd_pcm_subformat_t subformat)
+{
+ if (subformat > SND_PCM_SUBFORMAT_LAST)
+ return NULL;
+ return snd_pcm_subformat_descriptions[subformat];
+}
+
+/**
+ * \brief (DEPRECATED) get name of PCM start mode setting
+ * \param mode PCM start mode
+ * \return ascii name of PCM start mode setting
+ */
+const char *snd_pcm_start_mode_name(snd_pcm_start_t mode)
+{
+ if (mode > SND_PCM_START_LAST)
+ return NULL;
+ return snd_pcm_start_mode_names[mode];
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_start_mode_name, "Warning: start_mode is deprecated, consider to use start_threshold");
+#endif
+
+/**
+ * \brief (DEPRECATED) get name of PCM xrun mode setting
+ * \param mode PCM xrun mode
+ * \return ascii name of PCM xrun mode setting
+ */
+const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode)
+{
+ if (mode > SND_PCM_XRUN_LAST)
+ return NULL;
+ return snd_pcm_xrun_mode_names[mode];
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_xrun_mode_name, "Warning: xrun_mode is deprecated, consider to use stop_threshold");
+#endif
+
+/**
+ * \brief get name of PCM tstamp mode setting
+ * \param mode PCM tstamp mode
+ * \return ascii name of PCM tstamp mode setting
+ */
+const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
+{
+ if (mode > SND_PCM_TSTAMP_LAST)
+ return NULL;
+ return snd_pcm_tstamp_mode_names[mode];
+}
+
+/**
+ * \brief get name of PCM state
+ * \param state PCM state
+ * \return ascii name of PCM state
+ */
+const char *snd_pcm_state_name(snd_pcm_state_t state)
+{
+ if (state > SND_PCM_STATE_LAST)
+ return NULL;
+ return snd_pcm_state_names[state];
+}
+
+/**
+ * \brief get name of PCM type
+ * \param type PCM type
+ * \return ascii name of PCM type
+ */
+#ifndef DOXYGEN
+const char *INTERNAL(snd_pcm_type_name)(snd_pcm_type_t type)
+#else
+const char *snd_pcm_type_name(snd_pcm_type_t type)
+#endif
+{
+ if (type > SND_PCM_TYPE_LAST)
+ return NULL;
+ return snd_pcm_type_names[type];
+}
+use_default_symbol_version(__snd_pcm_type_name, snd_pcm_type_name, ALSA_0.9.0);
+
+/**
+ * \brief Dump current hardware setup for PCM
+ * \param pcm PCM handle
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
+{
+ assert(pcm);
+ assert(out);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
+ snd_output_printf(out, " access : %s\n", snd_pcm_access_name(pcm->access));
+ snd_output_printf(out, " format : %s\n", snd_pcm_format_name(pcm->format));
+ snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
+ snd_output_printf(out, " channels : %u\n", pcm->channels);
+ snd_output_printf(out, " rate : %u\n", pcm->rate);
+ snd_output_printf(out, " exact rate : %g (%u/%u)\n",
+ (pcm->rate_den ? ((double) pcm->rate_num / pcm->rate_den) : 0.0),
+ pcm->rate_num, pcm->rate_den);
+ snd_output_printf(out, " msbits : %u\n", pcm->msbits);
+ snd_output_printf(out, " buffer_size : %lu\n", pcm->buffer_size);
+ snd_output_printf(out, " period_size : %lu\n", pcm->period_size);
+ snd_output_printf(out, " period_time : %u\n", pcm->period_time);
+ return 0;
+}
+
+/**
+ * \brief Dump current software setup for PCM
+ * \param pcm PCM handle
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
+{
+ assert(pcm);
+ assert(out);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
+ snd_output_printf(out, " period_step : %d\n", pcm->period_step);
+ snd_output_printf(out, " avail_min : %ld\n", pcm->avail_min);
+ snd_output_printf(out, " period_event : %i\n", pcm->period_event);
+ snd_output_printf(out, " start_threshold : %ld\n", pcm->start_threshold);
+ snd_output_printf(out, " stop_threshold : %ld\n", pcm->stop_threshold);
+ snd_output_printf(out, " silence_threshold: %ld\n", pcm->silence_threshold);
+ snd_output_printf(out, " silence_size : %ld\n", pcm->silence_size);
+ snd_output_printf(out, " boundary : %ld\n", pcm->boundary);
+ return 0;
+}
+
+/**
+ * \brief Dump current setup (hardware and software) for PCM
+ * \param pcm PCM handle
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_dump_hw_setup(pcm, out);
+ snd_pcm_dump_sw_setup(pcm, out);
+ return 0;
+}
+
+/**
+ * \brief Dump status
+ * \param status Status container
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out)
+{
+ assert(status);
+ snd_output_printf(out, " state : %s\n", snd_pcm_state_name((snd_pcm_state_t) status->state));
+ snd_output_printf(out, " trigger_time: %ld.%06ld\n",
+ status->trigger_tstamp.tv_sec, status->trigger_tstamp.tv_nsec);
+ snd_output_printf(out, " tstamp : %ld.%06ld\n",
+ status->tstamp.tv_sec, status->tstamp.tv_nsec);
+ snd_output_printf(out, " delay : %ld\n", (long)status->delay);
+ snd_output_printf(out, " avail : %ld\n", (long)status->avail);
+ snd_output_printf(out, " avail_max : %ld\n", (long)status->avail_max);
+ return 0;
+}
+
+/**
+ * \brief Dump PCM info
+ * \param pcm PCM handle
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ assert(pcm);
+ assert(out);
+ pcm->ops->dump(pcm->op_arg, out);
+ return 0;
+}
+
+/**
+ * \brief Convert bytes in frames for a PCM
+ * \param pcm PCM handle
+ * \param bytes quantity in bytes
+ * \return quantity expressed in frames
+ */
+snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return bytes * 8 / pcm->frame_bits;
+}
+
+/**
+ * \brief Convert frames in bytes for a PCM
+ * \param pcm PCM handle
+ * \param frames quantity in frames
+ * \return quantity expressed in bytes
+ */
+ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return frames * pcm->frame_bits / 8;
+}
+
+/**
+ * \brief Convert bytes in samples for a PCM
+ * \param pcm PCM handle
+ * \param bytes quantity in bytes
+ * \return quantity expressed in samples
+ */
+long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return bytes * 8 / pcm->sample_bits;
+}
+
+/**
+ * \brief Convert samples in bytes for a PCM
+ * \param pcm PCM handle
+ * \param samples quantity in samples
+ * \return quantity expressed in bytes
+ */
+ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return samples * pcm->sample_bits / 8;
+}
+
+/**
+ * \brief Add an async handler for a PCM
+ * \param handler Returned handler handle
+ * \param pcm PCM handle
+ * \param callback Callback function
+ * \param private_data Callback private data
+ * \return 0 otherwise a negative error code on failure
+ *
+ * The asynchronous callback is called when period boundary elapses.
+ */
+int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
+ snd_async_callback_t callback, void *private_data)
+{
+ int err;
+ int was_empty;
+ snd_async_handler_t *h;
+ err = snd_async_add_handler(&h, _snd_pcm_async_descriptor(pcm),
+ callback, private_data);
+ if (err < 0)
+ return err;
+ h->type = SND_ASYNC_HANDLER_PCM;
+ h->u.pcm = pcm;
+ was_empty = list_empty(&pcm->async_handlers);
+ list_add_tail(&h->hlist, &pcm->async_handlers);
+ if (was_empty) {
+ err = snd_pcm_async(pcm, snd_async_handler_get_signo(h), getpid());
+ if (err < 0) {
+ snd_async_del_handler(h);
+ return err;
+ }
+ }
+ *handler = h;
+ return 0;
+}
+
+/**
+ * \brief Return PCM handle related to an async handler
+ * \param handler Async handler handle
+ * \return PCM handle
+ */
+snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler)
+{
+ if (handler->type != SND_ASYNC_HANDLER_PCM) {
+ SNDMSG("invalid handler type %d", handler->type);
+ return NULL;
+ }
+ return handler->u.pcm;
+}
+
+static const char *const build_in_pcms[] = {
+ "adpcm", "alaw", "copy", "dmix", "file", "hooks", "hw", "ladspa", "lfloat",
+ "linear", "meter", "mulaw", "multi", "null", "empty", "plug", "rate", "route", "share",
+ "shm", "dsnoop", "dshare", "asym", "iec958", "softvol", "mmap_emul",
+ NULL
+};
+
+static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *pcm_root, snd_config_t *pcm_conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ const char *str;
+ char *buf = NULL, *buf1 = NULL;
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_pcm_t **, const char *,
+ snd_config_t *, snd_config_t *,
+ snd_pcm_stream_t, int) = NULL;
+#ifndef PIC
+ extern void *snd_pcm_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ char *val;
+ id = NULL;
+ snd_config_get_id(pcm_conf, &id);
+ val = NULL;
+ snd_config_get_ascii(pcm_conf, &val);
+ SNDERR("Invalid type for PCM %s%sdefinition (id: %s, value: %s)", name ? name : "", name ? " " : "", id, val);
+ free(val);
+ return -EINVAL;
+ }
+ err = snd_config_search(pcm_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(pcm_root, "pcm_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for PCM type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ buf = malloc(strlen(str) + 32);
+ if (buf == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ open_name = buf;
+ sprintf(buf, "_snd_pcm_%s_open", str);
+ }
+ if (!lib) {
+ const char *const *build_in = build_in_pcms;
+ while (*build_in) {
+ if (!strcmp(*build_in, str))
+ break;
+ build_in++;
+ }
+ if (*build_in == NULL) {
+ buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ lib = buf1;
+ sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
+ }
+ }
+#ifndef PIC
+ snd_pcm_open_symbols(); /* this call is for static linking only */
+#endif
+ open_func = snd_dlobj_cache_lookup(open_name);
+ if (open_func) {
+ err = 0;
+ goto _err;
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s",
+ lib ? lib : "[builtin]");
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name,
+ lib ? lib : "[builtin]");
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (err >= 0) {
+ err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
+ if (err >= 0) {
+ if (h /*&& (mode & SND_PCM_KEEP_ALIVE)*/) {
+ snd_dlobj_cache_add(open_name, h, open_func);
+ h = NULL;
+ }
+ (*pcmp)->dl_handle = h;
+ err = 0;
+ } else {
+ if (h)
+ snd_dlclose(h);
+ }
+ }
+ if (type_conf)
+ snd_config_delete(type_conf);
+ free(buf);
+ free(buf1);
+ return err;
+}
+
+static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
+ const char *name, snd_pcm_stream_t stream,
+ int mode, int hop)
+{
+ int err;
+ snd_config_t *pcm_conf;
+ const char *str;
+
+ err = snd_config_search_definition(root, "pcm", name, &pcm_conf);
+ if (err < 0) {
+ SNDERR("Unknown PCM %s", name);
+ return err;
+ }
+ if (snd_config_get_string(pcm_conf, &str) >= 0)
+ err = snd_pcm_open_noupdate(pcmp, root, str, stream, mode,
+ hop + 1);
+ else {
+ snd_config_set_hop(pcm_conf, hop);
+ err = snd_pcm_open_conf(pcmp, name, root, pcm_conf, stream, mode);
+ }
+ snd_config_delete(pcm_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a PCM
+ * \param pcmp Returned PCM handle
+ * \param name ASCII identifier of the PCM handle
+ * \param stream Wanted stream
+ * \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_stream_t stream, int mode)
+{
+ int err;
+ assert(pcmp && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_pcm_open_noupdate(pcmp, snd_config, name, stream, mode, 0);
+}
+
+/**
+ * \brief Opens a PCM using local configuration
+ * \param pcmp Returned PCM handle
+ * \param name ASCII identifier of the PCM handle
+ * \param stream Wanted stream
+ * \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_stream_t stream, int mode,
+ snd_config_t *lconf)
+{
+ assert(pcmp && name && lconf);
+ return snd_pcm_open_noupdate(pcmp, lconf, name, stream, mode, 0);
+}
+
+#ifndef DOC_HIDDEN
+int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm;
+ pcm = calloc(1, sizeof(*pcm));
+ if (!pcm)
+ return -ENOMEM;
+ pcm->type = type;
+ if (name)
+ pcm->name = strdup(name);
+ pcm->stream = stream;
+ pcm->mode = mode;
+ pcm->poll_fd_count = 1;
+ pcm->poll_fd = -1;
+ pcm->op_arg = pcm;
+ pcm->fast_op_arg = pcm;
+ INIT_LIST_HEAD(&pcm->async_handlers);
+ *pcmp = pcm;
+ return 0;
+}
+
+int snd_pcm_free(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ free(pcm->name);
+ free(pcm->hw.link_dst);
+ free(pcm->appl.link_dst);
+ if (pcm->dl_handle)
+ snd_dlclose(pcm->dl_handle);
+ free(pcm);
+ return 0;
+}
+
+int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root,
+ snd_config_t *conf, snd_pcm_stream_t stream,
+ int mode, snd_config_t *parent_conf)
+{
+ const char *str;
+ int hop;
+
+ if ((hop = snd_config_check_hop(parent_conf)) < 0)
+ return hop;
+ if (snd_config_get_string(conf, &str) >= 0)
+ return snd_pcm_open_noupdate(pcmp, root, str, stream, mode,
+ hop + 1);
+ return snd_pcm_open_conf(pcmp, name, root, conf, stream, mode);
+}
+#endif
+
+/**
+ * \brief Wait for a PCM to become ready
+ * \param pcm PCM handle
+ * \param timeout maximum time in milliseconds to wait,
+ * a negative value means infinity
+ * \return a positive value on success otherwise a negative error code
+ * (-EPIPE for the xrun and -ESTRPIPE for the suspended status,
+ * others for general errors)
+ * \retval 0 timeout occurred
+ * \retval 1 PCM stream is ready for I/O
+ */
+int snd_pcm_wait(snd_pcm_t *pcm, int timeout)
+{
+ if (snd_pcm_mmap_avail(pcm) >= pcm->avail_min) {
+ /* check more precisely */
+ switch (snd_pcm_state(pcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return 1;
+ }
+ }
+ return snd_pcm_wait_nocheck(pcm, timeout);
+}
+
+#ifndef DOC_HIDDEN
+/*
+ * like snd_pcm_wait() but doesn't check mmap_avail before calling poll()
+ *
+ * used in drain code in some plugins
+ */
+int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
+{
+ struct pollfd *pfd;
+ unsigned short *revents;
+ int i, npfds, pollio, err, err_poll;
+
+ npfds = snd_pcm_poll_descriptors_count(pcm);
+ if (npfds <= 0 || npfds >= 16) {
+ SNDERR("Invalid poll_fds %d\n", npfds);
+ return -EIO;
+ }
+ pfd = alloca(sizeof(*pfd) * npfds);
+ revents = alloca(sizeof(*revents) * npfds);
+ err = snd_pcm_poll_descriptors(pcm, pfd, npfds);
+ if (err < 0)
+ return err;
+ if (err != npfds) {
+ SNDMSG("invalid poll descriptors %d\n", err);
+ return -EIO;
+ }
+ do {
+ pollio = 0;
+ err_poll = poll(pfd, npfds, timeout);
+ if (err_poll < 0) {
+ if (errno == EINTR)
+ continue;
+ return -errno;
+ }
+ if (! err_poll)
+ break;
+ err = snd_pcm_poll_descriptors_revents(pcm, pfd, npfds, revents);
+ if (err < 0)
+ return err;
+ for (i = 0; i < npfds; i++) {
+ if (revents[i] & (POLLERR | POLLNVAL)) {
+ /* check more precisely */
+ switch (snd_pcm_state(pcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EIO;
+ }
+ }
+ if ((revents[i] & (POLLIN | POLLOUT)) == 0)
+ continue;
+ pollio++;
+ }
+ } while (! pollio);
+#if 0 /* very useful code to test poll related problems */
+ {
+ snd_pcm_sframes_t avail_update;
+ snd_pcm_hwsync(pcm);
+ avail_update = snd_pcm_avail_update(pcm);
+ if (avail_update < (snd_pcm_sframes_t)pcm->avail_min) {
+ printf("*** snd_pcm_wait() FATAL ERROR!!!\n");
+ printf("avail_min = %li, avail_update = %li\n", pcm->avail_min, avail_update);
+ }
+ }
+#endif
+ return err_poll > 0 ? 1 : 0;
+}
+#endif
+
+/**
+ * \brief Return number of frames ready to be read (capture) / written (playback)
+ * \param pcm PCM handle
+ * \return a positive number of frames ready otherwise a negative
+ * error code
+ *
+ * On capture does all the actions needed to transport to application
+ * level all the ready frames across underlying layers.
+ *
+ * The position is not synced with hardware (driver) position in the sound
+ * ring buffer in this function. This function is a light version of
+ * #snd_pcm_avail() .
+ *
+ * Using this function is ideal after poll() or select() when audio
+ * file descriptor made the event and when application expects just period
+ * timing.
+ *
+ * Also this function might be called after #snd_pcm_delay() or
+ * #snd_pcm_hwsync() functions to move private ring buffer pointers
+ * in alsa-lib (the internal plugin chain).
+ */
+snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm)
+{
+ return pcm->fast_ops->avail_update(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Return number of frames ready to be read (capture) / written (playback)
+ * \param pcm PCM handle
+ * \return a positive number of frames ready otherwise a negative
+ * error code
+ *
+ * On capture does all the actions needed to transport to application
+ * level all the ready frames across underlying layers.
+ *
+ * The position is synced with hardware (driver) position in the sound
+ * ring buffer in this functions.
+ */
+snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm)
+{
+ int err;
+
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ err = pcm->fast_ops->hwsync(pcm->fast_op_arg);
+ if (err < 0)
+ return err;
+ return pcm->fast_ops->avail_update(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Combine snd_pcm_avail and snd_pcm_delay functions
+ * \param pcm PCM handle
+ * \param avail Number of available frames in the ring buffer
+ * \param delay Total I/O latency in frames
+ * \return zero on success otherwise a negative error code
+ *
+ * The avail and delay values retuned are in sync.
+ */
+int snd_pcm_avail_delay(snd_pcm_t *pcm,
+ snd_pcm_sframes_t *availp,
+ snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_sframes_t sf;
+
+ assert(pcm && availp && delayp);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ sf = pcm->fast_ops->delay(pcm->fast_op_arg, delayp);
+ if (sf < 0)
+ return (int)sf;
+ sf = pcm->fast_ops->avail_update(pcm->fast_op_arg);
+ if (sf < 0)
+ return (int)sf;
+ *availp = sf;
+ return 0;
+}
+
+/**
+ * \brief Silence an area
+ * \param dst_area area specification
+ * \param dst_offset offset in frames inside area
+ * \param samples samples to silence
+ * \param format PCM sample format
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset,
+ unsigned int samples, snd_pcm_format_t format)
+{
+ /* FIXME: sub byte resolution and odd dst_offset */
+ char *dst;
+ unsigned int dst_step;
+ int width;
+ u_int64_t silence;
+ if (!dst_area->addr)
+ return 0;
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ width = snd_pcm_format_physical_width(format);
+ silence = snd_pcm_format_silence_64(format);
+ if (dst_area->step == (unsigned int) width) {
+ unsigned int dwords = samples * width / 64;
+ u_int64_t *dstp = (u_int64_t *)dst;
+ samples -= dwords * 64 / width;
+ while (dwords-- > 0)
+ *dstp++ = silence;
+ if (samples == 0)
+ return 0;
+ }
+ dst_step = dst_area->step / 8;
+ switch (width) {
+ case 4: {
+ u_int8_t s0 = silence & 0xf0;
+ u_int8_t s1 = silence & 0x0f;
+ int dstbit = dst_area->first % 8;
+ int dstbit_step = dst_area->step % 8;
+ while (samples-- > 0) {
+ if (dstbit) {
+ *dst &= 0xf0;
+ *dst |= s1;
+ } else {
+ *dst &= 0x0f;
+ *dst |= s0;
+ }
+ dst += dst_step;
+ dstbit += dstbit_step;
+ if (dstbit == 8) {
+ dst++;
+ dstbit = 0;
+ }
+ }
+ break;
+ }
+ case 8: {
+ u_int8_t sil = silence;
+ while (samples-- > 0) {
+ *dst = sil;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 16: {
+ u_int16_t sil = silence;
+ while (samples-- > 0) {
+ *(u_int16_t*)dst = sil;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 24:
+#ifdef SNDRV_LITTLE_ENDIAN
+ *(dst + 0) = silence >> 0;
+ *(dst + 1) = silence >> 8;
+ *(dst + 2) = silence >> 16;
+#else
+ *(dst + 2) = silence >> 0;
+ *(dst + 1) = silence >> 8;
+ *(dst + 0) = silence >> 16;
+#endif
+ break;
+ case 32: {
+ u_int32_t sil = silence;
+ while (samples-- > 0) {
+ *(u_int32_t*)dst = sil;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 64: {
+ while (samples-- > 0) {
+ *(u_int64_t*)dst = silence;
+ dst += dst_step;
+ }
+ break;
+ }
+ default:
+ SNDMSG("invalid format width %d", width);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+/**
+ * \brief Silence one or more areas
+ * \param dst_areas areas specification (one for each channel)
+ * \param dst_offset offset in frames inside area
+ * \param channels channels count
+ * \param frames frames to silence
+ * \param format PCM sample format
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format)
+{
+ int width = snd_pcm_format_physical_width(format);
+ while (channels > 0) {
+ void *addr = dst_areas->addr;
+ unsigned int step = dst_areas->step;
+ const snd_pcm_channel_area_t *begin = dst_areas;
+ int channels1 = channels;
+ unsigned int chns = 0;
+ int err;
+ while (1) {
+ channels1--;
+ chns++;
+ dst_areas++;
+ if (channels1 == 0 ||
+ dst_areas->addr != addr ||
+ dst_areas->step != step ||
+ dst_areas->first != dst_areas[-1].first + width)
+ break;
+ }
+ if (chns > 1 && chns * width == step) {
+ /* Collapse the areas */
+ snd_pcm_channel_area_t d;
+ d.addr = begin->addr;
+ d.first = begin->first;
+ d.step = width;
+ err = snd_pcm_area_silence(&d, dst_offset * chns, frames * chns, format);
+ channels -= chns;
+ } else {
+ err = snd_pcm_area_silence(begin, dst_offset, frames, format);
+ dst_areas = begin + 1;
+ channels--;
+ }
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+
+/**
+ * \brief Copy an area
+ * \param dst_area destination area specification
+ * \param dst_offset offset in frames inside destination area
+ * \param src_area source area specification
+ * \param src_offset offset in frames inside source area
+ * \param samples samples to copy
+ * \param format PCM sample format
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_area, snd_pcm_uframes_t src_offset,
+ unsigned int samples, snd_pcm_format_t format)
+{
+ /* FIXME: sub byte resolution and odd dst_offset */
+ const char *src;
+ char *dst;
+ int width;
+ int src_step, dst_step;
+ if (dst_area == src_area && dst_offset == src_offset)
+ return 0;
+ if (!src_area->addr)
+ return snd_pcm_area_silence(dst_area, dst_offset, samples, format);
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ if (!dst_area->addr)
+ return 0;
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ width = snd_pcm_format_physical_width(format);
+ if (src_area->step == (unsigned int) width &&
+ dst_area->step == (unsigned int) width) {
+ size_t bytes = samples * width / 8;
+ samples -= bytes * 8 / width;
+ memcpy(dst, src, bytes);
+ if (samples == 0)
+ return 0;
+ }
+ src_step = src_area->step / 8;
+ dst_step = dst_area->step / 8;
+ switch (width) {
+ case 4: {
+ int srcbit = src_area->first % 8;
+ int srcbit_step = src_area->step % 8;
+ int dstbit = dst_area->first % 8;
+ int dstbit_step = dst_area->step % 8;
+ while (samples-- > 0) {
+ unsigned char srcval;
+ if (srcbit)
+ srcval = *src & 0x0f;
+ else
+ srcval = *src & 0xf0;
+ if (dstbit)
+ *dst &= 0xf0;
+ else
+ *dst &= 0x0f;
+ *dst |= srcval;
+ src += src_step;
+ srcbit += srcbit_step;
+ if (srcbit == 8) {
+ src++;
+ srcbit = 0;
+ }
+ dst += dst_step;
+ dstbit += dstbit_step;
+ if (dstbit == 8) {
+ dst++;
+ dstbit = 0;
+ }
+ }
+ break;
+ }
+ case 8: {
+ while (samples-- > 0) {
+ *dst = *src;
+ src += src_step;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 16: {
+ while (samples-- > 0) {
+ *(u_int16_t*)dst = *(const u_int16_t*)src;
+ src += src_step;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 24:
+ while (samples-- > 0) {
+ *(dst + 0) = *(src + 0);
+ *(dst + 1) = *(src + 1);
+ *(dst + 2) = *(src + 2);
+ src += src_step;
+ dst += dst_step;
+ }
+ break;
+ case 32: {
+ while (samples-- > 0) {
+ *(u_int32_t*)dst = *(const u_int32_t*)src;
+ src += src_step;
+ dst += dst_step;
+ }
+ break;
+ }
+ case 64: {
+ while (samples-- > 0) {
+ *(u_int64_t*)dst = *(const u_int64_t*)src;
+ src += src_step;
+ dst += dst_step;
+ }
+ break;
+ }
+ default:
+ SNDMSG("invalid format width %d", width);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+/**
+ * \brief Copy one or more areas
+ * \param dst_areas destination areas specification (one for each channel)
+ * \param dst_offset offset in frames inside destination area
+ * \param src_areas source areas specification (one for each channel)
+ * \param src_offset offset in frames inside source area
+ * \param channels channels count
+ * \param frames frames to copy
+ * \param format PCM sample format
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format)
+{
+ int width = snd_pcm_format_physical_width(format);
+ assert(dst_areas);
+ assert(src_areas);
+ if (! channels) {
+ SNDMSG("invalid channels %d", channels);
+ return -EINVAL;
+ }
+ if (! frames) {
+ SNDMSG("invalid frames %ld", frames);
+ return -EINVAL;
+ }
+ while (channels > 0) {
+ unsigned int step = src_areas->step;
+ void *src_addr = src_areas->addr;
+ const snd_pcm_channel_area_t *src_start = src_areas;
+ void *dst_addr = dst_areas->addr;
+ const snd_pcm_channel_area_t *dst_start = dst_areas;
+ int channels1 = channels;
+ unsigned int chns = 0;
+ while (dst_areas->step == step) {
+ channels1--;
+ chns++;
+ src_areas++;
+ dst_areas++;
+ if (channels1 == 0 ||
+ src_areas->step != step ||
+ src_areas->addr != src_addr ||
+ dst_areas->addr != dst_addr ||
+ src_areas->first != src_areas[-1].first + width ||
+ dst_areas->first != dst_areas[-1].first + width)
+ break;
+ }
+ if (chns > 1 && chns * width == step) {
+ /* Collapse the areas */
+ snd_pcm_channel_area_t s, d;
+ s.addr = src_start->addr;
+ s.first = src_start->first;
+ s.step = width;
+ d.addr = dst_start->addr;
+ d.first = dst_start->first;
+ d.step = width;
+ snd_pcm_area_copy(&d, dst_offset * chns,
+ &s, src_offset * chns,
+ frames * chns, format);
+ channels -= chns;
+ } else {
+ snd_pcm_area_copy(dst_start, dst_offset,
+ src_start, src_offset,
+ frames, format);
+ src_areas = src_start + 1;
+ dst_areas = dst_start + 1;
+ channels--;
+ }
+ }
+ return 0;
+}
+
+static void dump_one_param(snd_pcm_hw_params_t *params, unsigned int k, snd_output_t *out)
+{
+ snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(k));
+ snd_pcm_hw_param_dump(params, k, out);
+ snd_output_putc(out, '\n');
+}
+
+/**
+ * \brief Dump a PCM hardware configuration space
+ * \param params Configuration space
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out)
+{
+ unsigned int k;
+ for (k = SND_PCM_HW_PARAM_FIRST_MASK; k <= SND_PCM_HW_PARAM_LAST_MASK; k++)
+ dump_one_param(params, k, out);
+ for (k = SND_PCM_HW_PARAM_FIRST_INTERVAL; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; k++)
+ dump_one_param(params, k, out);
+ return 0;
+}
+
+/**
+ * \brief Check, if hardware supports sample-resolution mmap for given configuration
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't support sample-resolution mmap
+ * \retval 1 Hardware supports sample-resolution mmap
+ *
+ * The return value is always one when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_MMAP_VALID);
+}
+
+/**
+ * \brief Check, if hardware does double buffering for start/stop for given configuration
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't do double buffering for start/stop
+ * \retval 1 Hardware does double buffering for start/stop
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_DOUBLE);
+}
+
+/**
+ * \brief Check, if hardware does double buffering for data transfers for given configuration
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't do double buffering for data transfers
+ * \retval 1 Hardware does double buffering for data transfers
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_BATCH);
+}
+
+/**
+ * \brief Check, if hardware does block transfers for samples for given configuration
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't block transfers
+ * \retval 1 Hardware does block transfers
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_BLOCK_TRANSFER);
+}
+
+/**
+ * \brief Check, if timestamps are monotonic for given configuration
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Device doesn't do monotomic timestamps
+ * \retval 1 Device does monotonic timestamps
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SND_PCM_INFO_MONOTONIC);
+}
+
+/**
+ * \brief Check, if hardware supports overrange detection
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't support overrange detection
+ * \retval 1 Hardware supports overrange detection
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_OVERRANGE);
+}
+
+/**
+ * \brief Check, if hardware supports pause
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't support pause
+ * \retval 1 Hardware supports pause
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_PAUSE);
+}
+
+/**
+ * \brief Check, if hardware supports resume
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't support resume
+ * \retval 1 Hardware supports resume
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_RESUME);
+}
+
+/**
+ * \brief Check, if hardware does half-duplex only
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't do half-duplex
+ * \retval 1 Hardware does half-duplex
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_HALF_DUPLEX);
+}
+
+/**
+ * \brief Check, if hardware does joint-duplex (playback and capture are somewhat correlated)
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't do joint-duplex
+ * \retval 1 Hardware does joint-duplex
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_JOINT_DUPLEX);
+}
+
+/**
+ * \brief Check, if hardware supports synchronized start with sample resolution
+ * \param params Configuration space
+ * \return Boolean value
+ * \retval 0 Hardware doesn't support synchronized start
+ * \retval 1 Hardware supports synchronized start
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return 0; /* FIXME: should be a negative error? */
+ }
+ return !!(params->info & SNDRV_PCM_INFO_SYNC_START);
+}
+
+/**
+ * \brief Get rate exact info from a configuration space
+ * \param params Configuration space
+ * \param rate_num Pointer to returned rate numerator
+ * \param rate_den Pointer to returned rate denominator
+ * \return 0 otherwise a negative error code if the info is not available
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
+ unsigned int *rate_num, unsigned int *rate_den)
+{
+ assert(params);
+ if (CHECK_SANITY(params->rate_den == 0)) {
+ SNDMSG("invalid rate_den value");
+ return -EINVAL;
+ }
+ *rate_num = params->rate_num;
+ *rate_den = params->rate_den;
+ return 0;
+}
+
+/**
+ * \brief Get sample resolution info from a configuration space
+ * \param params Configuration space
+ * \return signification bits in sample otherwise a negative error code if the info is not available
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->msbits == 0)) {
+ SNDMSG("invalid msbits value");
+ return -EINVAL;
+ }
+ return params->msbits;
+}
+
+/**
+ * \brief Get hard are FIFO size info from a configuration space
+ * \param params Configuration space
+ * \return FIFO size in frames otherwise a negative error code if the info is not available
+ *
+ * It is not allowed to call this function when given configuration is not exactly one.
+ * Usually, #snd_pcm_hw_params() function chooses one configuration
+ * from the configuration space.
+ */
+int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
+{
+ assert(params);
+ if (CHECK_SANITY(params->info == ~0U)) {
+ SNDMSG("invalid PCM info field");
+ return -EINVAL;
+ }
+ return params->fifo_size;
+}
+
+/**
+ * \brief Fill params with a full configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ */
+int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ _snd_pcm_hw_params_any(params);
+ return snd_pcm_hw_refine(pcm, params);
+}
+
+/**
+ * \brief get size of #snd_pcm_access_mask_t
+ * \return size in bytes
+ */
+size_t snd_pcm_access_mask_sizeof()
+{
+ return sizeof(snd_pcm_access_mask_t);
+}
+
+/**
+ * \brief allocate an empty #snd_pcm_access_mask_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_access_mask_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_access_mask_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_access_mask_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief reset all bits in a #snd_pcm_access_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask)
+{
+ snd_mask_none((snd_mask_t *) mask);
+}
+
+/**
+ * \brief set all bits in a #snd_pcm_access_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask)
+{
+ snd_mask_any((snd_mask_t *) mask);
+}
+
+/**
+ * \brief test the presence of an access type in a #snd_pcm_access_mask_t
+ * \param mask pointer to mask
+ * \param val access type
+ */
+int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
+{
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief test, if given a #snd_pcm_access_mask_t is empty
+ * \param mask pointer to mask
+ * \retval 0 not empty
+ * \retval 1 empty
+ */
+int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask)
+{
+ return snd_mask_empty((const snd_mask_t *) mask);
+}
+
+/**
+ * \brief make an access type present in a #snd_pcm_access_mask_t
+ * \param mask pointer to mask
+ * \param val access type
+ */
+void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
+{
+ snd_mask_set((snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief make an access type missing from a #snd_pcm_access_mask_t
+ * \param mask pointer to mask
+ * \param val access type
+ */
+void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
+{
+ snd_mask_reset((snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief get size of #snd_pcm_format_mask_t
+ * \return size in bytes
+ */
+size_t snd_pcm_format_mask_sizeof()
+{
+ return sizeof(snd_pcm_format_mask_t);
+}
+
+/**
+ * \brief allocate an empty #snd_pcm_format_mask_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_format_mask_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_format_mask_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_format_mask_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief reset all bits in a #snd_pcm_format_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask)
+{
+ snd_mask_none((snd_mask_t *) mask);
+}
+
+/**
+ * \brief set all bits in a #snd_pcm_format_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask)
+{
+ snd_mask_any((snd_mask_t *) mask);
+}
+
+/**
+ * \brief test the presence of a format in a #snd_pcm_format_mask_t
+ * \param mask pointer to mask
+ * \param val format
+ */
+int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
+{
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief test, if given a #snd_pcm_format_mask_t is empty
+ * \param mask pointer to mask
+ * \retval 0 not empty
+ * \retval 1 empty
+ */
+int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask)
+{
+ return snd_mask_empty((const snd_mask_t *) mask);
+}
+
+/**
+ * \brief make a format present in a #snd_pcm_format_mask_t
+ * \param mask pointer to mask
+ * \param val format
+ */
+void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
+{
+ snd_mask_set((snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief make a format missing from a #snd_pcm_format_mask_t
+ * \param mask pointer to mask
+ * \param val format
+ */
+void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
+{
+ snd_mask_reset((snd_mask_t *) mask, (unsigned long) val);
+}
+
+
+/**
+ * \brief get size of #snd_pcm_subformat_mask_t
+ * \return size in bytes
+ */
+size_t snd_pcm_subformat_mask_sizeof()
+{
+ return sizeof(snd_pcm_subformat_mask_t);
+}
+
+/**
+ * \brief allocate an empty #snd_pcm_subformat_mask_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_subformat_mask_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_subformat_mask_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_subformat_mask_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief reset all bits in a #snd_pcm_subformat_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask)
+{
+ snd_mask_none((snd_mask_t *) mask);
+}
+
+/**
+ * \brief set all bits in a #snd_pcm_subformat_mask_t
+ * \param mask pointer to mask
+ */
+void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask)
+{
+ snd_mask_any((snd_mask_t *) mask);
+}
+
+/**
+ * \brief test the presence of a subformat in a #snd_pcm_subformat_mask_t
+ * \param mask pointer to mask
+ * \param val subformat
+ */
+int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
+{
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief test, if given a #snd_pcm_subformat_mask_t is empty
+ * \param mask pointer to mask
+ * \retval 0 not empty
+ * \retval 1 empty
+ */
+int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask)
+{
+ return snd_mask_empty((const snd_mask_t *) mask);
+}
+
+/**
+ * \brief make a subformat present in a #snd_pcm_subformat_mask_t
+ * \param mask pointer to mask
+ * \param val subformat
+ */
+void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
+{
+ snd_mask_set((snd_mask_t *) mask, (unsigned long) val);
+}
+
+/**
+ * \brief make a subformat missing from a #snd_pcm_subformat_mask_t
+ * \param mask pointer to mask
+ * \param val subformat
+ */
+void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
+{
+ snd_mask_reset((snd_mask_t *) mask, (unsigned long) val);
+}
+
+
+/**
+ * \brief get size of #snd_pcm_hw_params_t
+ * \return size in bytes
+ */
+size_t snd_pcm_hw_params_sizeof()
+{
+ return sizeof(snd_pcm_hw_params_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_pcm_hw_params_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_hw_params_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_hw_params_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_hw_params_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Extract access type from a configuration space
+ * \param params Configuration space
+ * \param access Returned value
+ * \return access type otherwise a negative error code if not exactly one is present
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#else
+int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, &_val, NULL);
+ if (err >= 0)
+ *access = _val;
+ return err;
+}
+
+/**
+ * \brief Verify if an access type is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param access access type
+ * \return 0 if available a negative error code otherwise
+ */
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_ACCESS, access, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one access type
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param access access type
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, access, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its first access type
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param access Returned first access type
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_access_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#else
+int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, access, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its last access type
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param access Returned last access type
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_access_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#else
+int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, access, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only a set of access types
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param mask Access mask
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
+{
+ return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
+}
+
+/**
+ * \brief Get access mask from a configuration space
+ * \param params Configuration space
+ * \param mask Returned Access mask
+ */
+int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
+{
+ if (params == NULL || mask == NULL)
+ return -EINVAL;
+ snd_pcm_access_mask_copy(mask, snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS));
+ return 0;
+}
+
+
+/**
+ * \brief Extract format from a configuration space
+ * \param params Configuration space
+ * \param format returned format
+ * \return format otherwise a negative error code if not exactly one is present
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_format)(const snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#else
+int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, (unsigned int *)format, NULL);
+}
+
+/**
+ * \brief Verify if a format is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param format format
+ * \return 0 if available a negative error code otherwise
+ */
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, format, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one format
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param format format
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, format, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its first format
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param format Returned first format
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_format_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#else
+int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, (unsigned int *)format, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its last format
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param format Returned last format
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_format_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#else
+int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, (unsigned int *)format, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only a set of formats
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param mask Format mask
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
+{
+ return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, (snd_mask_t *) mask);
+}
+
+/**
+ * \brief Get format mask from a configuration space
+ * \param params Configuration space
+ * \param mask Returned Format mask
+ */
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
+{
+ snd_pcm_format_mask_copy(mask, snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_FORMAT));
+}
+
+
+/**
+ * \brief Extract subformat from a configuration space
+ * \param params Configuration space
+ * \param subformat Returned subformat value
+ * \return subformat otherwise a negative error code if not exactly one is present
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#else
+int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
+}
+
+/**
+ * \brief Verify if a subformat is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param subformat subformat value
+ * \return 0 if available a negative error code otherwise
+ */
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_SUBFORMAT, subformat, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one subformat
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param subformat subformat value
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, subformat, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its first subformat
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param subformat Returned subformat
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#else
+int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its last subformat
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param subformat Returned subformat
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#else
+int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only a set of subformats
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param mask Subformat mask
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
+{
+ return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
+}
+
+/**
+ * \brief Get subformat mask from a configuration space
+ * \param params Configuration space
+ * \param mask Returned Subformat mask
+ */
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
+{
+ snd_pcm_subformat_mask_copy(mask, snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
+}
+
+
+/**
+ * \brief Extract channels from a configuration space
+ * \param params Configuration space
+ * \param val Returned channels count
+ * \return 0 otherwise a negative error code if not exactly one is present
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Extract minimum channels count from a configuration space
+ * \param params Configuration space
+ * \param val minimum channels count
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_channels_min)(const snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Extract maximum channels count from a configuration space
+ * \param params Configuration space
+ * \param val maximum channels count
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_channels_max)(const snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Verify if a channels count is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val channels count
+ * \return 0 if available a negative error code otherwise
+ */
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_CHANNELS, val, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one channels count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val channels count
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, 0);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum channels count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val minimum channels count (on return filled with actual minimum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+{
+ return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum channels count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val maximum channels count (on return filled with actual maximum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+{
+ return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to have channels counts in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min minimum channels count (on return filled with actual minimum)
+ * \param max maximum channels count (on return filled with actual maximum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max)
+{
+ return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, min, NULL, max, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to have channels count nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val target channels count, returned chosen channels count
+ * \return 0 otherwise a negative error code if configuration space is empty
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_channels_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum channels count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val minimum channels count
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_channels_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum channels count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val maximum channels count
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_channels_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#else
+int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
+}
+
+
+/**
+ * \brief Extract rate from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Extract minimum rate from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate minimum rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_rate_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Extract maximum rate from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate maximum rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_rate_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Verify if a rate is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate rate
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one rate
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum rate
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum rate (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum rate
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum rate (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to have rates in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum rate (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum rate (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+{
+ return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, min, mindir, max, maxdir);
+}
+
+/**
+ * \brief Restrict a configuration space to have rate nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target rate / returned approximate set rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_rate_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum rate
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned minimum approximate rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_rate_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum rate
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned maximum approximate rate
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_rate_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only real hardware rates
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val 0 = disable, 1 = enable (default) rate resampling
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
+{
+ assert(pcm && params);
+ if (!val)
+ params->flags |= SND_PCM_HW_PARAMS_NORESAMPLE;
+ else
+ params->flags &= ~SND_PCM_HW_PARAMS_NORESAMPLE;
+ return snd_pcm_hw_refine(pcm, params);
+}
+
+/**
+ * \brief Extract resample state from a configuration space
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val 0 = disable, 1 = enable rate resampling
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+{
+ assert(pcm && params && val);
+ *val = params->flags & SND_PCM_HW_PARAMS_NORESAMPLE ? 0 : 1;
+ return 0;
+}
+
+/**
+ * \brief Restrict a configuration space to allow the buffer accessible from outside
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val 0 = disable, 1 = enable (default) exporting buffer
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
+{
+ assert(pcm && params);
+ if (val)
+ params->flags |= SND_PCM_HW_PARAMS_EXPORT_BUFFER;
+ else
+ params->flags &= ~SND_PCM_HW_PARAMS_EXPORT_BUFFER;
+ return snd_pcm_hw_refine(pcm, params);
+}
+
+/**
+ * \brief Extract buffer accessibility from a configuration space
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val 0 = disable, 1 = enable exporting buffer
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
+{
+ assert(pcm && params && val);
+ *val = params->flags & SND_PCM_HW_PARAMS_EXPORT_BUFFER ? 1 : 0;
+ return 0;
+}
+
+/**
+ * \brief Extract period time from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate period duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Extract minimum period time from a configuration space
+ * \param params Configuration space
+ * \param val approximate minimum period duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Extract maximum period time from a configuration space
+ * \param params Configuration space
+ * \param val approximate maximum period duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Verify if a period time is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate period duration in us
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one period time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate period duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+
+/**
+ * \brief Restrict a configuration space with a minimum period time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum period duration in us (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum period time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum period duration in us (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to have period times in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum period duration in us (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum period duration in us (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+{
+ return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, min, mindir, max, maxdir);
+}
+
+/**
+ * \brief Restrict a configuration space to have period time nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target period duration in us / returned chosen approximate target period duration
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum period time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate period duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum period time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned maximum approximate period time
+ * \param dir Sub unit direction
+ * \return approximate period duration in us
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
+}
+
+
+/**
+ * \brief Extract period size from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Extract minimum period size from a configuration space
+ * \param params Configuration space
+ * \param val approximate minimum period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Extract maximum period size from a configuration space
+ * \param params Configuration space
+ * \param val approximate minimum period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_period_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Verify if a period size is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate period size in frames
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one period size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum period size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum period size in frames (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum period size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum period size in frames (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to have period sizes in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum period size in frames (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum period size in frames (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir)
+{
+ unsigned int _min = *min;
+ unsigned int _max = *max;
+ int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_min, mindir, &_max, maxdir);
+ *min = _min;
+ *max = _max;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to have period size nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target period size in frames / returned chosen approximate target period size
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum period size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned maximum approximate period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum period size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned maximum approximate period size in frames
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_period_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#else
+int snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to contain only integer period sizes
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE);
+}
+
+
+/**
+ * \brief Extract periods from a configuration space
+ * \param params Configuration space
+ * \param val approximate periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_periods)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Extract minimum periods count from a configuration space
+ * \param params Configuration space
+ * \param val approximate minimum periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_periods_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Extract maximum periods count from a configuration space
+ * \param params Configuration space
+ * \param val approximate maximum periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_periods_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Verify if a periods count is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one periods count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum periods count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum periods per buffer (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum periods count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum periods per buffer (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to have periods counts in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum periods per buffer (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum periods per buffer (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+{
+ return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, maxdir);
+}
+
+/**
+ * \brief Restrict a configuration space to have periods count nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target periods per buffer / returned chosen approximate target periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_periods_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum periods count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate minimum periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_periods_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum periods count
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate maximum periods per buffer
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_periods_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only integer periods counts
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS);
+}
+
+
+/**
+ * \brief Extract buffer time from a configuration space
+ * \param params Configuration space
+ * \param val Returned buffer time in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Extract minimum buffer time from a configuration space
+ * \param params Configuration space
+ * \param val approximate minimum buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Extract maximum buffer time from a configuration space
+ * \param params Configuration space
+ * \param val approximate maximum buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Verify if a buffer time is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one buffer time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum buffer time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum buffer duration in us (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum buffer time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum buffer duration in us (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+{
+ return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to have buffer times in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum buffer duration in us (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum buffer duration in us (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
+{
+ return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, min, mindir, max, maxdir);
+}
+
+/**
+ * \brief Restrict a configuration space to have buffer time nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target buffer duration in us / returned chosen approximate target buffer duration
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum buffer time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate minimum buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum buffered time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate maximum buffer duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#else
+int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
+}
+
+
+/**
+ * \brief Extract buffer size from a configuration space
+ * \param params Configuration space
+ * \param val Returned buffer size in frames
+ * \return 0 otherwise a negative error code if not exactly one is present
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Extract minimum buffer size from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate minimum buffer size in frames
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Extract maximum buffer size from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate maximum buffer size in frames
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_buffer_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Verify if a buffer size is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val buffer size in frames
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
+}
+
+/**
+ * \brief Restrict a configuration space to contain only one buffer size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val buffer size in frames
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
+{
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
+}
+
+/**
+ * \brief Restrict a configuration space with a minimum buffer size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum buffer size in frames (on return filled with actual minimum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space with a maximum buffer size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum buffer size in frames (on return filled with actual maximum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to have buffer sizes in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum buffer size in frames (on return filled with actual minimum)
+ * \param max approximate maximum buffer size in frames (on return filled with actual maximum)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ */
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max)
+{
+ unsigned int _min = *min;
+ unsigned int _max = *max;
+ int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_min, NULL, &_max, NULL);
+ *min = _min;
+ *max = _max;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to have buffer size nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target buffer size in frames / returned chosen approximate target buffer size in frames
+ * \return 0 otherwise a negative error code if configuration space is empty
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val = *val;
+ int err = snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its minimum buffer size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned minimum buffer size in frames
+ * \return buffer size in frames
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+/**
+ * \brief Restrict a configuration space to contain only its maximum buffer size
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned maximum buffer size in frames
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ unsigned int _val;
+ int err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
+ if (err >= 0)
+ *val = _val;
+ return err;
+}
+
+
+/**
+ * \brief (DEPRECATED) Extract tick time from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if not exactly one is present
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ *val = 0;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Extract minimum tick time from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate minimum tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ *val = 0;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Extract maximum tick time from a configuration space
+ * \param params Configuration space
+ * \param val Returned approximate maximum tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Exact value is <,=,> the returned one following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ *val = 0;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Verify if a tick time is available inside a configuration space for a PCM
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 if available a negative error code otherwise
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int val, int dir ATTRIBUTE_UNUSED)
+{
+ return val ? -EINVAL : 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space to contain only one tick time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted exact value is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int dir ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space with a minimum tick time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate minimum tick duration in us (on return filled with actual minimum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space with a maximum tick time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate maximum tick duration in us (on return filled with actual maximum)
+ * \param dir Sub unit direction (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space to have tick times in a given range
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param min approximate minimum tick duration in us (on return filled with actual minimum)
+ * \param mindir Sub unit direction for minimum (on return filled with actual direction)
+ * \param max approximate maximum tick duration in us (on return filled with actual maximum)
+ * \param maxdir Sub unit direction for maximum (on return filled with actual direction)
+ * \return 0 otherwise a negative error code if configuration space would become empty
+ *
+ * Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)
+ */
+int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *min ATTRIBUTE_UNUSED, int *mindir ATTRIBUTE_UNUSED, unsigned int *max ATTRIBUTE_UNUSED, int *maxdir ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space to have tick time nearest to a target
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val approximate target tick duration in us / returned chosen approximate target tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code if configuration space is empty
+ *
+ * target/chosen exact value is <,=,> val following dir (-1,0,1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space to contain only its minimum tick time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate minimum tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Restrict a configuration space to contain only its maximum tick time
+ * \param pcm PCM handle
+ * \param params Configuration space
+ * \param val Returned approximate maximum tick duration in us
+ * \param dir Sub unit direction
+ * \return 0 otherwise a negative error code
+ *
+ * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val ATTRIBUTE_UNUSED, int *dir ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief Get the minimum transfer align value in samples
+ * \param params Configuration space
+ * \param val Returned minimum align value
+ * \return 0 otherwise a negative error code if not exactly one is present
+ */
+int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
+{
+ unsigned int format, channels, fb, min_align;
+ int err;
+
+ err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, &format, NULL);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, &channels, NULL);
+ if (err < 0)
+ return err;
+ // compute frame bits
+ fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels;
+ min_align = 1;
+ while (fb % 8) {
+ fb *= 2;
+ min_align *= 2;
+ }
+ if (val)
+ *val = min_align;
+ return 0;
+}
+
+/**
+ * \brief Return current software configuration for a PCM
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ assert(pcm && params);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ params->tstamp_mode = pcm->tstamp_mode;
+ params->period_step = pcm->period_step;
+ params->sleep_min = 0;
+ params->avail_min = pcm->avail_min;
+ params->period_event = pcm->period_event;
+ params->xfer_align = 1;
+ params->start_threshold = pcm->start_threshold;
+ params->stop_threshold = pcm->stop_threshold;
+ params->silence_threshold = pcm->silence_threshold;
+ params->silence_size = pcm->silence_size;
+ params->boundary = pcm->boundary;
+ return 0;
+}
+
+/**
+ * \brief Dump a software configuration
+ * \param params Software configuration container
+ * \param out Output handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
+{
+ snd_output_printf(out, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(params->tstamp_mode));
+ snd_output_printf(out, "period_step: %u\n", params->period_step);
+ snd_output_printf(out, "avail_min: %lu\n", params->avail_min);
+ snd_output_printf(out, "start_threshold: %ld\n", params->start_threshold);
+ snd_output_printf(out, "stop_threshold: %ld\n", params->stop_threshold);
+ snd_output_printf(out, "silence_threshold: %lu\n", params->silence_threshold);
+ snd_output_printf(out, "silence_size: %lu\n", params->silence_size);
+ snd_output_printf(out, "boundary: %lu\n", params->boundary);
+ return 0;
+}
+
+/**
+ * \brief get size of #snd_pcm_sw_params_t
+ * \return size in bytes
+ */
+size_t snd_pcm_sw_params_sizeof()
+{
+ return sizeof(snd_pcm_sw_params_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_pcm_sw_params_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_sw_params_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_sw_params_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_sw_params_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get boundary for ring pointers from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned boundary in frames
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+{
+ assert(params);
+ *val = params->boundary;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Set start mode inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Start mode
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val)
+{
+ assert(pcm && params);
+ switch (val) {
+ case SND_PCM_START_DATA:
+ params->start_threshold = 1;
+ break;
+ case SND_PCM_START_EXPLICIT:
+ params->start_threshold = pcm->boundary;
+ break;
+ default:
+ SNDMSG("invalid start mode value %d\n", val);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_sw_params_set_start_mode, "Warning: start_mode is deprecated, consider to use start_threshold");
+#endif
+
+/**
+ * \brief (DEPRECATED) Get start mode from a software configuration container
+ * \param params Software configuration container
+ * \return start mode
+ */
+snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params)
+{
+ assert(params);
+ /* FIXME: Ugly */
+ return params->start_threshold > 1024 * 1024 ? SND_PCM_START_EXPLICIT : SND_PCM_START_DATA;
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_sw_params_get_start_mode, "Warning: start_mode is deprecated, consider to use start_threshold");
+#endif
+
+/**
+ * \brief (DEPRECATED) Set xrun mode inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Xrun mode
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val)
+#else
+int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val)
+#endif
+{
+ assert(pcm && params);
+ switch (val) {
+ case SND_PCM_XRUN_STOP:
+ params->stop_threshold = pcm->buffer_size;
+ break;
+ case SND_PCM_XRUN_NONE:
+ params->stop_threshold = pcm->boundary;
+ break;
+ default:
+ SNDMSG("invalid xrun mode value %d\n", val);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_sw_params_set_xrun_mode, "Warning: xrun_mode is deprecated, consider to use stop_threshold");
+#endif
+
+/**
+ * \brief (DEPRECATED) Get xrun mode from a software configuration container
+ * \param params Software configuration container
+ * \return xrun mode
+ */
+snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params)
+{
+ assert(params);
+ /* FIXME: Ugly */
+ return params->stop_threshold > 1024 * 1024 ? SND_PCM_XRUN_NONE : SND_PCM_XRUN_STOP;
+}
+
+#ifndef DOC_HIDDEN
+link_warning(snd_pcm_sw_params_get_xrun_mode, "Warning: xrun_mode is deprecated, consider to use stop_threshold");
+#endif
+
+/**
+ * \brief Set timestamp mode inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Timestamp mode
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val)
+#else
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val)
+#endif
+{
+ assert(pcm && params);
+ if (CHECK_SANITY(val > SND_PCM_TSTAMP_LAST)) {
+ SNDMSG("invalid tstamp_mode value %d", val);
+ return -EINVAL;
+ }
+ params->tstamp_mode = val;
+ return 0;
+}
+
+/**
+ * \brief Get timestamp mode from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned timestamp
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_tstamp_mode)(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val)
+#else
+int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val)
+#endif
+{
+ assert(params && val);
+ *val = params->tstamp_mode;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Minimum ticks to sleep or 0 to disable the use of tick timer
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Get minimum numbers of ticks to sleep from a software configuration container
+ * \param params Software configuration container
+ * \param val returned minimum number of ticks to sleep or 0 if tick timer is disabled
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_sleep_min)(const snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, unsigned int *val)
+#else
+int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val)
+#endif
+{
+ *val = 0;
+ return 0;
+}
+
+/**
+ * \brief Set avail min inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Minimum avail frames to consider PCM ready
+ * \return 0 otherwise a negative error code
+ *
+ * Note: This is similar to setting an OSS wakeup point. The valid
+ * values for 'val' are determined by the specific hardware. Most PC
+ * sound cards can only accept power of 2 frame counts (i.e. 512,
+ * 1024, 2048). You cannot use this as a high resolution timer - it
+ * is limited to how often the sound card hardware raises an
+ * interrupt.
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#else
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ assert(pcm && params);
+ /* Fix avail_min if it's below period size. The period_size
+ * defines the minimal wake-up timing accuracy, so it doesn't
+ * make sense to set below that.
+ */
+ if (val < pcm->period_size)
+ val = pcm->period_size;
+ params->avail_min = val;
+ return 0;
+}
+
+/**
+ * \brief Get avail min from a software configuration container
+ * \param params Software configuration container
+ * \param val returned minimum available frames to consider PCM ready
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ assert(params && val);
+ *val = params->avail_min;
+ return 0;
+}
+
+/**
+ * \brief Set period event inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val 0 = disable period event, 1 = enable period event
+ * \return 0 otherwise a negative error code
+ *
+ * An poll (select) wakeup event is raised if enabled.
+ */
+int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val)
+{
+ assert(pcm && params);
+ params->period_event = val;
+ return 0;
+}
+
+/**
+ * \brief Get period event from a software configuration container
+ * \param params Software configuration container
+ * \param val returned period event state
+ * \return 0 otherwise a negative error code
+ */
+int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val)
+{
+ assert(params && val);
+ *val = params->period_event;
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Set xfer align inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Chunk size (frames are attempted to be transferred in chunks)
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t val ATTRIBUTE_UNUSED)
+#else
+int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief (DEPRECATED) Get xfer align from a software configuration container
+ * \param params Software configuration container
+ * \param val returned chunk size (frames are attempted to be transferred in chunks)
+ * \return 0 otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_xfer_align)(const snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ *val = 1;
+ return 0;
+}
+
+/**
+ * \brief Set start threshold inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Start threshold in frames
+ * \return 0 otherwise a negative error code
+ *
+ * PCM is automatically started when playback frames available to PCM
+ * are >= threshold or when requested capture frames are >= threshold
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#else
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ assert(pcm && params);
+ params->start_threshold = val;
+ return 0;
+}
+
+/**
+ * \brief Get start threshold from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned start threshold in frames
+ * \return 0 otherwise a negative error code
+ *
+ * PCM is automatically started when playback frames available to PCM
+ * are >= threshold or when requested capture frames are >= threshold
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_start_threshold)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ assert(params);
+ *val = params->start_threshold;
+ return 0;
+}
+
+
+/**
+ * \brief Set stop threshold inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Stop threshold in frames
+ * \return 0 otherwise a negative error code
+ *
+ * PCM is automatically stopped in #SND_PCM_STATE_XRUN state when available
+ * frames is >= threshold. If the stop threshold is equal to boundary (also
+ * software parameter - sw_param) then automatic stop will be disabled
+ * (thus device will do the endless loop in the ring buffer).
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#else
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ assert(pcm && params);
+ params->stop_threshold = val;
+ return 0;
+}
+
+/**
+ * \brief Get stop threshold from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned stop threshold in frames
+ * \return 0 otherwise a negative error code
+ *
+ * PCM is automatically stopped in #SND_PCM_STATE_XRUN state when available
+ * frames is >= threshold. If the stop threshold is equal to boundary (also
+ * software parameter - sw_param) then automatic stop will be disabled
+ * (thus device will do the endless loop in the ring buffer).
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_stop_threshold)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ assert(params);
+ *val = params->stop_threshold;
+ return 0;
+}
+
+
+/**
+ * \brief Set silence threshold inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Silence threshold in frames
+ * \return 0 otherwise a negative error code
+ *
+ * A portion of playback buffer is overwritten with silence (see
+ * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
+ * than silence threshold.
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#else
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ assert(pcm && params);
+ if (CHECK_SANITY(val >= pcm->buffer_size)) {
+ SNDMSG("invalid silent_threshold value %ld (buffer_size = %ld)",
+ val, pcm->buffer_size);
+ return -EINVAL;
+ }
+ params->silence_threshold = val;
+ return 0;
+}
+
+/**
+ * \brief Get silence threshold from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned silence threshold in frames
+ * \return 0 otherwise a negative error value
+ *
+ * A portion of playback buffer is overwritten with silence (see
+ * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
+ * than silence threshold.
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_silence_threshold)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ assert(params && val);
+ *val = params->silence_threshold;
+ return 0;
+}
+
+
+/**
+ * \brief Set silence size inside a software configuration container
+ * \param pcm PCM handle
+ * \param params Software configuration container
+ * \param val Silence size in frames (0 for disabled)
+ * \return 0 otherwise a negative error code
+ *
+ * A portion of playback buffer is overwritten with silence when playback
+ * underrun is nearer than silence threshold (see
+ * #snd_pcm_sw_params_set_silence_threshold)
+ *
+ * The special case is when silence size value is equal or greater than
+ * boundary. The unused portion of the ring buffer (initial written samples
+ * are untouched) is filled with silence at start. Later, only just processed
+ * sample area is filled with silence. Note: silence_threshold must be set to zero.
+ */
+#ifndef DOXYGEN
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#else
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
+#endif
+{
+ assert(pcm && params);
+ if (CHECK_SANITY(val < pcm->boundary && val > pcm->buffer_size)) {
+ SNDMSG("invalid silence_size %ld (boundary %ld, buffer_size %ld)",
+ val, pcm->boundary, pcm->buffer_size);
+ return -EINVAL;
+ }
+ params->silence_size = val;
+ return 0;
+}
+
+/**
+ * \brief Get silence size from a software configuration container
+ * \param params Software configuration container
+ * \param val Returned silence size in frames (0 for disabled)
+ * \return 0 otherwise a negative error code
+ *
+ * A portion of playback buffer is overwritten with silence when playback
+ * underrun is nearer than silence threshold (see
+ * #snd_pcm_sw_params_set_silence_threshold)
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_pcm_sw_params_get_silence_size)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#else
+int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
+#endif
+{
+ assert(params);
+ *val = params->silence_size;
+ return 0;
+}
+
+
+/**
+ * \brief get size of #snd_pcm_status_t
+ * \return size in bytes
+ */
+size_t snd_pcm_status_sizeof()
+{
+ return sizeof(snd_pcm_status_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_pcm_status_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_status_malloc(snd_pcm_status_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_status_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_status_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_status_free(snd_pcm_status_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_status_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get state from a PCM status container (see #snd_pcm_state)
+ * \param obj #snd_pcm_status_t pointer
+ * \return PCM state
+ */
+snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->state;
+}
+
+/**
+ * \brief Get trigger timestamp from a PCM status container
+ * \param obj #snd_pcm_status_t pointer
+ * \param ptr Pointer to returned timestamp
+ *
+ * Trigger means a PCM state transition (from stopped to running or
+ * versa vice). It applies also to pause and suspend. In other words,
+ * timestamp contains time when stream started or when it was stopped.
+ */
+void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
+{
+ assert(obj && ptr);
+ ptr->tv_sec = obj->trigger_tstamp.tv_sec;
+ ptr->tv_usec = obj->trigger_tstamp.tv_nsec / 1000L;
+}
+
+/**
+ * \brief Get trigger hi-res timestamp from a PCM status container
+ * \param obj #snd_pcm_status_t pointer
+ * \param ptr Pointer to returned timestamp
+ *
+ * Trigger means a PCM state transition (from stopped to running or
+ * versa vice). It applies also to pause and suspend. In other words,
+ * timestamp contains time when stream started or when it was stopped.
+ */
+#ifndef DOXYGEN
+void INTERNAL(snd_pcm_status_get_trigger_htstamp)(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
+#else
+void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
+#endif
+{
+ assert(obj && ptr);
+ *ptr = obj->trigger_tstamp;
+}
+use_default_symbol_version(__snd_pcm_status_get_trigger_htstamp, snd_pcm_status_get_trigger_htstamp, ALSA_0.9.0rc8);
+
+/**
+ * \brief Get "now" timestamp from a PCM status container
+ * \param obj #snd_pcm_status_t pointer
+ * \param ptr Pointer to returned timestamp
+ */
+void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
+{
+ assert(obj && ptr);
+ ptr->tv_sec = obj->tstamp.tv_sec;
+ ptr->tv_usec = obj->tstamp.tv_nsec / 1000L;
+}
+
+/**
+ * \brief Get "now" hi-res timestamp from a PCM status container
+ * \param obj pointer to #snd_pcm_status_t
+ * \param ptr Pointer to returned timestamp
+ */
+#ifndef DOXYGEN
+void INTERNAL(snd_pcm_status_get_htstamp)(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
+#else
+void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
+#endif
+{
+ assert(obj && ptr);
+ *ptr = obj->tstamp;
+}
+use_default_symbol_version(__snd_pcm_status_get_htstamp, snd_pcm_status_get_htstamp, ALSA_0.9.0rc8);
+
+/**
+ * \brief Get delay from a PCM status container (see #snd_pcm_delay)
+ * \return Delay in frames
+ *
+ * Delay is distance between current application frame position and
+ * sound frame position.
+ * It's positive and less than buffer size in normal situation,
+ * negative on playback underrun and greater than buffer size on
+ * capture overrun.
+ */
+snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->delay;
+}
+
+/**
+ * \brief Get number of frames available from a PCM status container (see #snd_pcm_avail_update)
+ * \return Number of frames ready to be read/written
+ */
+snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->avail;
+}
+
+/**
+ * \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call
+ * \return Maximum number of frames ready to be read/written
+ */
+snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->avail_max;
+}
+
+/**
+ * \brief Get count of ADC overrange detections since last call
+ * \return Count of ADC overrange detections
+ */
+snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj)
+{
+ assert(obj);
+ return obj->overrange;
+}
+
+/**
+ * \brief get size of #snd_pcm_info_t
+ * \return size in bytes
+ */
+size_t snd_pcm_info_sizeof()
+{
+ return sizeof(snd_pcm_info_t);
+}
+
+/**
+ * \brief allocate an invalid #snd_pcm_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_info_malloc(snd_pcm_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_pcm_info_t
+ * \param obj pointer to object to free
+ */
+void snd_pcm_info_free(snd_pcm_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_pcm_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief Get device from a PCM info container
+ * \param obj PCM info container
+ * \return device number
+ */
+unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->device;
+}
+
+/**
+ * \brief Get subdevice from a PCM info container
+ * \param obj PCM info container
+ * \return subdevice number
+ */
+unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->subdevice;
+}
+
+/**
+ * \brief Get stream (direction) from a PCM info container
+ * \param obj PCM info container
+ * \return stream
+ */
+snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->stream;
+}
+
+/**
+ * \brief Get card from a PCM info container
+ * \param obj PCM info container
+ * \return card number otherwise a negative error code if not associable to a card
+ */
+int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->card;
+}
+
+/**
+ * \brief Get id from a PCM info container
+ * \param obj PCM info container
+ * \return short id of PCM
+ */
+const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->id;
+}
+
+/**
+ * \brief Get name from a PCM info container
+ * \param obj PCM info container
+ * \return name of PCM
+ */
+const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->name;
+}
+
+/**
+ * \brief Get subdevice name from a PCM info container
+ * \param obj PCM info container
+ * \return name of used PCM subdevice
+ */
+const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return (const char *)obj->subname;
+}
+
+/**
+ * \brief Get class from a PCM info container
+ * \param obj PCM info container
+ * \return class of PCM
+ */
+snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->dev_class;
+}
+
+/**
+ * \brief Get subclass from a PCM info container
+ * \param obj PCM info container
+ * \return subclass of PCM
+ */
+snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->dev_subclass;
+}
+
+/**
+ * \brief Get subdevices count from a PCM info container
+ * \param obj PCM info container
+ * \return subdevices total count of PCM
+ */
+unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->subdevices_count;
+}
+
+/**
+ * \brief Get available subdevices count from a PCM info container
+ * \param obj PCM info container
+ * \return available subdevices count of PCM
+ */
+unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
+{
+ assert(obj);
+ return obj->subdevices_avail;
+}
+
+/**
+ * \brief Get hardware synchronization ID from a PCM info container
+ * \param obj PCM info container
+ * \return hardware synchronization ID
+ */
+snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj)
+{
+ snd_pcm_sync_id_t res;
+ assert(obj);
+ memcpy(&res, &obj->sync, sizeof(res));
+ return res;
+}
+
+/**
+ * \brief Set wanted device inside a PCM info container (see #snd_ctl_pcm_info)
+ * \param obj PCM info container
+ * \param val Device number
+ */
+void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->device = val;
+}
+
+/**
+ * \brief Set wanted subdevice inside a PCM info container (see #snd_ctl_pcm_info)
+ * \param obj PCM info container
+ * \param val Subdevice number
+ */
+void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val)
+{
+ assert(obj);
+ obj->subdevice = val;
+}
+
+/**
+ * \brief Set wanted stream inside a PCM info container (see #snd_ctl_pcm_info)
+ * \param obj PCM info container
+ * \param val Stream
+ */
+void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
+{
+ assert(obj);
+ obj->stream = val;
+}
+
+/**
+ * \brief Application request to access a portion of direct (mmap) area
+ * \param pcm PCM handle
+ * \param areas Returned mmap channel areas
+ * \param offset Returned mmap area offset in area steps (== frames)
+ * \param frames mmap area portion size in frames (wanted on entry, contiguous available on exit)
+ * \return 0 on success otherwise a negative error code
+ *
+ * It is necessary to call the snd_pcm_avail_update() function directly before
+ * this call. Otherwise, this function can return a wrong count of available frames.
+ *
+ * The function should be called before a sample-direct area can be accessed.
+ * The resulting size parameter is always less or equal to the input count of frames
+ * and can be zero, if no frames can be processed (the ring buffer is full).
+ *
+ * See the snd_pcm_mmap_commit() function to finish the frame processing in
+ * the direct areas.
+ */
+int snd_pcm_mmap_begin(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t **areas,
+ snd_pcm_uframes_t *offset,
+ snd_pcm_uframes_t *frames)
+{
+ snd_pcm_uframes_t cont;
+ snd_pcm_uframes_t f;
+ snd_pcm_uframes_t avail;
+ const snd_pcm_channel_area_t *xareas;
+ assert(pcm && areas && offset && frames);
+ xareas = snd_pcm_mmap_areas(pcm);
+ if (xareas == NULL)
+ return -EBADFD;
+ *areas = xareas;
+ *offset = *pcm->appl.ptr % pcm->buffer_size;
+ avail = snd_pcm_mmap_avail(pcm);
+ if (avail > pcm->buffer_size)
+ avail = pcm->buffer_size;
+ cont = pcm->buffer_size - *offset;
+ f = *frames;
+ if (f > avail)
+ f = avail;
+ if (f > cont)
+ f = cont;
+ *frames = f;
+ return 0;
+}
+
+/**
+ * \brief Application has completed the access to area requested with #snd_pcm_mmap_begin
+ * \param pcm PCM handle
+ * \param offset area offset in area steps (== frames)
+ * \param frames area portion size in frames
+ * \return count of transferred frames otherwise a negative error code
+ *
+ * You should pass this function the offset value that
+ * snd_pcm_mmap_begin() returned. The frames parameter should hold the
+ * number of frames you have written or read to/from the audio
+ * buffer. The frames parameter must never exceed the contiguous frames
+ * count that snd_pcm_mmap_begin() returned. Each call to snd_pcm_mmap_begin()
+ * must be followed by a call to snd_pcm_mmap_commit().
+ *
+ * Example:
+\code
+ double phase = 0;
+ const snd_pcm_area_t *areas;
+ snd_pcm_sframes_t avail, size, commitres;
+ snd_pcm_uframes_t offset, frames;
+ int err;
+
+ avail = snd_pcm_avail_update(pcm);
+ if (avail < 0)
+ error(avail);
+ // at this point, we can transfer at least 'avail' frames
+
+ // we want to process frames in chunks (period_size)
+ if (avail < period_size)
+ goto _skip;
+ size = period_size;
+ // it is possible that contiguous areas are smaller, thus we use a loop
+ while (size > 0) {
+ frames = size;
+
+ err = snd_pcm_mmap_begin(pcm_handle, &areas, &offset, &frames);
+ if (err < 0)
+ error(err);
+ // this function fills the areas from offset with count of frames
+ generate_sine(areas, offset, frames, &phase);
+ commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames);
+ if (commitres < 0 || commitres != frames)
+ error(commitres >= 0 ? -EPIPE : commitres);
+
+ size -= frames;
+ }
+ _skip:
+\endcode
+ *
+ * Look to the \ref example_test_pcm "Sine-wave generator" example
+ * for more details about the generate_sine function.
+ */
+snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t frames)
+{
+ assert(pcm);
+ if (CHECK_SANITY(offset != *pcm->appl.ptr % pcm->buffer_size)) {
+ SNDMSG("commit offset (%ld) doesn't match with appl_ptr (%ld) %% buf_size (%ld)",
+ offset, *pcm->appl.ptr, pcm->buffer_size);
+ return -EPIPE;
+ }
+ if (CHECK_SANITY(frames > snd_pcm_mmap_avail(pcm))) {
+ SNDMSG("commit frames (%ld) overflow (avail = %ld)", frames,
+ snd_pcm_mmap_avail(pcm));
+ return -EPIPE;
+ }
+ return pcm->fast_ops->mmap_commit(pcm->fast_op_arg, offset, frames);
+}
+
+#ifndef DOC_HIDDEN
+
+int _snd_pcm_poll_descriptor(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return pcm->poll_fd;
+}
+
+void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
+ void *buf)
+{
+ unsigned int channel;
+ unsigned int channels = pcm->channels;
+ for (channel = 0; channel < channels; ++channel, ++areas) {
+ areas->addr = buf;
+ areas->first = channel * pcm->sample_bits;
+ areas->step = pcm->frame_bits;
+ }
+}
+
+void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
+ void **bufs)
+{
+ unsigned int channel;
+ unsigned int channels = pcm->channels;
+ for (channel = 0; channel < channels; ++channel, ++areas, ++bufs) {
+ areas->addr = *bufs;
+ areas->first = 0;
+ areas->step = pcm->sample_bits;
+ }
+}
+
+snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, snd_pcm_uframes_t size,
+ snd_pcm_xfer_areas_func_t func)
+{
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t err = 0;
+ snd_pcm_state_t state = snd_pcm_state(pcm);
+
+ if (size == 0)
+ return 0;
+
+ switch (state) {
+ case SND_PCM_STATE_PREPARED:
+ err = snd_pcm_start(pcm);
+ if (err < 0)
+ goto _end;
+ break;
+ case SND_PCM_STATE_DRAINING:
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+
+ while (size > 0) {
+ snd_pcm_uframes_t frames;
+ snd_pcm_sframes_t avail;
+ _again:
+ if (state == SND_PCM_STATE_RUNNING) {
+ err = snd_pcm_hwsync(pcm);
+ if (err < 0)
+ goto _end;
+ }
+ avail = snd_pcm_avail_update(pcm);
+ if (avail < 0) {
+ err = avail;
+ goto _end;
+ }
+ if ((snd_pcm_uframes_t)avail < pcm->avail_min &&
+ size > (snd_pcm_uframes_t)avail) {
+ if (pcm->mode & SND_PCM_NONBLOCK) {
+ err = -EAGAIN;
+ goto _end;
+ }
+
+ err = snd_pcm_wait(pcm, -1);
+ if (err < 0)
+ break;
+ goto _again;
+
+ }
+ frames = size;
+ if (frames > (snd_pcm_uframes_t) avail)
+ frames = avail;
+ if (! frames)
+ break;
+ err = func(pcm, areas, offset, frames);
+ if (err < 0)
+ break;
+ frames = err;
+ offset += frames;
+ size -= frames;
+ xfer += frames;
+ }
+ _end:
+ return xfer > 0 ? (snd_pcm_sframes_t) xfer : snd_pcm_check_error(pcm, err);
+}
+
+snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, snd_pcm_uframes_t size,
+ snd_pcm_xfer_areas_func_t func)
+{
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t err = 0;
+ snd_pcm_state_t state = snd_pcm_state(pcm);
+
+ if (size == 0)
+ return 0;
+
+ switch (state) {
+ case SND_PCM_STATE_PREPARED:
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+
+ while (size > 0) {
+ snd_pcm_uframes_t frames;
+ snd_pcm_sframes_t avail;
+ _again:
+ if (state == SND_PCM_STATE_RUNNING) {
+ err = snd_pcm_hwsync(pcm);
+ if (err < 0)
+ goto _end;
+ }
+ avail = snd_pcm_avail_update(pcm);
+ if (avail < 0) {
+ err = avail;
+ goto _end;
+ }
+ if ((state == SND_PCM_STATE_RUNNING &&
+ (snd_pcm_uframes_t)avail < pcm->avail_min &&
+ size > (snd_pcm_uframes_t)avail)) {
+ if (pcm->mode & SND_PCM_NONBLOCK) {
+ err = -EAGAIN;
+ goto _end;
+ }
+
+ err = snd_pcm_wait(pcm, -1);
+ if (err < 0)
+ break;
+ goto _again;
+ }
+ frames = size;
+ if (frames > (snd_pcm_uframes_t) avail)
+ frames = avail;
+ if (! frames)
+ break;
+ err = func(pcm, areas, offset, frames);
+ if (err < 0)
+ break;
+ frames = err;
+ if (state == SND_PCM_STATE_PREPARED) {
+ snd_pcm_sframes_t hw_avail = pcm->buffer_size - avail;
+ hw_avail += frames;
+ /* some plugins might automatically start the stream */
+ state = snd_pcm_state(pcm);
+ if (state == SND_PCM_STATE_PREPARED &&
+ hw_avail >= (snd_pcm_sframes_t) pcm->start_threshold) {
+ err = snd_pcm_start(pcm);
+ if (err < 0)
+ goto _end;
+ }
+ }
+ offset += frames;
+ size -= frames;
+ xfer += frames;
+ }
+ _end:
+ return xfer > 0 ? (snd_pcm_sframes_t) xfer : snd_pcm_check_error(pcm, err);
+}
+
+snd_pcm_uframes_t _snd_pcm_mmap_hw_ptr(snd_pcm_t *pcm)
+{
+ return *pcm->hw.ptr;
+}
+
+snd_pcm_uframes_t _snd_pcm_boundary(snd_pcm_t *pcm)
+{
+ return pcm->boundary;
+}
+
+#ifndef DOC_HIDDEN
+link_warning(_snd_pcm_mmap_hw_ptr, "Warning: _snd_pcm_mmap_hw_ptr() is deprecated, consider to not use this function");
+link_warning(_snd_pcm_boundary, "Warning: _snd_pcm_boundary() is deprecated, consider to use snd_pcm_sw_params_current()");
+#endif
+
+static const char *const names[SND_PCM_HW_PARAM_LAST_INTERVAL + 1] = {
+ [SND_PCM_HW_PARAM_FORMAT] = "format",
+ [SND_PCM_HW_PARAM_CHANNELS] = "channels",
+ [SND_PCM_HW_PARAM_RATE] = "rate",
+ [SND_PCM_HW_PARAM_PERIOD_TIME] = "period_time",
+ [SND_PCM_HW_PARAM_PERIOD_SIZE] = "period_size",
+ [SND_PCM_HW_PARAM_BUFFER_TIME] = "buffer_time",
+ [SND_PCM_HW_PARAM_BUFFER_SIZE] = "buffer_size",
+ [SND_PCM_HW_PARAM_PERIODS] = "periods"
+};
+
+int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
+ snd_config_t **_pcm_conf, unsigned int count, ...)
+{
+ snd_config_iterator_t i, next;
+ const char *str;
+ struct {
+ unsigned int index;
+ int flags;
+ void *ptr;
+ int present;
+ } fields[count];
+ unsigned int k;
+ snd_config_t *pcm_conf = NULL;
+ int err;
+ int to_free = 0;
+ va_list args;
+ assert(root);
+ assert(conf);
+ assert(_pcm_conf);
+ if (snd_config_get_string(conf, &str) >= 0) {
+ err = snd_config_search_definition(root, "pcm_slave", str, &conf);
+ if (err < 0) {
+ SNDERR("Invalid slave definition");
+ return -EINVAL;
+ }
+ to_free = 1;
+ }
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid slave definition");
+ err = -EINVAL;
+ goto _err;
+ }
+ va_start(args, count);
+ for (k = 0; k < count; ++k) {
+ fields[k].index = va_arg(args, int);
+ fields[k].flags = va_arg(args, int);
+ fields[k].ptr = va_arg(args, void *);
+ fields[k].present = 0;
+ }
+ va_end(args);
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "pcm") == 0) {
+ if (pcm_conf != NULL)
+ snd_config_delete(pcm_conf);
+ if ((err = snd_config_copy(&pcm_conf, n)) < 0)
+ goto _err;
+ continue;
+ }
+ for (k = 0; k < count; ++k) {
+ unsigned int idx = fields[k].index;
+ long v;
+ assert(idx < SND_PCM_HW_PARAM_LAST_INTERVAL);
+ assert(names[idx]);
+ if (strcmp(id, names[idx]) != 0)
+ continue;
+ switch (idx) {
+ case SND_PCM_HW_PARAM_FORMAT:
+ {
+ snd_pcm_format_t f;
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ _invalid:
+ SNDERR("invalid type for %s", id);
+ goto _err;
+ }
+ if ((fields[k].flags & SCONF_UNCHANGED) &&
+ strcasecmp(str, "unchanged") == 0) {
+ *(snd_pcm_format_t*)fields[k].ptr = (snd_pcm_format_t) -2;
+ break;
+ }
+ f = snd_pcm_format_value(str);
+ if (f == SND_PCM_FORMAT_UNKNOWN) {
+ SNDERR("unknown format %s", str);
+ err = -EINVAL;
+ goto _err;
+ }
+ *(snd_pcm_format_t*)fields[k].ptr = f;
+ break;
+ }
+ default:
+ if ((fields[k].flags & SCONF_UNCHANGED)) {
+ err = snd_config_get_string(n, &str);
+ if (err >= 0 &&
+ strcasecmp(str, "unchanged") == 0) {
+ *(int*)fields[k].ptr = -2;
+ break;
+ }
+ }
+ err = snd_config_get_integer(n, &v);
+ if (err < 0)
+ goto _invalid;
+ *(int*)fields[k].ptr = v;
+ break;
+ }
+ fields[k].present = 1;
+ break;
+ }
+ if (k < count)
+ continue;
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ if (!pcm_conf) {
+ SNDERR("missing field pcm");
+ err = -EINVAL;
+ goto _err;
+ }
+ for (k = 0; k < count; ++k) {
+ if ((fields[k].flags & SCONF_MANDATORY) && !fields[k].present) {
+ SNDERR("missing field %s", names[fields[k].index]);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ *_pcm_conf = pcm_conf;
+ pcm_conf = NULL;
+ err = 0;
+ _err:
+ if (pcm_conf)
+ snd_config_delete(pcm_conf);
+ if (to_free)
+ snd_config_delete(conf);
+ return err;
+}
+
+
+int snd_pcm_conf_generic_id(const char *id)
+{
+ static const char ids[3][8] = { "comment", "type", "hint" };
+ unsigned int k;
+ for (k = 0; k < sizeof(ids) / sizeof(ids[0]); ++k) {
+ if (strcmp(id, ids[k]) == 0)
+ return 1;
+ }
+ return 0;
+}
+
+static void snd_pcm_set_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *rbptr,
+ volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset)
+{
+ rbptr->master = NULL; /* I'm master */
+ rbptr->ptr = hw_ptr;
+ rbptr->fd = fd;
+ rbptr->offset = offset;
+ if (rbptr->changed)
+ rbptr->changed(pcm, NULL);
+}
+
+void snd_pcm_set_hw_ptr(snd_pcm_t *pcm, volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset)
+{
+ assert(pcm);
+ assert(hw_ptr);
+ snd_pcm_set_ptr(pcm, &pcm->hw, hw_ptr, fd, offset);
+}
+
+void snd_pcm_set_appl_ptr(snd_pcm_t *pcm, volatile snd_pcm_uframes_t *appl_ptr, int fd, off_t offset)
+{
+ assert(pcm);
+ assert(appl_ptr);
+ snd_pcm_set_ptr(pcm, &pcm->appl, appl_ptr, fd, offset);
+}
+
+static void snd_pcm_link_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
+ snd_pcm_t *slave, snd_pcm_rbptr_t *slave_rbptr)
+{
+ snd_pcm_t **a;
+ int idx;
+
+ a = slave_rbptr->link_dst;
+ for (idx = 0; idx < slave_rbptr->link_dst_count; idx++)
+ if (a[idx] == NULL) {
+ a[idx] = pcm;
+ goto __found_free_place;
+ }
+ a = realloc(a, sizeof(snd_pcm_t *) * (slave_rbptr->link_dst_count + 1));
+ if (a == NULL) {
+ pcm_rbptr->ptr = NULL;
+ pcm_rbptr->fd = -1;
+ pcm_rbptr->offset = 0UL;
+ return;
+ }
+ a[slave_rbptr->link_dst_count++] = pcm;
+ __found_free_place:
+ pcm_rbptr->master = slave_rbptr->master ? slave_rbptr->master : slave;
+ pcm_rbptr->ptr = slave_rbptr->ptr;
+ pcm_rbptr->fd = slave_rbptr->fd;
+ pcm_rbptr->offset = slave_rbptr->offset;
+ slave_rbptr->link_dst = a;
+ if (pcm_rbptr->changed)
+ pcm_rbptr->changed(pcm, slave);
+}
+
+static void snd_pcm_unlink_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
+ snd_pcm_t *slave, snd_pcm_rbptr_t *slave_rbptr)
+{
+ snd_pcm_t **a;
+ int idx;
+
+ a = slave_rbptr->link_dst;
+ for (idx = 0; idx < slave_rbptr->link_dst_count; idx++) {
+ if (a[idx] == pcm) {
+ a[idx] = NULL;
+ goto __found;
+ }
+ }
+ /* assert(0); */
+ return;
+
+ __found:
+ pcm_rbptr->master = NULL;
+ pcm_rbptr->ptr = NULL;
+ pcm_rbptr->fd = -1;
+ pcm_rbptr->offset = 0UL;
+ if (pcm_rbptr->changed)
+ pcm_rbptr->changed(pcm, slave);
+}
+
+void snd_pcm_link_hw_ptr(snd_pcm_t *pcm, snd_pcm_t *slave)
+{
+ assert(pcm);
+ assert(slave);
+ snd_pcm_link_ptr(pcm, &pcm->hw, slave, &slave->hw);
+}
+
+void snd_pcm_link_appl_ptr(snd_pcm_t *pcm, snd_pcm_t *slave)
+{
+ assert(pcm);
+ assert(slave);
+ snd_pcm_link_ptr(pcm, &pcm->appl, slave, &slave->appl);
+}
+
+void snd_pcm_unlink_hw_ptr(snd_pcm_t *pcm, snd_pcm_t *slave)
+{
+ assert(pcm);
+ assert(slave);
+ snd_pcm_unlink_ptr(pcm, &pcm->hw, slave, &slave->hw);
+}
+
+void snd_pcm_unlink_appl_ptr(snd_pcm_t *pcm, snd_pcm_t *slave)
+{
+ assert(pcm);
+ assert(slave);
+ snd_pcm_unlink_ptr(pcm, &pcm->appl, slave, &slave->appl);
+}
+
+#endif /* DOC_HIDDEN */
+
+/*
+ *
+ */
+
+#ifndef DOC_HIDDEN
+
+#ifdef USE_VERSIONED_SYMBOLS
+
+#define OBSOLETE1(name, what, new) \
+ default_symbol_version(__##name, name, new); \
+ symbol_version(__old_##name, name, what);
+
+#else
+
+#define OBSOLETE1(name, what, new) \
+ use_default_symbol_version(__##name, name, new);
+
+#endif /* USE_VERSIONED_SYMBOLS */
+
+#define __P_OLD_GET(pfx, name, val_type, ret_type) \
+ret_type pfx##name(const snd_pcm_hw_params_t *params) \
+{ \
+ val_type val; \
+ if (INTERNAL(name)(params, &val) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __P_OLD_GET1(pfx, name, val_type, ret_type) \
+ret_type pfx##name(const snd_pcm_hw_params_t *params, int *dir) \
+{ \
+ val_type val; \
+ if (INTERNAL(name)(params, &val, dir) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __OLD_GET(name, val_type, ret_type) __P_OLD_GET(__old_, name, val_type, ret_type)
+#define __OLD_GET1(name, val_type, ret_type) __P_OLD_GET1(__old_, name, val_type, ret_type)
+
+__OLD_GET(snd_pcm_hw_params_get_access, snd_pcm_access_t, int);
+__OLD_GET(snd_pcm_hw_params_get_format, snd_pcm_format_t, int);
+__OLD_GET(snd_pcm_hw_params_get_subformat, snd_pcm_subformat_t, int);
+__OLD_GET(snd_pcm_hw_params_get_channels, unsigned int, int);
+__OLD_GET1(snd_pcm_hw_params_get_rate, unsigned int, int);
+__OLD_GET1(snd_pcm_hw_params_get_period_time, unsigned int, int);
+__OLD_GET1(snd_pcm_hw_params_get_period_size, snd_pcm_uframes_t, snd_pcm_sframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_periods, unsigned int, int);
+__OLD_GET1(snd_pcm_hw_params_get_buffer_time, unsigned int, int);
+__OLD_GET(snd_pcm_hw_params_get_buffer_size, snd_pcm_uframes_t, snd_pcm_sframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_tick_time, unsigned int, int);
+
+__OLD_GET(snd_pcm_hw_params_get_channels_min, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_rate_min, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_period_time_min, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_period_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_periods_min, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_buffer_time_min, unsigned int, unsigned int);
+__OLD_GET(snd_pcm_hw_params_get_buffer_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_tick_time_min, unsigned int, unsigned int);
+
+__OLD_GET(snd_pcm_hw_params_get_channels_max, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_rate_max, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_period_time_max, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_period_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_periods_max, unsigned int, unsigned int);
+__OLD_GET1(snd_pcm_hw_params_get_buffer_time_max, unsigned int, unsigned int);
+__OLD_GET(snd_pcm_hw_params_get_buffer_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t);
+__OLD_GET1(snd_pcm_hw_params_get_tick_time_max, unsigned int, unsigned int);
+
+#define __P_OLD_NEAR(pfx, name, ret_type) \
+ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val) \
+{ \
+ if (INTERNAL(name)(pcm, params, &val) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __P_OLD_NEAR1(pfx, name, ret_type) \
+ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val, int *dir) \
+{ \
+ if (INTERNAL(name)(pcm, params, &val, dir) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __OLD_NEAR(name, ret_type) __P_OLD_NEAR(__old_, name, ret_type)
+#define __OLD_NEAR1(name, ret_type) __P_OLD_NEAR1(__old_, name, ret_type)
+
+__OLD_NEAR(snd_pcm_hw_params_set_channels_near, unsigned int);
+__OLD_NEAR1(snd_pcm_hw_params_set_rate_near, unsigned int);
+__OLD_NEAR1(snd_pcm_hw_params_set_period_time_near, unsigned int);
+__OLD_NEAR1(snd_pcm_hw_params_set_period_size_near, snd_pcm_uframes_t);
+__OLD_NEAR1(snd_pcm_hw_params_set_periods_near, unsigned int);
+__OLD_NEAR1(snd_pcm_hw_params_set_buffer_time_near, unsigned int);
+__OLD_NEAR(snd_pcm_hw_params_set_buffer_size_near, snd_pcm_uframes_t);
+__OLD_NEAR1(snd_pcm_hw_params_set_tick_time_near, unsigned int);
+
+#define __P_OLD_SET_FL(pfx, name, ret_type) \
+ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) \
+{ \
+ ret_type val; \
+ if (INTERNAL(name)(pcm, params, &val) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __P_OLD_SET_FL1(pfx, name, ret_type) \
+ret_type pfx##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) \
+{ \
+ ret_type val; \
+ if (INTERNAL(name)(pcm, params, &val, dir) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __OLD_SET_FL(name, ret_type) __P_OLD_SET_FL(__old_, name, ret_type)
+#define __OLD_SET_FL1(name, ret_type) __P_OLD_SET_FL1(__old_, name, ret_type)
+
+__OLD_SET_FL(snd_pcm_hw_params_set_access_first, snd_pcm_access_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_format_first, snd_pcm_format_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_subformat_first, snd_pcm_subformat_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_channels_first, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_rate_first, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_first, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_first, snd_pcm_uframes_t);
+__OLD_SET_FL1(snd_pcm_hw_params_set_periods_first, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_first, unsigned int);
+__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_first, snd_pcm_uframes_t);
+__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_first, unsigned int);
+
+__OLD_SET_FL(snd_pcm_hw_params_set_access_last, snd_pcm_access_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_format_last, snd_pcm_format_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_subformat_last, snd_pcm_subformat_t);
+__OLD_SET_FL(snd_pcm_hw_params_set_channels_last, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_rate_last, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_last, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_last, snd_pcm_uframes_t);
+__OLD_SET_FL1(snd_pcm_hw_params_set_periods_last, unsigned int);
+__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_last, unsigned int);
+__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_last, snd_pcm_uframes_t);
+__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_last, unsigned int);
+
+#define __P_OLD_GET_SW(pfx, name, ret_type) \
+ret_type pfx##name(snd_pcm_sw_params_t *params) \
+{ \
+ ret_type val; \
+ if (INTERNAL(name)(params, &val) < 0) \
+ return 0; \
+ return (ret_type)val; \
+}
+
+#define __OLD_GET_SW(name, ret_type) __P_OLD_GET_SW(__old_, name, ret_type)
+
+__OLD_GET_SW(snd_pcm_sw_params_get_tstamp_mode, snd_pcm_tstamp_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_sleep_min, unsigned int);
+__OLD_GET_SW(snd_pcm_sw_params_get_avail_min, snd_pcm_uframes_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_xfer_align, snd_pcm_uframes_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_start_threshold, snd_pcm_uframes_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_stop_threshold, snd_pcm_uframes_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_silence_threshold, snd_pcm_uframes_t);
+__OLD_GET_SW(snd_pcm_sw_params_get_silence_size, snd_pcm_uframes_t);
+
+OBSOLETE1(snd_pcm_hw_params_get_access, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_access_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_access_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_format, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_format_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_format_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_subformat, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_subformat_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_subformat_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_channels, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_channels_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_channels_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_channels_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_channels_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_channels_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_rate, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_rate_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_rate_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_rate_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_rate_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_rate_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_period_time, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_period_time_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_period_time_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_time_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_time_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_time_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_period_size, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_period_size_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_period_size_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_size_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_size_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_period_size_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_periods, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_periods_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_periods_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_periods_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_periods_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_periods_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_buffer_time, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_buffer_time_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_buffer_time_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_time_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_time_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_time_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_buffer_size, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_buffer_size_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_buffer_size_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_size_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_size_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_buffer_size_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_hw_params_get_tick_time, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_tick_time_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_get_tick_time_max, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_tick_time_near, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_tick_time_first, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_hw_params_set_tick_time_last, ALSA_0.9, ALSA_0.9.0rc4);
+
+OBSOLETE1(snd_pcm_sw_params_get_tstamp_mode, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_sleep_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_avail_min, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_xfer_align, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_start_threshold, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_stop_threshold, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_silence_threshold, ALSA_0.9, ALSA_0.9.0rc4);
+OBSOLETE1(snd_pcm_sw_params_get_silence_size, ALSA_0.9, ALSA_0.9.0rc4);
+
+#endif /* DOC_HIDDEN */
+
+/*
+ * basic helpers
+ */
+
+
+/**
+ * \brief Recover the stream state from an error or suspend
+ * \param pcm PCM handle
+ * \param err error number
+ * \param silent do not print error reason
+ * \return 0 when error code was handled successfuly, otherwise a negative error code
+ *
+ * This functions handles -EINTR (interrupted system call),
+ * -EPIPE (overrun or underrun) and -ESTRPIPE (stream is suspended)
+ * error codes trying to prepare given stream for next I/O.
+ *
+ * Note that this function returs the original error code when it is not
+ * handled inside this function (for example -EAGAIN is returned back).
+ */
+int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
+{
+ if (err > 0)
+ err = -err;
+ if (err == -EINTR) /* nothing to do, continue */
+ return 0;
+ if (err == -EPIPE) {
+ const char *s;
+ if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK)
+ s = "underrun";
+ else
+ s = "overrun";
+ if (!silent)
+ SNDERR("%s occured", s);
+ err = snd_pcm_prepare(pcm);
+ if (err < 0) {
+ SNDERR("cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
+ return err;
+ }
+ return 0;
+ }
+ if (err == -ESTRPIPE) {
+ while ((err = snd_pcm_resume(pcm)) == -EAGAIN)
+ /* wait until suspend flag is released */
+ poll(NULL, 0, 1000);
+ if (err < 0) {
+ err = snd_pcm_prepare(pcm);
+ if (err < 0) {
+ SNDERR("cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ return 0;
+ }
+ return err;
+}
+
+/**
+ * \brief Set the hardware and software parameters in a simple way
+ * \param pcm PCM handle
+ * \param format required PCM format
+ * \param access required PCM access
+ * \param channels required PCM channels
+ * \param rate required sample rate in Hz
+ * \param soft_resample 0 = disallow alsa-lib resample stream, 1 = allow resampling
+ * \param latency required overall latency in us (0 = optimum latency for players)
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_set_params(snd_pcm_t *pcm,
+ snd_pcm_format_t format,
+ snd_pcm_access_t access,
+ unsigned int channels,
+ unsigned int rate,
+ int soft_resample,
+ unsigned int latency)
+{
+ snd_pcm_hw_params_t *params;
+ snd_pcm_sw_params_t *swparams;
+ const char *s = snd_pcm_stream_name(snd_pcm_stream(pcm));
+ snd_pcm_uframes_t buffer_size, period_size;
+ unsigned int rrate, period_time;
+ int err;
+
+ snd_pcm_hw_params_alloca(&params);
+ snd_pcm_sw_params_alloca(&swparams);
+
+ assert(pcm);
+ /* choose all parameters */
+ err = snd_pcm_hw_params_any(pcm, params);
+ if (err < 0) {
+ SNDERR("Broken configuration for %s: no configurations available", s);
+ return err;
+ }
+ /* set software resampling */
+ err = snd_pcm_hw_params_set_rate_resample(pcm, params, soft_resample);
+ if (err < 0) {
+ SNDERR("Resampling setup failed for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* set the selected read/write format */
+ err = snd_pcm_hw_params_set_access(pcm, params, access);
+ if (err < 0) {
+ SNDERR("Access type not available for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* set the sample format */
+ err = snd_pcm_hw_params_set_format(pcm, params, format);
+ if (err < 0) {
+ SNDERR("Sample format not available for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* set the count of channels */
+ err = snd_pcm_hw_params_set_channels(pcm, params, channels);
+ if (err < 0) {
+ SNDERR("Channels count (%i) not available for %s: %s", channels, s, snd_strerror(err));
+ return err;
+ }
+ /* set the stream rate */
+ rrate = rate;
+ err = INTERNAL(snd_pcm_hw_params_set_rate_near)(pcm, params, &rrate, 0);
+ if (err < 0) {
+ SNDERR("Rate %iHz not available for playback: %s", rate, snd_strerror(err));
+ return err;
+ }
+ if (rrate != rate) {
+ SNDERR("Rate doesn't match (requested %iHz, get %iHz)", rate, err);
+ return -EINVAL;
+ }
+ /* set the buffer time */
+ err = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(pcm, params, &latency, NULL);
+ if (err < 0) {
+ /* error path -> set period size as first */
+ /* set the period time */
+ period_time = latency / 4;
+ err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm, params, &period_time, NULL);
+ if (err < 0) {
+ SNDERR("Unable to set period time %i for %s: %s", period_time, s, snd_strerror(err));
+ return err;
+ }
+ err = INTERNAL(snd_pcm_hw_params_get_period_size)(params, &period_size, NULL);
+ if (err < 0) {
+ SNDERR("Unable to get period size for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ buffer_size = period_size * 4;
+ err = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(pcm, params, &buffer_size);
+ if (err < 0) {
+ SNDERR("Unable to set buffer size %lu %s: %s", buffer_size, s, snd_strerror(err));
+ return err;
+ }
+ err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &buffer_size);
+ if (err < 0) {
+ SNDERR("Unable to get buffer size for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ } else {
+ /* standard configuration buffer_time -> periods */
+ err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &buffer_size);
+ if (err < 0) {
+ SNDERR("Unable to get buffer size for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ err = INTERNAL(snd_pcm_hw_params_get_buffer_time)(params, &latency, NULL);
+ if (err < 0) {
+ SNDERR("Unable to get buffer time (latency) for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* set the period time */
+ period_time = latency / 4;
+ err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm, params, &period_time, NULL);
+ if (err < 0) {
+ SNDERR("Unable to set period time %i for %s: %s", period_time, s, snd_strerror(err));
+ return err;
+ }
+ err = INTERNAL(snd_pcm_hw_params_get_period_size)(params, &period_size, NULL);
+ if (err < 0) {
+ SNDERR("Unable to get period size for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ }
+ /* write the parameters to device */
+ err = snd_pcm_hw_params(pcm, params);
+ if (err < 0) {
+ SNDERR("Unable to set hw params for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+
+ /* get the current swparams */
+ err = snd_pcm_sw_params_current(pcm, swparams);
+ if (err < 0) {
+ SNDERR("Unable to determine current swparams for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* start the transfer when the buffer is almost full: */
+ /* (buffer_size / avail_min) * avail_min */
+ err = snd_pcm_sw_params_set_start_threshold(pcm, swparams, (buffer_size / period_size) * period_size);
+ if (err < 0) {
+ SNDERR("Unable to set start threshold mode for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* allow the transfer when at least period_size samples can be processed */
+ err = snd_pcm_sw_params_set_avail_min(pcm, swparams, period_size);
+ if (err < 0) {
+ SNDERR("Unable to set avail min for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ /* write the parameters to the playback device */
+ err = snd_pcm_sw_params(pcm, swparams);
+ if (err < 0) {
+ SNDERR("Unable to set sw params for %s: %s", s, snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+/**
+ * \brief Get the transfer size parameters in a simple way
+ * \param pcm PCM handle
+ * \param buffer_size PCM ring buffer size in frames
+ * \param period_size PCM period size in frames
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_get_params(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size)
+{
+ snd_pcm_hw_params_t *hw;
+ int err;
+
+ assert(pcm);
+ snd_pcm_hw_params_alloca(&hw);
+ err = snd_pcm_hw_params_current(pcm, hw);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(hw, buffer_size);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_period_size)(hw, period_size, NULL);
+ if (err < 0)
+ return err;
+ return 0;
+}
diff --git a/alsa-lib/src/pcm/pcm_adpcm.c b/alsa-lib/src/pcm/pcm_adpcm.c
new file mode 100644
index 0000000..b68007f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_adpcm.c
@@ -0,0 +1,679 @@
+/**
+ * \file pcm/pcm_adpcm.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Ima-ADPCM Conversion Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Uros Bizjak <uros@kss-loka.si>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Ima-ADPCM conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ * Based on Version 1.2, 18-Dec-92 implementation of Intel/DVI ADPCM code
+ * by Jack Jansen, CWI, Amsterdam <Jack.Jansen@cwi.nl>, Copyright 1992
+ * by Stichting Mathematisch Centrum, Amsterdam, The Netherlands.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*
+These routines convert 16 bit linear PCM samples to 4 bit ADPCM code
+and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which
+is being recommended by the IMA Digital Audio Technical Working Group.
+
+The algorithm for this coder was taken from:
+Proposal for Standardized Audio Interstreamge Formats,
+IMA compatibility project proceedings, Vol 2, Issue 2, May 1992.
+
+- No, this is *not* a G.721 coder/decoder. The algorithm used by G.721
+ is very complicated, requiring oodles of floating-point ops per
+ sample (resulting in very poor performance). I have not done any
+ tests myself but various people have assured my that 721 quality is
+ actually lower than DVI quality.
+
+- No, it probably isn't a RIFF ADPCM decoder either. Trying to decode
+ RIFF ADPCM with these routines seems to result in something
+ recognizable but very distorted.
+
+- No, it is not a CDROM-XA coder either, as far as I know. I haven't
+ come across a good description of XA yet.
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_adpcm = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef void (*adpcm_f)(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx,
+ snd_pcm_adpcm_state_t *states);
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int getput_idx;
+ adpcm_f func;
+ snd_pcm_format_t sformat;
+ snd_pcm_adpcm_state_t *states;
+} snd_pcm_adpcm_t;
+
+#endif
+
+/* First table lookup for Ima-ADPCM quantizer */
+static const char IndexAdjust[8] = { -1, -1, -1, -1, 2, 4, 6, 8 };
+
+/* Second table lookup for Ima-ADPCM quantizer */
+static const short StepSize[89] = {
+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
+ 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
+ 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
+ 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
+ 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
+ 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
+ 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
+ 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
+ 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
+};
+
+static char adpcm_encoder(int sl, snd_pcm_adpcm_state_t * state)
+{
+ short diff; /* Difference between sl and predicted sample */
+ short pred_diff; /* Predicted difference to next sample */
+
+ unsigned char sign; /* sign of diff */
+ short step; /* holds previous StepSize value */
+ unsigned char adjust_idx; /* Index to IndexAdjust lookup table */
+
+ int i;
+
+ /* Compute difference to previous predicted value */
+ diff = sl - state->pred_val;
+ sign = (diff < 0) ? 0x8 : 0x0;
+ if (sign) {
+ diff = -diff;
+ }
+
+ /*
+ * This code *approximately* computes:
+ * adjust_idx = diff * 4 / step;
+ * pred_diff = (adjust_idx + 0.5) * step / 4;
+ *
+ * But in shift step bits are dropped. The net result of this is
+ * that even if you have fast mul/div hardware you cannot put it to
+ * good use since the fix-up would be too expensive.
+ */
+
+ step = StepSize[state->step_idx];
+
+ /* Divide and clamp */
+ pred_diff = step >> 3;
+ for (adjust_idx = 0, i = 0x4; i; i >>= 1, step >>= 1) {
+ if (diff >= step) {
+ adjust_idx |= i;
+ diff -= step;
+ pred_diff += step;
+ }
+ }
+
+ /* Update and clamp previous predicted value */
+ state->pred_val += sign ? -pred_diff : pred_diff;
+
+ if (state->pred_val > 32767) {
+ state->pred_val = 32767;
+ } else if (state->pred_val < -32768) {
+ state->pred_val = -32768;
+ }
+
+ /* Update and clamp StepSize lookup table index */
+ state->step_idx += IndexAdjust[adjust_idx];
+
+ if (state->step_idx < 0) {
+ state->step_idx = 0;
+ } else if (state->step_idx > 88) {
+ state->step_idx = 88;
+ }
+ return (sign | adjust_idx);
+}
+
+
+static int adpcm_decoder(unsigned char code, snd_pcm_adpcm_state_t * state)
+{
+ short pred_diff; /* Predicted difference to next sample */
+ short step; /* holds previous StepSize value */
+ char sign;
+
+ int i;
+
+ /* Separate sign and magnitude */
+ sign = code & 0x8;
+ code &= 0x7;
+
+ /*
+ * Computes pred_diff = (code + 0.5) * step / 4,
+ * but see comment in adpcm_coder.
+ */
+
+ step = StepSize[state->step_idx];
+
+ /* Compute difference and new predicted value */
+ pred_diff = step >> 3;
+ for (i = 0x4; i; i >>= 1, step >>= 1) {
+ if (code & i) {
+ pred_diff += step;
+ }
+ }
+ state->pred_val += (sign) ? -pred_diff : pred_diff;
+
+ /* Clamp output value */
+ if (state->pred_val > 32767) {
+ state->pred_val = 32767;
+ } else if (state->pred_val < -32768) {
+ state->pred_val = -32768;
+ }
+
+ /* Find new StepSize index value */
+ state->step_idx += IndexAdjust[code];
+
+ if (state->step_idx < 0) {
+ state->step_idx = 0;
+ } else if (state->step_idx > 88) {
+ state->step_idx = 88;
+ }
+ return (state->pred_val);
+}
+
+#ifndef DOC_HIDDEN
+
+void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx,
+ snd_pcm_adpcm_state_t *states)
+{
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef PUT16_LABELS
+ void *put = put16_labels[putidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel, ++states) {
+ const char *src;
+ int srcbit;
+ char *dst;
+ int src_step, srcbit_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ srcbit = src_area->first + src_area->step * src_offset;
+ src = (const char *) src_area->addr + srcbit / 8;
+ srcbit %= 8;
+ src_step = src_area->step / 8;
+ srcbit_step = src_area->step % 8;
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ int16_t sample;
+ unsigned char v;
+ if (srcbit)
+ v = *src & 0x0f;
+ else
+ v = (*src >> 4) & 0x0f;
+ sample = adpcm_decoder(v, states);
+ goto *put;
+#define PUT16_END after
+#include "plugin_ops.h"
+#undef PUT16_END
+ after:
+ src += src_step;
+ srcbit += srcbit_step;
+ if (srcbit == 8) {
+ src++;
+ srcbit = 0;
+ }
+ dst += dst_step;
+ }
+ }
+}
+
+void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx,
+ snd_pcm_adpcm_state_t *states)
+{
+#define GET16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+ void *get = get16_labels[getidx];
+ unsigned int channel;
+ int16_t sample = 0;
+ for (channel = 0; channel < channels; ++channel, ++states) {
+ const char *src;
+ char *dst;
+ int dstbit;
+ int src_step, dst_step, dstbit_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dstbit = dst_area->first + dst_area->step * dst_offset;
+ dst = (char *) dst_area->addr + dstbit / 8;
+ dstbit %= 8;
+ dst_step = dst_area->step / 8;
+ dstbit_step = dst_area->step % 8;
+ frames1 = frames;
+ while (frames1-- > 0) {
+ int v;
+ goto *get;
+#define GET16_END after
+#include "plugin_ops.h"
+#undef GET16_END
+ after:
+ v = adpcm_encoder(sample, states);
+ if (dstbit)
+ *dst = (*dst & 0xf0) | v;
+ else
+ *dst = (*dst & 0x0f) | (v << 4);
+ src += src_step;
+ dst += dst_step;
+ dstbit += dstbit_step;
+ if (dstbit == 8) {
+ dst++;
+ dstbit = 0;
+ }
+ }
+ }
+}
+
+#endif
+
+static int snd_pcm_adpcm_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ if (adpcm->sformat == SND_PCM_FORMAT_IMA_ADPCM) {
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ } else {
+ err = _snd_pcm_hw_params_set_format(params,
+ SND_PCM_FORMAT_IMA_ADPCM);
+ }
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params,
+ SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_adpcm_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, adpcm->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_adpcm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_adpcm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_adpcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_adpcm_hw_refine_cprepare,
+ snd_pcm_adpcm_hw_refine_cchange,
+ snd_pcm_adpcm_hw_refine_sprepare,
+ snd_pcm_adpcm_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ snd_pcm_format_t format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_adpcm_hw_refine_cchange,
+ snd_pcm_adpcm_hw_refine_sprepare,
+ snd_pcm_adpcm_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
+ if (err < 0)
+ return err;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (adpcm->sformat == SND_PCM_FORMAT_IMA_ADPCM) {
+ adpcm->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16);
+ adpcm->func = snd_pcm_adpcm_encode;
+ } else {
+ adpcm->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, adpcm->sformat);
+ adpcm->func = snd_pcm_adpcm_decode;
+ }
+ } else {
+ if (adpcm->sformat == SND_PCM_FORMAT_IMA_ADPCM) {
+ adpcm->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, format);
+ adpcm->func = snd_pcm_adpcm_decode;
+ } else {
+ adpcm->getput_idx = snd_pcm_linear_get_index(adpcm->sformat, SND_PCM_FORMAT_S16);
+ adpcm->func = snd_pcm_adpcm_encode;
+ }
+ }
+ assert(!adpcm->states);
+ adpcm->states = malloc(adpcm->plug.gen.slave->channels * sizeof(*adpcm->states));
+ if (adpcm->states == NULL)
+ return -ENOMEM;
+ return 0;
+}
+
+static int snd_pcm_adpcm_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ free(adpcm->states);
+ adpcm->states = NULL;
+ return snd_pcm_hw_free(adpcm->plug.gen.slave);
+}
+
+static int snd_pcm_adpcm_init(snd_pcm_t *pcm)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ unsigned int k;
+ for (k = 0; k < pcm->channels; ++k) {
+ adpcm->states[k].pred_val = 0;
+ adpcm->states[k].step_idx = 0;
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_adpcm_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ adpcm->func(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size,
+ adpcm->getput_idx, adpcm->states);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ adpcm->func(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size,
+ adpcm->getput_idx, adpcm->states);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_adpcm_t *adpcm = pcm->private_data;
+ snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
+ snd_pcm_format_name(adpcm->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(adpcm->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_adpcm_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_adpcm_hw_refine,
+ .hw_params = snd_pcm_adpcm_hw_params,
+ .hw_free = snd_pcm_adpcm_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_adpcm_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new Ima-ADPCM conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_adpcm_t *adpcm;
+ int err;
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_IMA_ADPCM)
+ return -EINVAL;
+ adpcm = calloc(1, sizeof(snd_pcm_adpcm_t));
+ if (!adpcm) {
+ return -ENOMEM;
+ }
+ adpcm->sformat = sformat;
+ snd_pcm_plugin_init(&adpcm->plug);
+ adpcm->plug.read = snd_pcm_adpcm_read_areas;
+ adpcm->plug.write = snd_pcm_adpcm_write_areas;
+ adpcm->plug.init = snd_pcm_adpcm_init;
+ adpcm->plug.gen.slave = slave;
+ adpcm->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_ADPCM, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(adpcm);
+ return err;
+ }
+ pcm->ops = &snd_pcm_adpcm_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = adpcm;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &adpcm->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &adpcm->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_adpcm Plugin: Ima-ADPCM
+
+This plugin converts Ima-ADPCM samples to linear or linear to Ima-ADPCM samples
+from master Ima-ADPCM conversion PCM to given slave PCM. The channel count,
+format and rate must match for both of them.
+
+\code
+pcm.name {
+ type adpcm # Ima-ADPCM conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+}
+\endcode
+
+\subsection pcm_plugins_adpcm_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_adpcm_open()
+ <LI>_snd_pcm_adpcm_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Ima-ADPCM conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_IMA_ADPCM) {
+ snd_config_delete(sconf);
+ SNDERR("invalid slave format");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_alaw.c b/alsa-lib/src/pcm/pcm_alaw.c
new file mode 100644
index 0000000..09ad481
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_alaw.c
@@ -0,0 +1,553 @@
+/**
+ * \file pcm/pcm_alaw.c
+ * \ingroup PCM_Plugins
+ * \brief PCM A-Law Conversion Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - A-Law conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_alaw = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef void (*alaw_f)(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx);
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int getput_idx;
+ alaw_f func;
+ snd_pcm_format_t sformat;
+} snd_pcm_alaw_t;
+
+#endif
+
+static inline int val_seg(int val)
+{
+ int r = 1;
+ val >>= 8;
+ if (val & 0xf0) {
+ val >>= 4;
+ r += 4;
+ }
+ if (val & 0x0c) {
+ val >>= 2;
+ r += 2;
+ }
+ if (val & 0x02)
+ r += 1;
+ return r;
+}
+
+/*
+ * s16_to_alaw() - Convert a 16-bit linear PCM value to 8-bit A-law
+ *
+ * s16_to_alaw() accepts an 16-bit integer and encodes it as A-law data.
+ *
+ * Linear Input Code Compressed Code
+ * ------------------------ ---------------
+ * 0000000wxyza 000wxyz
+ * 0000001wxyza 001wxyz
+ * 000001wxyzab 010wxyz
+ * 00001wxyzabc 011wxyz
+ * 0001wxyzabcd 100wxyz
+ * 001wxyzabcde 101wxyz
+ * 01wxyzabcdef 110wxyz
+ * 1wxyzabcdefg 111wxyz
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+
+static unsigned char s16_to_alaw(int pcm_val)
+{
+ int mask;
+ int seg;
+ unsigned char aval;
+
+ if (pcm_val >= 0) {
+ mask = 0xD5;
+ } else {
+ mask = 0x55;
+ pcm_val = -pcm_val;
+ if (pcm_val > 0x7fff)
+ pcm_val = 0x7fff;
+ }
+
+ if (pcm_val < 256)
+ aval = pcm_val >> 4;
+ else {
+ /* Convert the scaled magnitude to segment number. */
+ seg = val_seg(pcm_val);
+ aval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0x0f);
+ }
+ return aval ^ mask;
+}
+
+/*
+ * alaw_to_s16() - Convert an A-law value to 16-bit linear PCM
+ *
+ */
+static int alaw_to_s16(unsigned char a_val)
+{
+ int t;
+ int seg;
+
+ a_val ^= 0x55;
+ t = a_val & 0x7f;
+ if (t < 16)
+ t = (t << 4) + 8;
+ else {
+ seg = (t >> 4) & 0x07;
+ t = ((t & 0x0f) << 4) + 0x108;
+ t <<= seg -1;
+ }
+ return ((a_val & 0x80) ? t : -t);
+}
+
+#ifndef DOC_HIDDEN
+
+void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx)
+{
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef PUT16_LABELS
+ void *put = put16_labels[putidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const unsigned char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ int16_t sample = alaw_to_s16(*src);
+ goto *put;
+#define PUT16_END after
+#include "plugin_ops.h"
+#undef PUT16_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx)
+{
+#define GET16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+ void *get = get16_labels[getidx];
+ unsigned int channel;
+ int16_t sample = 0;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *get;
+#define GET16_END after
+#include "plugin_ops.h"
+#undef GET16_END
+ after:
+ *dst = s16_to_alaw(sample);
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ if (alaw->sformat == SND_PCM_FORMAT_A_LAW) {
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ } else {
+ err = _snd_pcm_hw_params_set_format(params,
+ SND_PCM_FORMAT_A_LAW);
+ }
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_alaw_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, alaw->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_alaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_alaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_alaw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_alaw_hw_refine_cprepare,
+ snd_pcm_alaw_hw_refine_cchange,
+ snd_pcm_alaw_hw_refine_sprepare,
+ snd_pcm_alaw_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ snd_pcm_format_t format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_alaw_hw_refine_cchange,
+ snd_pcm_alaw_hw_refine_sprepare,
+ snd_pcm_alaw_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
+ if (err < 0)
+ return err;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (alaw->sformat == SND_PCM_FORMAT_A_LAW) {
+ alaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16);
+ alaw->func = snd_pcm_alaw_encode;
+ } else {
+ alaw->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, alaw->sformat);
+ alaw->func = snd_pcm_alaw_decode;
+ }
+ } else {
+ if (alaw->sformat == SND_PCM_FORMAT_A_LAW) {
+ alaw->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, format);
+ alaw->func = snd_pcm_alaw_decode;
+ } else {
+ alaw->getput_idx = snd_pcm_linear_get_index(alaw->sformat, SND_PCM_FORMAT_S16);
+ alaw->func = snd_pcm_alaw_encode;
+ }
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_alaw_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ alaw->func(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size,
+ alaw->getput_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ alaw->func(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size,
+ alaw->getput_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_alaw_t *alaw = pcm->private_data;
+ snd_output_printf(out, "A-Law conversion PCM (%s)\n",
+ snd_pcm_format_name(alaw->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(alaw->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_alaw_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_alaw_hw_refine,
+ .hw_params = snd_pcm_alaw_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_alaw_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new A-Law conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_alaw_t *alaw;
+ int err;
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_A_LAW)
+ return -EINVAL;
+ alaw = calloc(1, sizeof(snd_pcm_alaw_t));
+ if (!alaw) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&alaw->plug);
+ alaw->sformat = sformat;
+ alaw->plug.read = snd_pcm_alaw_read_areas;
+ alaw->plug.write = snd_pcm_alaw_write_areas;
+ alaw->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ alaw->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ alaw->plug.gen.slave = slave;
+ alaw->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_ALAW, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(alaw);
+ return err;
+ }
+ pcm->ops = &snd_pcm_alaw_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = alaw;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &alaw->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &alaw->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_alaw Plugin: A-Law
+
+This plugin converts A-Law samples to linear or linear to A-Law samples
+from master A-Law conversion PCM to given slave PCM. The channel count,
+format and rate must match for both of them.
+
+\code
+pcm.name {
+ type alaw # A-Law conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+}
+\endcode
+
+\subsection pcm_plugins_alaw_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_alaw_open()
+ <LI>_snd_pcm_alaw_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new A-Law conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_A_LAW) {
+ snd_config_delete(sconf);
+ SNDERR("invalid slave format");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_asym.c b/alsa-lib/src/pcm/pcm_asym.c
new file mode 100644
index 0000000..9c32b1b
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_asym.c
@@ -0,0 +1,119 @@
+/**
+ * \file pcm/pcm_asym.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Asymmetrical Plugin Interface
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2003
+ */
+
+#include "pcm_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_asym = "";
+#endif
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_asym Plugin: asym
+
+This plugin is a combination of playback and capture PCM streams.
+Slave PCMs can be defined asymmetrically for both directions.
+
+\code
+pcm.name {
+ type asym # Asym PCM
+ playback STR # Playback slave name
+ # or
+ playback { # Playback slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ capture STR # Capture slave name
+ # or
+ capture { # Capture slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+}
+\endcode
+
+For example, you can combine a dmix plugin and a dsnoop plugin as
+as a single PCM for playback and capture directions, respectively.
+\code
+pcm.duplex {
+ type asym
+ playback.pcm "dmix"
+ capture.pcm "dsnoop"
+}
+\endcode
+
+By defining only a single direction, the resultant PCM becomes
+half-duplex.
+
+\subsection pcm_plugins_asym_funcref Function reference
+
+<UL>
+ <LI>_snd_pcm_asym_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new asym stream PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_asym_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "playback") == 0) {
+ if (stream == SND_PCM_STREAM_PLAYBACK)
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "capture") == 0) {
+ if (stream == SND_PCM_STREAM_CAPTURE)
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (! slave) {
+ SNDERR("%s slave is not defined",
+ stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_named_slave(pcmp, name, root, sconf, stream,
+ mode, conf);
+ snd_config_delete(sconf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_asym_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_copy.c b/alsa-lib/src/pcm/pcm_copy.c
new file mode 100644
index 0000000..072bb12
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_copy.c
@@ -0,0 +1,299 @@
+/**
+ * \file pcm/pcm_copy.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Copy Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Copy conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_copy = "";
+#endif
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+} snd_pcm_copy_t;
+#endif
+
+static int snd_pcm_copy_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_copy_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ return 0;
+}
+
+static int snd_pcm_copy_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_copy_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_copy_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_copy_hw_refine_cprepare,
+ snd_pcm_copy_hw_refine_cchange,
+ snd_pcm_copy_hw_refine_sprepare,
+ snd_pcm_copy_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_copy_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_copy_hw_refine_cchange,
+ snd_pcm_copy_hw_refine_sprepare,
+ snd_pcm_copy_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+}
+
+static snd_pcm_uframes_t
+snd_pcm_copy_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ snd_pcm_areas_copy(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size, pcm->format);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_copy_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ snd_pcm_areas_copy(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size, pcm->format);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_copy_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_copy_t *copy = pcm->private_data;
+ snd_output_printf(out, "Copy conversion PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(copy->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_copy_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_copy_hw_refine,
+ .hw_params = snd_pcm_copy_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_copy_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new copy PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_copy_t *copy;
+ int err;
+ assert(pcmp && slave);
+ copy = calloc(1, sizeof(snd_pcm_copy_t));
+ if (!copy) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&copy->plug);
+ copy->plug.read = snd_pcm_copy_read_areas;
+ copy->plug.write = snd_pcm_copy_write_areas;
+ copy->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ copy->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ copy->plug.gen.slave = slave;
+ copy->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_COPY, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(copy);
+ return err;
+ }
+ pcm->ops = &snd_pcm_copy_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = copy;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &copy->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &copy->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_copy Plugin: copy
+
+This plugin copies samples from master copy PCM to given slave PCM.
+The channel count, format and rate must match for both of them.
+
+\code
+pcm.name {
+ type copy # Copy PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+}
+\endcode
+
+\subsection pcm_plugins_copy_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_copy_open()
+ <LI>_snd_pcm_copy_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new copy PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_copy_open(pcmp, name, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_direct.c b/alsa-lib/src/pcm/pcm_direct.c
new file mode 100644
index 0000000..82cc126
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_direct.c
@@ -0,0 +1,1666 @@
+/*
+ * PCM - Direct Stream Mixing
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <grp.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+#include <sys/mman.h>
+#include "pcm_direct.h"
+
+/*
+ *
+ */
+
+union semun {
+ int val; /* Value for SETVAL */
+ struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
+ unsigned short *array; /* Array for GETALL, SETALL */
+ struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */
+};
+
+/*
+ * FIXME:
+ * add possibility to use futexes here
+ */
+
+int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix)
+{
+ union semun s;
+ struct semid_ds buf;
+ int i;
+
+ dmix->semid = semget(dmix->ipc_key, DIRECT_IPC_SEMS,
+ IPC_CREAT | dmix->ipc_perm);
+ if (dmix->semid < 0)
+ return -errno;
+ if (dmix->ipc_gid < 0)
+ return 0;
+ for (i = 0; i < DIRECT_IPC_SEMS; i++) {
+ s.buf = &buf;
+ if (semctl(dmix->semid, i, IPC_STAT, s) < 0) {
+ int err = -errno;
+ snd_pcm_direct_semaphore_discard(dmix);
+ return err;
+ }
+ buf.sem_perm.gid = dmix->ipc_gid;
+ s.buf = &buf;
+ semctl(dmix->semid, i, IPC_SET, s);
+ }
+ return 0;
+}
+
+#define SND_PCM_DIRECT_MAGIC (0xa15ad300 + sizeof(snd_pcm_direct_share_t))
+
+/*
+ * global shared memory area
+ */
+
+int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix)
+{
+ struct shmid_ds buf;
+ int tmpid, err;
+
+retryget:
+ dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t),
+ IPC_CREAT | dmix->ipc_perm);
+ err = -errno;
+ if (dmix->shmid < 0){
+ if (errno == EINVAL)
+ if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1)
+ if (!shmctl(tmpid, IPC_STAT, &buf))
+ if (!buf.shm_nattch)
+ /* no users so destroy the segment */
+ if (!shmctl(tmpid, IPC_RMID, NULL))
+ goto retryget;
+ return err;
+ }
+ dmix->shmptr = shmat(dmix->shmid, 0, 0);
+ if (dmix->shmptr == (void *) -1) {
+ err = -errno;
+ snd_pcm_direct_shm_discard(dmix);
+ return err;
+ }
+ mlock(dmix->shmptr, sizeof(snd_pcm_direct_share_t));
+ if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0) {
+ err = -errno;
+ snd_pcm_direct_shm_discard(dmix);
+ return err;
+ }
+ if (buf.shm_nattch == 1) { /* we're the first user, clear the segment */
+ memset(dmix->shmptr, 0, sizeof(snd_pcm_direct_share_t));
+ if (dmix->ipc_gid >= 0) {
+ buf.shm_perm.gid = dmix->ipc_gid;
+ shmctl(dmix->shmid, IPC_SET, &buf);
+ }
+ dmix->shmptr->magic = SND_PCM_DIRECT_MAGIC;
+ return 1;
+ } else {
+ if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) {
+ snd_pcm_direct_shm_discard(dmix);
+ return -EINVAL;
+ }
+ }
+ return 0;
+}
+
+/* discard shared memory */
+/*
+ * Define snd_* functions to be used in server.
+ * Since objects referred in a plugin can be released dynamically, a forked
+ * server should have statically linked functions.
+ * (e.g. Novell bugzilla #105772)
+ */
+static int _snd_pcm_direct_shm_discard(snd_pcm_direct_t *dmix)
+{
+ struct shmid_ds buf;
+ int ret = 0;
+
+ if (dmix->shmid < 0)
+ return -EINVAL;
+ if (dmix->shmptr != (void *) -1 && shmdt(dmix->shmptr) < 0)
+ return -errno;
+ dmix->shmptr = (void *) -1;
+ if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0)
+ return -errno;
+ if (buf.shm_nattch == 0) { /* we're the last user, destroy the segment */
+ if (shmctl(dmix->shmid, IPC_RMID, NULL) < 0)
+ return -errno;
+ ret = 1;
+ }
+ dmix->shmid = -1;
+ return ret;
+}
+
+/* ... and an exported version */
+int snd_pcm_direct_shm_discard(snd_pcm_direct_t *dmix)
+{
+ return _snd_pcm_direct_shm_discard(dmix);
+}
+
+/*
+ * server side
+ */
+
+static int get_tmp_name(char *filename, size_t size)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ snprintf(filename, size, TMPDIR "/alsa-dmix-%i-%li-%li", (int)getpid(), (long)tv.tv_sec, (long)tv.tv_usec);
+ filename[size-1] = '\0';
+ return 0;
+}
+
+static int make_local_socket(const char *filename, int server, mode_t ipc_perm, int ipc_gid)
+{
+ size_t l = strlen(filename);
+ size_t size = offsetof(struct sockaddr_un, sun_path) + l;
+ struct sockaddr_un *addr = alloca(size);
+ int sock;
+
+ sock = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (sock < 0) {
+ int result = -errno;
+ SYSERR("socket failed");
+ return result;
+ }
+
+ if (server)
+ unlink(filename);
+ memset(addr, 0, size); /* make valgrind happy */
+ addr->sun_family = AF_LOCAL;
+ memcpy(addr->sun_path, filename, l);
+
+ if (server) {
+ if (bind(sock, (struct sockaddr *) addr, size) < 0) {
+ int result = -errno;
+ SYSERR("bind failed: %s", filename);
+ close(sock);
+ return result;
+ } else {
+ if (chmod(filename, ipc_perm) < 0) {
+ int result = -errno;
+ SYSERR("chmod failed: %s", filename);
+ close(sock);
+ unlink(filename);
+ return result;
+ }
+ if (chown(filename, -1, ipc_gid) < 0) {
+#if 0 /* it's not fatal */
+ int result = -errno;
+ SYSERR("chown failed: %s", filename);
+ close(sock);
+ unlink(filename);
+ return result;
+#endif
+ }
+ }
+ } else {
+ if (connect(sock, (struct sockaddr *) addr, size) < 0) {
+ int result = -errno;
+ SYSERR("connect failed: %s", filename);
+ close(sock);
+ return result;
+ }
+ }
+ return sock;
+}
+
+#if 0
+#define SERVER_JOB_DEBUG
+#define server_printf(fmt, args...) printf(fmt, ##args)
+#else
+#undef SERVER_JOB_DEBUG
+#define server_printf(fmt, args...) /* nothing */
+#endif
+
+static snd_pcm_direct_t *server_job_dmix;
+
+static void server_cleanup(snd_pcm_direct_t *dmix)
+{
+ close(dmix->server_fd);
+ close(dmix->hw_fd);
+ if (dmix->server_free)
+ dmix->server_free(dmix);
+ unlink(dmix->shmptr->socket_name);
+ _snd_pcm_direct_shm_discard(dmix);
+ snd_pcm_direct_semaphore_discard(dmix);
+}
+
+static void server_job_signal(int sig ATTRIBUTE_UNUSED)
+{
+ snd_pcm_direct_semaphore_down(server_job_dmix, DIRECT_IPC_SEM_CLIENT);
+ server_cleanup(server_job_dmix);
+ server_printf("DIRECT SERVER EXIT - SIGNAL\n");
+ _exit(EXIT_SUCCESS);
+}
+
+/* This is a copy from ../socket.c, provided here only for a server job
+ * (see the comment above)
+ */
+static int _snd_send_fd(int sock, void *data, size_t len, int fd)
+{
+ int ret;
+ size_t cmsg_len = CMSG_LEN(sizeof(int));
+ struct cmsghdr *cmsg = alloca(cmsg_len);
+ int *fds = (int *) CMSG_DATA(cmsg);
+ struct msghdr msghdr;
+ struct iovec vec;
+
+ vec.iov_base = (void *)&data;
+ vec.iov_len = len;
+
+ cmsg->cmsg_len = cmsg_len;
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ *fds = fd;
+
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &vec;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = cmsg;
+ msghdr.msg_controllen = cmsg_len;
+ msghdr.msg_flags = 0;
+
+ ret = sendmsg(sock, &msghdr, 0 );
+ if (ret < 0)
+ return -errno;
+ return ret;
+}
+
+static void server_job(snd_pcm_direct_t *dmix)
+{
+ int ret, sck, i;
+ int max = 128, current = 0;
+ struct pollfd pfds[max + 1];
+
+ server_job_dmix = dmix;
+ /* don't allow to be killed */
+ signal(SIGHUP, server_job_signal);
+ signal(SIGQUIT, server_job_signal);
+ signal(SIGTERM, server_job_signal);
+ signal(SIGKILL, server_job_signal);
+ /* close all files to free resources */
+ i = sysconf(_SC_OPEN_MAX);
+#ifdef SERVER_JOB_DEBUG
+ while (--i >= 3) {
+#else
+ while (--i >= 0) {
+#endif
+ if (i != dmix->server_fd && i != dmix->hw_fd)
+ close(i);
+ }
+
+ /* detach from parent */
+ setsid();
+
+ pfds[0].fd = dmix->server_fd;
+ pfds[0].events = POLLIN | POLLERR | POLLHUP;
+
+ server_printf("DIRECT SERVER STARTED\n");
+ while (1) {
+ ret = poll(pfds, current + 1, 500);
+ server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x, errno = %i\n", ret, pfds[0].revents, errno);
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ /* some error */
+ break;
+ }
+ if (ret == 0 || (pfds[0].revents & (POLLERR | POLLHUP))) { /* timeout or error? */
+ struct shmid_ds buf;
+ snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
+ if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0) {
+ _snd_pcm_direct_shm_discard(dmix);
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ continue;
+ }
+ server_printf("DIRECT SERVER: nattch = %i\n", (int)buf.shm_nattch);
+ if (buf.shm_nattch == 1) /* server is the last user, exit */
+ break;
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ continue;
+ }
+ if (pfds[0].revents & POLLIN) {
+ ret--;
+ sck = accept(dmix->server_fd, 0, 0);
+ if (sck >= 0) {
+ server_printf("DIRECT SERVER: new connection %i\n", sck);
+ if (current == max) {
+ close(sck);
+ } else {
+ unsigned char buf = 'A';
+ pfds[current+1].fd = sck;
+ pfds[current+1].events = POLLIN | POLLERR | POLLHUP;
+ _snd_send_fd(sck, &buf, 1, dmix->hw_fd);
+ server_printf("DIRECT SERVER: fd sent ok\n");
+ current++;
+ }
+ }
+ }
+ for (i = 0; i < current && ret > 0; i++) {
+ struct pollfd *pfd = &pfds[i+1];
+ unsigned char cmd;
+ server_printf("client %i revents = 0x%x\n", pfd->fd, pfd->revents);
+ if (pfd->revents & (POLLERR | POLLHUP)) {
+ ret--;
+ close(pfd->fd);
+ pfd->fd = -1;
+ continue;
+ }
+ if (!(pfd->revents & POLLIN))
+ continue;
+ ret--;
+ if (read(pfd->fd, &cmd, 1) == 1)
+ cmd = 0 /*process command */;
+ }
+ for (i = 0; i < current; i++) {
+ if (pfds[i+1].fd < 0) {
+ if (i + 1 != max)
+ memcpy(&pfds[i+1], &pfds[i+2], sizeof(struct pollfd) * (max - i - 1));
+ current--;
+ }
+ }
+ }
+ server_cleanup(dmix);
+ server_printf("DIRECT SERVER EXIT\n");
+#ifdef SERVER_JOB_DEBUG
+ close(0); close(1); close(2);
+#endif
+ _exit(EXIT_SUCCESS);
+}
+
+int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix)
+{
+ int ret;
+
+ dmix->server_fd = -1;
+
+ ret = get_tmp_name(dmix->shmptr->socket_name, sizeof(dmix->shmptr->socket_name));
+ if (ret < 0)
+ return ret;
+
+ ret = make_local_socket(dmix->shmptr->socket_name, 1, dmix->ipc_perm, dmix->ipc_gid);
+ if (ret < 0)
+ return ret;
+ dmix->server_fd = ret;
+
+ ret = listen(dmix->server_fd, 4);
+ if (ret < 0) {
+ close(dmix->server_fd);
+ return ret;
+ }
+
+ ret = fork();
+ if (ret < 0) {
+ close(dmix->server_fd);
+ return ret;
+ } else if (ret == 0) {
+ ret = fork();
+ if (ret == 0)
+ server_job(dmix);
+ _exit(EXIT_SUCCESS);
+ } else {
+ waitpid(ret, NULL, 0);
+ }
+ dmix->server_pid = ret;
+ dmix->server = 1;
+ return 0;
+}
+
+int snd_pcm_direct_server_discard(snd_pcm_direct_t *dmix)
+{
+ if (dmix->server) {
+ //kill(dmix->server_pid, SIGTERM);
+ //waitpid(dmix->server_pid, NULL, 0);
+ dmix->server_pid = (pid_t)-1;
+ }
+ if (dmix->server_fd > 0) {
+ close(dmix->server_fd);
+ dmix->server_fd = -1;
+ }
+ dmix->server = 0;
+ return 0;
+}
+
+/*
+ * client side
+ */
+
+int snd_pcm_direct_client_connect(snd_pcm_direct_t *dmix)
+{
+ int ret;
+ unsigned char buf;
+
+ ret = make_local_socket(dmix->shmptr->socket_name, 0, -1, -1);
+ if (ret < 0)
+ return ret;
+ dmix->comm_fd = ret;
+
+ ret = snd_receive_fd(dmix->comm_fd, &buf, 1, &dmix->hw_fd);
+ if (ret < 1 || buf != 'A') {
+ close(dmix->comm_fd);
+ dmix->comm_fd = -1;
+ return ret;
+ }
+
+ dmix->client = 1;
+ return 0;
+}
+
+int snd_pcm_direct_client_discard(snd_pcm_direct_t *dmix)
+{
+ if (dmix->client) {
+ close(dmix->comm_fd);
+ dmix->comm_fd = -1;
+ }
+ return 0;
+}
+
+/*
+ * plugin helpers
+ */
+
+int snd_pcm_direct_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ /* value is cached for us in pcm->mode (SND_PCM_NONBLOCK flag) */
+ return 0;
+}
+
+int snd_pcm_direct_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ return snd_timer_async(dmix->timer, sig, pid);
+}
+
+/* empty the timer read queue */
+void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix)
+{
+ if (dmix->timer_need_poll) {
+ while (poll(&dmix->timer_fd, 1, 0) > 0) {
+ /* we don't need the value */
+ if (dmix->tread) {
+ snd_timer_tread_t rbuf[4];
+ snd_timer_read(dmix->timer, rbuf, sizeof(rbuf));
+ } else {
+ snd_timer_read_t rbuf;
+ snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf));
+ }
+ }
+ } else {
+ if (dmix->tread) {
+ snd_timer_tread_t rbuf[4];
+ int len;
+ while ((len = snd_timer_read(dmix->timer, rbuf,
+ sizeof(rbuf))) > 0 &&
+ len != sizeof(rbuf[0]))
+ ;
+ } else {
+ snd_timer_read_t rbuf;
+ while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) > 0)
+ ;
+ }
+ }
+}
+
+int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix)
+{
+ snd_timer_stop(dmix->timer);
+ snd_pcm_direct_clear_timer_queue(dmix);
+ return 0;
+}
+
+int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ unsigned short events;
+ int empty = 0;
+
+ assert(pfds && nfds == 1 && revents);
+ events = pfds[0].revents;
+ if (events & POLLIN) {
+ snd_pcm_uframes_t avail;
+ snd_pcm_avail_update(pcm);
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ events |= POLLOUT;
+ events &= ~POLLIN;
+ avail = snd_pcm_mmap_playback_avail(pcm);
+ } else {
+ avail = snd_pcm_mmap_capture_avail(pcm);
+ }
+ empty = avail < pcm->avail_min;
+ }
+ switch (snd_pcm_state(dmix->spcm)) {
+ case SND_PCM_STATE_XRUN:
+ case SND_PCM_STATE_SUSPENDED:
+ events |= POLLERR;
+ break;
+ default:
+ if (empty) {
+ snd_pcm_direct_clear_timer_queue(dmix);
+ events &= ~(POLLOUT|POLLIN);
+ /* additional check */
+ switch (snd_pcm_state(pcm)) {
+ case SND_PCM_STATE_XRUN:
+ case SND_PCM_STATE_SUSPENDED:
+ events |= POLLERR;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ }
+ *revents = events;
+ return 0;
+}
+
+int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
+{
+ // snd_pcm_direct_t *dmix = pcm->private_data;
+
+ memset(info, 0, sizeof(*info));
+ info->stream = pcm->stream;
+ info->card = -1;
+ /* FIXME: fill this with something more useful: we know the hardware name */
+ if (pcm->name) {
+ strncpy((char *)info->id, pcm->name, sizeof(info->id));
+ strncpy((char *)info->name, pcm->name, sizeof(info->name));
+ strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
+ }
+ info->subdevices_count = 1;
+ return 0;
+}
+
+static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ return &params->masks[var - SND_PCM_HW_PARAM_FIRST_MASK];
+}
+
+static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ return &params->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL];
+}
+
+static int hw_param_interval_refine_one(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ snd_interval_t *src)
+{
+ snd_interval_t *i;
+
+ if (!(params->rmask & (1<<var))) /* nothing to do? */
+ return 0;
+ i = hw_param_interval(params, var);
+ if (snd_interval_empty(i)) {
+ SNDERR("dshare interval %i empty?", (int)var);
+ return -EINVAL;
+ }
+ if (snd_interval_refine(i, src))
+ params->cmask |= 1<<var;
+ return 0;
+}
+
+static int hw_param_interval_refine_minmax(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int imin,
+ unsigned int imax)
+{
+ snd_interval_t t;
+
+ memset(&t, 0, sizeof(t));
+ snd_interval_set_minmax(&t, imin, imax);
+ t.integer = 1;
+ return hw_param_interval_refine_one(params, var, &t);
+}
+
+#undef REFINE_DEBUG
+
+int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ static const snd_mask_t access = { .bits = {
+ (1<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) |
+ (1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) |
+ (1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) |
+ (1<<SNDRV_PCM_ACCESS_RW_NONINTERLEAVED),
+ 0, 0, 0 } };
+ int err;
+
+#ifdef REFINE_DEBUG
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr, 0);
+ snd_output_puts(log, "DMIX REFINE (begin):\n");
+ snd_pcm_hw_params_dump(params, log);
+#endif
+ if (params->rmask & (1<<SND_PCM_HW_PARAM_ACCESS)) {
+ if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS))) {
+ SNDERR("dshare access mask empty?");
+ return -EINVAL;
+ }
+ if (snd_mask_refine(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS), &access))
+ params->cmask |= 1<<SND_PCM_HW_PARAM_ACCESS;
+ }
+ if (params->rmask & (1<<SND_PCM_HW_PARAM_FORMAT)) {
+ if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT))) {
+ SNDERR("dshare format mask empty?");
+ return -EINVAL;
+ }
+ if (snd_mask_refine_set(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT),
+ dshare->shmptr->hw.format))
+ params->cmask |= 1<<SND_PCM_HW_PARAM_FORMAT;
+ }
+ //snd_mask_none(hw_param_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
+ if (params->rmask & (1<<SND_PCM_HW_PARAM_CHANNELS)) {
+ if (snd_interval_empty(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS))) {
+ SNDERR("dshare channels mask empty?");
+ return -EINVAL;
+ }
+ err = snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS), dshare->channels);
+ if (err < 0)
+ return err;
+ }
+ err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_RATE,
+ &dshare->shmptr->hw.rate);
+ if (err < 0)
+ return err;
+ err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_PERIOD_SIZE,
+ &dshare->shmptr->hw.period_size);
+ if (err < 0)
+ return err;
+ err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ &dshare->shmptr->hw.period_time);
+ if (err < 0)
+ return err;
+ if (dshare->max_periods < 0) {
+ err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_BUFFER_SIZE,
+ &dshare->shmptr->hw.buffer_size);
+ if (err < 0)
+ return err;
+ err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_BUFFER_TIME,
+ &dshare->shmptr->hw.buffer_time);
+ if (err < 0)
+ return err;
+ } else if (params->rmask & ((1<<SND_PCM_HW_PARAM_PERIODS)|
+ (1<<SND_PCM_HW_PARAM_BUFFER_BYTES)|
+ (1<<SND_PCM_HW_PARAM_BUFFER_SIZE)|
+ (1<<SND_PCM_HW_PARAM_BUFFER_TIME))) {
+ int changed;
+ unsigned int max_periods = dshare->max_periods;
+ if (max_periods < 2)
+ max_periods = dshare->slave_buffer_size / dshare->slave_period_size;
+ do {
+ changed = 0;
+ err = hw_param_interval_refine_minmax(params, SND_PCM_HW_PARAM_PERIODS,
+ 2, max_periods);
+ if (err < 0)
+ return err;
+ changed |= err;
+ err = snd_pcm_hw_refine_soft(pcm, params);
+ if (err < 0)
+ return err;
+ changed |= err;
+ } while (changed);
+ }
+ params->info = dshare->shmptr->s.info;
+#ifdef REFINE_DEBUG
+ snd_output_puts(log, "DMIX REFINE (end):\n");
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_close(log);
+#endif
+ return 0;
+}
+
+int snd_pcm_direct_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ params->info = dmix->shmptr->s.info;
+ params->rate_num = dmix->shmptr->s.rate;
+ params->rate_den = 1;
+ params->fifo_size = 0;
+ params->msbits = dmix->shmptr->s.msbits;
+ return 0;
+}
+
+int snd_pcm_direct_hw_free(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ /* values are cached in the pcm structure */
+ return 0;
+}
+
+int snd_pcm_direct_sw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t * params ATTRIBUTE_UNUSED)
+{
+ /* values are cached in the pcm structure */
+ return 0;
+}
+
+int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
+{
+ return snd_pcm_channel_info_shm(pcm, info, -1);
+}
+
+int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_pcm_direct_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_pcm_direct_resume(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ int err;
+
+ snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
+ err = snd_pcm_resume(dmix->spcm);
+ if (err == -ENOSYS) {
+ /* FIXME: error handling? */
+ snd_pcm_prepare(dmix->spcm);
+ snd_pcm_start(dmix->spcm);
+ err = 0;
+ }
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ return err;
+}
+
+#define COPY_SLAVE(field) (dmix->shmptr->s.field = spcm->field)
+
+/* copy the slave setting */
+static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
+{
+ spcm->info &= ~SND_PCM_INFO_PAUSE;
+
+ COPY_SLAVE(access);
+ COPY_SLAVE(format);
+ COPY_SLAVE(subformat);
+ COPY_SLAVE(channels);
+ COPY_SLAVE(rate);
+ COPY_SLAVE(period_size);
+ COPY_SLAVE(period_time);
+ COPY_SLAVE(periods);
+ COPY_SLAVE(tstamp_mode);
+ COPY_SLAVE(period_step);
+ COPY_SLAVE(avail_min);
+ COPY_SLAVE(start_threshold);
+ COPY_SLAVE(stop_threshold);
+ COPY_SLAVE(silence_threshold);
+ COPY_SLAVE(silence_size);
+ COPY_SLAVE(boundary);
+ COPY_SLAVE(info);
+ COPY_SLAVE(msbits);
+ COPY_SLAVE(rate_num);
+ COPY_SLAVE(rate_den);
+ COPY_SLAVE(hw_flags);
+ COPY_SLAVE(fifo_size);
+ COPY_SLAVE(buffer_size);
+ COPY_SLAVE(buffer_time);
+ COPY_SLAVE(sample_bits);
+ COPY_SLAVE(frame_bits);
+}
+
+#undef COPY_SLAVE
+
+/*
+ * this function initializes hardware and starts playback operation with
+ * no stop threshold (it operates all time without xrun checking)
+ * also, the driver silences the unused ring buffer areas for us
+ */
+int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, struct slave_params *params)
+{
+ snd_pcm_hw_params_t *hw_params;
+ snd_pcm_sw_params_t *sw_params;
+ int ret, buffer_is_not_initialized;
+ snd_pcm_uframes_t boundary;
+ struct pollfd fd;
+ int loops = 10;
+
+ snd_pcm_hw_params_alloca(&hw_params);
+ snd_pcm_sw_params_alloca(&sw_params);
+
+ __again:
+ if (loops-- <= 0) {
+ SNDERR("unable to find a valid configuration for slave");
+ return -EINVAL;
+ }
+ ret = snd_pcm_hw_params_any(spcm, hw_params);
+ if (ret < 0) {
+ SNDERR("snd_pcm_hw_params_any failed");
+ return ret;
+ }
+ ret = snd_pcm_hw_params_set_access(spcm, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ if (ret < 0) {
+ ret = snd_pcm_hw_params_set_access(spcm, hw_params, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ if (ret < 0) {
+ SNDERR("slave plugin does not support mmap interleaved or mmap noninterleaved access");
+ return ret;
+ }
+ }
+ if (params->format == SND_PCM_FORMAT_UNKNOWN)
+ ret = -EINVAL;
+ else
+ ret = snd_pcm_hw_params_set_format(spcm, hw_params,
+ params->format);
+ if (ret < 0) {
+ static const snd_pcm_format_t dmix_formats[] = {
+ SND_PCM_FORMAT_S32,
+ SND_PCM_FORMAT_S32 ^ SND_PCM_FORMAT_S32_LE ^ SND_PCM_FORMAT_S32_BE,
+ SND_PCM_FORMAT_S16,
+ SND_PCM_FORMAT_S16 ^ SND_PCM_FORMAT_S16_LE ^ SND_PCM_FORMAT_S16_BE,
+ SND_PCM_FORMAT_S24_3LE,
+ SND_PCM_FORMAT_U8,
+ };
+ snd_pcm_format_t format;
+ unsigned int i;
+
+ for (i = 0; i < sizeof dmix_formats / sizeof dmix_formats[0]; ++i) {
+ format = dmix_formats[i];
+ ret = snd_pcm_hw_params_set_format(spcm, hw_params, format);
+ if (ret >= 0)
+ break;
+ }
+ if (ret < 0 && dmix->type != SND_PCM_TYPE_DMIX) {
+ /* TODO: try to choose a good format */
+ ret = INTERNAL(snd_pcm_hw_params_set_format_first)(spcm, hw_params, &format);
+ }
+ if (ret < 0) {
+ SNDERR("requested or auto-format is not available");
+ return ret;
+ }
+ params->format = format;
+ }
+ ret = INTERNAL(snd_pcm_hw_params_set_channels_near)(spcm, hw_params, (unsigned int *)&params->channels);
+ if (ret < 0) {
+ SNDERR("requested count of channels is not available");
+ return ret;
+ }
+ ret = INTERNAL(snd_pcm_hw_params_set_rate_near)(spcm, hw_params, (unsigned int *)&params->rate, 0);
+ if (ret < 0) {
+ SNDERR("requested rate is not available");
+ return ret;
+ }
+
+ buffer_is_not_initialized = 0;
+ if (params->buffer_time > 0) {
+ ret = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(spcm, hw_params, (unsigned int *)&params->buffer_time, 0);
+ if (ret < 0) {
+ SNDERR("unable to set buffer time");
+ return ret;
+ }
+ } else if (params->buffer_size > 0) {
+ ret = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(spcm, hw_params, (snd_pcm_uframes_t *)&params->buffer_size);
+ if (ret < 0) {
+ SNDERR("unable to set buffer size");
+ return ret;
+ }
+ } else {
+ buffer_is_not_initialized = 1;
+ }
+
+ if (params->period_time > 0) {
+ ret = INTERNAL(snd_pcm_hw_params_set_period_time_near)(spcm, hw_params, (unsigned int *)&params->period_time, 0);
+ if (ret < 0) {
+ SNDERR("unable to set period_time");
+ return ret;
+ }
+ } else if (params->period_size > 0) {
+ ret = INTERNAL(snd_pcm_hw_params_set_period_size_near)(spcm, hw_params, (snd_pcm_uframes_t *)&params->period_size, 0);
+ if (ret < 0) {
+ SNDERR("unable to set period_size");
+ return ret;
+ }
+ }
+
+ if (buffer_is_not_initialized && params->periods > 0) {
+ unsigned int periods = params->periods;
+ ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm, hw_params, &params->periods, 0);
+ if (ret < 0) {
+ SNDERR("unable to set requested periods");
+ return ret;
+ }
+ if (params->periods == 1) {
+ params->periods = periods;
+ if (params->period_time > 0) {
+ params->period_time /= 2;
+ goto __again;
+ } else if (params->period_size > 0) {
+ params->period_size /= 2;
+ goto __again;
+ }
+ SNDERR("unable to use stream with periods == 1");
+ return ret;
+ }
+ }
+
+ ret = snd_pcm_hw_params(spcm, hw_params);
+ if (ret < 0) {
+ SNDERR("unable to install hw params");
+ return ret;
+ }
+
+ /* store some hw_params values to shared info */
+ dmix->shmptr->hw.format = snd_mask_value(hw_param_mask(hw_params, SND_PCM_HW_PARAM_FORMAT));
+ dmix->shmptr->hw.rate = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_RATE);
+ dmix->shmptr->hw.buffer_size = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_BUFFER_SIZE);
+ dmix->shmptr->hw.buffer_time = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_BUFFER_TIME);
+ dmix->shmptr->hw.period_size = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIOD_SIZE);
+ dmix->shmptr->hw.period_time = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIOD_TIME);
+ dmix->shmptr->hw.periods = *hw_param_interval(hw_params, SND_PCM_HW_PARAM_PERIODS);
+
+
+ ret = snd_pcm_sw_params_current(spcm, sw_params);
+ if (ret < 0) {
+ SNDERR("unable to get current sw_params");
+ return ret;
+ }
+
+ ret = snd_pcm_sw_params_get_boundary(sw_params, &boundary);
+ if (ret < 0) {
+ SNDERR("unable to get boundary");
+ return ret;
+ }
+ ret = snd_pcm_sw_params_set_stop_threshold(spcm, sw_params, boundary);
+ if (ret < 0) {
+ SNDERR("unable to set stop threshold");
+ return ret;
+ }
+
+ /* set timestamp mode to MMAP
+ * the slave timestamp is copied appropriately in dsnoop/dmix/dshare
+ * based on the tstamp_mode of each client
+ */
+ ret = snd_pcm_sw_params_set_tstamp_mode(spcm, sw_params,
+ SND_PCM_TSTAMP_ENABLE);
+ if (ret < 0) {
+ SNDERR("unable to tstamp mode MMAP");
+ return ret;
+ }
+
+ if (dmix->type != SND_PCM_TYPE_DMIX)
+ goto __skip_silencing;
+
+ ret = snd_pcm_sw_params_set_silence_threshold(spcm, sw_params, 0);
+ if (ret < 0) {
+ SNDERR("unable to set silence threshold");
+ return ret;
+ }
+ ret = snd_pcm_sw_params_set_silence_size(spcm, sw_params, boundary);
+ if (ret < 0) {
+ SNDERR("unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
+ return ret;
+ }
+
+ __skip_silencing:
+
+ ret = snd_pcm_sw_params(spcm, sw_params);
+ if (ret < 0) {
+ SNDERR("unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
+ return ret;
+ }
+
+ if (dmix->type == SND_PCM_TYPE_DSHARE) {
+ const snd_pcm_channel_area_t *dst_areas;
+ dst_areas = snd_pcm_mmap_areas(spcm);
+ snd_pcm_areas_silence(dst_areas, 0, spcm->channels, spcm->buffer_size, spcm->format);
+ }
+
+ ret = snd_pcm_start(spcm);
+ if (ret < 0) {
+ SNDERR("unable to start PCM stream");
+ return ret;
+ }
+
+ if (snd_pcm_poll_descriptors_count(spcm) != 1) {
+ SNDERR("unable to use hardware pcm with fd more than one!!!");
+ return ret;
+ }
+ snd_pcm_poll_descriptors(spcm, &fd, 1);
+ dmix->hw_fd = fd.fd;
+
+ save_slave_setting(dmix, spcm);
+
+ /* Currently, we assume that each dmix client has the same
+ * hw_params setting.
+ * If the arbitrary hw_parmas is supported in future,
+ * boundary has to be taken from the slave config but
+ * recalculated for the native boundary size (for 32bit
+ * emulation on 64bit arch).
+ */
+ dmix->slave_buffer_size = spcm->buffer_size;
+ dmix->slave_period_size = spcm->period_size;
+ dmix->slave_boundary = spcm->boundary;
+
+ spcm->donot_close = 1;
+
+ {
+ int ver = 0;
+ ioctl(spcm->poll_fd, SNDRV_PCM_IOCTL_PVERSION, &ver);
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 8))
+ dmix->shmptr->use_server = 1;
+ }
+
+ return 0;
+}
+
+/*
+ * the trick is used here; we cannot use effectively the hardware handle because
+ * we cannot drive multiple accesses to appl_ptr; so we use slave timer of given
+ * PCM hardware handle; it's not this easy and cheap?
+ */
+int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
+{
+ int ret;
+ snd_pcm_info_t *info;
+ char name[128];
+ int capture = dmix->type == SND_PCM_TYPE_DSNOOP ? 1 : 0;
+
+ dmix->tread = 1;
+ dmix->timer_need_poll = 0;
+ snd_pcm_info_alloca(&info);
+ ret = snd_pcm_info(dmix->spcm, info);
+ if (ret < 0) {
+ SNDERR("unable to info for slave pcm");
+ return ret;
+ }
+ sprintf(name, "hw:CLASS=%i,SCLASS=0,CARD=%i,DEV=%i,SUBDEV=%i",
+ (int)SND_TIMER_CLASS_PCM,
+ snd_pcm_info_get_card(info),
+ snd_pcm_info_get_device(info),
+ snd_pcm_info_get_subdevice(info) * 2 + capture);
+ ret = snd_timer_open(&dmix->timer, name, SND_TIMER_OPEN_NONBLOCK | SND_TIMER_OPEN_TREAD);
+ if (ret < 0) {
+ dmix->tread = 0;
+ ret = snd_timer_open(&dmix->timer, name, SND_TIMER_OPEN_NONBLOCK);
+ if (ret < 0) {
+ SNDERR("unable to open timer '%s'", name);
+ return ret;
+ }
+ }
+
+ if (snd_timer_poll_descriptors_count(dmix->timer) != 1) {
+ SNDERR("unable to use timer '%s' with more than one fd!", name);
+ return ret;
+ }
+ snd_timer_poll_descriptors(dmix->timer, &dmix->timer_fd, 1);
+ dmix->poll_fd = dmix->timer_fd.fd;
+
+ dmix->timer_event_suspend = 1<<SND_TIMER_EVENT_MSUSPEND;
+ dmix->timer_event_resume = 1<<SND_TIMER_EVENT_MRESUME;
+
+ /*
+ * Some hacks for older kernel drivers
+ */
+ {
+ int ver = 0;
+ ioctl(dmix->poll_fd, SNDRV_TIMER_IOCTL_PVERSION, &ver);
+ /* In older versions, check via poll before read() is needed
+ * because of the confliction between TIMER_START and
+ * FIONBIO ioctls.
+ */
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ dmix->timer_need_poll = 1;
+ /*
+ * In older versions, timer uses pause events instead
+ * suspend/resume events.
+ */
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
+ dmix->timer_event_suspend = 1<<SND_TIMER_EVENT_MPAUSE;
+ dmix->timer_event_resume = 1<<SND_TIMER_EVENT_MCONTINUE;
+ }
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t recalc_boundary_size(unsigned long long bsize, snd_pcm_uframes_t buffer_size)
+{
+ if (bsize > LONG_MAX) {
+ bsize = buffer_size;
+ while (bsize * 2 <= LONG_MAX - buffer_size)
+ bsize *= 2;
+ }
+ return (snd_pcm_uframes_t)bsize;
+}
+
+#define COPY_SLAVE(field) (spcm->field = dmix->shmptr->s.field)
+
+/* copy the slave setting */
+static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
+{
+ COPY_SLAVE(access);
+ COPY_SLAVE(format);
+ COPY_SLAVE(subformat);
+ COPY_SLAVE(channels);
+ COPY_SLAVE(rate);
+ COPY_SLAVE(period_size);
+ COPY_SLAVE(period_time);
+ COPY_SLAVE(periods);
+ COPY_SLAVE(tstamp_mode);
+ COPY_SLAVE(period_step);
+ COPY_SLAVE(avail_min);
+ COPY_SLAVE(start_threshold);
+ COPY_SLAVE(stop_threshold);
+ COPY_SLAVE(silence_threshold);
+ COPY_SLAVE(silence_size);
+ COPY_SLAVE(boundary);
+ COPY_SLAVE(info);
+ COPY_SLAVE(msbits);
+ COPY_SLAVE(rate_num);
+ COPY_SLAVE(rate_den);
+ COPY_SLAVE(hw_flags);
+ COPY_SLAVE(fifo_size);
+ COPY_SLAVE(buffer_size);
+ COPY_SLAVE(buffer_time);
+ COPY_SLAVE(sample_bits);
+ COPY_SLAVE(frame_bits);
+
+ spcm->info &= ~SND_PCM_INFO_PAUSE;
+ spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size);
+}
+
+#undef COPY_SLAVE
+
+
+/*
+ * open a slave PCM as secondary client (dup'ed fd)
+ */
+int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dmix, const char *client_name)
+{
+ int ret;
+ snd_pcm_t *spcm;
+
+ ret = snd_pcm_hw_open_fd(spcmp, client_name, dmix->hw_fd, 0, 0);
+ if (ret < 0) {
+ SNDERR("unable to open hardware");
+ return ret;
+ }
+
+ spcm = *spcmp;
+ spcm->donot_close = 1;
+ spcm->setup = 1;
+
+ copy_slave_setting(dmix, spcm);
+
+ /* Use the slave setting as SPCM, so far */
+ dmix->slave_buffer_size = spcm->buffer_size;
+ dmix->slave_period_size = dmix->shmptr->s.period_size;
+ dmix->slave_boundary = spcm->boundary;
+
+ ret = snd_pcm_mmap(spcm);
+ if (ret < 0) {
+ SNDERR("unable to mmap channels");
+ return ret;
+ }
+ return 0;
+}
+
+/*
+ * open a slave PCM as secondary client (dup'ed fd)
+ */
+int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix,
+ snd_pcm_t *spcm,
+ struct slave_params *params ATTRIBUTE_UNUSED)
+{
+ int ret;
+
+ spcm->donot_close = 1;
+ spcm->setup = 1;
+
+ copy_slave_setting(dmix, spcm);
+
+ /* Use the slave setting as SPCM, so far */
+ dmix->slave_buffer_size = spcm->buffer_size;
+ dmix->slave_period_size = dmix->shmptr->s.period_size;
+ dmix->slave_boundary = spcm->boundary;
+
+ ret = snd_pcm_mmap(spcm);
+ if (ret < 0) {
+ SNDERR("unable to mmap channels");
+ return ret;
+ }
+ return 0;
+}
+
+int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
+{
+ snd_timer_params_t *params;
+ unsigned int filter;
+ int ret;
+
+ snd_timer_params_alloca(&params);
+ snd_timer_params_set_auto_start(params, 1);
+ if (dmix->type != SND_PCM_TYPE_DSNOOP)
+ snd_timer_params_set_early_event(params, 1);
+ snd_timer_params_set_ticks(params, 1);
+ if (dmix->tread) {
+ filter = (1<<SND_TIMER_EVENT_TICK) |
+ dmix->timer_event_suspend |
+ dmix->timer_event_resume;
+ snd_timer_params_set_filter(params, filter);
+ }
+ ret = snd_timer_params(dmix->timer, params);
+ if (ret < 0) {
+ SNDERR("unable to set timer parameters");
+ return ret;
+ }
+ return 0;
+}
+
+/*
+ * ring buffer operation
+ */
+int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm)
+{
+ unsigned int chn, channels;
+ int bits, interleaved = 1;
+ const snd_pcm_channel_area_t *dst_areas;
+ const snd_pcm_channel_area_t *src_areas;
+
+ bits = snd_pcm_format_physical_width(pcm->format);
+ if ((bits % 8) != 0)
+ interleaved = 0;
+ channels = dmix->channels;
+ dst_areas = snd_pcm_mmap_areas(dmix->spcm);
+ src_areas = snd_pcm_mmap_areas(pcm);
+ for (chn = 1; chn < channels; chn++) {
+ if (dst_areas[chn-1].addr != dst_areas[chn].addr) {
+ interleaved = 0;
+ break;
+ }
+ if (src_areas[chn-1].addr != src_areas[chn].addr) {
+ interleaved = 0;
+ break;
+ }
+ }
+ for (chn = 0; chn < channels; chn++) {
+ if (dmix->bindings && dmix->bindings[chn] != chn) {
+ interleaved = 0;
+ break;
+ }
+ if (dst_areas[chn].first != chn * bits ||
+ dst_areas[chn].step != channels * bits) {
+ interleaved = 0;
+ break;
+ }
+ if (src_areas[chn].first != chn * bits ||
+ src_areas[chn].step != channels * bits) {
+ interleaved = 0;
+ break;
+ }
+ }
+ return dmix->interleaved = interleaved;
+}
+
+/*
+ * parse the channel map
+ * id == client channel
+ * value == slave's channel
+ */
+int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
+ struct slave_params *params,
+ snd_config_t *cfg)
+{
+ snd_config_iterator_t i, next;
+ unsigned int chn, chn1, count = 0;
+ unsigned int *bindings;
+ int err;
+
+ dmix->channels = UINT_MAX;
+ if (cfg == NULL)
+ return 0;
+ if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("invalid type for bindings");
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, cfg) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long cchannel;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0 || cchannel < 0) {
+ SNDERR("invalid client channel in binding: %s\n", id);
+ return -EINVAL;
+ }
+ if ((unsigned)cchannel >= count)
+ count = cchannel + 1;
+ }
+ if (count == 0)
+ return 0;
+ if (count > 1024) {
+ SNDERR("client channel out of range");
+ return -EINVAL;
+ }
+ bindings = malloc(count * sizeof(unsigned int));
+ if (bindings == NULL)
+ return -ENOMEM;
+ for (chn = 0; chn < count; chn++)
+ bindings[chn] = UINT_MAX; /* don't route */
+ snd_config_for_each(i, next, cfg) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long cchannel, schannel;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ safe_strtol(id, &cchannel);
+ if (snd_config_get_integer(n, &schannel) < 0) {
+ SNDERR("unable to get slave channel (should be integer type) in binding: %s\n", id);
+ free(bindings);
+ return -EINVAL;
+ }
+ if (schannel < 0 || schannel >= params->channels) {
+ SNDERR("invalid slave channel number %ld in binding to %ld",
+ schannel, cchannel);
+ free(bindings);
+ return -EINVAL;
+ }
+ bindings[cchannel] = schannel;
+ }
+ if (dmix->type == SND_PCM_TYPE_DSNOOP ||
+ ! dmix->bindings)
+ goto __skip_same_dst;
+ for (chn = 0; chn < count; chn++) {
+ for (chn1 = 0; chn1 < count; chn1++) {
+ if (chn == chn1)
+ continue;
+ if (bindings[chn] == dmix->bindings[chn1]) {
+ SNDERR("unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
+ free(bindings);
+ return -EINVAL;
+ }
+ }
+ }
+ __skip_same_dst:
+ dmix->bindings = bindings;
+ dmix->channels = count;
+ return 0;
+}
+
+/*
+ * parse slave config and calculate the ipc_key offset
+ */
+
+static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
+ snd_config_t *sconf,
+ int direction,
+ int hop)
+{
+ snd_config_iterator_t i, next;
+ snd_config_t *pcm_conf;
+ int err;
+ long card = 0, device = 0, subdevice = 0;
+ const char *str;
+
+ if (snd_config_get_string(sconf, &str) >= 0) {
+ if (hop > SND_CONF_MAX_HOPS) {
+ SNDERR("Too many definition levels (looped?)");
+ return -EINVAL;
+ }
+ err = snd_config_search_definition(root, "pcm", str, &pcm_conf);
+ if (err < 0) {
+ SNDERR("Unknown slave PCM %s", str);
+ return err;
+ }
+ err = _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
+ direction,
+ hop + 1);
+ snd_config_delete(pcm_conf);
+ return err;
+ }
+
+#if 0 /* for debug purposes */
+ {
+ snd_output_t *out;
+ snd_output_stdio_attach(&out, stderr, 0);
+ snd_config_save(sconf, out);
+ snd_output_close(out);
+ }
+#endif
+
+ if (snd_config_search(sconf, "slave", &pcm_conf) >= 0 &&
+ (snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0 ||
+ (snd_config_get_string(pcm_conf, &str) >= 0 &&
+ snd_config_search_definition(root, "pcm_slave", str, &pcm_conf) >= 0 &&
+ snd_config_search(pcm_conf, "pcm", &pcm_conf) >= 0)))
+ return _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
+ direction,
+ hop + 1);
+
+ snd_config_for_each(i, next, sconf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id, *str;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "type") == 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ SNDERR("Invalid value for PCM type definition\n");
+ return -EINVAL;
+ }
+ if (strcmp(str, "hw")) {
+ SNDERR("Invalid type '%s' for slave PCM\n", str);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ card = snd_card_get_index(str);
+ if (card < 0) {
+ SNDERR("Invalid value for %s", id);
+ return card;
+ }
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ continue;
+ }
+ }
+ if (card < 0)
+ card = 0;
+ if (device < 0)
+ device = 0;
+ if (subdevice < 0)
+ subdevice = 0;
+ return (direction << 1) + (device << 2) + (subdevice << 8) + (card << 12);
+}
+
+static int snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
+ snd_config_t *sconf,
+ int direction)
+{
+ return _snd_pcm_direct_get_slave_ipc_offset(root, sconf, direction, 0);
+}
+
+int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
+ int stream, struct snd_pcm_direct_open_conf *rec)
+{
+ snd_config_iterator_t i, next;
+ int ipc_key_add_uid = 0;
+ snd_config_t *n;
+ int err;
+
+ rec->slave = NULL;
+ rec->bindings = NULL;
+ rec->ipc_key = 0;
+ rec->ipc_perm = 0600;
+ rec->ipc_gid = -1;
+ rec->slowptr = 1;
+ rec->max_periods = 0;
+
+ /* read defaults */
+ if (snd_config_search(root, "defaults.pcm.dmix_max_periods", &n) >= 0) {
+ long val;
+ err = snd_config_get_integer(n, &val);
+ if (err >= 0)
+ rec->max_periods = val;
+ }
+
+ snd_config_for_each(i, next, conf) {
+ const char *id;
+ n = snd_config_iterator_entry(i);
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "ipc_key") == 0) {
+ long key;
+ err = snd_config_get_integer(n, &key);
+ if (err < 0) {
+ SNDERR("The field ipc_key must be an integer type");
+
+ return err;
+ }
+ rec->ipc_key = key;
+ continue;
+ }
+ if (strcmp(id, "ipc_perm") == 0) {
+ long perm;
+ err = snd_config_get_integer(n, &perm);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ if ((perm & ~0777) != 0) {
+ SNDERR("The field ipc_perm must be a valid file permission");
+ return -EINVAL;
+ }
+ rec->ipc_perm = perm;
+ continue;
+ }
+ if (strcmp(id, "ipc_gid") == 0) {
+ char *group;
+ char *endp;
+ err = snd_config_get_ascii(n, &group);
+ if (err < 0) {
+ SNDERR("The field ipc_gid must be a valid group");
+ return err;
+ }
+ if (! *group) {
+ rec->ipc_gid = -1;
+ free(group);
+ continue;
+ }
+ if (isdigit(*group) == 0) {
+ struct group *grp = getgrnam(group);
+ if (grp == NULL) {
+ SNDERR("The field ipc_gid must be a valid group (create group %s)", group);
+ free(group);
+ return -EINVAL;
+ }
+ rec->ipc_gid = grp->gr_gid;
+ } else {
+ rec->ipc_gid = strtol(group, &endp, 10);
+ }
+ free(group);
+ continue;
+ }
+ if (strcmp(id, "ipc_key_add_uid") == 0) {
+ if ((err = snd_config_get_bool(n)) < 0) {
+ SNDERR("The field ipc_key_add_uid must be a boolean type");
+ return err;
+ }
+ ipc_key_add_uid = err;
+ continue;
+ }
+ if (strcmp(id, "slave") == 0) {
+ rec->slave = n;
+ continue;
+ }
+ if (strcmp(id, "bindings") == 0) {
+ rec->bindings = n;
+ continue;
+ }
+ if (strcmp(id, "slowptr") == 0) {
+ err = snd_config_get_bool(n);
+ if (err < 0)
+ return err;
+ rec->slowptr = err;
+ continue;
+ }
+ if (strcmp(id, "max_periods") == 0) {
+ long val;
+ err = snd_config_get_integer(n, &val);
+ if (err < 0)
+ return err;
+ rec->max_periods = val;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!rec->slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ if (!rec->ipc_key) {
+ SNDERR("Unique IPC key is not defined");
+ return -EINVAL;
+ }
+ if (ipc_key_add_uid)
+ rec->ipc_key += getuid();
+ err = snd_pcm_direct_get_slave_ipc_offset(root, conf, stream);
+ if (err < 0)
+ return err;
+ rec->ipc_key += err;
+
+ return 0;
+}
diff --git a/alsa-lib/src/pcm/pcm_direct.h b/alsa-lib/src/pcm/pcm_direct.h
new file mode 100644
index 0000000..006617a
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_direct.h
@@ -0,0 +1,306 @@
+/*
+ * PCM - Direct Stream Mixing
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+
+#define DIRECT_IPC_SEMS 1
+#define DIRECT_IPC_SEM_CLIENT 0
+
+typedef void (mix_areas_t)(unsigned int size,
+ volatile void *dst, void *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step);
+
+typedef void (mix_areas_16_t)(unsigned int size,
+ volatile signed short *dst, signed short *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step);
+
+typedef void (mix_areas_32_t)(unsigned int size,
+ volatile signed int *dst, signed int *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step);
+
+typedef void (mix_areas_24_t)(unsigned int size,
+ volatile unsigned char *dst, unsigned char *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step);
+
+typedef void (mix_areas_u8_t)(unsigned int size,
+ volatile unsigned char *dst, unsigned char *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step);
+
+struct slave_params {
+ snd_pcm_format_t format;
+ int rate;
+ int channels;
+ int period_time;
+ int buffer_time;
+ snd_pcm_sframes_t period_size;
+ snd_pcm_sframes_t buffer_size;
+ unsigned int periods;
+};
+
+/* shared among direct plugin clients - be careful to be 32/64bit compatible! */
+typedef struct {
+ unsigned int magic; /* magic number */
+ char socket_name[256]; /* name of communication socket */
+ snd_pcm_type_t type; /* PCM type (currently only hw) */
+ int use_server;
+ struct {
+ unsigned int format;
+ snd_interval_t rate;
+ snd_interval_t buffer_size;
+ snd_interval_t buffer_time;
+ snd_interval_t period_size;
+ snd_interval_t period_time;
+ snd_interval_t periods;
+ } hw;
+ struct {
+ /* copied to slave PCMs */
+ snd_pcm_access_t access;
+ snd_pcm_format_t format;
+ snd_pcm_subformat_t subformat;
+ unsigned int channels;
+ unsigned int rate;
+ unsigned int period_size;
+ unsigned int period_time;
+ snd_interval_t periods;
+ unsigned int monotonic;
+ snd_pcm_tstamp_t tstamp_mode;
+ unsigned int period_step;
+ unsigned int sleep_min; /* not used */
+ unsigned int avail_min;
+ unsigned int start_threshold;
+ unsigned int stop_threshold;
+ unsigned int silence_threshold;
+ unsigned int silence_size;
+ unsigned int xfer_align; /* not used */
+ unsigned long long boundary;
+ unsigned int info;
+ unsigned int msbits;
+ unsigned int rate_num;
+ unsigned int rate_den;
+ unsigned int hw_flags;
+ unsigned int fifo_size;
+ unsigned int buffer_size;
+ snd_interval_t buffer_time;
+ unsigned int sample_bits;
+ unsigned int frame_bits;
+ } s;
+ union {
+ struct {
+ unsigned long long chn_mask;
+ } dshare;
+ } u;
+} snd_pcm_direct_share_t;
+
+typedef struct snd_pcm_direct snd_pcm_direct_t;
+
+struct snd_pcm_direct {
+ snd_pcm_type_t type; /* type (dmix, dsnoop, dshare) */
+ key_t ipc_key; /* IPC key for semaphore and memory */
+ mode_t ipc_perm; /* IPC socket permissions */
+ int ipc_gid; /* IPC socket gid */
+ int semid; /* IPC global semaphore identification */
+ int shmid; /* IPC global shared memory identification */
+ snd_pcm_direct_share_t *shmptr; /* pointer to shared memory area */
+ snd_pcm_t *spcm; /* slave PCM handle */
+ snd_pcm_uframes_t appl_ptr;
+ snd_pcm_uframes_t last_appl_ptr;
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_uframes_t avail_max;
+ snd_pcm_uframes_t slave_appl_ptr;
+ snd_pcm_uframes_t slave_hw_ptr;
+ snd_pcm_uframes_t slave_period_size;
+ snd_pcm_uframes_t slave_buffer_size;
+ snd_pcm_uframes_t slave_boundary;
+ int (*sync_ptr)(snd_pcm_t *pcm);
+ snd_pcm_state_t state;
+ snd_htimestamp_t trigger_tstamp;
+ int server, client;
+ int comm_fd; /* communication file descriptor (socket) */
+ int hw_fd; /* hardware file descriptor */
+ struct pollfd timer_fd;
+ int poll_fd;
+ int tread;
+ int timer_need_poll;
+ unsigned int timer_event_suspend;
+ unsigned int timer_event_resume;
+ int server_fd;
+ pid_t server_pid;
+ snd_timer_t *timer; /* timer used as poll_fd */
+ int interleaved; /* we have interleaved buffer */
+ int slowptr; /* use slow but more precise ptr updates */
+ int max_periods; /* max periods (-1 = fixed periods, 0 = max buffer size) */
+ unsigned int channels; /* client's channels */
+ unsigned int *bindings;
+ union {
+ struct {
+ int shmid_sum; /* IPC global sum ring buffer memory identification */
+ signed int *sum_buffer; /* shared sum buffer */
+ mix_areas_16_t *mix_areas_16;
+ mix_areas_32_t *mix_areas_32;
+ mix_areas_24_t *mix_areas_24;
+ mix_areas_u8_t *mix_areas_u8;
+ mix_areas_16_t *remix_areas_16;
+ mix_areas_32_t *remix_areas_32;
+ mix_areas_24_t *remix_areas_24;
+ mix_areas_u8_t *remix_areas_u8;
+ } dmix;
+ struct {
+ } dsnoop;
+ struct {
+ unsigned long long chn_mask;
+ } dshare;
+ } u;
+ void (*server_free)(snd_pcm_direct_t *direct);
+};
+
+/* make local functions really local */
+#define snd_pcm_direct_semaphore_create_or_connect \
+ snd1_pcm_direct_semaphore_create_or_connect
+#define snd_pcm_direct_shm_create_or_connect \
+ snd1_pcm_direct_shm_create_or_connect
+#define snd_pcm_direct_shm_discard \
+ snd1_pcm_direct_shm_discard
+#define snd_pcm_direct_server_create \
+ snd1_pcm_direct_server_create
+#define snd_pcm_direct_server_discard \
+ snd1_pcm_direct_server_discard
+#define snd_pcm_direct_client_connect \
+ snd1_pcm_direct_client_connect
+#define snd_pcm_direct_client_discard \
+ snd1_pcm_direct_client_discard
+#define snd_pcm_direct_initialize_slave \
+ snd1_pcm_direct_initialize_slave
+#define snd_pcm_direct_initialize_secondary_slave \
+ snd1_pcm_direct_initialize_secondary_slave
+#define snd_pcm_direct_initialize_poll_fd \
+ snd1_pcm_direct_initialize_poll_fd
+#define snd_pcm_direct_check_interleave \
+ snd1_pcm_direct_check_interleave
+#define snd_pcm_direct_parse_bindings \
+ snd1_pcm_direct_parse_bindings
+#define snd_pcm_direct_nonblock \
+ snd1_pcm_direct_nonblock
+#define snd_pcm_direct_async \
+ snd1_pcm_direct_async
+#define snd_pcm_direct_poll_revents \
+ snd1_pcm_direct_poll_revents
+#define snd_pcm_direct_info \
+ snd1_pcm_direct_info
+#define snd_pcm_direct_hw_refine \
+ snd1_pcm_direct_hw_refine
+#define snd_pcm_direct_hw_params \
+ snd1_pcm_direct_hw_params
+#define snd_pcm_direct_hw_free \
+ snd1_pcm_direct_hw_free
+#define snd_pcm_direct_sw_params \
+ snd1_pcm_direct_sw_params
+#define snd_pcm_direct_channel_info \
+ snd1_pcm_direct_channel_info
+#define snd_pcm_direct_mmap \
+ snd1_pcm_direct_mmap
+#define snd_pcm_direct_munmap \
+ snd1_pcm_direct_munmap
+#define snd_pcm_direct_resume \
+ snd1_pcm_direct_resume
+#define snd_pcm_direct_timer_stop \
+ snd1_pcm_direct_timer_stop
+#define snd_pcm_direct_clear_timer_queue \
+ snd1_pcm_direct_clear_timer_queue
+#define snd_pcm_direct_set_timer_params \
+ snd1_pcm_direct_set_timer_params
+#define snd_pcm_direct_open_secondary_client \
+ snd1_pcm_direct_open_secondary_client
+#define snd_pcm_direct_parse_open_conf \
+ snd1_pcm_direct_parse_open_conf
+
+int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix);
+
+static inline int snd_pcm_direct_semaphore_discard(snd_pcm_direct_t *dmix)
+{
+ if (dmix->semid >= 0) {
+ if (semctl(dmix->semid, 0, IPC_RMID, NULL) < 0)
+ return -errno;
+ dmix->semid = -1;
+ }
+ return 0;
+}
+
+static inline int snd_pcm_direct_semaphore_down(snd_pcm_direct_t *dmix, int sem_num)
+{
+ struct sembuf op[2] = { { sem_num, 0, 0 }, { sem_num, 1, SEM_UNDO } };
+ return semop(dmix->semid, op, 2);
+}
+
+static inline int snd_pcm_direct_semaphore_up(snd_pcm_direct_t *dmix, int sem_num)
+{
+ struct sembuf op = { sem_num, -1, SEM_UNDO | IPC_NOWAIT };
+ return semop(dmix->semid, &op, 1);
+}
+
+int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_shm_discard(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_server_discard(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_client_connect(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_client_discard(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, struct slave_params *params);
+int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, struct slave_params *params);
+int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_check_interleave(snd_pcm_direct_t *dmix, snd_pcm_t *pcm);
+int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
+ struct slave_params *params,
+ snd_config_t *cfg);
+int snd_pcm_direct_nonblock(snd_pcm_t *pcm, int nonblock);
+int snd_pcm_direct_async(snd_pcm_t *pcm, int sig, pid_t pid);
+int snd_pcm_direct_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info);
+int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_direct_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params);
+int snd_pcm_direct_hw_free(snd_pcm_t *pcm);
+int snd_pcm_direct_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params);
+int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info);
+int snd_pcm_direct_mmap(snd_pcm_t *pcm);
+int snd_pcm_direct_munmap(snd_pcm_t *pcm);
+int snd_pcm_direct_resume(snd_pcm_t *pcm);
+int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix);
+void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix);
+int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dmix, const char *client_name);
+
+int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid);
+struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm);
+
+struct snd_pcm_direct_open_conf {
+ key_t ipc_key;
+ mode_t ipc_perm;
+ int ipc_gid;
+ int slowptr;
+ int max_periods;
+ snd_config_t *slave;
+ snd_config_t *bindings;
+};
+
+int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf, int stream, struct snd_pcm_direct_open_conf *rec);
diff --git a/alsa-lib/src/pcm/pcm_dmix.c b/alsa-lib/src/pcm/pcm_dmix.c
new file mode 100644
index 0000000..5b967e8
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix.c
@@ -0,0 +1,1316 @@
+/**
+ * \file pcm/pcm_dmix.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Direct Stream Mixing (dmix) Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2003
+ */
+/*
+ * PCM - Direct Stream Mixing
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <grp.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/mman.h>
+#include "pcm_direct.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_dmix = "";
+#endif
+
+#ifndef DOC_HIDDEN
+/* start is pending - this state happens when rate plugin does a delayed commit */
+#define STATE_RUN_PENDING 1024
+#endif
+
+/*
+ *
+ */
+
+static int shm_sum_discard(snd_pcm_direct_t *dmix);
+
+/*
+ * sum ring buffer shared memory area
+ */
+static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
+{
+ struct shmid_ds buf;
+ int tmpid, err;
+ size_t size;
+
+ size = dmix->shmptr->s.channels *
+ dmix->shmptr->s.buffer_size *
+ sizeof(signed int);
+retryshm:
+ dmix->u.dmix.shmid_sum = shmget(dmix->ipc_key + 1, size,
+ IPC_CREAT | dmix->ipc_perm);
+ err = -errno;
+ if (dmix->u.dmix.shmid_sum < 0) {
+ if (errno == EINVAL)
+ if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1)
+ if (!shmctl(tmpid, IPC_STAT, &buf))
+ if (!buf.shm_nattch)
+ /* no users so destroy the segment */
+ if (!shmctl(tmpid, IPC_RMID, NULL))
+ goto retryshm;
+ return err;
+ }
+ if (shmctl(dmix->u.dmix.shmid_sum, IPC_STAT, &buf) < 0) {
+ err = -errno;
+ shm_sum_discard(dmix);
+ return err;
+ }
+ if (dmix->ipc_gid >= 0) {
+ buf.shm_perm.gid = dmix->ipc_gid;
+ shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf);
+ }
+ dmix->u.dmix.sum_buffer = shmat(dmix->u.dmix.shmid_sum, 0, 0);
+ if (dmix->u.dmix.sum_buffer == (void *) -1) {
+ err = -errno;
+ shm_sum_discard(dmix);
+ return err;
+ }
+ mlock(dmix->u.dmix.sum_buffer, size);
+ return 0;
+}
+
+static int shm_sum_discard(snd_pcm_direct_t *dmix)
+{
+ struct shmid_ds buf;
+ int ret = 0;
+
+ if (dmix->u.dmix.shmid_sum < 0)
+ return -EINVAL;
+ if (dmix->u.dmix.sum_buffer != (void *) -1 && shmdt(dmix->u.dmix.sum_buffer) < 0)
+ return -errno;
+ dmix->u.dmix.sum_buffer = (void *) -1;
+ if (shmctl(dmix->u.dmix.shmid_sum, IPC_STAT, &buf) < 0)
+ return -errno;
+ if (buf.shm_nattch == 0) { /* we're the last user, destroy the segment */
+ if (shmctl(dmix->u.dmix.shmid_sum, IPC_RMID, NULL) < 0)
+ return -errno;
+ ret = 1;
+ }
+ dmix->u.dmix.shmid_sum = -1;
+ return ret;
+}
+
+static void dmix_server_free(snd_pcm_direct_t *dmix)
+{
+ /* remove the memory region */
+ shm_sum_create_or_connect(dmix);
+ shm_sum_discard(dmix);
+}
+
+/*
+ * the main function of this plugin: mixing
+ * FIXME: optimize it for different architectures
+ */
+
+#include "pcm_dmix_generic.c"
+#if defined(__i386__)
+#include "pcm_dmix_i386.c"
+#elif defined(__x86_64__)
+#include "pcm_dmix_x86_64.c"
+#else
+#define mix_select_callbacks(x) generic_mix_select_callbacks(x)
+#define dmix_supported_format generic_dmix_supported_format
+#endif
+
+static void mix_areas(snd_pcm_direct_t *dmix,
+ const snd_pcm_channel_area_t *src_areas,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t src_ofs,
+ snd_pcm_uframes_t dst_ofs,
+ snd_pcm_uframes_t size)
+{
+ unsigned int src_step, dst_step;
+ unsigned int chn, dchn, channels, sample_size;
+ mix_areas_t *do_mix_areas;
+
+ channels = dmix->channels;
+ switch (dmix->shmptr->s.format) {
+ case SND_PCM_FORMAT_S16_LE:
+ case SND_PCM_FORMAT_S16_BE:
+ sample_size = 2;
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_16;
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_S32_BE:
+ sample_size = 4;
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_32;
+ break;
+ case SND_PCM_FORMAT_S24_3LE:
+ sample_size = 3;
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_24;
+ break;
+ case SND_PCM_FORMAT_U8:
+ sample_size = 1;
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_u8;
+ break;
+ default:
+ return;
+ }
+ if (dmix->interleaved) {
+ /*
+ * process all areas in one loop
+ * it optimizes the memory accesses for this case
+ */
+ do_mix_areas(size * channels,
+ (unsigned char *)dst_areas[0].addr + sample_size * dst_ofs * channels,
+ (unsigned char *)src_areas[0].addr + sample_size * src_ofs * channels,
+ dmix->u.dmix.sum_buffer + dst_ofs * channels,
+ sample_size,
+ sample_size,
+ sizeof(signed int));
+ return;
+ }
+ for (chn = 0; chn < channels; chn++) {
+ dchn = dmix->bindings ? dmix->bindings[chn] : chn;
+ if (dchn >= dmix->shmptr->s.channels)
+ continue;
+ src_step = src_areas[chn].step / 8;
+ dst_step = dst_areas[dchn].step / 8;
+ do_mix_areas(size,
+ ((unsigned char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + dst_ofs * dst_step,
+ ((unsigned char *)src_areas[chn].addr + src_areas[chn].first / 8) + src_ofs * src_step,
+ dmix->u.dmix.sum_buffer + channels * dst_ofs + chn,
+ dst_step,
+ src_step,
+ channels * sizeof(signed int));
+ }
+}
+
+static void remix_areas(snd_pcm_direct_t *dmix,
+ const snd_pcm_channel_area_t *src_areas,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t src_ofs,
+ snd_pcm_uframes_t dst_ofs,
+ snd_pcm_uframes_t size)
+{
+ unsigned int src_step, dst_step;
+ unsigned int chn, dchn, channels, sample_size;
+ mix_areas_t *do_remix_areas;
+
+ channels = dmix->channels;
+ switch (dmix->shmptr->s.format) {
+ case SND_PCM_FORMAT_S16_LE:
+ case SND_PCM_FORMAT_S16_BE:
+ sample_size = 2;
+ do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_16;
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_S32_BE:
+ sample_size = 4;
+ do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_32;
+ break;
+ case SND_PCM_FORMAT_S24_3LE:
+ sample_size = 3;
+ do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_24;
+ break;
+ case SND_PCM_FORMAT_U8:
+ sample_size = 1;
+ do_remix_areas = (mix_areas_t *)dmix->u.dmix.remix_areas_u8;
+ break;
+ default:
+ return;
+ }
+ if (dmix->interleaved) {
+ /*
+ * process all areas in one loop
+ * it optimizes the memory accesses for this case
+ */
+ do_remix_areas(size * channels,
+ (unsigned char *)dst_areas[0].addr + sample_size * dst_ofs * channels,
+ (unsigned char *)src_areas[0].addr + sample_size * src_ofs * channels,
+ dmix->u.dmix.sum_buffer + dst_ofs * channels,
+ sample_size,
+ sample_size,
+ sizeof(signed int));
+ return;
+ }
+ for (chn = 0; chn < channels; chn++) {
+ dchn = dmix->bindings ? dmix->bindings[chn] : chn;
+ if (dchn >= dmix->shmptr->s.channels)
+ continue;
+ src_step = src_areas[chn].step / 8;
+ dst_step = dst_areas[dchn].step / 8;
+ do_remix_areas(size,
+ ((unsigned char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + dst_ofs * dst_step,
+ ((unsigned char *)src_areas[chn].addr + src_areas[chn].first / 8) + src_ofs * src_step,
+ dmix->u.dmix.sum_buffer + channels * dst_ofs + chn,
+ dst_step,
+ src_step,
+ channels * sizeof(signed int));
+ }
+}
+
+/*
+ * if no concurrent access is allowed in the mixing routines, we need to protect
+ * the area via semaphore
+ */
+#ifndef DOC_HIDDEN
+#ifdef NO_CONCURRENT_ACCESS
+#define dmix_down_sem(dmix) snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT)
+#define dmix_up_sem(dmix) snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT)
+#else
+#define dmix_down_sem(dmix)
+#define dmix_up_sem(dmix)
+#endif
+#endif
+
+/*
+ * synchronize shm ring buffer with hardware
+ */
+static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
+ snd_pcm_uframes_t appl_ptr, size, transfer;
+ const snd_pcm_channel_area_t *src_areas, *dst_areas;
+
+ /* calculate the size to transfer */
+ /* check the available size in the local buffer
+ * last_appl_ptr keeps the last updated position
+ */
+ size = dmix->appl_ptr - dmix->last_appl_ptr;
+ if (! size)
+ return;
+ if (size >= pcm->boundary / 2)
+ size = pcm->boundary - size;
+
+ /* the slave_app_ptr can be far behind the slave_hw_ptr */
+ /* reduce mixing and errors here - just skip not catched writes */
+ if (dmix->slave_hw_ptr <= dmix->slave_appl_ptr)
+ slave_size = dmix->slave_appl_ptr - dmix->slave_hw_ptr;
+ else
+ slave_size = dmix->slave_appl_ptr + (dmix->slave_boundary - dmix->slave_hw_ptr);
+ if (slave_size > dmix->slave_buffer_size) {
+ transfer = dmix->slave_buffer_size - slave_size;
+ if (transfer > size)
+ transfer = size;
+ dmix->last_appl_ptr += transfer;
+ dmix->last_appl_ptr %= pcm->boundary;
+ dmix->slave_appl_ptr += transfer;
+ dmix->slave_appl_ptr %= dmix->slave_boundary;
+ size = dmix->appl_ptr - dmix->last_appl_ptr;
+ if (! size)
+ return;
+ if (size >= pcm->boundary / 2)
+ size = pcm->boundary - size;
+ }
+
+ /* check the available size in the slave PCM buffer */
+ slave_hw_ptr = dmix->slave_hw_ptr;
+ /* don't write on the last active period - this area may be cleared
+ * by the driver during mix operation...
+ */
+ slave_hw_ptr -= slave_hw_ptr % dmix->slave_period_size;
+ slave_hw_ptr += dmix->slave_buffer_size;
+ if (slave_hw_ptr >= dmix->slave_boundary)
+ slave_hw_ptr -= dmix->slave_boundary;
+ if (slave_hw_ptr < dmix->slave_appl_ptr)
+ slave_size = slave_hw_ptr + (dmix->slave_boundary - dmix->slave_appl_ptr);
+ else
+ slave_size = slave_hw_ptr - dmix->slave_appl_ptr;
+ if (slave_size < size)
+ size = slave_size;
+ if (! size)
+ return;
+
+ /* add sample areas here */
+ src_areas = snd_pcm_mmap_areas(pcm);
+ dst_areas = snd_pcm_mmap_areas(dmix->spcm);
+ appl_ptr = dmix->last_appl_ptr % pcm->buffer_size;
+ dmix->last_appl_ptr += size;
+ dmix->last_appl_ptr %= pcm->boundary;
+ slave_appl_ptr = dmix->slave_appl_ptr % dmix->slave_buffer_size;
+ dmix->slave_appl_ptr += size;
+ dmix->slave_appl_ptr %= dmix->slave_boundary;
+ dmix_down_sem(dmix);
+ for (;;) {
+ transfer = size;
+ if (appl_ptr + transfer > pcm->buffer_size)
+ transfer = pcm->buffer_size - appl_ptr;
+ if (slave_appl_ptr + transfer > dmix->slave_buffer_size)
+ transfer = dmix->slave_buffer_size - slave_appl_ptr;
+ mix_areas(dmix, src_areas, dst_areas, appl_ptr, slave_appl_ptr, transfer);
+ size -= transfer;
+ if (! size)
+ break;
+ slave_appl_ptr += transfer;
+ slave_appl_ptr %= dmix->slave_buffer_size;
+ appl_ptr += transfer;
+ appl_ptr %= pcm->buffer_size;
+ }
+ dmix_up_sem(dmix);
+}
+
+/*
+ * synchronize hardware pointer (hw_ptr) with ours
+ */
+static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
+ snd_pcm_sframes_t diff;
+
+ switch (snd_pcm_state(dmix->spcm)) {
+ case SND_PCM_STATE_DISCONNECTED:
+ dmix->state = SND_PCM_STATE_DISCONNECTED;
+ return -ENODEV;
+ default:
+ break;
+ }
+ if (dmix->slowptr)
+ snd_pcm_hwsync(dmix->spcm);
+ old_slave_hw_ptr = dmix->slave_hw_ptr;
+ slave_hw_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ if (diff == 0) /* fast path */
+ return 0;
+ if (dmix->state != SND_PCM_STATE_RUNNING &&
+ dmix->state != SND_PCM_STATE_DRAINING)
+ /* not really started yet - don't update hw_ptr */
+ return 0;
+ if (diff < 0) {
+ slave_hw_ptr += dmix->slave_boundary;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ }
+ dmix->hw_ptr += diff;
+ dmix->hw_ptr %= pcm->boundary;
+ if (pcm->stop_threshold >= pcm->boundary) /* don't care */
+ return 0;
+ avail = snd_pcm_mmap_playback_avail(pcm);
+ if (avail > dmix->avail_max)
+ dmix->avail_max = avail;
+ if (avail >= pcm->stop_threshold) {
+ snd_timer_stop(dmix->timer);
+ gettimestamp(&dmix->trigger_tstamp, pcm->monotonic);
+ if (dmix->state == SND_PCM_STATE_RUNNING) {
+ dmix->state = SND_PCM_STATE_XRUN;
+ return -EPIPE;
+ }
+ dmix->state = SND_PCM_STATE_SETUP;
+ /* clear queue to remove pending poll events */
+ snd_pcm_direct_clear_timer_queue(dmix);
+ }
+ return 0;
+}
+
+/*
+ * plugin implementation
+ */
+
+static snd_pcm_state_t snd_pcm_dmix_state(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_state_t state;
+ state = snd_pcm_state(dmix->spcm);
+ switch (state) {
+ case SND_PCM_STATE_SUSPENDED:
+ return state;
+ case SND_PCM_STATE_DISCONNECTED:
+ return state;
+ default:
+ break;
+ }
+ if (dmix->state == STATE_RUN_PENDING)
+ return SNDRV_PCM_STATE_RUNNING;
+ return dmix->state;
+}
+
+static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ switch (dmix->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ snd_pcm_dmix_sync_ptr(pcm);
+ break;
+ default:
+ break;
+ }
+ memset(status, 0, sizeof(*status));
+ status->state = snd_pcm_dmix_state(pcm);
+ status->trigger_tstamp = dmix->trigger_tstamp;
+ gettimestamp(&status->tstamp, pcm->monotonic);
+ status->avail = snd_pcm_mmap_playback_avail(pcm);
+ status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
+ dmix->avail_max = 0;
+ return 0;
+}
+
+static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ int err;
+
+ switch(dmix->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ err = snd_pcm_dmix_sync_ptr(pcm);
+ if (err < 0)
+ return err;
+ /* fallthru */
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ case STATE_RUN_PENDING:
+ *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ switch(dmix->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ /* sync slave PCM */
+ return snd_pcm_dmix_sync_ptr(pcm);
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ case STATE_RUN_PENDING:
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dmix_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ snd_pcm_direct_check_interleave(dmix, pcm);
+ dmix->state = SND_PCM_STATE_PREPARED;
+ dmix->appl_ptr = dmix->last_appl_ptr = 0;
+ dmix->hw_ptr = 0;
+ return snd_pcm_direct_set_timer_params(dmix);
+}
+
+static void reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix)
+{
+ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
+ if (pcm->buffer_size > pcm->period_size * 2)
+ return;
+ /* If we have too litte periods, better to align the start position
+ * to the period boundary so that the interrupt can be handled properly
+ * at the right time.
+ */
+ dmix->slave_appl_ptr = ((dmix->slave_appl_ptr + dmix->slave_period_size - 1)
+ / dmix->slave_period_size) * dmix->slave_period_size;
+}
+
+static int snd_pcm_dmix_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ dmix->hw_ptr %= pcm->period_size;
+ dmix->appl_ptr = dmix->last_appl_ptr = dmix->hw_ptr;
+ reset_slave_ptr(pcm, dmix);
+ return 0;
+}
+
+static int snd_pcm_dmix_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dmix)
+{
+ int err;
+
+ snd_pcm_hwsync(dmix->spcm);
+ reset_slave_ptr(pcm, dmix);
+ err = snd_timer_start(dmix->timer);
+ if (err < 0)
+ return err;
+ dmix->state = SND_PCM_STATE_RUNNING;
+ return 0;
+}
+
+static int snd_pcm_dmix_start(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_sframes_t avail;
+ int err;
+
+ if (dmix->state != SND_PCM_STATE_PREPARED)
+ return -EBADFD;
+ avail = snd_pcm_mmap_playback_hw_avail(pcm);
+ if (avail == 0)
+ dmix->state = STATE_RUN_PENDING;
+ else if (avail < 0)
+ return 0;
+ else {
+ if ((err = snd_pcm_dmix_start_timer(pcm, dmix)) < 0)
+ return err;
+ snd_pcm_dmix_sync_area(pcm);
+ }
+ gettimestamp(&dmix->trigger_tstamp, pcm->monotonic);
+ return 0;
+}
+
+static int snd_pcm_dmix_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ if (dmix->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ snd_pcm_direct_timer_stop(dmix);
+ dmix->state = SND_PCM_STATE_SETUP;
+ return 0;
+}
+
+static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t stop_threshold;
+ int err;
+
+ if (dmix->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ if (pcm->mode & SND_PCM_NONBLOCK)
+ return -EAGAIN;
+ if (dmix->state == SND_PCM_STATE_PREPARED) {
+ if (snd_pcm_mmap_playback_hw_avail(pcm) > 0)
+ snd_pcm_dmix_start(pcm);
+ else {
+ snd_pcm_dmix_drop(pcm);
+ return 0;
+ }
+ }
+
+ if (dmix->state == SND_PCM_STATE_XRUN) {
+ snd_pcm_dmix_drop(pcm);
+ return 0;
+ }
+
+ stop_threshold = pcm->stop_threshold;
+ if (pcm->stop_threshold > pcm->buffer_size)
+ pcm->stop_threshold = pcm->buffer_size;
+ dmix->state = SND_PCM_STATE_DRAINING;
+ do {
+ err = snd_pcm_dmix_sync_ptr(pcm);
+ if (err < 0) {
+ snd_pcm_dmix_drop(pcm);
+ return err;
+ }
+ if (dmix->state == SND_PCM_STATE_DRAINING) {
+ snd_pcm_dmix_sync_area(pcm);
+ snd_pcm_wait_nocheck(pcm, -1);
+ snd_pcm_direct_clear_timer_queue(dmix); /* force poll to wait */
+ }
+ } while (dmix->state == SND_PCM_STATE_DRAINING);
+ pcm->stop_threshold = stop_threshold;
+ return 0;
+}
+
+static int snd_pcm_dmix_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED)
+{
+ return -EIO;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t slave_appl_ptr, slave_size;
+ snd_pcm_uframes_t appl_ptr, size, transfer, result;
+ const snd_pcm_channel_area_t *src_areas, *dst_areas;
+
+ if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING)
+ return snd_pcm_dmix_hwsync(pcm);
+
+ if (dmix->last_appl_ptr < dmix->appl_ptr)
+ size = dmix->appl_ptr - dmix->last_appl_ptr;
+ else
+ size = dmix->appl_ptr + (pcm->boundary - dmix->last_appl_ptr);
+ if (frames < size)
+ size = frames;
+ snd_pcm_mmap_appl_backward(pcm, size);
+ frames -= size;
+ if (!frames)
+ return size;
+ result = size;
+
+ if (dmix->hw_ptr < dmix->appl_ptr)
+ size = dmix->appl_ptr - dmix->hw_ptr;
+ else
+ size = dmix->appl_ptr + (pcm->boundary - dmix->hw_ptr);
+ if (size > frames)
+ size = frames;
+ if (dmix->slave_hw_ptr < dmix->slave_appl_ptr)
+ slave_size = dmix->slave_appl_ptr - dmix->slave_hw_ptr;
+ else
+ slave_size = dmix->slave_appl_ptr + (pcm->boundary - dmix->slave_hw_ptr);
+ if (slave_size < size)
+ size = slave_size;
+ frames -= size;
+ result += size;
+
+ /* add sample areas here */
+ src_areas = snd_pcm_mmap_areas(pcm);
+ dst_areas = snd_pcm_mmap_areas(dmix->spcm);
+ dmix->last_appl_ptr -= size;
+ dmix->last_appl_ptr %= pcm->boundary;
+ appl_ptr = dmix->last_appl_ptr % pcm->buffer_size;
+ dmix->slave_appl_ptr -= size;
+ dmix->slave_appl_ptr %= dmix->slave_boundary;
+ slave_appl_ptr = dmix->slave_appl_ptr % dmix->slave_buffer_size;
+ dmix_down_sem(dmix);
+ for (;;) {
+ transfer = size;
+ if (appl_ptr + transfer > pcm->buffer_size)
+ transfer = pcm->buffer_size - appl_ptr;
+ if (slave_appl_ptr + transfer > dmix->slave_buffer_size)
+ transfer = dmix->slave_buffer_size - slave_appl_ptr;
+ remix_areas(dmix, src_areas, dst_areas, appl_ptr, slave_appl_ptr, transfer);
+ size -= transfer;
+ if (! size)
+ break;
+ slave_appl_ptr += transfer;
+ slave_appl_ptr %= dmix->slave_buffer_size;
+ appl_ptr += transfer;
+ appl_ptr %= pcm->buffer_size;
+ }
+ dmix->last_appl_ptr -= frames;
+ dmix->last_appl_ptr %= pcm->boundary;
+ dmix->slave_appl_ptr -= frames;
+ dmix->slave_appl_ptr %= dmix->slave_boundary;
+ dmix_up_sem(dmix);
+
+ snd_pcm_mmap_appl_backward(pcm, frames);
+
+ return result + frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_mmap_playback_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_readi(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_readn(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static int snd_pcm_dmix_close(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ if (dmix->timer)
+ snd_timer_close(dmix->timer);
+ snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
+ snd_pcm_close(dmix->spcm);
+ if (dmix->server)
+ snd_pcm_direct_server_discard(dmix);
+ if (dmix->client)
+ snd_pcm_direct_client_discard(dmix);
+ shm_sum_discard(dmix);
+ if (snd_pcm_direct_shm_discard(dmix)) {
+ if (snd_pcm_direct_semaphore_discard(dmix))
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ } else
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ free(dmix->bindings);
+ pcm->private_data = NULL;
+ free(dmix);
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ int err;
+
+ switch (snd_pcm_state(dmix->spcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
+ if (! size)
+ return 0;
+ snd_pcm_mmap_appl_forward(pcm, size);
+ if (dmix->state == STATE_RUN_PENDING) {
+ if ((err = snd_pcm_dmix_start_timer(pcm, dmix)) < 0)
+ return err;
+ } else if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dmix_sync_ptr(pcm);
+ if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING) {
+ /* ok, we commit the changes after the validation of area */
+ /* it's intended, although the result might be crappy */
+ snd_pcm_dmix_sync_area(pcm);
+ /* clear timer queue to avoid a bogus return from poll */
+ if (snd_pcm_mmap_playback_avail(pcm) < pcm->avail_min)
+ snd_pcm_direct_clear_timer_queue(dmix);
+ }
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dmix_sync_ptr(pcm);
+ return snd_pcm_mmap_playback_avail(pcm);
+}
+
+static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dmix_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_playback_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
+}
+
+static int snd_pcm_dmix_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ if (dmix->state == SND_PCM_STATE_RUNNING)
+ snd_pcm_dmix_sync_area(pcm);
+ return snd_pcm_direct_poll_revents(pcm, pfds, nfds, revents);
+}
+
+
+static void snd_pcm_dmix_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+
+ snd_output_printf(out, "Direct Stream Mixing PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ if (dmix->spcm)
+ snd_pcm_dump(dmix->spcm, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_dmix_ops = {
+ .close = snd_pcm_dmix_close,
+ .info = snd_pcm_direct_info,
+ .hw_refine = snd_pcm_direct_hw_refine,
+ .hw_params = snd_pcm_direct_hw_params,
+ .hw_free = snd_pcm_direct_hw_free,
+ .sw_params = snd_pcm_direct_sw_params,
+ .channel_info = snd_pcm_direct_channel_info,
+ .dump = snd_pcm_dmix_dump,
+ .nonblock = snd_pcm_direct_nonblock,
+ .async = snd_pcm_direct_async,
+ .mmap = snd_pcm_direct_mmap,
+ .munmap = snd_pcm_direct_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_dmix_fast_ops = {
+ .status = snd_pcm_dmix_status,
+ .state = snd_pcm_dmix_state,
+ .hwsync = snd_pcm_dmix_hwsync,
+ .delay = snd_pcm_dmix_delay,
+ .prepare = snd_pcm_dmix_prepare,
+ .reset = snd_pcm_dmix_reset,
+ .start = snd_pcm_dmix_start,
+ .drop = snd_pcm_dmix_drop,
+ .drain = snd_pcm_dmix_drain,
+ .pause = snd_pcm_dmix_pause,
+ .rewindable = snd_pcm_dmix_rewindable,
+ .rewind = snd_pcm_dmix_rewind,
+ .forwardable = snd_pcm_dmix_forwardable,
+ .forward = snd_pcm_dmix_forward,
+ .resume = snd_pcm_direct_resume,
+ .link = NULL,
+ .link_slaves = NULL,
+ .unlink = NULL,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_dmix_readi,
+ .readn = snd_pcm_dmix_readn,
+ .avail_update = snd_pcm_dmix_avail_update,
+ .mmap_commit = snd_pcm_dmix_mmap_commit,
+ .htimestamp = snd_pcm_dmix_htimestamp,
+ .poll_descriptors = NULL,
+ .poll_descriptors_count = NULL,
+ .poll_revents = snd_pcm_dmix_poll_revents,
+};
+
+/**
+ * \brief Creates a new dmix PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param opts Direct PCM configurations
+ * \param params Parameters for slave
+ * \param root Configuration root
+ * \param sconf Slave configuration
+ * \param stream PCM Direction (stream)
+ * \param mode PCM Mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
+ struct snd_pcm_direct_open_conf *opts,
+ struct slave_params *params,
+ snd_config_t *root, snd_config_t *sconf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm = NULL, *spcm = NULL;
+ snd_pcm_direct_t *dmix = NULL;
+ int ret, first_instance;
+ int fail_sem_loop = 10;
+
+ assert(pcmp);
+
+ if (stream != SND_PCM_STREAM_PLAYBACK) {
+ SNDERR("The dmix plugin supports only playback stream");
+ return -EINVAL;
+ }
+
+ dmix = calloc(1, sizeof(snd_pcm_direct_t));
+ if (!dmix) {
+ ret = -ENOMEM;
+ goto _err_nosem;
+ }
+
+ ret = snd_pcm_direct_parse_bindings(dmix, params, opts->bindings);
+ if (ret < 0)
+ goto _err_nosem;
+
+ dmix->ipc_key = opts->ipc_key;
+ dmix->ipc_perm = opts->ipc_perm;
+ dmix->ipc_gid = opts->ipc_gid;
+ dmix->semid = -1;
+ dmix->shmid = -1;
+
+ ret = snd_pcm_new(&pcm, dmix->type = SND_PCM_TYPE_DMIX, name, stream, mode);
+ if (ret < 0)
+ goto _err;
+
+
+ while (1) {
+ ret = snd_pcm_direct_semaphore_create_or_connect(dmix);
+ if (ret < 0) {
+ SNDERR("unable to create IPC semaphore");
+ goto _err_nosem;
+ }
+ ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
+ if (ret < 0) {
+ snd_pcm_direct_semaphore_discard(dmix);
+ if (--fail_sem_loop <= 0)
+ goto _err_nosem;
+ continue;
+ }
+ break;
+ }
+
+ first_instance = ret = snd_pcm_direct_shm_create_or_connect(dmix);
+ if (ret < 0) {
+ SNDERR("unable to create IPC shm instance");
+ goto _err;
+ }
+
+ pcm->ops = &snd_pcm_dmix_ops;
+ pcm->fast_ops = &snd_pcm_dmix_fast_ops;
+ pcm->private_data = dmix;
+ dmix->state = SND_PCM_STATE_OPEN;
+ dmix->slowptr = opts->slowptr;
+ dmix->max_periods = opts->max_periods;
+ dmix->sync_ptr = snd_pcm_dmix_sync_ptr;
+
+ if (first_instance) {
+ /* recursion is already checked in
+ snd_pcm_direct_get_slave_ipc_offset() */
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK, NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dmix plugin can be only connected to hw plugin");
+ ret = -EINVAL;
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+
+ dmix->spcm = spcm;
+
+ if (dmix->shmptr->use_server) {
+ dmix->server_free = dmix_server_free;
+
+ ret = snd_pcm_direct_server_create(dmix);
+ if (ret < 0) {
+ SNDERR("unable to create server");
+ goto _err;
+ }
+ }
+
+ dmix->shmptr->type = spcm->type;
+ } else {
+ if (dmix->shmptr->use_server) {
+ /* up semaphore to avoid deadlock */
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ ret = snd_pcm_direct_client_connect(dmix);
+ if (ret < 0) {
+ SNDERR("unable to connect client");
+ goto _err_nosem;
+ }
+
+ snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
+ ret = snd_pcm_direct_open_secondary_client(&spcm, dmix, "dmix_client");
+ if (ret < 0)
+ goto _err;
+ } else {
+
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK |
+ SND_PCM_APPEND,
+ NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dmix plugin can be only connected to hw plugin");
+ ret = -EINVAL;
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+ }
+
+ dmix->spcm = spcm;
+ }
+
+ ret = shm_sum_create_or_connect(dmix);
+ if (ret < 0) {
+ SNDERR("unable to initialize sum ring buffer");
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_poll_fd(dmix);
+ if (ret < 0) {
+ SNDERR("unable to initialize poll_fd");
+ goto _err;
+ }
+
+ mix_select_callbacks(dmix);
+
+ pcm->poll_fd = dmix->poll_fd;
+ pcm->poll_events = POLLIN; /* it's different than other plugins */
+
+ pcm->mmap_rw = 1;
+ snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
+
+ if (dmix->channels == UINT_MAX)
+ dmix->channels = dmix->shmptr->s.channels;
+
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+
+ *pcmp = pcm;
+ return 0;
+
+ _err:
+ if (dmix->timer)
+ snd_timer_close(dmix->timer);
+ if (dmix->server)
+ snd_pcm_direct_server_discard(dmix);
+ if (dmix->client)
+ snd_pcm_direct_client_discard(dmix);
+ if (spcm)
+ snd_pcm_close(spcm);
+ if (dmix->u.dmix.shmid_sum >= 0)
+ shm_sum_discard(dmix);
+ if (dmix->shmid >= 0)
+ snd_pcm_direct_shm_discard(dmix);
+ if (snd_pcm_direct_semaphore_discard(dmix) < 0)
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
+ _err_nosem:
+ if (dmix) {
+ free(dmix->bindings);
+ free(dmix);
+ }
+ if (pcm)
+ snd_pcm_free(pcm);
+ return ret;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_dmix Plugin: dmix
+
+This plugin provides direct mixing of multiple streams. The resolution
+for 32-bit mixing is only 24-bit. The low significant byte is filled with
+zeros. The extra 8 bits are used for the saturation.
+
+\code
+pcm.name {
+ type dmix # Direct mix
+ ipc_key INT # unique IPC key
+ ipc_key_add_uid BOOL # add current uid to unique IPC key
+ ipc_perm INT # IPC permissions (octal, default 0600)
+ slave STR
+ # or
+ slave { # Slave definition
+ pcm STR # slave PCM name
+ # or
+ pcm { } # slave PCM definition
+ format STR # format definition
+ rate INT # rate definition
+ channels INT
+ period_time INT # in usec
+ # or
+ period_size INT # in bytes
+ buffer_time INT # in usec
+ # or
+ buffer_size INT # in bytes
+ periods INT # when buffer_size or buffer_time is not specified
+ }
+ bindings { # note: this is client independent!!!
+ N INT # maps slave channel to client channel N
+ }
+ slowptr BOOL # slow but more precise pointer updates
+}
+\endcode
+
+<code>ipc_key</code> specfies the unique IPC key in integer.
+This number must be unique for each different dmix definition,
+since the shared memory is created with this key number.
+When <code>ipc_key_add_uid</code> is set true, the uid value is
+added to the value set in <code>ipc_key</code>. This will
+avoid the confliction of the same IPC key with different users
+concurrently.
+
+Note that the dmix plugin itself supports only a single configuration.
+That is, it supports only the fixed rate (default 48000), format
+(\c S16), channels (2), and period_time (125000).
+For using other configuration, you have to set the value explicitly
+in the slave PCM definition. The rate, format and channels can be
+covered by an additional \ref pcm_plugins_dmix "plug plugin",
+but there is only one base configuration, anyway.
+
+An example configuration for setting 44100 Hz, \c S32_LE format
+as the slave PCM of "hw:0" is like below:
+\code
+pcm.dmix_44 {
+ type dmix
+ ipc_key 321456 # any unique value
+ ipc_key_add_uid true
+ slave {
+ pcm "hw:0"
+ format S32_LE
+ rate 44100
+ }
+}
+\endcode
+You can hear 48000 Hz samples still using this dmix pcm via plug plugin
+like:
+\code
+% aplay -Dplug:dmix_44 foo_48k.wav
+\endcode
+
+For using the dmix plugin for OSS emulation device, you have to set
+the period and the buffer sizes in power of two. For example,
+\code
+pcm.dmixoss {
+ type dmix
+ ipc_key 321456 # any unique value
+ ipc_key_add_uid true
+ slave {
+ pcm "hw:0"
+ period_time 0
+ period_size 1024 # must be power of 2
+ buffer_size 8192 # ditto
+ }
+}
+\endcode
+<code>period_time 0</code> must be set, too, for resetting the
+default value. In the case of soundcards with multi-channel IO,
+adding the bindings would help
+\code
+pcm.dmixoss {
+ ...
+ bindings {
+ 0 0 # map from 0 to 0
+ 1 1 # map from 1 to 1
+ }
+}
+\endcode
+so that only the first two channels are used by dmix.
+Also, note that ICE1712 have the limited buffer size, 5513 frames
+(corresponding to 640 kB). In this case, reduce the buffer_size
+to 4096.
+
+\subsection pcm_plugins_dmix_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_dmix_open()
+ <LI>_snd_pcm_dmix_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new dmix PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with dmix PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_t *sconf;
+ struct slave_params params;
+ struct snd_pcm_direct_open_conf dopen;
+ int bsize, psize;
+ int err;
+
+ err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen);
+ if (err < 0)
+ return err;
+
+ /* the default settings, it might be invalid for some hardware */
+ params.format = SND_PCM_FORMAT_S16;
+ params.rate = 48000;
+ params.channels = 2;
+ params.period_time = -1;
+ params.buffer_time = -1;
+ bsize = psize = -1;
+ params.periods = 3;
+
+ err = snd_pcm_slave_conf(root, dopen.slave, &sconf, 8,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, &params.format,
+ SND_PCM_HW_PARAM_RATE, 0, &params.rate,
+ SND_PCM_HW_PARAM_CHANNELS, 0, &params.channels,
+ SND_PCM_HW_PARAM_PERIOD_TIME, 0, &params.period_time,
+ SND_PCM_HW_PARAM_BUFFER_TIME, 0, &params.buffer_time,
+ SND_PCM_HW_PARAM_PERIOD_SIZE, 0, &psize,
+ SND_PCM_HW_PARAM_BUFFER_SIZE, 0, &bsize,
+ SND_PCM_HW_PARAM_PERIODS, 0, &params.periods);
+ if (err < 0)
+ return err;
+
+ /* set a reasonable default */
+ if (psize == -1 && params.period_time == -1)
+ params.period_time = 125000; /* 0.125 seconds */
+
+ if (params.format == -2)
+ params.format = SND_PCM_FORMAT_UNKNOWN;
+ else if (!(dmix_supported_format & (1ULL << params.format))) {
+ /* sorry, limited features */
+ SNDERR("Unsupported format");
+ snd_config_delete(sconf);
+ return -EINVAL;
+ }
+
+ params.period_size = psize;
+ params.buffer_size = bsize;
+
+ err = snd_pcm_dmix_open(pcmp, name, &dopen, &params,
+ root, sconf, stream, mode);
+ snd_config_delete(sconf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_dmix_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_dmix_generic.c b/alsa-lib/src/pcm/pcm_dmix_generic.c
new file mode 100644
index 0000000..a1086c9
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix_generic.c
@@ -0,0 +1,535 @@
+#if 0
+//#if defined(__i386__) || defined(__x86_64__)
+#define LOCK_PREFIX "lock ; "
+#define ARCH_ADD(p,a) \
+ __asm__ __volatile__(LOCK_PREFIX "addl %1,%0" \
+ :"=m" (*p) \
+ :"ir" (a), "m" (*p))
+struct __xchg_dummy { unsigned long a[100]; };
+#define __xg(x) ((struct __xchg_dummy *)(x))
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+ unsigned long new, int size)
+{
+ unsigned long prev;
+ switch (size) {
+ case 1:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 2:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ case 4:
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+ : "=a"(prev)
+ : "q"(new), "m"(*__xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+ }
+ return old;
+}
+
+#define ARCH_CMPXCHG(ptr,o,n)\
+ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
+ (unsigned long)(n),sizeof(*(ptr))))
+#define IS_CONCURRENT 1 /* check race */
+#endif
+
+#ifndef ARCH_ADD
+#define ARCH_ADD(p,a) (*(p) += (a))
+#define ARCH_CMPXCHG(p,a,b) (*(p)) /* fake */
+#define NO_CONCURRENT_ACCESS /* use semaphore to avoid race */
+#define IS_CONCURRENT 0 /* no race check */
+#endif
+
+#if IS_CONCURRENT
+static void mix_areas_16(unsigned int size,
+ volatile signed short *dst, signed short *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ register signed int sample, old_sample;
+
+ for (;;) {
+ sample = *src;
+ old_sample = *sum;
+ if (ARCH_CMPXCHG(dst, 0, 1) == 0)
+ sample -= old_sample;
+ ARCH_ADD(sum, sample);
+ do {
+ old_sample = *sum;
+ if (old_sample > 0x7fff)
+ sample = 0x7fff;
+ else if (old_sample < -0x8000)
+ sample = -0x8000;
+ else
+ sample = old_sample;
+ *dst = sample;
+ } while (IS_CONCURRENT && *sum != old_sample);
+ if (!--size)
+ return;
+ src = (signed short *) ((char *)src + src_step);
+ dst = (signed short *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void mix_areas_32(unsigned int size,
+ volatile signed int *dst, signed int *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ register signed int sample, old_sample;
+
+ for (;;) {
+ sample = *src >> 8;
+ old_sample = *sum;
+ if (ARCH_CMPXCHG(dst, 0, 1) == 0)
+ sample -= old_sample;
+ ARCH_ADD(sum, sample);
+ do {
+ old_sample = *sum;
+ if (old_sample > 0x7fffff)
+ sample = 0x7fffffff;
+ else if (old_sample < -0x800000)
+ sample = -0x80000000;
+ else
+ sample = old_sample * 256;
+ *dst = sample;
+ } while (IS_CONCURRENT && *sum != old_sample);
+ if (!--size)
+ return;
+ src = (signed int *) ((char *)src + src_step);
+ dst = (signed int *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void mix_select_callbacks(snd_pcm_direct_t *dmix)
+{
+ dmix->u.dmix.mix_areas_16 = mix_areas_16;
+ dmix->u.dmix.mix_areas_32 = mix_areas_32;
+}
+
+#else
+
+/* non-concurrent version, supporting both endians */
+#define generic_dmix_supported_format \
+ ((1ULL << SND_PCM_FORMAT_S16_LE) | (1ULL << SND_PCM_FORMAT_S32_LE) |\
+ (1ULL << SND_PCM_FORMAT_S16_BE) | (1ULL << SND_PCM_FORMAT_S32_BE) |\
+ (1ULL << SND_PCM_FORMAT_S24_3LE) | \
+ (1ULL << SND_PCM_FORMAT_U8))
+
+#include <byteswap.h>
+
+static void generic_mix_areas_16_native(unsigned int size,
+ volatile signed short *dst,
+ signed short *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = *src;
+ if (! *dst) {
+ *sum = sample;
+ *dst = *src;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7fff)
+ sample = 0x7fff;
+ else if (sample < -0x8000)
+ sample = -0x8000;
+ *dst = sample;
+ }
+ if (!--size)
+ return;
+ src = (signed short *) ((char *)src + src_step);
+ dst = (signed short *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_16_native(unsigned int size,
+ volatile signed short *dst,
+ signed short *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = *src;
+ if (! *dst) {
+ *sum = -sample;
+ *dst = -sample;
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7fff)
+ sample = 0x7fff;
+ else if (sample < -0x8000)
+ sample = -0x8000;
+ *dst = sample;
+ }
+ if (!--size)
+ return;
+ src = (signed short *) ((char *)src + src_step);
+ dst = (signed short *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_mix_areas_32_native(unsigned int size,
+ volatile signed int *dst,
+ signed int *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = *src >> 8;
+ if (! *dst) {
+ *sum = sample;
+ *dst = *src;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffffff;
+ else if (sample < -0x800000)
+ sample = -0x80000000;
+ else
+ sample *= 256;
+ *dst = sample;
+ }
+ if (!--size)
+ return;
+ src = (signed int *) ((char *)src + src_step);
+ dst = (signed int *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_32_native(unsigned int size,
+ volatile signed int *dst,
+ signed int *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = *src >> 8;
+ if (! *dst) {
+ *sum = -sample;
+ *dst = -*src;
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffffff;
+ else if (sample < -0x800000)
+ sample = -0x80000000;
+ else
+ sample *= 256;
+ *dst = sample;
+ }
+ if (!--size)
+ return;
+ src = (signed int *) ((char *)src + src_step);
+ dst = (signed int *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_mix_areas_16_swap(unsigned int size,
+ volatile signed short *dst,
+ signed short *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = (signed short) bswap_16(*src);
+ if (! *dst) {
+ *sum = sample;
+ *dst = *src;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7fff)
+ sample = 0x7fff;
+ else if (sample < -0x8000)
+ sample = -0x8000;
+ *dst = (signed short) bswap_16((signed short) sample);
+ }
+ if (!--size)
+ return;
+ src = (signed short *) ((char *)src + src_step);
+ dst = (signed short *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_16_swap(unsigned int size,
+ volatile signed short *dst,
+ signed short *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = (signed short) bswap_16(*src);
+ if (! *dst) {
+ *sum = -sample;
+ *dst = (signed short) bswap_16((signed short) -sample);
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7fff)
+ sample = 0x7fff;
+ else if (sample < -0x8000)
+ sample = -0x8000;
+ *dst = (signed short) bswap_16((signed short) sample);
+ }
+ if (!--size)
+ return;
+ src = (signed short *) ((char *)src + src_step);
+ dst = (signed short *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_mix_areas_32_swap(unsigned int size,
+ volatile signed int *dst,
+ signed int *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = bswap_32(*src) >> 8;
+ if (! *dst) {
+ *sum = sample;
+ *dst = *src;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffffff;
+ else if (sample < -0x800000)
+ sample = -0x80000000;
+ else
+ sample *= 256;
+ *dst = bswap_32(sample);
+ }
+ if (!--size)
+ return;
+ src = (signed int *) ((char *)src + src_step);
+ dst = (signed int *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_32_swap(unsigned int size,
+ volatile signed int *dst,
+ signed int *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = bswap_32(*src) >> 8;
+ if (! *dst) {
+ *sum = -sample;
+ *dst = bswap_32(-sample);
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffffff;
+ else if (sample < -0x800000)
+ sample = -0x80000000;
+ else
+ sample *= 256;
+ *dst = bswap_32(sample);
+ }
+ if (!--size)
+ return;
+ src = (signed int *) ((char *)src + src_step);
+ dst = (signed int *) ((char *)dst + dst_step);
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+/* always little endian */
+static void generic_mix_areas_24(unsigned int size,
+ volatile unsigned char *dst,
+ unsigned char *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = src[0] | (src[1] << 8) | (((signed char *)src)[2] << 16);
+ if (!(dst[0] | dst[1] | dst[2])) {
+ *sum = sample;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffff;
+ else if (sample < -0x800000)
+ sample = -0x800000;
+ }
+ dst[0] = sample;
+ dst[1] = sample >> 8;
+ dst[2] = sample >> 16;
+ if (!--size)
+ return;
+ dst += dst_step;
+ src += src_step;
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_24(unsigned int size,
+ volatile unsigned char *dst,
+ unsigned char *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ register signed int sample;
+
+ for (;;) {
+ sample = src[0] | (src[1] << 8) | (((signed char *)src)[2] << 16);
+ if (!(dst[0] | dst[1] | dst[2])) {
+ sample = -sample;
+ *sum = sample;
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7fffff)
+ sample = 0x7fffff;
+ else if (sample < -0x800000)
+ sample = -0x800000;
+ }
+ dst[0] = sample;
+ dst[1] = sample >> 8;
+ dst[2] = sample >> 16;
+ if (!--size)
+ return;
+ dst += dst_step;
+ src += src_step;
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_mix_areas_u8(unsigned int size,
+ volatile unsigned char *dst,
+ unsigned char *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ for (;;) {
+ register int sample = *src - 0x80;
+ if (*dst == 0x80) {
+ *sum = sample;
+ } else {
+ sample += *sum;
+ *sum = sample;
+ if (sample > 0x7f)
+ sample = 0x7f;
+ else if (sample < -0x80)
+ sample = -0x80;
+ }
+ *dst = sample + 0x80;
+ if (!--size)
+ return;
+ dst += dst_step;
+ src += src_step;
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+static void generic_remix_areas_u8(unsigned int size,
+ volatile unsigned char *dst,
+ unsigned char *src,
+ volatile signed int *sum,
+ size_t dst_step,
+ size_t src_step,
+ size_t sum_step)
+{
+ for (;;) {
+ register int sample = *src - 0x80;
+ if (*dst == 0x80) {
+ sample = -sample;
+ *sum = sample;
+ } else {
+ *sum = sample = *sum - sample;
+ if (sample > 0x7f)
+ sample = 0x7f;
+ else if (sample < -0x80)
+ sample = -0x80;
+ }
+ *dst = sample + 0x80;
+ if (!--size)
+ return;
+ dst += dst_step;
+ src += src_step;
+ sum = (signed int *) ((char *)sum + sum_step);
+ }
+}
+
+
+static void generic_mix_select_callbacks(snd_pcm_direct_t *dmix)
+{
+ if (snd_pcm_format_cpu_endian(dmix->shmptr->s.format)) {
+ dmix->u.dmix.mix_areas_16 = generic_mix_areas_16_native;
+ dmix->u.dmix.mix_areas_32 = generic_mix_areas_32_native;
+ dmix->u.dmix.remix_areas_16 = generic_remix_areas_16_native;
+ dmix->u.dmix.remix_areas_32 = generic_remix_areas_32_native;
+ } else {
+ dmix->u.dmix.mix_areas_16 = generic_mix_areas_16_swap;
+ dmix->u.dmix.mix_areas_32 = generic_mix_areas_32_swap;
+ dmix->u.dmix.remix_areas_16 = generic_remix_areas_16_swap;
+ dmix->u.dmix.remix_areas_32 = generic_remix_areas_32_swap;
+ }
+ dmix->u.dmix.mix_areas_24 = generic_mix_areas_24;
+ dmix->u.dmix.mix_areas_u8 = generic_mix_areas_u8;
+ dmix->u.dmix.remix_areas_24 = generic_remix_areas_24;
+ dmix->u.dmix.remix_areas_u8 = generic_remix_areas_u8;
+}
+
+#endif
diff --git a/alsa-lib/src/pcm/pcm_dmix_i386.c b/alsa-lib/src/pcm/pcm_dmix_i386.c
new file mode 100644
index 0000000..68c4755
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix_i386.c
@@ -0,0 +1,132 @@
+/*
+ * optimized mixing code for i386
+ */
+
+#define MIX_AREAS_16 mix_areas_16
+#define MIX_AREAS_16_MMX mix_areas_16_mmx
+#define MIX_AREAS_32 mix_areas_32
+#define MIX_AREAS_24 mix_areas_24
+#define MIX_AREAS_24_CMOV mix_areas_24_cmov
+#define LOCK_PREFIX ""
+#define XADD "addl"
+#define XSUB "subl"
+#include "pcm_dmix_i386.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_16_MMX
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef MIX_AREAS_24_CMOV
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 remix_areas_16
+#define MIX_AREAS_16_MMX remix_areas_16_mmx
+#define MIX_AREAS_32 remix_areas_32
+#define MIX_AREAS_24 remix_areas_24
+#define MIX_AREAS_24_CMOV remix_areas_24_cmov
+#define LOCK_PREFIX ""
+#define XADD "subl"
+#define XSUB "addl"
+#include "pcm_dmix_i386.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_16_MMX
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef MIX_AREAS_24_CMOV
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 mix_areas_16_smp
+#define MIX_AREAS_16_MMX mix_areas_16_smp_mmx
+#define MIX_AREAS_32 mix_areas_32_smp
+#define MIX_AREAS_24 mix_areas_24_smp
+#define MIX_AREAS_24_CMOV mix_areas_24_smp_cmov
+#define LOCK_PREFIX "lock ; "
+#define XADD "addl"
+#define XSUB "subl"
+#include "pcm_dmix_i386.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_16_MMX
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef MIX_AREAS_24_CMOV
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 remix_areas_16_smp
+#define MIX_AREAS_16_MMX remix_areas_16_smp_mmx
+#define MIX_AREAS_32 remix_areas_32_smp
+#define MIX_AREAS_24 remix_areas_24_smp
+#define MIX_AREAS_24_CMOV remix_areas_24_smp_cmov
+#define LOCK_PREFIX "lock ; "
+#define XADD "subl"
+#define XSUB "addl"
+#include "pcm_dmix_i386.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_16_MMX
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef MIX_AREAS_24_CMOV
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define i386_dmix_supported_format \
+ ((1ULL << SND_PCM_FORMAT_S16_LE) |\
+ (1ULL << SND_PCM_FORMAT_S32_LE) |\
+ (1ULL << SND_PCM_FORMAT_S24_3LE))
+
+#define dmix_supported_format \
+ (i386_dmix_supported_format | generic_dmix_supported_format)
+
+static void mix_select_callbacks(snd_pcm_direct_t *dmix)
+{
+ static int smp = 0, mmx = 0, cmov = 0;
+
+ if (!((1ULL<< dmix->shmptr->s.format) & i386_dmix_supported_format)) {
+ generic_mix_select_callbacks(dmix);
+ return;
+ }
+
+ if (!smp) {
+ FILE *in;
+ char line[255];
+
+ /* try to determine the capabilities of the CPU */
+ in = fopen("/proc/cpuinfo", "r");
+ if (in) {
+ while (!feof(in)) {
+ fgets(line, sizeof(line), in);
+ if (!strncmp(line, "processor", 9))
+ smp++;
+ else if (!strncmp(line, "flags", 5)) {
+ if (strstr(line, " mmx"))
+ mmx = 1;
+ if (strstr(line, " cmov"))
+ cmov = 1;
+ }
+ }
+ fclose(in);
+ }
+ }
+
+ if (mmx) {
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx;
+ dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp_mmx : remix_areas_16_mmx;
+ } else {
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp : mix_areas_16;
+ dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp : remix_areas_16;
+ }
+ dmix->u.dmix.mix_areas_32 = smp > 1 ? mix_areas_32_smp : mix_areas_32;
+ dmix->u.dmix.remix_areas_32 = smp > 1 ? remix_areas_32_smp : remix_areas_32;
+ if (cmov) {
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp_cmov : mix_areas_24_cmov;
+ dmix->u.dmix.remix_areas_24 = smp > 1 ? remix_areas_24_smp_cmov : remix_areas_24_cmov;
+ } else {
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp: mix_areas_24;
+ dmix->u.dmix.remix_areas_24 = smp > 1 ? remix_areas_24_smp: remix_areas_24;
+ }
+}
diff --git a/alsa-lib/src/pcm/pcm_dmix_i386.h b/alsa-lib/src/pcm/pcm_dmix_i386.h
new file mode 100644
index 0000000..9ea155d
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix_i386.h
@@ -0,0 +1,559 @@
+/**
+ * \file pcm/pcm_dmix_i386.h
+ * \ingroup PCM_Plugins
+ * \brief PCM Direct Stream Mixing (dmix) Plugin Interface - I386 assembler code
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2003
+ */
+/*
+ * PCM - Direct Stream Mixing
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*
+ * for plain i386
+ */
+static void MIX_AREAS_16(unsigned int size,
+ volatile signed short *dst, signed short *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned int old_ebx;
+
+ /*
+ * ESI - src
+ * EDI - dst
+ * EBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovl %1, %%edi\n"
+ "\tmovl %2, %%esi\n"
+ "\tmovl %3, %%ebx\n"
+ "\tcmpl $0, %0\n"
+ "\tjnz 2f\n"
+ "\tjmp 7f\n"
+
+
+ /*
+ * for (;;)
+ */
+ "\t.p2align 4,,15\n"
+ "1:"
+ "\tadd %4, %%edi\n"
+ "\tadd %5, %%esi\n"
+ "\tadd %6, %%ebx\n"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (cmpxchg(*dst, 0, 1) == 0)
+ * sample -= sum_sample;
+ * xadd(*sum, sample);
+ */
+
+ "2:"
+ "\tmovw $0, %%ax\n"
+ "\tmovw $1, %%cx\n"
+ "\tmovl (%%ebx), %%edx\n"
+ "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n"
+ "\tmovswl (%%esi), %%ecx\n"
+ "\tjnz 3f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "3:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%ebx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(v);
+ * *dst = sample;
+ * } while (v != *sum);
+ */
+
+ "4:"
+ "\tmovl (%%ebx), %%ecx\n"
+ "\tcmpl $0x7fff,%%ecx\n"
+ "\tjg 5f\n"
+ "\tcmpl $-0x8000,%%ecx\n"
+ "\tjl 6f\n"
+ "\tmovw %%cx, (%%edi)\n"
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 4b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+ "\tjmp 7f\n"
+
+ /*
+ * sample > 0x7fff
+ */
+
+ "\t.p2align 4,,15\n"
+
+ "5:"
+ "\tmovw $0x7fff, (%%edi)\n"
+ "\tcmpl %%ecx,(%%ebx)\n"
+ "\tjnz 4b\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+ "\tjmp 7f\n"
+
+ /*
+ * sample < -0x8000
+ */
+
+ "\t.p2align 4,,15\n"
+
+ "6:"
+ "\tmovw $-0x8000, (%%edi)\n"
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 4b\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+
+ "7:"
+ "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_ebx)
+ : "esi", "edi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * MMX optimized
+ */
+static void MIX_AREAS_16_MMX(unsigned int size,
+ volatile signed short *dst, signed short *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned int old_ebx;
+
+ /*
+ * ESI - src
+ * EDI - dst
+ * EBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovl %1, %%edi\n"
+ "\tmovl %2, %%esi\n"
+ "\tmovl %3, %%ebx\n"
+ "\tcmpl $0, %0\n"
+ "\tjnz 2f\n"
+ "\tjmp 5f\n"
+
+ "\t.p2align 4,,15\n"
+ "1:"
+ "\tadd %4, %%edi\n"
+ "\tadd %5, %%esi\n"
+ "\tadd %6, %%ebx\n"
+
+ "2:"
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (cmpxchg(*dst, 0, 1) == 0)
+ * sample -= sum_sample;
+ * xadd(*sum, sample);
+ */
+ "\tmovw $0, %%ax\n"
+ "\tmovw $1, %%cx\n"
+ "\tmovl (%%ebx), %%edx\n"
+ "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n"
+ "\tmovswl (%%esi), %%ecx\n"
+ "\tjnz 3f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "3:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%ebx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(v);
+ * *dst = sample;
+ * } while (v != *sum);
+ */
+
+ "4:"
+ "\tmovl (%%ebx), %%ecx\n"
+ "\tmovd %%ecx, %%mm0\n"
+ "\tpackssdw %%mm1, %%mm0\n"
+ "\tmovd %%mm0, %%eax\n"
+ "\tmovw %%ax, (%%edi)\n"
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 4b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+ "\temms\n"
+ "5:"
+ "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_ebx)
+ : "esi", "edi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * for plain i386, 32-bit version (24-bit resolution)
+ */
+static void MIX_AREAS_32(unsigned int size,
+ volatile signed int *dst, signed int *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned int old_ebx;
+
+ /*
+ * ESI - src
+ * EDI - dst
+ * EBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovl %1, %%edi\n"
+ "\tmovl %2, %%esi\n"
+ "\tmovl %3, %%ebx\n"
+ "\tcmpl $0, %0\n"
+ "\tjnz 1f\n"
+ "\tjmp 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (cmpxchg(*dst, 0, 1) == 0)
+ * sample -= sum_sample;
+ * xadd(*sum, sample);
+ */
+ "\tmovl $0, %%eax\n"
+ "\tmovl $1, %%ecx\n"
+ "\tmovl (%%ebx), %%edx\n"
+ "\t" LOCK_PREFIX "cmpxchgl %%ecx, (%%edi)\n"
+ "\tjnz 2f\n"
+ "\tmovl (%%esi), %%ecx\n"
+ /* sample >>= 8 */
+ "\tsarl $8, %%ecx\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "\tjmp 21f\n"
+ "2:"
+ "\tmovl (%%esi), %%ecx\n"
+ /* sample >>= 8 */
+ "\tsarl $8, %%ecx\n"
+ "21:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%ebx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(v);
+ * *dst = sample;
+ * } while (v != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%ebx), %%ecx\n"
+ /*
+ * if (sample > 0x7fff00)
+ */
+ "\tmovl $0x7fffff, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjg 4f\n"
+ /*
+ * if (sample < -0x800000)
+ */
+ "\tmovl $-0x800000, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjl 4f\n"
+ "\tmovl %%ecx, %%eax\n"
+ "4:"
+ /*
+ * sample <<= 8;
+ */
+ "\tsall $8, %%eax\n"
+ "\tmovl %%eax, (%%edi)\n"
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tdecl %0\n"
+ "\tjz 6f\n"
+ "\tadd %4, %%edi\n"
+ "\tadd %5, %%esi\n"
+ "\tadd %6, %%ebx\n"
+ "\tjmp 1b\n"
+
+ "6:"
+ "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_ebx)
+ : "esi", "edi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * 24-bit version for plain i386
+ */
+static void MIX_AREAS_24(unsigned int size,
+ volatile unsigned char *dst, unsigned char *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned int old_ebx;
+
+ /*
+ * ESI - src
+ * EDI - dst
+ * EBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovl %1, %%edi\n"
+ "\tmovl %2, %%esi\n"
+ "\tmovl %3, %%ebx\n"
+ "\tcmpl $0, %0\n"
+ "\tjnz 1f\n"
+ "\tjmp 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (test_and_set_bit(0, dst) == 0)
+ * sample -= sum_sample;
+ * *sum += sample;
+ */
+ "\tmovsbl 2(%%esi), %%eax\n"
+ "\tmovzwl (%%esi), %%ecx\n"
+ "\tmovl (%%ebx), %%edx\n"
+ "\tsall $16, %%eax\n"
+ "\t" LOCK_PREFIX "btsw $0, (%%edi)\n"
+ "\tleal (%%ecx,%%eax,1), %%ecx\n"
+ "\tjc 2f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "2:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%ebx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(sample);
+ * *dst = sample | 1;
+ * } while (old_sample != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%ebx), %%ecx\n"
+ /*
+ * if (sample > 0x7fffff)
+ */
+ "\tmovl $0x7fffff, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjg 4f\n"
+ /*
+ * if (sample < -0x7fffff)
+ */
+ "\tmovl $-0x7fffff, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjl 4f\n"
+ "\tmovl %%ecx, %%eax\n"
+ "\torl $1, %%eax\n"
+ "4:"
+ "\tmovw %%ax, (%%edi)\n"
+ "\tshrl $16, %%eax\n"
+ "\tmovb %%al, 2(%%edi)\n"
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tdecl %0\n"
+ "\tjz 6f\n"
+ "\tadd %4, %%edi\n"
+ "\tadd %5, %%esi\n"
+ "\tadd %6, %%ebx\n"
+ "\tjmp 1b\n"
+
+ "6:"
+ "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_ebx)
+ : "esi", "edi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * 24-bit version for Pentium Pro/II
+ */
+static void MIX_AREAS_24_CMOV(unsigned int size,
+ volatile unsigned char *dst, unsigned char *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned int old_ebx;
+
+ /*
+ * ESI - src
+ * EDI - dst
+ * EBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovl %1, %%edi\n"
+ "\tmovl %2, %%esi\n"
+ "\tmovl %3, %%ebx\n"
+ "\tcmpl $0, %0\n"
+ "\tjz 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (test_and_set_bit(0, dst) == 0)
+ * sample -= sum_sample;
+ * *sum += sample;
+ */
+ "\tmovsbl 2(%%esi), %%eax\n"
+ "\tmovzwl (%%esi), %%ecx\n"
+ "\tmovl (%%ebx), %%edx\n"
+ "\tsall $16, %%eax\n"
+ "\t" LOCK_PREFIX "btsw $0, (%%edi)\n"
+ "\tleal (%%ecx,%%eax,1), %%ecx\n"
+ "\tjc 2f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "2:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%ebx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(sample);
+ * *dst = sample | 1;
+ * } while (old_sample != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%ebx), %%ecx\n"
+
+ "\tmovl $0x7fffff, %%eax\n"
+ "\tmovl $-0x7fffff, %%edx\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tcmovng %%ecx, %%eax\n"
+ "\tcmpl %%edx, %%ecx\n"
+ "\tcmovl %%edx, %%eax\n"
+
+ "\torl $1, %%eax\n"
+ "\tmovw %%ax, (%%edi)\n"
+ "\tshrl $16, %%eax\n"
+ "\tmovb %%al, 2(%%edi)\n"
+
+ "\tcmpl %%ecx, (%%ebx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tadd %4, %%edi\n"
+ "\tadd %5, %%esi\n"
+ "\tadd %6, %%ebx\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+
+ "6:"
+ "\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_ebx)
+ : "esi", "edi", "edx", "ecx", "eax"
+ );
+}
diff --git a/alsa-lib/src/pcm/pcm_dmix_x86_64.c b/alsa-lib/src/pcm/pcm_dmix_x86_64.c
new file mode 100644
index 0000000..831046d
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix_x86_64.c
@@ -0,0 +1,100 @@
+/*
+ * optimized mixing code for x86-64
+ */
+
+#define MIX_AREAS_16 mix_areas_16
+#define MIX_AREAS_32 mix_areas_32
+#define MIX_AREAS_24 mix_areas_24
+#define LOCK_PREFIX ""
+#define XADD "addl"
+#define XSUB "subl"
+#include "pcm_dmix_x86_64.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 remix_areas_16
+#define MIX_AREAS_32 remix_areas_32
+#define MIX_AREAS_24 remix_areas_24
+#define LOCK_PREFIX ""
+#define XADD "subl"
+#define XSUB "addl"
+#include "pcm_dmix_x86_64.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 mix_areas_16_smp
+#define MIX_AREAS_32 mix_areas_32_smp
+#define MIX_AREAS_24 mix_areas_24_smp
+#define LOCK_PREFIX "lock ; "
+#define XADD "addl"
+#define XSUB "subl"
+#include "pcm_dmix_x86_64.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define MIX_AREAS_16 remix_areas_16_smp
+#define MIX_AREAS_32 remix_areas_32_smp
+#define MIX_AREAS_24 remix_areas_24_smp
+#define LOCK_PREFIX "lock ; "
+#define XADD "subl"
+#define XSUB "addl"
+#include "pcm_dmix_x86_64.h"
+#undef MIX_AREAS_16
+#undef MIX_AREAS_32
+#undef MIX_AREAS_24
+#undef LOCK_PREFIX
+#undef XADD
+#undef XSUB
+
+#define x86_64_dmix_supported_format \
+ ((1ULL << SND_PCM_FORMAT_S16_LE) |\
+ (1ULL << SND_PCM_FORMAT_S32_LE) |\
+ (1ULL << SND_PCM_FORMAT_S24_3LE))
+
+#define dmix_supported_format \
+ (x86_64_dmix_supported_format | generic_dmix_supported_format)
+
+static void mix_select_callbacks(snd_pcm_direct_t *dmix)
+{
+ static int smp = 0;
+
+ if (!((1ULL<< dmix->shmptr->s.format) & x86_64_dmix_supported_format)) {
+ generic_mix_select_callbacks(dmix);
+ return;
+ }
+
+ if (!smp) {
+ FILE *in;
+ char line[255];
+
+ /* try to determine, if we have SMP */
+ in = fopen("/proc/cpuinfo", "r");
+ if (in) {
+ while (!feof(in)) {
+ fgets(line, sizeof(line), in);
+ if (!strncmp(line, "processor", 9))
+ smp++;
+ }
+ fclose(in);
+ }
+ }
+ // printf("SMP: %i\n", smp);
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp : mix_areas_16;
+ dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp : remix_areas_16;
+ dmix->u.dmix.mix_areas_32 = smp > 1 ? mix_areas_32_smp : mix_areas_32;
+ dmix->u.dmix.remix_areas_32 = smp > 1 ? remix_areas_32_smp : remix_areas_32;
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp : mix_areas_24;
+ dmix->u.dmix.remix_areas_24 = smp > 1 ? remix_areas_24_smp : remix_areas_24;
+}
diff --git a/alsa-lib/src/pcm/pcm_dmix_x86_64.h b/alsa-lib/src/pcm/pcm_dmix_x86_64.h
new file mode 100644
index 0000000..b4d0a41
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dmix_x86_64.h
@@ -0,0 +1,341 @@
+/**
+ * \file pcm/pcm_dmix_x86_64.h
+ * \ingroup PCM_Plugins
+ * \brief PCM Direct Stream Mixing (dmix) Plugin Interface - X86-64 assembler code
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2003
+ */
+/*
+ * PCM - Direct Stream Mixing
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ * Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*
+ * MMX optimized
+ */
+static void MIX_AREAS_16(unsigned int size,
+ volatile signed short *dst, signed short *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned long long old_rbx;
+
+ /*
+ * RSI - src
+ * RDI - dst
+ * RBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovq %%rbx, %7\n"
+ /*
+ * initialization, load RSI, RDI, RBX registers
+ */
+ "\tmovq %1, %%rdi\n"
+ "\tmovq %2, %%rsi\n"
+ "\tmovq %3, %%rbx\n"
+
+ /*
+ * while (size-- > 0) {
+ */
+ "\tcmpl $0, %0\n"
+ "jz 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (cmpxchg(*dst, 0, 1) == 0)
+ * sample -= sum_sample;
+ * xadd(*sum, sample);
+ */
+ "\tmovw $0, %%ax\n"
+ "\tmovw $1, %%cx\n"
+ "\tmovl (%%rbx), %%edx\n"
+ "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%rdi)\n"
+ "\tmovswl (%%rsi), %%ecx\n"
+ "\tjnz 2f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "2:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%rbx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(v);
+ * *dst = sample;
+ * } while (v != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%rbx), %%ecx\n"
+ "\tmovd %%ecx, %%mm0\n"
+ "\tpackssdw %%mm1, %%mm0\n"
+ "\tmovd %%mm0, %%eax\n"
+ "\tmovw %%ax, (%%rdi)\n"
+ "\tcmpl %%ecx, (%%rbx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tadd %4, %%rdi\n"
+ "\tadd %5, %%rsi\n"
+ "\tadd %6, %%rbx\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+
+ "6:"
+
+ "\temms\n"
+ "\tmovq %7, %%rbx\n"
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_rbx)
+ : "rsi", "rdi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * 32-bit version (24-bit resolution)
+ */
+static void MIX_AREAS_32(unsigned int size,
+ volatile signed int *dst, signed int *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned long long old_rbx;
+
+ /*
+ * RSI - src
+ * RDI - dst
+ * RBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovq %%rbx, %7\n"
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovq %1, %%rdi\n"
+ "\tmovq %2, %%rsi\n"
+ "\tmovq %3, %%rbx\n"
+
+ /*
+ * while (size-- > 0) {
+ */
+ "\tcmpl $0, %0\n"
+ "jz 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (cmpxchg(*dst, 0, 1) == 0)
+ * sample -= sum_sample;
+ * xadd(*sum, sample);
+ */
+ "\tmovl $0, %%eax\n"
+ "\tmovl $1, %%ecx\n"
+ "\tmovl (%%rbx), %%edx\n"
+ "\t" LOCK_PREFIX "cmpxchgl %%ecx, (%%rdi)\n"
+ "\tjnz 2f\n"
+ "\tmovl (%%rsi), %%ecx\n"
+ /* sample >>= 8 */
+ "\tsarl $8, %%ecx\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "\tjmp 21f\n"
+ "2:"
+ "\tmovl (%%rsi), %%ecx\n"
+ /* sample >>= 8 */
+ "\tsarl $8, %%ecx\n"
+ "21:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%rbx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(v);
+ * *dst = sample;
+ * } while (v != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%rbx), %%ecx\n"
+ /*
+ * if (sample > 0x7fff00)
+ */
+ "\tmovl $0x7fffff, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjg 4f\n"
+ /*
+ * if (sample < -0x800000)
+ */
+ "\tmovl $-0x800000, %%eax\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tjl 4f\n"
+ "\tmovl %%ecx, %%eax\n"
+ "4:"
+ /*
+ * sample <<= 8;
+ */
+ "\tsall $8, %%eax\n"
+ "\tmovl %%eax, (%%rdi)\n"
+ "\tcmpl %%ecx, (%%rbx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tadd %4, %%rdi\n"
+ "\tadd %5, %%rsi\n"
+ "\tadd %6, %%rbx\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+
+ "6:"
+ "\tmovq %7, %%rbx\n"
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_rbx)
+ : "rsi", "rdi", "edx", "ecx", "eax"
+ );
+}
+
+/*
+ * 24-bit version
+ */
+static void MIX_AREAS_24(unsigned int size,
+ volatile unsigned char *dst, unsigned char *src,
+ volatile signed int *sum, size_t dst_step,
+ size_t src_step, size_t sum_step)
+{
+ unsigned long long old_rbx;
+
+ /*
+ * RSI - src
+ * RDI - dst
+ * RBX - sum
+ * ECX - old sample
+ * EAX - sample / temporary
+ * EDX - temporary
+ */
+ __asm__ __volatile__ (
+ "\n"
+
+ "\tmovq %%rbx, %7\n"
+ /*
+ * initialization, load ESI, EDI, EBX registers
+ */
+ "\tmovq %1, %%rdi\n"
+ "\tmovq %2, %%rsi\n"
+ "\tmovq %3, %%rbx\n"
+
+ /*
+ * while (size-- > 0) {
+ */
+ "\tcmpl $0, %0\n"
+ "jz 6f\n"
+
+ "\t.p2align 4,,15\n"
+
+ "1:"
+
+ /*
+ * sample = *src;
+ * sum_sample = *sum;
+ * if (test_and_set_bit(0, dst) == 0)
+ * sample -= sum_sample;
+ * *sum += sample;
+ */
+ "\tmovsbl 2(%%rsi), %%eax\n"
+ "\tmovswl (%%rsi), %%ecx\n"
+ "\tmovl (%%rbx), %%edx\n"
+ "\tsall $16, %%eax\n"
+ "\t" LOCK_PREFIX "btsw $0, (%%rdi)\n"
+ "\t.byte 0x67, 0x8d, 0x0c, 0x01\n"
+ "\tjc 2f\n"
+ "\t" XSUB " %%edx, %%ecx\n"
+ "2:"
+ "\t" LOCK_PREFIX XADD " %%ecx, (%%rbx)\n"
+
+ /*
+ * do {
+ * sample = old_sample = *sum;
+ * saturate(sample);
+ * *dst = sample | 1;
+ * } while (old_sample != *sum);
+ */
+
+ "3:"
+ "\tmovl (%%rbx), %%ecx\n"
+
+ "\tmovl $0x7fffff, %%eax\n"
+ "\tmovl $-0x7fffff, %%edx\n"
+ "\tcmpl %%eax, %%ecx\n"
+ "\tcmovng %%ecx, %%eax\n"
+ "\tcmpl %%edx, %%ecx\n"
+ "\tcmovl %%edx, %%eax\n"
+
+ "\torl $1, %%eax\n"
+ "\tmovw %%ax, (%%rdi)\n"
+ "\tshrl $16, %%eax\n"
+ "\tmovb %%al, 2(%%rdi)\n"
+
+ "\tcmpl %%ecx, (%%rbx)\n"
+ "\tjnz 3b\n"
+
+ /*
+ * while (size-- > 0)
+ */
+ "\tadd %4, %%rdi\n"
+ "\tadd %5, %%rsi\n"
+ "\tadd %6, %%rbx\n"
+ "\tdecl %0\n"
+ "\tjnz 1b\n"
+
+ "6:"
+ "\tmovq %7, %%rbx\n"
+
+ : /* no output regs */
+ : "m" (size), "m" (dst), "m" (src),
+ "m" (sum), "m" (dst_step), "m" (src_step),
+ "m" (sum_step), "m" (old_rbx)
+ : "rsi", "rdi", "edx", "ecx", "eax"
+ );
+}
diff --git a/alsa-lib/src/pcm/pcm_dshare.c b/alsa-lib/src/pcm/pcm_dshare.c
new file mode 100644
index 0000000..c91fa3b
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dshare.c
@@ -0,0 +1,939 @@
+/**
+ * \file pcm/pcm_dshare.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Direct Sharing of Channels Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2003
+ */
+/*
+ * PCM - Direct Sharing of Channels
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <grp.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/mman.h>
+#include "pcm_direct.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_dshare = "";
+#endif
+
+#ifndef DOC_HIDDEN
+/* start is pending - this state happens when rate plugin does a delayed commit */
+#define STATE_RUN_PENDING 1024
+#endif
+
+static void do_silence(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ const snd_pcm_channel_area_t *dst_areas;
+ unsigned int chn, dchn, channels;
+ snd_pcm_format_t format;
+
+ dst_areas = snd_pcm_mmap_areas(dshare->spcm);
+ channels = dshare->channels;
+ format = dshare->shmptr->s.format;
+ for (chn = 0; chn < channels; chn++) {
+ dchn = dshare->bindings ? dshare->bindings[chn] : chn;
+ snd_pcm_area_silence(&dst_areas[dchn], 0, dshare->shmptr->s.buffer_size, format);
+ }
+}
+
+static void share_areas(snd_pcm_direct_t *dshare,
+ const snd_pcm_channel_area_t *src_areas,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t src_ofs,
+ snd_pcm_uframes_t dst_ofs,
+ snd_pcm_uframes_t size)
+{
+ unsigned int chn, dchn, channels;
+ snd_pcm_format_t format;
+
+ channels = dshare->channels;
+ format = dshare->shmptr->s.format;
+ if (dshare->interleaved) {
+ unsigned int fbytes = snd_pcm_format_physical_width(format) / 8;
+ memcpy(((char *)dst_areas[0].addr) + (dst_ofs * channels * fbytes),
+ ((char *)src_areas[0].addr) + (src_ofs * channels * fbytes),
+ size * channels * fbytes);
+ } else {
+ for (chn = 0; chn < channels; chn++) {
+ dchn = dshare->bindings ? dshare->bindings[chn] : chn;
+ snd_pcm_area_copy(&dst_areas[dchn], dst_ofs, &src_areas[chn], src_ofs, size, format);
+
+ }
+ }
+}
+
+/*
+ * synchronize shm ring buffer with hardware
+ */
+static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
+ snd_pcm_uframes_t appl_ptr, size;
+ const snd_pcm_channel_area_t *src_areas, *dst_areas;
+
+ /* calculate the size to transfer */
+ size = dshare->appl_ptr - dshare->last_appl_ptr;
+ if (! size)
+ return;
+ slave_hw_ptr = dshare->slave_hw_ptr;
+ /* don't write on the last active period - this area may be cleared
+ * by the driver during write operation...
+ */
+ slave_hw_ptr -= slave_hw_ptr % dshare->slave_period_size;
+ slave_hw_ptr += dshare->slave_buffer_size;
+ if (dshare->slave_hw_ptr > dshare->slave_boundary)
+ slave_hw_ptr -= dshare->slave_boundary;
+ if (slave_hw_ptr < dshare->slave_appl_ptr)
+ slave_size = slave_hw_ptr + (dshare->slave_boundary - dshare->slave_appl_ptr);
+ else
+ slave_size = slave_hw_ptr - dshare->slave_appl_ptr;
+ if (slave_size < size)
+ size = slave_size;
+ if (! size)
+ return;
+
+ /* add sample areas here */
+ src_areas = snd_pcm_mmap_areas(pcm);
+ dst_areas = snd_pcm_mmap_areas(dshare->spcm);
+ appl_ptr = dshare->last_appl_ptr % pcm->buffer_size;
+ dshare->last_appl_ptr += size;
+ dshare->last_appl_ptr %= pcm->boundary;
+ slave_appl_ptr = dshare->slave_appl_ptr % dshare->slave_buffer_size;
+ dshare->slave_appl_ptr += size;
+ dshare->slave_appl_ptr %= dshare->slave_boundary;
+ for (;;) {
+ snd_pcm_uframes_t transfer = size;
+ if (appl_ptr + transfer > pcm->buffer_size)
+ transfer = pcm->buffer_size - appl_ptr;
+ if (slave_appl_ptr + transfer > dshare->slave_buffer_size)
+ transfer = dshare->slave_buffer_size - slave_appl_ptr;
+ share_areas(dshare, src_areas, dst_areas, appl_ptr, slave_appl_ptr, transfer);
+ size -= transfer;
+ if (! size)
+ break;
+ slave_appl_ptr += transfer;
+ slave_appl_ptr %= dshare->slave_buffer_size;
+ appl_ptr += transfer;
+ appl_ptr %= pcm->buffer_size;
+ }
+}
+
+/*
+ * synchronize hardware pointer (hw_ptr) with ours
+ */
+static int snd_pcm_dshare_sync_ptr(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
+ snd_pcm_sframes_t diff;
+
+ switch (snd_pcm_state(dshare->spcm)) {
+ case SND_PCM_STATE_DISCONNECTED:
+ dshare->state = SNDRV_PCM_STATE_DISCONNECTED;
+ return -ENODEV;
+ default:
+ break;
+ }
+ if (dshare->slowptr)
+ snd_pcm_hwsync(dshare->spcm);
+ old_slave_hw_ptr = dshare->slave_hw_ptr;
+ slave_hw_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ if (diff == 0) /* fast path */
+ return 0;
+ if (dshare->state != SND_PCM_STATE_RUNNING &&
+ dshare->state != SND_PCM_STATE_DRAINING)
+ /* not really started yet - don't update hw_ptr */
+ return 0;
+ if (diff < 0) {
+ slave_hw_ptr += dshare->slave_boundary;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ }
+ dshare->hw_ptr += diff;
+ dshare->hw_ptr %= pcm->boundary;
+ // printf("sync ptr diff = %li\n", diff);
+ if (pcm->stop_threshold >= pcm->boundary) /* don't care */
+ return 0;
+ avail = snd_pcm_mmap_playback_avail(pcm);
+ if (avail > dshare->avail_max)
+ dshare->avail_max = avail;
+ if (avail >= pcm->stop_threshold) {
+ snd_timer_stop(dshare->timer);
+ gettimestamp(&dshare->trigger_tstamp, pcm->monotonic);
+ if (dshare->state == SND_PCM_STATE_RUNNING) {
+ dshare->state = SND_PCM_STATE_XRUN;
+ return -EPIPE;
+ }
+ dshare->state = SND_PCM_STATE_SETUP;
+ /* clear queue to remove pending poll events */
+ snd_pcm_direct_clear_timer_queue(dshare);
+ }
+ return 0;
+}
+
+/*
+ * plugin implementation
+ */
+
+static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ switch (dshare->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ snd_pcm_dshare_sync_ptr(pcm);
+ break;
+ default:
+ break;
+ }
+ memset(status, 0, sizeof(*status));
+ status->state = snd_pcm_state(dshare->spcm);
+ status->trigger_tstamp = dshare->trigger_tstamp;
+ gettimestamp(&status->tstamp, pcm->monotonic);
+ status->avail = snd_pcm_mmap_playback_avail(pcm);
+ status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
+ dshare->avail_max = 0;
+ return 0;
+}
+
+static snd_pcm_state_t snd_pcm_dshare_state(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ switch (snd_pcm_state(dshare->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return SND_PCM_STATE_SUSPENDED;
+ case SND_PCM_STATE_DISCONNECTED:
+ return SND_PCM_STATE_DISCONNECTED;
+ default:
+ break;
+ }
+ if (dshare->state == STATE_RUN_PENDING)
+ return SNDRV_PCM_STATE_RUNNING;
+ return dshare->state;
+}
+
+static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ int err;
+
+ switch (dshare->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ err = snd_pcm_dshare_sync_ptr(pcm);
+ if (err < 0)
+ return err;
+ /* fallthru */
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ case STATE_RUN_PENDING:
+ *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dshare_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ switch(dshare->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ return snd_pcm_dshare_sync_ptr(pcm);
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dshare_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ snd_pcm_direct_check_interleave(dshare, pcm);
+ dshare->state = SND_PCM_STATE_PREPARED;
+ dshare->appl_ptr = dshare->last_appl_ptr = 0;
+ dshare->hw_ptr = 0;
+ return snd_pcm_direct_set_timer_params(dshare);
+}
+
+static int snd_pcm_dshare_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ dshare->hw_ptr %= pcm->period_size;
+ dshare->appl_ptr = dshare->last_appl_ptr = dshare->hw_ptr;
+ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr;
+ return 0;
+}
+
+static int snd_pcm_dshare_start_timer(snd_pcm_direct_t *dshare)
+{
+ int err;
+
+ snd_pcm_hwsync(dshare->spcm);
+ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr;
+ err = snd_timer_start(dshare->timer);
+ if (err < 0)
+ return err;
+ dshare->state = SND_PCM_STATE_RUNNING;
+ return 0;
+}
+
+static int snd_pcm_dshare_start(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_sframes_t avail;
+ int err;
+
+ if (dshare->state != SND_PCM_STATE_PREPARED)
+ return -EBADFD;
+ avail = snd_pcm_mmap_playback_hw_avail(pcm);
+ if (avail == 0)
+ dshare->state = STATE_RUN_PENDING;
+ else if (avail < 0)
+ return 0;
+ else {
+ if ((err = snd_pcm_dshare_start_timer(dshare)) < 0)
+ return err;
+ snd_pcm_dshare_sync_area(pcm);
+ }
+ gettimestamp(&dshare->trigger_tstamp, pcm->monotonic);
+ return 0;
+}
+
+static int snd_pcm_dshare_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ if (dshare->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ snd_pcm_direct_timer_stop(dshare);
+ do_silence(pcm);
+ dshare->state = SND_PCM_STATE_SETUP;
+ return 0;
+}
+
+static int snd_pcm_dshare_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_uframes_t stop_threshold;
+ int err;
+
+ if (dshare->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ if (pcm->mode & SND_PCM_NONBLOCK)
+ return -EAGAIN;
+ if (dshare->state == SND_PCM_STATE_PREPARED) {
+ if (snd_pcm_mmap_playback_hw_avail(pcm) > 0)
+ snd_pcm_dshare_start(pcm);
+ else {
+ snd_pcm_dshare_drop(pcm);
+ return 0;
+ }
+ }
+
+ if (dshare->state == SND_PCM_STATE_XRUN) {
+ snd_pcm_dshare_drop(pcm);
+ return 0;
+ }
+
+ stop_threshold = pcm->stop_threshold;
+ if (pcm->stop_threshold > pcm->buffer_size)
+ pcm->stop_threshold = pcm->buffer_size;
+ dshare->state = SND_PCM_STATE_DRAINING;
+ do {
+ err = snd_pcm_dshare_sync_ptr(pcm);
+ if (err < 0) {
+ snd_pcm_dshare_drop(pcm);
+ break;
+ }
+ if (dshare->state == SND_PCM_STATE_DRAINING) {
+ snd_pcm_dshare_sync_area(pcm);
+ snd_pcm_wait_nocheck(pcm, -1);
+ snd_pcm_direct_clear_timer_queue(dshare); /* force poll to wait */
+ }
+ } while (dshare->state == SND_PCM_STATE_DRAINING);
+ pcm->stop_threshold = stop_threshold;
+ return 0;
+}
+
+static int snd_pcm_dshare_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED)
+{
+ return -EIO;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_playback_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_mmap_playback_hw_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_playback_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_mmap_playback_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_readi(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_readn(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static int snd_pcm_dshare_close(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ if (dshare->timer)
+ snd_timer_close(dshare->timer);
+ do_silence(pcm);
+ snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
+ dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
+ snd_pcm_close(dshare->spcm);
+ if (dshare->server)
+ snd_pcm_direct_server_discard(dshare);
+ if (dshare->client)
+ snd_pcm_direct_client_discard(dshare);
+ if (snd_pcm_direct_shm_discard(dshare))
+ snd_pcm_direct_semaphore_discard(dshare);
+ else
+ snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
+ free(dshare->bindings);
+ pcm->private_data = NULL;
+ free(dshare);
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ int err;
+
+ switch (snd_pcm_state(dshare->spcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
+ if (! size)
+ return 0;
+ snd_pcm_mmap_appl_forward(pcm, size);
+ if (dshare->state == STATE_RUN_PENDING) {
+ if ((err = snd_pcm_dshare_start_timer(dshare)) < 0)
+ return err;
+ } else if (dshare->state == SND_PCM_STATE_RUNNING ||
+ dshare->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dshare_sync_ptr(pcm);
+ if (dshare->state == SND_PCM_STATE_RUNNING ||
+ dshare->state == SND_PCM_STATE_DRAINING) {
+ /* ok, we commit the changes after the validation of area */
+ /* it's intended, although the result might be crappy */
+ snd_pcm_dshare_sync_area(pcm);
+ /* clear timer queue to avoid a bogus return from poll */
+ if (snd_pcm_mmap_playback_avail(pcm) < pcm->avail_min)
+ snd_pcm_direct_clear_timer_queue(dshare);
+ }
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ if (dshare->state == SND_PCM_STATE_RUNNING ||
+ dshare->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dshare_sync_ptr(pcm);
+ return snd_pcm_mmap_playback_avail(pcm);
+}
+
+static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dshare->state == SND_PCM_STATE_RUNNING ||
+ dshare->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dshare_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_playback_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
+}
+
+static void snd_pcm_dshare_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+
+ snd_output_printf(out, "Direct Share PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ if (dshare->spcm)
+ snd_pcm_dump(dshare->spcm, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_dshare_ops = {
+ .close = snd_pcm_dshare_close,
+ .info = snd_pcm_direct_info,
+ .hw_refine = snd_pcm_direct_hw_refine,
+ .hw_params = snd_pcm_direct_hw_params,
+ .hw_free = snd_pcm_direct_hw_free,
+ .sw_params = snd_pcm_direct_sw_params,
+ .channel_info = snd_pcm_direct_channel_info,
+ .dump = snd_pcm_dshare_dump,
+ .nonblock = snd_pcm_direct_nonblock,
+ .async = snd_pcm_direct_async,
+ .mmap = snd_pcm_direct_mmap,
+ .munmap = snd_pcm_direct_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_dshare_fast_ops = {
+ .status = snd_pcm_dshare_status,
+ .state = snd_pcm_dshare_state,
+ .hwsync = snd_pcm_dshare_hwsync,
+ .delay = snd_pcm_dshare_delay,
+ .prepare = snd_pcm_dshare_prepare,
+ .reset = snd_pcm_dshare_reset,
+ .start = snd_pcm_dshare_start,
+ .drop = snd_pcm_dshare_drop,
+ .drain = snd_pcm_dshare_drain,
+ .pause = snd_pcm_dshare_pause,
+ .rewindable = snd_pcm_dshare_rewindable,
+ .rewind = snd_pcm_dshare_rewind,
+ .forwardable = snd_pcm_dshare_forwardable,
+ .forward = snd_pcm_dshare_forward,
+ .resume = snd_pcm_direct_resume,
+ .link = NULL,
+ .link_slaves = NULL,
+ .unlink = NULL,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_dshare_readi,
+ .readn = snd_pcm_dshare_readn,
+ .avail_update = snd_pcm_dshare_avail_update,
+ .mmap_commit = snd_pcm_dshare_mmap_commit,
+ .htimestamp = snd_pcm_dshare_htimestamp,
+ .poll_descriptors = NULL,
+ .poll_descriptors_count = NULL,
+ .poll_revents = snd_pcm_direct_poll_revents,
+};
+
+/**
+ * \brief Creates a new dshare PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param opts Direct PCM configurations
+ * \param params Parameters for slave
+ * \param root Configuration root
+ * \param sconf Slave configuration
+ * \param stream PCM Direction (stream)
+ * \param mode PCM Mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
+ struct snd_pcm_direct_open_conf *opts,
+ struct slave_params *params,
+ snd_config_t *root, snd_config_t *sconf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm = NULL, *spcm = NULL;
+ snd_pcm_direct_t *dshare = NULL;
+ int ret, first_instance;
+ unsigned int chn;
+ int fail_sem_loop = 10;
+
+ assert(pcmp);
+
+ if (stream != SND_PCM_STREAM_PLAYBACK) {
+ SNDERR("The dshare plugin supports only playback stream");
+ return -EINVAL;
+ }
+
+ dshare = calloc(1, sizeof(snd_pcm_direct_t));
+ if (!dshare) {
+ ret = -ENOMEM;
+ goto _err_nosem;
+ }
+
+ ret = snd_pcm_direct_parse_bindings(dshare, params, opts->bindings);
+ if (ret < 0)
+ goto _err_nosem;
+
+ if (!dshare->bindings) {
+ SNDERR("dshare: specify bindings!!!");
+ ret = -EINVAL;
+ goto _err_nosem;
+ }
+
+ dshare->ipc_key = opts->ipc_key;
+ dshare->ipc_perm = opts->ipc_perm;
+ dshare->ipc_gid = opts->ipc_gid;
+ dshare->semid = -1;
+ dshare->shmid = -1;
+
+ ret = snd_pcm_new(&pcm, dshare->type = SND_PCM_TYPE_DSHARE, name, stream, mode);
+ if (ret < 0)
+ goto _err_nosem;
+
+ while (1) {
+ ret = snd_pcm_direct_semaphore_create_or_connect(dshare);
+ if (ret < 0) {
+ SNDERR("unable to create IPC semaphore");
+ goto _err_nosem;
+ }
+
+ ret = snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
+ if (ret < 0) {
+ snd_pcm_direct_semaphore_discard(dshare);
+ if (--fail_sem_loop <= 0)
+ goto _err_nosem;
+ continue;
+ }
+ break;
+ }
+
+ first_instance = ret = snd_pcm_direct_shm_create_or_connect(dshare);
+ if (ret < 0) {
+ SNDERR("unable to create IPC shm instance");
+ goto _err;
+ }
+
+ pcm->ops = &snd_pcm_dshare_ops;
+ pcm->fast_ops = &snd_pcm_dshare_fast_ops;
+ pcm->private_data = dshare;
+ dshare->state = SND_PCM_STATE_OPEN;
+ dshare->slowptr = opts->slowptr;
+ dshare->max_periods = opts->max_periods;
+ dshare->sync_ptr = snd_pcm_dshare_sync_ptr;
+
+ if (first_instance) {
+ /* recursion is already checked in
+ snd_pcm_direct_get_slave_ipc_offset() */
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK, NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dshare plugin can be only connected to hw plugin");
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+
+ dshare->spcm = spcm;
+
+ if (dshare->shmptr->use_server) {
+ ret = snd_pcm_direct_server_create(dshare);
+ if (ret < 0) {
+ SNDERR("unable to create server");
+ goto _err;
+ }
+ }
+
+ dshare->shmptr->type = spcm->type;
+ } else {
+ if (dshare->shmptr->use_server) {
+ /* up semaphore to avoid deadlock */
+ snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
+ ret = snd_pcm_direct_client_connect(dshare);
+ if (ret < 0) {
+ SNDERR("unable to connect client");
+ goto _err_nosem;
+ }
+
+ snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
+ ret = snd_pcm_direct_open_secondary_client(&spcm, dshare, "dshare_client");
+ if (ret < 0)
+ goto _err;
+
+ } else {
+
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK |
+ SND_PCM_APPEND,
+ NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dshare plugin can be only connected to hw plugin");
+ ret = -EINVAL;
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+ }
+
+ dshare->spcm = spcm;
+ }
+
+ for (chn = 0; chn < dshare->channels; chn++)
+ dshare->u.dshare.chn_mask |= (1ULL<<dshare->bindings[chn]);
+ if (dshare->shmptr->u.dshare.chn_mask & dshare->u.dshare.chn_mask) {
+ SNDERR("destination channel specified in bindings is already used");
+ dshare->u.dshare.chn_mask = 0;
+ ret = -EINVAL;
+ goto _err;
+ }
+ dshare->shmptr->u.dshare.chn_mask |= dshare->u.dshare.chn_mask;
+
+ ret = snd_pcm_direct_initialize_poll_fd(dshare);
+ if (ret < 0) {
+ SNDERR("unable to initialize poll_fd");
+ goto _err;
+ }
+
+ pcm->poll_fd = dshare->poll_fd;
+ pcm->poll_events = POLLIN; /* it's different than other plugins */
+
+ pcm->mmap_rw = 1;
+ snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0);
+
+ snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
+
+ *pcmp = pcm;
+ return 0;
+
+ _err:
+ if (dshare->shmptr)
+ dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
+ if (dshare->timer)
+ snd_timer_close(dshare->timer);
+ if (dshare->server)
+ snd_pcm_direct_server_discard(dshare);
+ if (dshare->client)
+ snd_pcm_direct_client_discard(dshare);
+ if (spcm)
+ snd_pcm_close(spcm);
+ if (dshare->shmid >= 0)
+ snd_pcm_direct_shm_discard(dshare);
+ if (snd_pcm_direct_semaphore_discard(dshare) < 0)
+ snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
+ _err_nosem:
+ if (dshare) {
+ free(dshare->bindings);
+ free(dshare);
+ }
+ if (pcm)
+ snd_pcm_free(pcm);
+ return ret;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_dshare Plugin: dshare
+
+This plugin provides sharing channels.
+Unlike \ref pcm_plugins_share "share plugin", this plugin doesn't need
+the explicit server program but accesses the shared buffer concurrently
+from each client as well as \ref pcm_plugins_dmix "dmix" and
+\ref pcm_plugins_dsnoop "dsnoop" plugins do.
+The parameters below are almost identical with these plugins.
+
+\code
+pcm.name {
+ type dshare # Direct sharing
+ ipc_key INT # unique IPC key
+ ipc_key_add_uid BOOL # add current uid to unique IPC key
+ ipc_perm INT # IPC permissions (octal, default 0600)
+ slave STR
+ # or
+ slave { # Slave definition
+ pcm STR # slave PCM name
+ # or
+ pcm { } # slave PCM definition
+ format STR # format definition
+ rate INT # rate definition
+ channels INT
+ period_time INT # in usec
+ # or
+ period_size INT # in bytes
+ buffer_time INT # in usec
+ # or
+ buffer_size INT # in bytes
+ periods INT # when buffer_size or buffer_time is not specified
+ }
+ bindings { # note: this is client independent!!!
+ N INT # maps slave channel to client channel N
+ }
+ slowptr BOOL # slow but more precise pointer updates
+}
+\endcode
+
+\subsection pcm_plugins_dshare_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_dshare_open()
+ <LI>_snd_pcm_dshare_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new dshare PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with dshare PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_t *sconf;
+ struct slave_params params;
+ struct snd_pcm_direct_open_conf dopen;
+ int bsize, psize;
+ int err;
+
+ err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen);
+ if (err < 0)
+ return err;
+
+ /* the default settings, it might be invalid for some hardware */
+ params.format = SND_PCM_FORMAT_S16;
+ params.rate = 48000;
+ params.channels = 2;
+ params.period_time = -1;
+ params.buffer_time = -1;
+ bsize = psize = -1;
+ params.periods = 3;
+ err = snd_pcm_slave_conf(root, dopen.slave, &sconf, 8,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, &params.format,
+ SND_PCM_HW_PARAM_RATE, 0, &params.rate,
+ SND_PCM_HW_PARAM_CHANNELS, 0, &params.channels,
+ SND_PCM_HW_PARAM_PERIOD_TIME, 0, &params.period_time,
+ SND_PCM_HW_PARAM_BUFFER_TIME, 0, &params.buffer_time,
+ SND_PCM_HW_PARAM_PERIOD_SIZE, 0, &psize,
+ SND_PCM_HW_PARAM_BUFFER_SIZE, 0, &bsize,
+ SND_PCM_HW_PARAM_PERIODS, 0, &params.periods);
+ if (err < 0)
+ return err;
+
+ /* set a reasonable default */
+ if (psize == -1 && params.period_time == -1)
+ params.period_time = 125000; /* 0.125 seconds */
+
+ if (params.format == -2)
+ params.format = SND_PCM_FORMAT_UNKNOWN;
+
+ params.period_size = psize;
+ params.buffer_size = bsize;
+
+ err = snd_pcm_dshare_open(pcmp, name, &dopen, &params,
+ root, sconf, stream, mode);
+ snd_config_delete(sconf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_dshare_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_dsnoop.c b/alsa-lib/src/pcm/pcm_dsnoop.c
new file mode 100644
index 0000000..9d42c12
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_dsnoop.c
@@ -0,0 +1,816 @@
+/**
+ * \file pcm/pcm_dsnoop.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Capture Stream Snooping (dsnoop) Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2003
+ */
+/*
+ * PCM - Capture Stream Snooping
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <grp.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/mman.h>
+#include "pcm_direct.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_dsnoop = "";
+#endif
+
+/*
+ *
+ */
+
+static void snoop_areas(snd_pcm_direct_t *dsnoop,
+ const snd_pcm_channel_area_t *src_areas,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t src_ofs,
+ snd_pcm_uframes_t dst_ofs,
+ snd_pcm_uframes_t size)
+{
+ unsigned int chn, schn, channels;
+ snd_pcm_format_t format;
+
+ channels = dsnoop->channels;
+ format = dsnoop->shmptr->s.format;
+ if (dsnoop->interleaved) {
+ unsigned int fbytes = snd_pcm_format_physical_width(format) / 8;
+ memcpy(((char *)dst_areas[0].addr) + (dst_ofs * channels * fbytes),
+ ((char *)src_areas[0].addr) + (src_ofs * channels * fbytes),
+ size * channels * fbytes);
+ } else {
+ for (chn = 0; chn < channels; chn++) {
+ schn = dsnoop->bindings ? dsnoop->bindings[chn] : chn;
+ snd_pcm_area_copy(&dst_areas[chn], dst_ofs, &src_areas[schn], src_ofs, size, format);
+ }
+ }
+}
+
+/*
+ * synchronize shm ring buffer with hardware
+ */
+static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr, snd_pcm_uframes_t size)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_uframes_t hw_ptr = dsnoop->hw_ptr;
+ snd_pcm_uframes_t transfer;
+ const snd_pcm_channel_area_t *src_areas, *dst_areas;
+
+ /* add sample areas here */
+ dst_areas = snd_pcm_mmap_areas(pcm);
+ src_areas = snd_pcm_mmap_areas(dsnoop->spcm);
+ hw_ptr %= pcm->buffer_size;
+ slave_hw_ptr %= dsnoop->slave_buffer_size;
+ while (size > 0) {
+ transfer = hw_ptr + size > pcm->buffer_size ? pcm->buffer_size - hw_ptr : size;
+ transfer = slave_hw_ptr + transfer > dsnoop->slave_buffer_size ?
+ dsnoop->slave_buffer_size - slave_hw_ptr : transfer;
+ size -= transfer;
+ snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer);
+ slave_hw_ptr += transfer;
+ slave_hw_ptr %= dsnoop->slave_buffer_size;
+ hw_ptr += transfer;
+ hw_ptr %= pcm->buffer_size;
+ }
+}
+
+/*
+ * synchronize hardware pointer (hw_ptr) with ours
+ */
+static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr, old_slave_hw_ptr, avail;
+ snd_pcm_sframes_t diff;
+
+ switch (snd_pcm_state(dsnoop->spcm)) {
+ case SND_PCM_STATE_DISCONNECTED:
+ dsnoop->state = SNDRV_PCM_STATE_DISCONNECTED;
+ return -ENODEV;
+ default:
+ break;
+ }
+ if (dsnoop->slowptr)
+ snd_pcm_hwsync(dsnoop->spcm);
+ old_slave_hw_ptr = dsnoop->slave_hw_ptr;
+ slave_hw_ptr = dsnoop->slave_hw_ptr = *dsnoop->spcm->hw.ptr;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ if (diff == 0) /* fast path */
+ return 0;
+ if (diff < 0) {
+ slave_hw_ptr += dsnoop->slave_boundary;
+ diff = slave_hw_ptr - old_slave_hw_ptr;
+ }
+ snd_pcm_dsnoop_sync_area(pcm, old_slave_hw_ptr, diff);
+ dsnoop->hw_ptr += diff;
+ dsnoop->hw_ptr %= pcm->boundary;
+ // printf("sync ptr diff = %li\n", diff);
+ if (pcm->stop_threshold >= pcm->boundary) /* don't care */
+ return 0;
+ if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) {
+ gettimestamp(&dsnoop->trigger_tstamp, pcm->monotonic);
+ dsnoop->state = SND_PCM_STATE_XRUN;
+ dsnoop->avail_max = avail;
+ return -EPIPE;
+ }
+ if (avail > dsnoop->avail_max)
+ dsnoop->avail_max = avail;
+ return 0;
+}
+
+/*
+ * plugin implementation
+ */
+
+static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_state_t state;
+
+ switch(dsnoop->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ snd_pcm_dsnoop_sync_ptr(pcm);
+ break;
+ default:
+ break;
+ }
+ memset(status, 0, sizeof(*status));
+ state = snd_pcm_state(dsnoop->spcm);
+ status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
+ status->trigger_tstamp = dsnoop->trigger_tstamp;
+ gettimestamp(&status->tstamp, pcm->monotonic);
+ status->avail = snd_pcm_mmap_capture_avail(pcm);
+ status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;
+ dsnoop->avail_max = 0;
+ return 0;
+}
+
+static snd_pcm_state_t snd_pcm_dsnoop_state(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ switch (snd_pcm_state(dsnoop->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return SND_PCM_STATE_SUSPENDED;
+ case SND_PCM_STATE_DISCONNECTED:
+ dsnoop->state = SNDRV_PCM_STATE_DISCONNECTED;
+ return -ENODEV;
+ default:
+ break;
+ }
+ return dsnoop->state;
+}
+
+static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ int err;
+
+ switch(dsnoop->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ err = snd_pcm_dsnoop_sync_ptr(pcm);
+ if (err < 0)
+ return err;
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ *delayp = snd_pcm_mmap_capture_hw_avail(pcm);
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dsnoop_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+
+ switch(dsnoop->state) {
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_RUNNING:
+ return snd_pcm_dsnoop_sync_ptr(pcm);
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ return 0;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SNDRV_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_dsnoop_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+
+ snd_pcm_direct_check_interleave(dsnoop, pcm);
+ dsnoop->state = SND_PCM_STATE_PREPARED;
+ dsnoop->appl_ptr = 0;
+ dsnoop->hw_ptr = 0;
+ return snd_pcm_direct_set_timer_params(dsnoop);
+}
+
+static int snd_pcm_dsnoop_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ dsnoop->hw_ptr %= pcm->period_size;
+ dsnoop->appl_ptr = dsnoop->hw_ptr;
+ dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr = *dsnoop->spcm->hw.ptr;
+ return 0;
+}
+
+static int snd_pcm_dsnoop_start(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ int err;
+
+ if (dsnoop->state != SND_PCM_STATE_PREPARED)
+ return -EBADFD;
+ snd_pcm_hwsync(dsnoop->spcm);
+ dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr = *dsnoop->spcm->hw.ptr;
+ err = snd_timer_start(dsnoop->timer);
+ if (err < 0)
+ return err;
+ dsnoop->state = SND_PCM_STATE_RUNNING;
+ gettimestamp(&dsnoop->trigger_tstamp, pcm->monotonic);
+ return 0;
+}
+
+static int snd_pcm_dsnoop_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ if (dsnoop->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ snd_timer_stop(dsnoop->timer);
+ dsnoop->state = SND_PCM_STATE_SETUP;
+ return 0;
+}
+
+static int snd_pcm_dsnoop_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_uframes_t stop_threshold;
+ int err;
+
+ if (dsnoop->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ stop_threshold = pcm->stop_threshold;
+ if (pcm->stop_threshold > pcm->buffer_size)
+ pcm->stop_threshold = pcm->buffer_size;
+ while (dsnoop->state == SND_PCM_STATE_RUNNING) {
+ err = snd_pcm_dsnoop_sync_ptr(pcm);
+ if (err < 0)
+ break;
+ if (pcm->mode & SND_PCM_NONBLOCK)
+ return -EAGAIN;
+ snd_pcm_wait(pcm, -1);
+ }
+ pcm->stop_threshold = stop_threshold;
+ return snd_pcm_dsnoop_drop(pcm);
+}
+
+static int snd_pcm_dsnoop_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED)
+{
+ return -EIO;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_capture_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_mmap_capture_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_capture_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_mmap_capture_hw_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_writei(snd_pcm_t *pcm ATTRIBUTE_UNUSED, const void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_writen(snd_pcm_t *pcm ATTRIBUTE_UNUSED, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size ATTRIBUTE_UNUSED)
+{
+ return -ENODEV;
+}
+
+static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+
+ if (dsnoop->timer)
+ snd_timer_close(dsnoop->timer);
+ snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
+ snd_pcm_close(dsnoop->spcm);
+ if (dsnoop->server)
+ snd_pcm_direct_server_discard(dsnoop);
+ if (dsnoop->client)
+ snd_pcm_direct_client_discard(dsnoop);
+ if (snd_pcm_direct_shm_discard(dsnoop))
+ snd_pcm_direct_semaphore_discard(dsnoop);
+ else
+ snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
+ free(dsnoop->bindings);
+ pcm->private_data = NULL;
+ free(dsnoop);
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ int err;
+
+ switch (snd_pcm_state(dsnoop->spcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
+ if (dsnoop->state == SND_PCM_STATE_RUNNING) {
+ err = snd_pcm_dsnoop_sync_ptr(pcm);
+ if (err < 0)
+ return err;
+ }
+ snd_pcm_mmap_appl_forward(pcm, size);
+ /* clear timer queue to avoid a bogus return from poll */
+ if (snd_pcm_mmap_capture_avail(pcm) < pcm->avail_min)
+ snd_pcm_direct_clear_timer_queue(dsnoop);
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_dsnoop_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ int err;
+
+ if (dsnoop->state == SND_PCM_STATE_RUNNING) {
+ err = snd_pcm_dsnoop_sync_ptr(pcm);
+ if (err < 0)
+ return err;
+ }
+ return snd_pcm_mmap_capture_avail(pcm);
+}
+
+static int snd_pcm_dsnoop_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dsnoop->state == SND_PCM_STATE_RUNNING ||
+ dsnoop->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dsnoop_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_capture_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
+}
+
+static void snd_pcm_dsnoop_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+
+ snd_output_printf(out, "Direct Snoop PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ if (dsnoop->spcm)
+ snd_pcm_dump(dsnoop->spcm, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_dsnoop_ops = {
+ .close = snd_pcm_dsnoop_close,
+ .info = snd_pcm_direct_info,
+ .hw_refine = snd_pcm_direct_hw_refine,
+ .hw_params = snd_pcm_direct_hw_params,
+ .hw_free = snd_pcm_direct_hw_free,
+ .sw_params = snd_pcm_direct_sw_params,
+ .channel_info = snd_pcm_direct_channel_info,
+ .dump = snd_pcm_dsnoop_dump,
+ .nonblock = snd_pcm_direct_nonblock,
+ .async = snd_pcm_direct_async,
+ .mmap = snd_pcm_direct_mmap,
+ .munmap = snd_pcm_direct_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_dsnoop_fast_ops = {
+ .status = snd_pcm_dsnoop_status,
+ .state = snd_pcm_dsnoop_state,
+ .hwsync = snd_pcm_dsnoop_hwsync,
+ .delay = snd_pcm_dsnoop_delay,
+ .prepare = snd_pcm_dsnoop_prepare,
+ .reset = snd_pcm_dsnoop_reset,
+ .start = snd_pcm_dsnoop_start,
+ .drop = snd_pcm_dsnoop_drop,
+ .drain = snd_pcm_dsnoop_drain,
+ .pause = snd_pcm_dsnoop_pause,
+ .rewindable = snd_pcm_dsnoop_rewindable,
+ .rewind = snd_pcm_dsnoop_rewind,
+ .forwardable = snd_pcm_dsnoop_forwardable,
+ .forward = snd_pcm_dsnoop_forward,
+ .resume = snd_pcm_direct_resume,
+ .link = NULL,
+ .link_slaves = NULL,
+ .unlink = NULL,
+ .writei = snd_pcm_dsnoop_writei,
+ .writen = snd_pcm_dsnoop_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .avail_update = snd_pcm_dsnoop_avail_update,
+ .mmap_commit = snd_pcm_dsnoop_mmap_commit,
+ .htimestamp = snd_pcm_dsnoop_htimestamp,
+ .poll_descriptors = NULL,
+ .poll_descriptors_count = NULL,
+ .poll_revents = snd_pcm_direct_poll_revents,
+};
+
+/**
+ * \brief Creates a new dsnoop PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param opts Direct PCM configurations
+ * \param params Parameters for slave
+ * \param root Configuration root
+ * \param sconf Slave configuration
+ * \param stream PCM Direction (stream)
+ * \param mode PCM Mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
+ struct snd_pcm_direct_open_conf *opts,
+ struct slave_params *params,
+ snd_config_t *root, snd_config_t *sconf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm = NULL, *spcm = NULL;
+ snd_pcm_direct_t *dsnoop = NULL;
+ int ret, first_instance, fail_sem_loop = 10;
+
+ assert(pcmp);
+
+ if (stream != SND_PCM_STREAM_CAPTURE) {
+ SNDERR("The dsnoop plugin supports only capture stream");
+ return -EINVAL;
+ }
+
+ dsnoop = calloc(1, sizeof(snd_pcm_direct_t));
+ if (!dsnoop) {
+ ret = -ENOMEM;
+ goto _err_nosem;
+ }
+
+ ret = snd_pcm_direct_parse_bindings(dsnoop, params, opts->bindings);
+ if (ret < 0)
+ goto _err_nosem;
+
+ dsnoop->ipc_key = opts->ipc_key;
+ dsnoop->ipc_perm = opts->ipc_perm;
+ dsnoop->ipc_gid = opts->ipc_gid;
+ dsnoop->semid = -1;
+ dsnoop->shmid = -1;
+
+ ret = snd_pcm_new(&pcm, dsnoop->type = SND_PCM_TYPE_DSNOOP, name, stream, mode);
+ if (ret < 0)
+ goto _err_nosem;
+
+ while (1) {
+ ret = snd_pcm_direct_semaphore_create_or_connect(dsnoop);
+ if (ret < 0) {
+ SNDERR("unable to create IPC semaphore");
+ goto _err_nosem;
+ }
+
+ ret = snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
+ if (ret < 0) {
+ snd_pcm_direct_semaphore_discard(dsnoop);
+ if (--fail_sem_loop <= 0)
+ goto _err_nosem;
+ continue;
+ }
+ break;
+ }
+
+ first_instance = ret = snd_pcm_direct_shm_create_or_connect(dsnoop);
+ if (ret < 0) {
+ SNDERR("unable to create IPC shm instance");
+ goto _err;
+ }
+
+ pcm->ops = &snd_pcm_dsnoop_ops;
+ pcm->fast_ops = &snd_pcm_dsnoop_fast_ops;
+ pcm->private_data = dsnoop;
+ dsnoop->state = SND_PCM_STATE_OPEN;
+ dsnoop->slowptr = opts->slowptr;
+ dsnoop->max_periods = opts->max_periods;
+ dsnoop->sync_ptr = snd_pcm_dsnoop_sync_ptr;
+
+ if (first_instance) {
+ /* recursion is already checked in
+ snd_pcm_direct_get_slave_ipc_offset() */
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK, NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dsnoop plugin can be only connected to hw plugin");
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+
+ dsnoop->spcm = spcm;
+
+ if (dsnoop->shmptr->use_server) {
+ ret = snd_pcm_direct_server_create(dsnoop);
+ if (ret < 0) {
+ SNDERR("unable to create server");
+ goto _err;
+ }
+ }
+
+ dsnoop->shmptr->type = spcm->type;
+ } else {
+ if (dsnoop->shmptr->use_server) {
+ /* up semaphore to avoid deadlock */
+ snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
+ ret = snd_pcm_direct_client_connect(dsnoop);
+ if (ret < 0) {
+ SNDERR("unable to connect client");
+ goto _err_nosem;
+ }
+
+ snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
+
+ ret = snd_pcm_direct_open_secondary_client(&spcm, dsnoop, "dsnoop_client");
+ if (ret < 0)
+ goto _err;
+ } else {
+
+ ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
+ mode | SND_PCM_NONBLOCK |
+ SND_PCM_APPEND,
+ NULL);
+ if (ret < 0) {
+ SNDERR("unable to open slave");
+ goto _err;
+ }
+ if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
+ SNDERR("dsnoop plugin can be only connected to hw plugin");
+ ret = -EINVAL;
+ goto _err;
+ }
+
+ ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
+ if (ret < 0) {
+ SNDERR("unable to initialize slave");
+ goto _err;
+ }
+ }
+
+ dsnoop->spcm = spcm;
+ }
+
+ ret = snd_pcm_direct_initialize_poll_fd(dsnoop);
+ if (ret < 0) {
+ SNDERR("unable to initialize poll_fd");
+ goto _err;
+ }
+
+ pcm->poll_fd = dsnoop->poll_fd;
+ pcm->poll_events = POLLIN; /* it's different than other plugins */
+
+ pcm->mmap_rw = 1;
+ snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0);
+
+ if (dsnoop->channels == UINT_MAX)
+ dsnoop->channels = dsnoop->shmptr->s.channels;
+
+ snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
+
+ *pcmp = pcm;
+ return 0;
+
+ _err:
+ if (dsnoop->timer)
+ snd_timer_close(dsnoop->timer);
+ if (dsnoop->server)
+ snd_pcm_direct_server_discard(dsnoop);
+ if (dsnoop->client)
+ snd_pcm_direct_client_discard(dsnoop);
+ if (spcm)
+ snd_pcm_close(spcm);
+ if (dsnoop->shmid >= 0)
+ snd_pcm_direct_shm_discard(dsnoop);
+ if (snd_pcm_direct_semaphore_discard(dsnoop) < 0)
+ snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
+ _err_nosem:
+ if (dsnoop) {
+ free(dsnoop->bindings);
+ free(dsnoop);
+ }
+ if (pcm)
+ snd_pcm_free(pcm);
+ return ret;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_dsnoop Plugin: dsnoop
+
+This plugin splits one capture stream to more.
+It works the reverse way of \ref pcm_plugins_dmix "dmix plugin",
+reading the shared capture buffer from many clients concurrently.
+The meaning of parameters below are almost identical with
+dmix plugin.
+
+\code
+pcm.name {
+ type dsnoop # Direct snoop
+ ipc_key INT # unique IPC key
+ ipc_key_add_uid BOOL # add current uid to unique IPC key
+ ipc_perm INT # IPC permissions (octal, default 0600)
+ slave STR
+ # or
+ slave { # Slave definition
+ pcm STR # slave PCM name
+ # or
+ pcm { } # slave PCM definition
+ format STR # format definition
+ rate INT # rate definition
+ channels INT
+ period_time INT # in usec
+ # or
+ period_size INT # in bytes
+ buffer_time INT # in usec
+ # or
+ buffer_size INT # in bytes
+ periods INT # when buffer_size or buffer_time is not specified
+ }
+ bindings { # note: this is client independent!!!
+ N INT # maps slave channel to client channel N
+ }
+ slowptr BOOL # slow but more precise pointer updates
+}
+\endcode
+
+\subsection pcm_plugins_dsnoop_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_dsnoop_open()
+ <LI>_snd_pcm_dsnoop_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new dsnoop PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with dsnoop PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_t *sconf;
+ struct slave_params params;
+ struct snd_pcm_direct_open_conf dopen;
+ int bsize, psize;
+ int err;
+
+ err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen);
+ if (err < 0)
+ return err;
+
+ /* the default settings, it might be invalid for some hardware */
+ params.format = SND_PCM_FORMAT_S16;
+ params.rate = 48000;
+ params.channels = 2;
+ params.period_time = -1;
+ params.buffer_time = -1;
+ bsize = psize = -1;
+ params.periods = 3;
+ err = snd_pcm_slave_conf(root, dopen.slave, &sconf, 8,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, &params.format,
+ SND_PCM_HW_PARAM_RATE, 0, &params.rate,
+ SND_PCM_HW_PARAM_CHANNELS, 0, &params.channels,
+ SND_PCM_HW_PARAM_PERIOD_TIME, 0, &params.period_time,
+ SND_PCM_HW_PARAM_BUFFER_TIME, 0, &params.buffer_time,
+ SND_PCM_HW_PARAM_PERIOD_SIZE, 0, &psize,
+ SND_PCM_HW_PARAM_BUFFER_SIZE, 0, &bsize,
+ SND_PCM_HW_PARAM_PERIODS, 0, &params.periods);
+ if (err < 0)
+ return err;
+
+ /* set a reasonable default */
+ if (psize == -1 && params.period_time == -1)
+ params.period_time = 125000; /* 0.125 seconds */
+
+ if (params.format == -2)
+ params.format = SND_PCM_FORMAT_UNKNOWN;
+
+ params.period_size = psize;
+ params.buffer_size = bsize;
+
+ err = snd_pcm_dsnoop_open(pcmp, name, &dopen, &params,
+ root, sconf, stream, mode);
+ snd_config_delete(sconf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_dsnoop_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_empty.c b/alsa-lib/src/pcm/pcm_empty.c
new file mode 100644
index 0000000..070850c
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_empty.c
@@ -0,0 +1,110 @@
+/**
+ * \file pcm/pcm_empty.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Null Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2006
+ */
+/*
+ * PCM - Null plugin
+ * Copyright (c) 2006 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_empty = "";
+#endif
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_null Plugin: Null
+
+This plugin discards contents of a PCM stream or creates a stream with zero
+samples.
+
+Note: This implementation uses devices /dev/null (playback, must be writable)
+and /dev/full (capture, must be readable).
+
+\code
+pcm.name {
+ type null # Null PCM
+}
+\endcode
+
+\subsection pcm_plugins_null_funcref Function reference
+
+<UL>
+ <LI>_snd_pcm_empty_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Empty PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with empty PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_iterator_t i, next;
+ int err;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_named_slave(pcmp, name, root, sconf, stream,
+ mode, conf);
+ snd_config_delete(sconf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_empty_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_ext_parm.h b/alsa-lib/src/pcm/pcm_ext_parm.h
new file mode 100644
index 0000000..d25f2ab
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_ext_parm.h
@@ -0,0 +1,41 @@
+/* hw_params */
+struct snd_ext_parm {
+ unsigned int min, max;
+ unsigned int num_list;
+ unsigned int *list;
+ unsigned int active: 1;
+ unsigned int integer: 1;
+};
+
+static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ return &params->masks[var - SND_PCM_HW_PARAM_FIRST_MASK];
+}
+
+static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ return &params->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL];
+}
+
+/* make local functions really local */
+#define snd_ext_parm_set_minmax \
+ snd1_ext_parm_set_minmax
+#define snd_ext_parm_set_list \
+ snd1_ext_parm_set_list
+#define snd_ext_parm_clear \
+ snd1_ext_parm_clear
+#define snd_interval_list \
+ snd1_interval_list
+#define snd_ext_parm_interval_refine \
+ snd1_ext_parm_interval_refine
+#define snd_ext_parm_mask_refine \
+ snd1_ext_parm_mask_refine
+
+int snd_ext_parm_set_minmax(struct snd_ext_parm *parm, unsigned int min, unsigned int max);
+int snd_ext_parm_set_list(struct snd_ext_parm *parm, unsigned int num_list, const unsigned int *list);
+void snd_ext_parm_clear(struct snd_ext_parm *parm);
+int snd_interval_list(snd_interval_t *ival, int num_list, unsigned int *list);
+int snd_ext_parm_interval_refine(snd_interval_t *ival, struct snd_ext_parm *parm, int type);
+int snd_ext_parm_mask_refine(snd_mask_t *mask, struct snd_ext_parm *parm, int type);
diff --git a/alsa-lib/src/pcm/pcm_extplug.c b/alsa-lib/src/pcm/pcm_extplug.c
new file mode 100644
index 0000000..a34706f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_extplug.c
@@ -0,0 +1,813 @@
+/**
+ * \file pcm/pcm_extplug.c
+ * \ingroup Plugin_SDK
+ * \brief External Filter Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ */
+/*
+ * PCM - External Filter Plugin SDK
+ * Copyright (c) 2005 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+#include "pcm_extplug.h"
+#include "pcm_ext_parm.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_extplug = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef struct snd_pcm_extplug_priv {
+ snd_pcm_plugin_t plug;
+ snd_pcm_extplug_t *data;
+ struct snd_ext_parm params[SND_PCM_EXTPLUG_HW_PARAMS];
+ struct snd_ext_parm sparams[SND_PCM_EXTPLUG_HW_PARAMS];
+} extplug_priv_t;
+
+static const int hw_params_type[SND_PCM_EXTPLUG_HW_PARAMS] = {
+ [SND_PCM_EXTPLUG_HW_FORMAT] = SND_PCM_HW_PARAM_FORMAT,
+ [SND_PCM_EXTPLUG_HW_CHANNELS] = SND_PCM_HW_PARAM_CHANNELS
+};
+
+#define is_mask_type(i) (hw_params_type[i] < SND_PCM_HW_PARAM_FIRST_INTERVAL)
+
+static const unsigned int excl_parbits[SND_PCM_EXTPLUG_HW_PARAMS] = {
+ [SND_PCM_EXTPLUG_HW_FORMAT] = (SND_PCM_HW_PARBIT_FORMAT|
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS),
+ [SND_PCM_EXTPLUG_HW_CHANNELS] = (SND_PCM_HW_PARBIT_CHANNELS|
+ SND_PCM_HW_PARBIT_FRAME_BITS),
+};
+
+/*
+ * set min/max values for the given parameter
+ */
+int snd_ext_parm_set_minmax(struct snd_ext_parm *parm, unsigned int min, unsigned int max)
+{
+ parm->num_list = 0;
+ free(parm->list);
+ parm->list = NULL;
+ parm->min = min;
+ parm->max = max;
+ parm->active = 1;
+ return 0;
+}
+
+/*
+ * set the list of available values for the given parameter
+ */
+static int val_compar(const void *ap, const void *bp)
+{
+ return *(const unsigned int *)ap - *(const unsigned int *)bp;
+}
+
+int snd_ext_parm_set_list(struct snd_ext_parm *parm, unsigned int num_list, const unsigned int *list)
+{
+ unsigned int *new_list;
+
+ new_list = malloc(sizeof(*new_list) * num_list);
+ if (new_list == NULL)
+ return -ENOMEM;
+ memcpy(new_list, list, sizeof(*new_list) * num_list);
+ qsort(new_list, num_list, sizeof(*new_list), val_compar);
+
+ free(parm->list);
+ parm->num_list = num_list;
+ parm->list = new_list;
+ parm->active = 1;
+ return 0;
+}
+
+void snd_ext_parm_clear(struct snd_ext_parm *parm)
+{
+ free(parm->list);
+ memset(parm, 0, sizeof(*parm));
+}
+
+/*
+ * limit the interval to the given list
+ */
+int snd_interval_list(snd_interval_t *ival, int num_list, unsigned int *list)
+{
+ int imin, imax;
+ int changed = 0;
+
+ if (snd_interval_empty(ival))
+ return -ENOENT;
+ for (imin = 0; imin < num_list; imin++) {
+ if (ival->min == list[imin] && ! ival->openmin)
+ break;
+ if (ival->min <= list[imin]) {
+ ival->min = list[imin];
+ ival->openmin = 0;
+ changed = 1;
+ break;
+ }
+ }
+ if (imin >= num_list)
+ return -EINVAL;
+ for (imax = num_list - 1; imax >= imin; imax--) {
+ if (ival->max == list[imax] && ! ival->openmax)
+ break;
+ if (ival->max >= list[imax]) {
+ ival->max = list[imax];
+ ival->openmax = 0;
+ changed = 1;
+ break;
+ }
+ }
+ if (imax < imin)
+ return -EINVAL;
+ return changed;
+}
+
+/*
+ * refine the interval parameter
+ */
+int snd_ext_parm_interval_refine(snd_interval_t *ival, struct snd_ext_parm *parm, int type)
+{
+ parm += type;
+ if (! parm->active)
+ return 0;
+ ival->integer |= parm->integer;
+ if (parm->num_list) {
+ return snd_interval_list(ival, parm->num_list, parm->list);
+ } else if (parm->min || parm->max) {
+ snd_interval_t t;
+ memset(&t, 0, sizeof(t));
+ snd_interval_set_minmax(&t, parm->min, parm->max);
+ t.integer = ival->integer;
+ return snd_interval_refine(ival, &t);
+ }
+ return 0;
+}
+
+/*
+ * refine the mask parameter
+ */
+int snd_ext_parm_mask_refine(snd_mask_t *mask, struct snd_ext_parm *parm, int type)
+{
+ snd_mask_t bits;
+ unsigned int i;
+
+ parm += type;
+ memset(&bits, 0, sizeof(bits));
+ for (i = 0; i < parm->num_list; i++)
+ bits.bits[parm->list[i] / 32] |= 1U << (parm->list[i] % 32);
+ return snd_mask_refine(mask, &bits);
+}
+
+
+/*
+ * hw_refine callback
+ */
+static int extplug_hw_refine(snd_pcm_hw_params_t *hw_params,
+ struct snd_ext_parm *parm)
+{
+ int i, err, change = 0;
+ for (i = 0; i < SND_PCM_EXTPLUG_HW_PARAMS; i++) {
+ int type = hw_params_type[i];
+ if (is_mask_type(i))
+ err = snd_ext_parm_mask_refine(hw_param_mask(hw_params, type),
+ parm, i);
+ else
+ err = snd_ext_parm_interval_refine(hw_param_interval(hw_params, type),
+ parm, i);
+ if (err < 0)
+ return err;
+ change |= err;
+ }
+ return change;
+}
+
+static int snd_pcm_extplug_hw_refine_cprepare(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ extplug_priv_t *ext = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = extplug_hw_refine(params, ext->params);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_extplug_hw_refine_sprepare(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *sparams)
+{
+ extplug_priv_t *ext = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ extplug_hw_refine(sparams, ext->sparams);
+ return 0;
+}
+
+static unsigned int get_links(struct snd_ext_parm *params)
+{
+ int i;
+ unsigned int links = (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS |
+ SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_FRAME_BITS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+
+ for (i = 0; i < SND_PCM_EXTPLUG_HW_PARAMS; i++) {
+ if (params[i].active)
+ links &= ~excl_parbits[i];
+ }
+ return links;
+}
+
+static int snd_pcm_extplug_hw_refine_schange(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ extplug_priv_t *ext = pcm->private_data;
+ unsigned int links = get_links(ext->sparams);
+
+ return _snd_pcm_hw_params_refine(sparams, links, params);
+}
+
+static int snd_pcm_extplug_hw_refine_cchange(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ extplug_priv_t *ext = pcm->private_data;
+ unsigned int links = get_links(ext->params);
+
+ return _snd_pcm_hw_params_refine(params, links, sparams);
+}
+
+static int snd_pcm_extplug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int err = snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_extplug_hw_refine_cprepare,
+ snd_pcm_extplug_hw_refine_cchange,
+ snd_pcm_extplug_hw_refine_sprepare,
+ snd_pcm_extplug_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+ return err;
+}
+
+/*
+ * hw_params callback
+ */
+static int snd_pcm_extplug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+
+ extplug_priv_t *ext = pcm->private_data;
+ snd_pcm_t *slave = ext->plug.gen.slave;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_extplug_hw_refine_cchange,
+ snd_pcm_extplug_hw_refine_sprepare,
+ snd_pcm_extplug_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+ ext->data->slave_format = slave->format;
+ ext->data->slave_subformat = slave->subformat;
+ ext->data->slave_channels = slave->channels;
+ ext->data->rate = slave->rate;
+ INTERNAL(snd_pcm_hw_params_get_format)(params, &ext->data->format);
+ INTERNAL(snd_pcm_hw_params_get_subformat)(params, &ext->data->subformat);
+ INTERNAL(snd_pcm_hw_params_get_channels)(params, &ext->data->channels);
+
+ if (ext->data->callback->hw_params) {
+ err = ext->data->callback->hw_params(ext->data, params);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+/*
+ * hw_free callback
+ */
+static int snd_pcm_extplug_hw_free(snd_pcm_t *pcm)
+{
+ extplug_priv_t *ext = pcm->private_data;
+
+ snd_pcm_hw_free(ext->plug.gen.slave);
+ if (ext->data->callback->hw_free)
+ return ext->data->callback->hw_free(ext->data);
+ return 0;
+}
+
+/*
+ * write_areas skeleton - call transfer callback
+ */
+static snd_pcm_uframes_t
+snd_pcm_extplug_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ extplug_priv_t *ext = pcm->private_data;
+
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ size = ext->data->callback->transfer(ext->data, slave_areas, slave_offset,
+ areas, offset, size);
+ *slave_sizep = size;
+ return size;
+}
+
+/*
+ * read_areas skeleton - call transfer callback
+ */
+static snd_pcm_uframes_t
+snd_pcm_extplug_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ extplug_priv_t *ext = pcm->private_data;
+
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ size = ext->data->callback->transfer(ext->data, areas, offset,
+ slave_areas, slave_offset, size);
+ *slave_sizep = size;
+ return size;
+}
+
+/*
+ * call init callback
+ */
+static int snd_pcm_extplug_init(snd_pcm_t *pcm)
+{
+ extplug_priv_t *ext = pcm->private_data;
+ return ext->data->callback->init(ext->data);
+}
+
+/*
+ * dump setup
+ */
+static void snd_pcm_extplug_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ extplug_priv_t *ext = pcm->private_data;
+
+ if (ext->data->callback->dump)
+ ext->data->callback->dump(ext->data, out);
+ else {
+ if (ext->data->name)
+ snd_output_printf(out, "%s\n", ext->data->name);
+ else
+ snd_output_printf(out, "External PCM Plugin\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(ext->plug.gen.slave, out);
+}
+
+static void clear_ext_params(extplug_priv_t *ext)
+{
+ int i;
+ for (i = 0; i < SND_PCM_EXTPLUG_HW_PARAMS; i++) {
+ snd_ext_parm_clear(&ext->params[i]);
+ snd_ext_parm_clear(&ext->sparams[i]);
+ }
+}
+
+static int snd_pcm_extplug_close(snd_pcm_t *pcm)
+{
+ extplug_priv_t *ext = pcm->private_data;
+
+ snd_pcm_close(ext->plug.gen.slave);
+ clear_ext_params(ext);
+ if (ext->data->callback->close)
+ ext->data->callback->close(ext->data);
+ free(ext);
+ return 0;
+}
+
+static const snd_pcm_ops_t snd_pcm_extplug_ops = {
+ .close = snd_pcm_extplug_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_extplug_hw_refine,
+ .hw_params = snd_pcm_extplug_hw_params,
+ .hw_free = snd_pcm_extplug_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_extplug_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+#endif /* !DOC_HIDDEN */
+
+/*
+ * Exported functions
+ */
+
+/*! \page pcm_external_plugins PCM External Plugin SDK
+
+\section pcm_externals External Plugins
+
+The external plugins are implemented in a shared object file located
+at /usr/lib/alsa-lib (the exact location depends on the build option
+and asoundrc configuration). It has to be the file like
+libasound_module_pcm_MYPLUGIN.so, where MYPLUGIN corresponds to your
+own plugin name.
+
+The entry point of the plugin is defined via
+#SND_PCM_PLUGIN_DEFINE_FUNC() macro. This macro defines the function
+with a proper name to be referred from alsa-lib. The function takes
+the following 6 arguments:
+\code
+int (snd_pcm_t **pcmp, const char *name, snd_config_t *root,
+ snd_config_t *conf, snd_pcm_stream_t stream, int mode)
+\endcode
+The first argument, pcmp, is the pointer to store the resultant PCM
+handle. The arguments name, root, stream and mode are the parameters
+to be passed to the plugin constructor. The conf is the configuration
+tree for the plugin. The arguments above are defined in the macro
+itself, so don't use variables with the same names to shadow
+parameters.
+
+After parsing the configuration parameters in the given conf tree,
+usually you will call the external plugin API function,
+#snd_pcm_extplug_create() or #snd_pcm_ioplug_create(), depending
+on the plugin type. The PCM handle must be filled *pcmp in return.
+Then this function must return either a value 0 when succeeded, or a
+negative value as the error code.
+
+Finally, add #SND_PCM_PLUGIN_SYMBOL() with the name of your
+plugin as the argument at the end. This defines the proper versioned
+symbol as the reference.
+
+The typical code would look like below:
+\code
+struct myplug_info {
+ snd_pcm_extplug_t ext;
+ int my_own_data;
+ ...
+};
+
+SND_PCM_PLUGIN_DEFINE_FUNC(myplug)
+{
+ snd_config_iterator_t i, next;
+ snd_config_t *slave = NULL;
+ struct myplug_info *myplug;
+ int err;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "my_own_parameter") == 0) {
+ ....
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+
+ if (! slave) {
+ SNDERR("No slave defined for myplug");
+ return -EINVAL;
+ }
+
+ myplug = calloc(1, sizeof(*myplug));
+ if (myplug == NULL)
+ return -ENOMEM;
+
+ myplug->ext.version = SND_PCM_EXTPLUG_VERSION;
+ myplug->ext.name = "My Own Plugin";
+ myplug->ext.callback = &my_own_callback;
+ myplug->ext.private_data = myplug;
+ ....
+
+ err = snd_pcm_extplug_create(&myplug->ext, name, root, conf, stream, mode);
+ if (err < 0) {
+ myplug_free(myplug);
+ return err;
+ }
+
+ *pcmp = myplug->ext.pcm;
+ return 0;
+}
+
+SND_PCM_PLUGIN_SYMBOL(myplug);
+\endcode
+
+Read the codes in alsa-plugins package for the real examples.
+
+
+\section pcm_extplug External Plugin: Filter-Type Plugin
+
+The filter-type plugin is a plugin to convert the PCM signals from the input
+and feeds to the output. Thus, this plugin always needs a slave PCM as its output.
+
+The plugin can modify the format and the channels of the input/output PCM.
+It can <i>not</i> modify the sample rate (because of simplicity reason).
+
+The following fields have to be filled in extplug record before calling
+#snd_pcm_extplug_create() : version, name, callback.
+Otherfields are optional and should be initialized with zero.
+
+The constant #SND_PCM_EXTPLUG_VERSION must be passed to the version
+field for the version check in alsa-lib. A non-NULL ASCII string
+has to be passed to the name field. The callback field contains the
+table of callback functions for this plugin (defined as
+#snd_pcm_extplug_callback_t).
+
+The driver can set an arbitrary value (pointer) to private_data
+field to refer its own data in the callbacks.
+
+The rest fields are filled by #snd_pcm_extplug_create(). The pcm field
+is the resultant PCM handle. The others are the current status of the
+PCM.
+
+The callback functions in #snd_pcm_extplug_callback_t define the real
+behavior of the driver.
+At least, transfer callback must be given. This callback is called
+at each time certain size of data block is transfered to the slave
+PCM. Other callbacks are optional.
+
+The close callback is called when the PCM is closed. If the plugin
+allocates private resources, this is the place to release them
+again. The hw_params and hw_free callbacks are called at
+#snd_pcm_hw_params() and #snd_pcm_hw_free() API calls,
+respectively. The last, dump callback, is called for printing the
+information of the given plugin.
+
+The init callback is called when the PCM is at prepare state or any
+initialization is issued. Use this callback to reset the PCM instance
+to a sane initial state.
+
+The hw_params constraints can be defined via either
+#snd_pcm_extplug_set_param_minmax() and #snd_pcm_extplug_set_param_list()
+functions after calling #snd_pcm_extplug_create().
+The former defines the minimal and maximal acceptable values for the
+given hw_params parameter (SND_PCM_EXTPLUG_HW_XXX).
+This function can't be used for the format parameter. The latter
+function specifies the available parameter values as the list.
+As mentioned above, the rate can't be changed. Only changeable
+parameters are sample format and channels.
+
+To define the constraints of the slave PCM configuration, use
+either #snd_pcm_extplug_set_slave_param_minmax() and
+#snd_pcm_extplug_set_slave_param_list(). The arguments are as same
+as former functions.
+
+To clear the parameter constraints, call #snd_pcm_extplug_params_reset()
+function.
+
+*/
+
+/**
+ * \brief Create an extplug instance
+ * \param extplug the extplug handle
+ * \param name name of the PCM
+ * \param root configuration tree root
+ * \param slave_conf slave configuration root
+ * \param stream stream direction
+ * \param mode PCM open mode
+ * \return 0 if successful, or a negative error code
+ *
+ * Creates the extplug instance based on the given handle.
+ * The slave_conf argument is mandatory, and usually taken from the config tree of the
+ * PCM plugin as "slave" config value.
+ * name, root, stream and mode arguments are the values used for opening the PCM.
+ *
+ * The callback is the mandatory field of extplug handle. At least, start, stop and
+ * pointer callbacks must be set before calling this function.
+ */
+int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
+ snd_config_t *root, snd_config_t *slave_conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ extplug_priv_t *ext;
+ int err;
+ snd_pcm_t *spcm, *pcm;
+ snd_config_t *sconf;
+
+ assert(root);
+ assert(extplug && extplug->callback);
+ assert(extplug->callback->transfer);
+ assert(slave_conf);
+
+ if (extplug->version != SND_PCM_EXTPLUG_VERSION) {
+ SNDERR("extplug: Plugin version mismatch\n");
+ return -ENXIO;
+ }
+
+ err = snd_pcm_slave_conf(root, slave_conf, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, NULL);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+
+ ext = calloc(1, sizeof(*ext));
+ if (! ext)
+ return -ENOMEM;
+
+ ext->data = extplug;
+ extplug->stream = stream;
+
+ snd_pcm_plugin_init(&ext->plug);
+ ext->plug.read = snd_pcm_extplug_read_areas;
+ ext->plug.write = snd_pcm_extplug_write_areas;
+ ext->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ ext->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ ext->plug.gen.slave = spcm;
+ ext->plug.gen.close_slave = 1;
+ if (extplug->callback->init)
+ ext->plug.init = snd_pcm_extplug_init;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_EXTPLUG, name, stream, mode);
+ if (err < 0) {
+ free(ext);
+ return err;
+ }
+
+ extplug->pcm = pcm;
+ pcm->ops = &snd_pcm_extplug_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = ext;
+ pcm->poll_fd = spcm->poll_fd;
+ pcm->poll_events = spcm->poll_events;
+ snd_pcm_set_hw_ptr(pcm, &ext->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &ext->plug.appl_ptr, -1, 0);
+
+ return 0;
+}
+
+/**
+ * \brief Delete the extplug instance
+ * \param extplug the extplug handle to delete
+ * \return 0 if successful, or a negative error code
+ *
+ * The destructor of extplug instance.
+ * Closes the PCM and deletes the associated resources.
+ */
+int snd_pcm_extplug_delete(snd_pcm_extplug_t *extplug)
+{
+ return snd_pcm_close(extplug->pcm);
+}
+
+
+/**
+ * \brief Reset extplug parameters
+ * \param extplug the extplug handle
+ *
+ * Resets the all parameters for the given extplug handle.
+ */
+void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *extplug)
+{
+ extplug_priv_t *ext = extplug->pcm->private_data;
+ clear_ext_params(ext);
+}
+
+/**
+ * \brief Set slave parameter as the list
+ * \param extplug the extplug handle
+ * \param type parameter type
+ * \param num_list number of available values
+ * \param list the list of available values
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the slave parameter as the list.
+ * The available values of the given parameter type of the slave PCM is restricted
+ * to the ones of the given list.
+ */
+int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
+{
+ extplug_priv_t *ext = extplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ return snd_ext_parm_set_list(&ext->sparams[type], num_list, list);
+}
+
+/**
+ * \brief Set slave parameter as the min/max values
+ * \param extplug the extplug handle
+ * \param type parameter type
+ * \param min the minimum value
+ * \param max the maximum value
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the slave parameter as the min/max values.
+ * The available values of the given parameter type of the slave PCM is restricted
+ * between the given minimum and maximum values.
+ */
+int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
+{
+ extplug_priv_t *ext = extplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ if (is_mask_type(type)) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ return snd_ext_parm_set_minmax(&ext->sparams[type], min, max);
+}
+
+/**
+ * \brief Set master parameter as the list
+ * \param extplug the extplug handle
+ * \param type parameter type
+ * \param num_list number of available values
+ * \param list the list of available values
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the master parameter as the list.
+ * The available values of the given parameter type of this PCM (as input) is restricted
+ * to the ones of the given list.
+ */
+int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list)
+{
+ extplug_priv_t *ext = extplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ return snd_ext_parm_set_list(&ext->params[type], num_list, list);
+}
+
+/**
+ * \brief Set master parameter as the min/max values
+ * \param extplug the extplug handle
+ * \param type parameter type
+ * \param min the minimum value
+ * \param max the maximum value
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the master parameter as the min/max values.
+ * The available values of the given parameter type of this PCM (as input) is restricted
+ * between the given minimum and maximum values.
+ */
+int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max)
+{
+ extplug_priv_t *ext = extplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_EXTPLUG_HW_PARAMS) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ if (is_mask_type(type)) {
+ SNDERR("EXTPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ return snd_ext_parm_set_minmax(&ext->params[type], min, max);
+}
+
diff --git a/alsa-lib/src/pcm/pcm_file.c b/alsa-lib/src/pcm/pcm_file.c
new file mode 100644
index 0000000..82823a0
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_file.c
@@ -0,0 +1,793 @@
+/**
+ * \file pcm/pcm_file.c
+ * \ingroup PCM_Plugins
+ * \brief PCM File Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - File plugin
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <endian.h>
+#include <byteswap.h>
+#include <ctype.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_file = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef enum _snd_pcm_file_format {
+ SND_PCM_FILE_FORMAT_RAW,
+ SND_PCM_FILE_FORMAT_WAV
+} snd_pcm_file_format_t;
+
+/* WAV format chunk */
+struct wav_fmt {
+ short fmt;
+ short chan;
+ int rate;
+ int bps;
+ short bwidth;
+ short bits;
+};
+
+typedef struct {
+ snd_pcm_generic_t gen;
+ char *fname;
+ int fd;
+ char *ifname;
+ int ifd;
+ int format;
+ snd_pcm_uframes_t appl_ptr;
+ snd_pcm_uframes_t file_ptr_bytes;
+ snd_pcm_uframes_t wbuf_size;
+ size_t wbuf_size_bytes;
+ size_t wbuf_used_bytes;
+ char *wbuf;
+ size_t rbuf_size_bytes;
+ size_t rbuf_used_bytes;
+ char *rbuf;
+ snd_pcm_channel_area_t *wbuf_areas;
+ size_t buffer_bytes;
+ struct wav_fmt wav_header;
+ size_t filelen;
+} snd_pcm_file_t;
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define TO_LE32(x) (x)
+#define TO_LE16(x) (x)
+#else
+#define TO_LE32(x) bswap_32(x)
+#define TO_LE16(x) bswap_16(x)
+#endif
+
+static void setup_wav_header(snd_pcm_t *pcm, struct wav_fmt *fmt)
+{
+ fmt->fmt = TO_LE16(0x01);
+ fmt->chan = TO_LE16(pcm->channels);
+ fmt->rate = TO_LE32(pcm->rate);
+ fmt->bwidth = pcm->frame_bits / 8;
+ fmt->bps = fmt->bwidth * pcm->rate;
+ fmt->bits = snd_pcm_format_width(pcm->format);
+ fmt->bps = TO_LE32(fmt->bps);
+ fmt->bwidth = TO_LE16(fmt->bwidth);
+ fmt->bits = TO_LE16(fmt->bits);
+}
+
+static int write_wav_header(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ static const char header[] = {
+ 'R', 'I', 'F', 'F',
+ 0x24, 0, 0, 0,
+ 'W', 'A', 'V', 'E',
+ 'f', 'm', 't', ' ',
+ 0x10, 0, 0, 0,
+ };
+ static const char header2[] = {
+ 'd', 'a', 't', 'a',
+ 0, 0, 0, 0
+ };
+
+ setup_wav_header(pcm, &file->wav_header);
+
+ if (write(file->fd, header, sizeof(header)) != sizeof(header) ||
+ write(file->fd, &file->wav_header, sizeof(file->wav_header)) !=
+ sizeof(file->wav_header) ||
+ write(file->fd, header2, sizeof(header2)) != sizeof(header2)) {
+ int err = errno;
+ SYSERR("Write error.\n");
+ return -err;
+ }
+ return 0;
+}
+
+/* fix up the length fields in WAV header */
+static void fixup_wav_header(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ int len, ret;
+
+ /* RIFF length */
+ if (lseek(file->fd, 4, SEEK_SET) == 4) {
+ len = (file->filelen + 0x24) > 0x7fffffff ?
+ 0x7fffffff : (int)(file->filelen + 0x24);
+ len = TO_LE32(len);
+ ret = write(file->fd, &len, 4);
+ if (ret < 0)
+ return;
+ }
+ /* data length */
+ if (lseek(file->fd, 0x28, SEEK_SET) == 0x28) {
+ len = file->filelen > 0x7fffffff ?
+ 0x7fffffff : (int)file->filelen;
+ len = TO_LE32(len);
+ ret = write(file->fd, &len, 4);
+ if (ret < 0)
+ return;
+ }
+}
+#endif /* DOC_HIDDEN */
+
+static void snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ assert(bytes <= file->wbuf_used_bytes);
+
+ if (file->format == SND_PCM_FILE_FORMAT_WAV &&
+ !file->wav_header.fmt) {
+ if (write_wav_header(pcm) < 0)
+ return;
+ }
+
+ while (bytes > 0) {
+ snd_pcm_sframes_t err;
+ size_t n = bytes;
+ size_t cont = file->wbuf_size_bytes - file->file_ptr_bytes;
+ if (n > cont)
+ n = cont;
+ err = write(file->fd, file->wbuf + file->file_ptr_bytes, n);
+ if (err < 0) {
+ SYSERR("write failed");
+ break;
+ }
+ bytes -= err;
+ file->wbuf_used_bytes -= err;
+ file->file_ptr_bytes += err;
+ if (file->file_ptr_bytes == file->wbuf_size_bytes)
+ file->file_ptr_bytes = 0;
+ file->filelen += err;
+ if ((snd_pcm_uframes_t)err != n)
+ break;
+ }
+}
+
+static void snd_pcm_file_add_frames(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t frames)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ while (frames > 0) {
+ snd_pcm_uframes_t n = frames;
+ snd_pcm_uframes_t cont = file->wbuf_size - file->appl_ptr;
+ snd_pcm_uframes_t avail = file->wbuf_size - snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes);
+ if (n > cont)
+ n = cont;
+ if (n > avail)
+ n = avail;
+ snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr,
+ areas, offset,
+ pcm->channels, n, pcm->format);
+ frames -= n;
+ offset += n;
+ file->appl_ptr += n;
+ if (file->appl_ptr == file->wbuf_size)
+ file->appl_ptr = 0;
+ file->wbuf_used_bytes += snd_pcm_frames_to_bytes(pcm, n);
+ if (file->wbuf_used_bytes > file->buffer_bytes)
+ snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes - file->buffer_bytes);
+ assert(file->wbuf_used_bytes < file->wbuf_size_bytes);
+ }
+}
+
+static int snd_pcm_file_close(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ if (file->fname) {
+ if (file->wav_header.fmt)
+ fixup_wav_header(pcm);
+ free((void *)file->fname);
+ close(file->fd);
+ }
+ if (file->ifname) {
+ free((void *)file->ifname);
+ close(file->ifd);
+ }
+ return snd_pcm_generic_close(pcm);
+}
+
+static int snd_pcm_file_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ int err = snd_pcm_reset(file->gen.slave);
+ if (err >= 0) {
+ /* FIXME: Questionable here */
+ snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes);
+ assert(file->wbuf_used_bytes == 0);
+ }
+ return err;
+}
+
+static int snd_pcm_file_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ int err = snd_pcm_drop(file->gen.slave);
+ if (err >= 0) {
+ /* FIXME: Questionable here */
+ snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes);
+ assert(file->wbuf_used_bytes == 0);
+ }
+ return err;
+}
+
+static int snd_pcm_file_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ int err = snd_pcm_drain(file->gen.slave);
+ if (err >= 0) {
+ snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes);
+ assert(file->wbuf_used_bytes == 0);
+ }
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_rewindable(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_sframes_t res = snd_pcm_rewindable(pcm);
+ snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes);
+ if (res > n)
+ res = n;
+ return res;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_sframes_t err;
+ snd_pcm_uframes_t n;
+
+ n = snd_pcm_frames_to_bytes(pcm, frames);
+ if (n > file->wbuf_used_bytes)
+ frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes);
+ err = snd_pcm_rewind(file->gen.slave, frames);
+ if (err > 0) {
+ file->appl_ptr = (file->appl_ptr - err + file->wbuf_size) % file->wbuf_size;
+ n = snd_pcm_frames_to_bytes(pcm, err);
+ file->wbuf_used_bytes -= n;
+ }
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_forwardable(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_sframes_t res = snd_pcm_forwardable(pcm);
+ snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes);
+ if (res > n)
+ res = n;
+ return res;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_sframes_t err;
+ snd_pcm_uframes_t n;
+
+ n = snd_pcm_frames_to_bytes(pcm, frames);
+ if (file->wbuf_used_bytes + n > file->wbuf_size_bytes)
+ frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes);
+ err = INTERNAL(snd_pcm_forward)(file->gen.slave, frames);
+ if (err > 0) {
+ file->appl_ptr = (file->appl_ptr + err) % file->wbuf_size;
+ n = snd_pcm_frames_to_bytes(pcm, err);
+ file->wbuf_used_bytes += n;
+ }
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_sframes_t n = snd_pcm_writei(file->gen.slave, buffer, size);
+ if (n > 0) {
+ snd_pcm_areas_from_buf(pcm, areas, (void*) buffer);
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
+ }
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_sframes_t n = snd_pcm_writen(file->gen.slave, bufs, size);
+ if (n > 0) {
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
+ }
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_sframes_t n;
+
+ n = snd_pcm_readi(file->gen.slave, buffer, size);
+ if (n <= 0)
+ return n;
+ if (file->ifd >= 0) {
+ n = read(file->ifd, buffer, n * pcm->frame_bits / 8);
+ if (n < 0)
+ return n;
+ return n * 8 / pcm->frame_bits;
+ }
+ snd_pcm_areas_from_buf(pcm, areas, buffer);
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_sframes_t n;
+
+ if (file->ifd >= 0) {
+ SNDERR("DEBUG: Noninterleaved read not yet implemented.\n");
+ return 0; /* TODO: Noninterleaved read */
+ }
+
+ n = snd_pcm_readn(file->gen.slave, bufs, size);
+ if (n > 0) {
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
+ }
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ snd_pcm_uframes_t ofs;
+ snd_pcm_uframes_t siz = size;
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_sframes_t result;
+
+ snd_pcm_mmap_begin(file->gen.slave, &areas, &ofs, &siz);
+ assert(ofs == offset && siz == size);
+ result = snd_pcm_mmap_commit(file->gen.slave, ofs, siz);
+ if (result > 0)
+ snd_pcm_file_add_frames(pcm, areas, ofs, result);
+ return result;
+}
+
+static int snd_pcm_file_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ free(file->wbuf);
+ free(file->wbuf_areas);
+ file->wbuf = NULL;
+ file->wbuf_areas = NULL;
+ return snd_pcm_hw_free(file->gen.slave);
+}
+
+static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ unsigned int channel;
+ snd_pcm_t *slave = file->gen.slave;
+ int err = _snd_pcm_hw_params(slave, params);
+ if (err < 0)
+ return err;
+ file->buffer_bytes = snd_pcm_frames_to_bytes(slave, slave->buffer_size);
+ file->wbuf_size = slave->buffer_size * 2;
+ file->wbuf_size_bytes = snd_pcm_frames_to_bytes(slave, file->wbuf_size);
+ file->wbuf_used_bytes = 0;
+ assert(!file->wbuf);
+ file->wbuf = malloc(file->wbuf_size_bytes);
+ if (file->wbuf == NULL) {
+ snd_pcm_file_hw_free(pcm);
+ return -ENOMEM;
+ }
+ file->wbuf_areas = malloc(sizeof(*file->wbuf_areas) * slave->channels);
+ if (file->wbuf_areas == NULL) {
+ snd_pcm_file_hw_free(pcm);
+ return -ENOMEM;
+ }
+ file->appl_ptr = file->file_ptr_bytes = 0;
+ for (channel = 0; channel < slave->channels; ++channel) {
+ snd_pcm_channel_area_t *a = &file->wbuf_areas[channel];
+ a->addr = file->wbuf;
+ a->first = slave->sample_bits * channel;
+ a->step = slave->frame_bits;
+ }
+ return 0;
+}
+
+static void snd_pcm_file_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_file_t *file = pcm->private_data;
+ if (file->fname)
+ snd_output_printf(out, "File PCM (file=%s)\n", file->fname);
+ else
+ snd_output_printf(out, "File PCM (fd=%d)\n", file->fd);
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(file->gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_file_ops = {
+ .close = snd_pcm_file_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_generic_hw_refine,
+ .hw_params = snd_pcm_file_hw_params,
+ .hw_free = snd_pcm_file_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_file_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_file_fast_ops = {
+ .status = snd_pcm_generic_status,
+ .state = snd_pcm_generic_state,
+ .hwsync = snd_pcm_generic_hwsync,
+ .delay = snd_pcm_generic_delay,
+ .prepare = snd_pcm_generic_prepare,
+ .reset = snd_pcm_file_reset,
+ .start = snd_pcm_generic_start,
+ .drop = snd_pcm_file_drop,
+ .drain = snd_pcm_file_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewindable = snd_pcm_file_rewindable,
+ .rewind = snd_pcm_file_rewind,
+ .forwardable = snd_pcm_file_forwardable,
+ .forward = snd_pcm_file_forward,
+ .resume = snd_pcm_generic_resume,
+ .link = snd_pcm_generic_link,
+ .link_slaves = snd_pcm_generic_link_slaves,
+ .unlink = snd_pcm_generic_unlink,
+ .writei = snd_pcm_file_writei,
+ .writen = snd_pcm_file_writen,
+ .readi = snd_pcm_file_readi,
+ .readn = snd_pcm_file_readn,
+ .avail_update = snd_pcm_generic_avail_update,
+ .mmap_commit = snd_pcm_file_mmap_commit,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_revents = snd_pcm_generic_poll_revents,
+};
+
+/**
+ * \brief Creates a new File PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param fname Output filename (or NULL if file descriptor fd is available)
+ * \param fd Output file descriptor
+ * \param ifname Input filename (or NULL if file descriptor ifd is available)
+ * \param ifd Input file descriptor (if (ifd < 0) && (ifname == NULL), no input
+ * redirection will be performed)
+ * \param trunc Truncate the file if it already exists
+ * \param fmt File format ("raw" or "wav" are available)
+ * \param perm File permission
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
+ const char *fname, int fd, const char *ifname, int ifd,
+ int trunc,
+ const char *fmt, int perm, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_file_t *file;
+ snd_pcm_file_format_t format;
+ struct timespec timespec;
+ char *tmpname = NULL;
+ int err;
+
+ assert(pcmp);
+ if (fmt == NULL ||
+ strcmp(fmt, "raw") == 0)
+ format = SND_PCM_FILE_FORMAT_RAW;
+ else if (!strcmp(fmt, "wav"))
+ format = SND_PCM_FILE_FORMAT_WAV;
+ else {
+ SNDERR("file format %s is unknown", fmt);
+ return -EINVAL;
+ }
+ if (fname) {
+ if (trunc)
+ fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, perm);
+ else {
+ fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, perm);
+ if (fd < 0) {
+ int idx, len;
+ len = strlen(fname) + 6;
+ tmpname = malloc(len);
+ if (!tmpname)
+ return -ENOMEM;
+ for (idx = 1; idx < 10000; idx++) {
+ snprintf(tmpname, len,
+ "%s.%04d", fname, idx);
+ fd = open(tmpname, O_WRONLY|O_CREAT|O_EXCL, perm);
+ if (fd >= 0) {
+ fname = tmpname;
+ break;
+ }
+ }
+ }
+ }
+ if (fd < 0) {
+ SYSERR("open %s for writing failed", fname);
+ free(tmpname);
+ return -errno;
+ }
+ }
+ file = calloc(1, sizeof(snd_pcm_file_t));
+ if (!file) {
+ if (fname)
+ close(fd);
+ free(tmpname);
+ return -ENOMEM;
+ }
+
+ if (ifname) {
+ ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */
+ if (ifd < 0) {
+ SYSERR("open %s for reading failed", ifname);
+ if (fname)
+ close(fd);
+ free(file);
+ free(tmpname);
+ return -errno;
+ }
+ }
+
+ if (fname)
+ file->fname = strdup(fname);
+ if (ifname)
+ file->ifname = strdup(ifname);
+ file->fd = fd;
+ file->ifd = ifd;
+ file->format = format;
+ file->gen.slave = slave;
+ file->gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(file->fname);
+ free(file);
+ free(tmpname);
+ return err;
+ }
+ pcm->ops = &snd_pcm_file_ops;
+ pcm->fast_ops = &snd_pcm_file_fast_ops;
+ pcm->private_data = file;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->mmap_shadow = 1;
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ pcm->monotonic = clock_gettime(CLOCK_MONOTONIC, &timespec) == 0;
+#else
+ pcm->monotonic = 0;
+#endif
+ snd_pcm_link_hw_ptr(pcm, slave);
+ snd_pcm_link_appl_ptr(pcm, slave);
+ *pcmp = pcm;
+
+ free(tmpname);
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_file Plugin: File
+
+This plugin stores contents of a PCM stream to file, and optionally
+uses an existing file as an input data source (i.e., "virtual mic")
+
+\code
+pcm.name {
+ type file # File PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ file STR # Output filename
+ or
+ file INT # Output file descriptor number
+ infile STR # Input filename - only raw format
+ or
+ infile INT # Input file descriptor number
+ [format STR] # File format ("raw" or "wav")
+ [perm INT] # Output file permission (octal, def. 0600)
+}
+\endcode
+
+\subsection pcm_plugins_file_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_file_open()
+ <LI>_snd_pcm_file_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new File PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with File PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ const char *fname = NULL, *ifname = NULL;
+ const char *format = NULL;
+ long fd = -1, ifd = -1, trunc = 1;
+ long perm = 0600;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "format") == 0) {
+ err = snd_config_get_string(n, &format);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "file") == 0) {
+ err = snd_config_get_string(n, &fname);
+ if (err < 0) {
+ err = snd_config_get_integer(n, &fd);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ }
+ continue;
+ }
+ if (strcmp(id, "infile") == 0) {
+ err = snd_config_get_string(n, &ifname);
+ if (err < 0) {
+ err = snd_config_get_integer(n, &ifd);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ }
+ continue;
+ }
+ if (strcmp(id, "perm") == 0) {
+ err = snd_config_get_integer(n, &perm);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ if ((perm & ~0777) != 0) {
+ SNDERR("The field perm must be a valid file permission");
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "truncate") == 0) {
+ err = snd_config_get_bool(n);
+ if (err < 0)
+ return -EINVAL;
+ trunc = err;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!format) {
+ snd_config_t *n;
+ /* read defaults */
+ if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
+ err = snd_config_get_string(n, &format);
+ if (err < 0) {
+ SNDERR("Invalid file format");
+ return -EINVAL;
+ }
+ }
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ if (!fname && fd < 0 && !ifname) {
+ snd_config_delete(sconf);
+ SNDERR("file is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_file_open(pcmp, name, fname, fd, ifname, ifd,
+ trunc, format, perm, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_generic.c b/alsa-lib/src/pcm/pcm_generic.c
new file mode 100644
index 0000000..d26aead
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_generic.c
@@ -0,0 +1,325 @@
+/**
+ * \file pcm/pcm_generic.c
+ * \ingroup PCM
+ * \brief PCM Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2004
+ */
+/*
+ * PCM - Common generic plugin code
+ * Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <sys/ioctl.h>
+#include <limits.h>
+#include "pcm_local.h"
+#include "pcm_generic.h"
+
+#ifndef DOC_HIDDEN
+
+int snd_pcm_generic_close(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ int err = 0;
+ if (generic->close_slave)
+ err = snd_pcm_close(generic->slave);
+ free(generic);
+ return 0;
+}
+
+int snd_pcm_generic_nonblock(snd_pcm_t *pcm, int nonblock)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_nonblock(generic->slave, nonblock);
+}
+
+int snd_pcm_generic_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_async(generic->slave, sig, pid);
+}
+
+int snd_pcm_generic_poll_descriptors_count(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_poll_descriptors_count(generic->slave);
+}
+
+int snd_pcm_generic_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_poll_descriptors(generic->slave, pfds, space);
+}
+
+int snd_pcm_generic_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_poll_descriptors_revents(generic->slave, pfds, nfds, revents);
+}
+
+int snd_pcm_generic_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_info(generic->slave, info);
+}
+
+int snd_pcm_generic_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_hw_free(generic->slave);
+}
+
+int snd_pcm_generic_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_sw_params(generic->slave, params);
+}
+
+int snd_pcm_generic_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_hw_refine(generic->slave, params);
+}
+
+int snd_pcm_generic_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return _snd_pcm_hw_params(generic->slave, params);
+}
+
+int snd_pcm_generic_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_prepare(generic->slave);
+}
+
+int snd_pcm_generic_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ if (pcm->mmap_shadow) {
+ /* No own buffer is required - the plugin won't change
+ * the data on the buffer, or do safely on-the-place
+ * conversion
+ */
+ return snd_pcm_channel_info(generic->slave, info);
+ } else {
+ /* Allocate own buffer */
+ return snd_pcm_channel_info_shm(pcm, info, -1);
+ }
+}
+
+int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_status(generic->slave, status);
+}
+
+snd_pcm_state_t snd_pcm_generic_state(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_state(generic->slave);
+}
+
+int snd_pcm_generic_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_hwsync(generic->slave);
+}
+
+int snd_pcm_generic_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_reset(generic->slave);
+}
+
+int snd_pcm_generic_start(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_start(generic->slave);
+}
+
+int snd_pcm_generic_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_drop(generic->slave);
+}
+
+int snd_pcm_generic_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_drain(generic->slave);
+}
+
+int snd_pcm_generic_pause(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_pause(generic->slave, enable);
+}
+
+int snd_pcm_generic_resume(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_resume(generic->slave);
+}
+
+int snd_pcm_generic_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_delay(generic->slave, delayp);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_forwardable(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_forwardable(generic->slave);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return INTERNAL(snd_pcm_forward)(generic->slave, frames);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_rewindable(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_rewindable(generic->slave);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_rewind(generic->slave, frames);
+}
+
+int snd_pcm_generic_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
+{
+ snd_pcm_generic_t *generic = pcm1->private_data;
+ if (generic->slave->fast_ops->link)
+ return generic->slave->fast_ops->link(generic->slave->fast_op_arg, pcm2);
+ return -ENOSYS;
+}
+
+int snd_pcm_generic_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ if (generic->slave->fast_ops->link_slaves)
+ return generic->slave->fast_ops->link_slaves(generic->slave->fast_op_arg, master);
+ return -ENOSYS;
+}
+
+int snd_pcm_generic_unlink(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ if (generic->slave->fast_ops->unlink)
+ return generic->slave->fast_ops->unlink(generic->slave->fast_op_arg);
+ return -ENOSYS;
+}
+
+snd_pcm_sframes_t snd_pcm_generic_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_writei(generic->slave, buffer, size);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_writen(generic->slave, bufs, size);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_readi(generic->slave, buffer, size);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_readn(generic->slave, bufs, size);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_mmap_commit(generic->slave, offset, size);
+}
+
+snd_pcm_sframes_t snd_pcm_generic_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_avail_update(generic->slave);
+}
+
+int snd_pcm_generic_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_htimestamp(generic->slave, avail, tstamp);
+}
+
+/* stand-alone version - similar like snd_pcm_hw_htimestamp but
+ * taking the tstamp via gettimestamp().
+ */
+int snd_pcm_generic_real_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_sframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ avail1 = snd_pcm_avail_update(pcm);
+ if (avail1 < 0)
+ return avail1;
+ if (ok && (snd_pcm_uframes_t)avail1 == *avail)
+ break;
+ *avail = avail1;
+ gettimestamp(tstamp, pcm->monotonic);
+ ok = 1;
+ }
+ return 0;
+}
+
+int snd_pcm_generic_mmap(snd_pcm_t *pcm)
+{
+ if (pcm->mmap_shadow) {
+ /* Copy the slave mmapped buffer data */
+ snd_pcm_generic_t *generic = pcm->private_data;
+ pcm->mmap_channels = generic->slave->mmap_channels;
+ pcm->running_areas = generic->slave->running_areas;
+ pcm->stopped_areas = generic->slave->stopped_areas;
+ }
+ return 0;
+}
+
+int snd_pcm_generic_munmap(snd_pcm_t *pcm)
+{
+ if (pcm->mmap_shadow) {
+ /* Clean up */
+ pcm->mmap_channels = NULL;
+ pcm->running_areas = NULL;
+ pcm->stopped_areas = NULL;
+ }
+ return 0;
+}
+
+#endif /* DOC_HIDDEN */
diff --git a/alsa-lib/src/pcm/pcm_generic.h b/alsa-lib/src/pcm/pcm_generic.h
new file mode 100644
index 0000000..430b8cf
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_generic.h
@@ -0,0 +1,151 @@
+/*
+ * PCM - Common generic plugin code
+ * Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+typedef struct {
+ snd_pcm_t *slave;
+ int close_slave;
+} snd_pcm_generic_t;
+
+/* make local functions really local */
+#define snd_pcm_generic_close \
+ snd1_pcm_generic_close
+#define snd_pcm_generic_nonblock \
+ snd1_pcm_generic_nonblock
+#define snd_pcm_generic_async \
+ snd1_pcm_generic_async
+#define snd_pcm_generic_poll_descriptors_count \
+ snd1_pcm_generic_poll_descriptors_count
+#define snd_pcm_generic_poll_descriptors \
+ snd1_pcm_generic_poll_descriptors
+#define snd_pcm_generic_poll_revents \
+ snd1_pcm_generic_poll_revents
+#define snd_pcm_generic_info \
+ snd1_pcm_generic_info
+#define snd_pcm_generic_hw_free \
+ snd1_pcm_generic_hw_free
+#define snd_pcm_generic_sw_params \
+ snd1_pcm_generic_sw_params
+#define snd_pcm_generic_hw_refine \
+ snd1_pcm_generic_hw_refine
+#define snd_pcm_generic_hw_params \
+ snd1_pcm_generic_hw_params
+#define snd_pcm_generic_channel_info \
+ snd1_pcm_generic_channel_info
+#define snd_pcm_generic_channel_info_no_buffer \
+ snd1_pcm_generic_channel_info_no_buffer
+#define snd_pcm_generic_status \
+ snd1_pcm_generic_status
+#define snd_pcm_generic_state \
+ snd1_pcm_generic_state
+#define snd_pcm_generic_prepare \
+ snd1_pcm_generic_prepare
+#define snd_pcm_generic_hwsync \
+ snd1_pcm_generic_hwsync
+#define snd_pcm_generic_reset \
+ snd1_pcm_generic_reset
+#define snd_pcm_generic_start \
+ snd1_pcm_generic_start
+#define snd_pcm_generic_drop \
+ snd1_pcm_generic_drop
+#define snd_pcm_generic_drain \
+ snd1_pcm_generic_drain
+#define snd_pcm_generic_pause \
+ snd1_pcm_generic_pause
+#define snd_pcm_generic_resume \
+ snd1_pcm_generic_resume
+#define snd_pcm_generic_delay \
+ snd1_pcm_generic_delay
+#define snd_pcm_generic_forwardable \
+ snd1_pcm_generic_forwardable
+#define snd_pcm_generic_forward \
+ snd1_pcm_generic_forward
+#define snd_pcm_generic_rewindable \
+ snd1_pcm_generic_rewindable
+#define snd_pcm_generic_rewind \
+ snd1_pcm_generic_rewind
+#define snd_pcm_generic_link \
+ snd1_pcm_generic_link
+#define snd_pcm_generic_link_slaves \
+ snd1_pcm_generic_link_slaves
+#define snd_pcm_generic_unlink \
+ snd1_pcm_generic_unlink
+#define snd_pcm_generic_writei \
+ snd1_pcm_generic_writei
+#define snd_pcm_generic_writen \
+ snd1_pcm_generic_writen
+#define snd_pcm_generic_readi \
+ snd1_pcm_generic_readi
+#define snd_pcm_generic_readn \
+ snd1_pcm_generic_readn
+#define snd_pcm_generic_mmap_commit \
+ snd1_pcm_generic_mmap_commit
+#define snd_pcm_generic_avail_update \
+ snd1_pcm_generic_avail_update
+#define snd_pcm_generic_mmap \
+ snd1_pcm_generic_mmap
+#define snd_pcm_generic_munmap \
+ snd1_pcm_generic_munmap
+
+int snd_pcm_generic_close(snd_pcm_t *pcm);
+int snd_pcm_generic_nonblock(snd_pcm_t *pcm, int nonblock);
+int snd_pcm_generic_async(snd_pcm_t *pcm, int sig, pid_t pid);
+int snd_pcm_generic_poll_descriptors_count(snd_pcm_t *pcm);
+int snd_pcm_generic_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
+int snd_pcm_generic_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+int snd_pcm_generic_info(snd_pcm_t *pcm, snd_pcm_info_t * info);
+int snd_pcm_generic_hw_free(snd_pcm_t *pcm);
+int snd_pcm_generic_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+int snd_pcm_generic_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_generic_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_generic_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info);
+int snd_pcm_generic_channel_info_no_buffer(snd_pcm_t *pcm, snd_pcm_channel_info_t * info);
+int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status);
+snd_pcm_state_t snd_pcm_generic_state(snd_pcm_t *pcm);
+int snd_pcm_generic_prepare(snd_pcm_t *pcm);
+int snd_pcm_generic_hwsync(snd_pcm_t *pcm);
+int snd_pcm_generic_reset(snd_pcm_t *pcm);
+int snd_pcm_generic_start(snd_pcm_t *pcm);
+int snd_pcm_generic_drop(snd_pcm_t *pcm);
+int snd_pcm_generic_drain(snd_pcm_t *pcm);
+int snd_pcm_generic_pause(snd_pcm_t *pcm, int enable);
+int snd_pcm_generic_resume(snd_pcm_t *pcm);
+int snd_pcm_generic_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
+snd_pcm_sframes_t snd_pcm_generic_forwardable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_generic_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+snd_pcm_sframes_t snd_pcm_generic_rewindable(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_generic_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+int snd_pcm_generic_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
+int snd_pcm_generic_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master);
+int snd_pcm_generic_unlink(snd_pcm_t *pcm);
+snd_pcm_sframes_t snd_pcm_generic_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_generic_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_generic_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_generic_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_generic_avail_update(snd_pcm_t *pcm);
+int snd_pcm_generic_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *timestamp);
+int snd_pcm_generic_real_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp);
+int snd_pcm_generic_mmap(snd_pcm_t *pcm);
+int snd_pcm_generic_munmap(snd_pcm_t *pcm);
diff --git a/alsa-lib/src/pcm/pcm_hooks.c b/alsa-lib/src/pcm/pcm_hooks.c
new file mode 100644
index 0000000..826685f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_hooks.c
@@ -0,0 +1,683 @@
+/**
+ * \file pcm/pcm_hooks.c
+ * \ingroup PCM_Hook
+ * \brief PCM Hook Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Hook functions
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_generic.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_hooks = "";
+#endif
+
+#ifndef DOC_HIDDEN
+struct _snd_pcm_hook {
+ snd_pcm_t *pcm;
+ snd_pcm_hook_func_t func;
+ void *private_data;
+ struct list_head list;
+};
+
+typedef struct {
+ snd_pcm_generic_t gen;
+ struct list_head hooks[SND_PCM_HOOK_TYPE_LAST + 1];
+} snd_pcm_hooks_t;
+#endif
+
+static int snd_pcm_hooks_close(snd_pcm_t *pcm)
+{
+ snd_pcm_hooks_t *h = pcm->private_data;
+ struct list_head *pos, *next;
+ unsigned int k;
+ int res = 0, err;
+
+ list_for_each_safe(pos, next, &h->hooks[SND_PCM_HOOK_TYPE_CLOSE]) {
+ snd_pcm_hook_t *hook = list_entry(pos, snd_pcm_hook_t, list);
+ err = hook->func(hook);
+ if (err < 0)
+ res = err;
+ }
+ for (k = 0; k <= SND_PCM_HOOK_TYPE_LAST; ++k) {
+ struct list_head *hooks = &h->hooks[k];
+ while (!list_empty(hooks)) {
+ snd_pcm_hook_t *hook;
+ pos = hooks->next;
+ hook = list_entry(pos, snd_pcm_hook_t, list);
+ snd_pcm_hook_remove(hook);
+ }
+ }
+ err = snd_pcm_generic_close(pcm);
+ if (err < 0)
+ res = err;
+ return res;
+}
+
+static int snd_pcm_hooks_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_hooks_t *h = pcm->private_data;
+ struct list_head *pos, *next;
+ int err = snd_pcm_generic_hw_params(pcm, params);
+ if (err < 0)
+ return err;
+ list_for_each_safe(pos, next, &h->hooks[SND_PCM_HOOK_TYPE_HW_PARAMS]) {
+ snd_pcm_hook_t *hook = list_entry(pos, snd_pcm_hook_t, list);
+ err = hook->func(hook);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hooks_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_hooks_t *h = pcm->private_data;
+ struct list_head *pos, *next;
+ int err = snd_pcm_generic_hw_free(pcm);
+ if (err < 0)
+ return err;
+ list_for_each_safe(pos, next, &h->hooks[SND_PCM_HOOK_TYPE_HW_FREE]) {
+ snd_pcm_hook_t *hook = list_entry(pos, snd_pcm_hook_t, list);
+ err = hook->func(hook);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static void snd_pcm_hooks_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_hooks_t *h = pcm->private_data;
+ snd_output_printf(out, "Hooks PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(h->gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_hooks_ops = {
+ .close = snd_pcm_hooks_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_generic_hw_refine,
+ .hw_params = snd_pcm_hooks_hw_params,
+ .hw_free = snd_pcm_hooks_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_hooks_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_hooks_fast_ops = {
+ .status = snd_pcm_generic_status,
+ .state = snd_pcm_generic_state,
+ .hwsync = snd_pcm_generic_hwsync,
+ .delay = snd_pcm_generic_delay,
+ .prepare = snd_pcm_generic_prepare,
+ .reset = snd_pcm_generic_reset,
+ .start = snd_pcm_generic_start,
+ .drop = snd_pcm_generic_drop,
+ .drain = snd_pcm_generic_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewindable = snd_pcm_generic_rewindable,
+ .rewind = snd_pcm_generic_rewind,
+ .forwardable = snd_pcm_generic_forwardable,
+ .forward = snd_pcm_generic_forward,
+ .resume = snd_pcm_generic_resume,
+ .link = snd_pcm_generic_link,
+ .link_slaves = snd_pcm_generic_link_slaves,
+ .unlink = snd_pcm_generic_unlink,
+ .writei = snd_pcm_generic_writei,
+ .writen = snd_pcm_generic_writen,
+ .readi = snd_pcm_generic_readi,
+ .readn = snd_pcm_generic_readn,
+ .avail_update = snd_pcm_generic_avail_update,
+ .mmap_commit = snd_pcm_generic_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_revents = snd_pcm_generic_poll_revents,
+};
+
+/**
+ * \brief Creates a new hooks PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param slave Slave PCM
+ * \param close_slave If set, slave PCM handle is closed when hooks PCM is closed
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_hooks_t *h;
+ unsigned int k;
+ int err;
+ assert(pcmp && slave);
+ h = calloc(1, sizeof(snd_pcm_hooks_t));
+ if (!h)
+ return -ENOMEM;
+ h->gen.slave = slave;
+ h->gen.close_slave = close_slave;
+ for (k = 0; k <= SND_PCM_HOOK_TYPE_LAST; ++k) {
+ INIT_LIST_HEAD(&h->hooks[k]);
+ }
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_HOOKS, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(h);
+ return err;
+ }
+ pcm->ops = &snd_pcm_hooks_ops;
+ pcm->fast_ops = &snd_pcm_hooks_fast_ops;
+ pcm->private_data = h;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->mmap_shadow = 1;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_link_hw_ptr(pcm, slave);
+ snd_pcm_link_appl_ptr(pcm, slave);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_hooks Plugin: hooks
+
+This plugin is used to call some 'hook' function when this plugin is opened,
+modified or closed.
+Typically, it is used to change control values for a certain state
+specially for the PCM (see the example below).
+
+\code
+# Hook arguments definition
+hook_args.NAME {
+ ... # Arbitrary arguments
+}
+
+# PCM hook type
+pcm_hook_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [install STR] # Install function (default _snd_pcm_hook_NAME_install)
+}
+
+# PCM hook definition
+pcm_hook.NAME {
+ type STR # PCM Hook type (see pcm_hook_type)
+ [args STR] # Arguments for install function (see hook_args)
+ # or
+ [args { }] # Arguments for install function
+}
+
+# PCM hook plugin
+pcm.NAME {
+ type hooks # PCM with hooks
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ hooks {
+ ID STR # Hook name (see pcm_hook)
+ # or
+ ID { } # Hook definition (see pcm_hook)
+ }
+}
+\endcode
+
+Example:
+
+\code
+ hooks.0 {
+ type ctl_elems
+ hook_args [
+ {
+ name "Wave Surround Playback Volume"
+ preserve true
+ lock true
+ optional true
+ value [ 0 0 ]
+ }
+ {
+ name "EMU10K1 PCM Send Volume"
+ index { @func private_pcm_subdevice }
+ lock true
+ value [ 0 0 0 0 0 0 255 0 0 0 0 255 ]
+ }
+ ]
+ }
+\endcode
+Here, the controls "Wave Surround Playback Volume" and "EMU10K1 PCM Send Volume"
+are set to the given values when this pcm is accessed. Since these controls
+take multi-dimensional values, the <code>value</code> field is written as
+an array.
+When <code>preserve</code> is true, the old values are saved and restored
+when the pcm is closed. The <code>lock</code> means that the control is
+locked during this pcm is opened, and cannot be changed by others.
+When <code>optional</code> is set, no error is returned but ignored
+even if the specified control doesn't exist.
+
+\subsection pcm_plugins_hooks_funcref Function reference
+
+<UL>
+ <LI>The function ctl_elems - _snd_pcm_hook_ctl_elems_install() - installs
+ CTL settings described by given configuration.
+ <LI>snd_pcm_hooks_open()
+ <LI>_snd_pcm_hooks_open()
+</UL>
+
+*/
+
+static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_t *conf)
+{
+ int err;
+ char buf[256];
+ const char *str, *id;
+ const char *lib = NULL, *install = NULL;
+ snd_config_t *type = NULL, *args = NULL;
+ snd_config_iterator_t i, next;
+ int (*install_func)(snd_pcm_t *pcm, snd_config_t *args) = NULL;
+ void *h = NULL;
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid hook definition");
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0) {
+ type = n;
+ continue;
+ }
+ if (strcmp(id, "hook_args") == 0) {
+ args = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!type) {
+ SNDERR("type is not defined");
+ return -EINVAL;
+ }
+ err = snd_config_get_id(type, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(type, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(root, "pcm_hook_type", str, &type);
+ if (err >= 0) {
+ if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for PCM type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "install") == 0) {
+ err = snd_config_get_string(n, &install);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!install) {
+ install = buf;
+ snprintf(buf, sizeof(buf), "_snd_pcm_hook_%s_install", str);
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ install_func = h ? snd_dlsym(h, install, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)) : NULL;
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s",
+ lib ? lib : "[builtin]");
+ err = -ENOENT;
+ } else if (!install_func) {
+ SNDERR("symbol %s is not defined inside %s", install,
+ lib ? lib : "[builtin]");
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type)
+ snd_config_delete(type);
+ if (err >= 0) {
+ if (args && snd_config_get_string(args, &str) >= 0) {
+ err = snd_config_search_definition(root, "hook_args", str, &args);
+ if (err < 0)
+ SNDERR("unknown hook_args %s", str);
+ else
+ err = install_func(pcm, args);
+ snd_config_delete(args);
+ } else
+ err = install_func(pcm, args);
+ snd_dlclose(h);
+ }
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+/**
+ * \brief Creates a new hooks PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with hooks PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *rpcm = NULL, *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_t *hooks = NULL;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "hooks") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ hooks = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hooks_open(&rpcm, name, spcm, 1);
+ if (err < 0) {
+ snd_pcm_close(spcm);
+ return err;
+ }
+ if (!hooks)
+ goto _done;
+ snd_config_for_each(i, next, hooks) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *str;
+ if (snd_config_get_string(n, &str) >= 0) {
+ err = snd_config_search_definition(root, "pcm_hook", str, &n);
+ if (err < 0) {
+ SNDERR("unknown pcm_hook %s", str);
+ } else {
+ err = snd_pcm_hook_add_conf(rpcm, root, n);
+ snd_config_delete(n);
+ }
+ } else
+ err = snd_pcm_hook_add_conf(rpcm, root, n);
+ if (err < 0) {
+ snd_pcm_close(rpcm);
+ return err;
+ }
+ }
+ _done:
+ *pcmp = rpcm;
+ return 0;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION);
+#endif
+
+/**
+ * \brief Get PCM handle for a PCM hook
+ * \param hook PCM hook handle
+ * \return PCM handle
+ */
+snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook)
+{
+ assert(hook);
+ return hook->pcm;
+}
+
+/**
+ * \brief Get callback function private data for a PCM hook
+ * \param hook PCM hook handle
+ * \return callback function private data
+ */
+void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook)
+{
+ assert(hook);
+ return hook->private_data;
+}
+
+/**
+ * \brief Set callback function private data for a PCM hook
+ * \param hook PCM hook handle
+ * \param private_data The private data value
+ */
+void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data)
+{
+ assert(hook);
+ hook->private_data = private_data;
+}
+
+/**
+ * \brief Add a PCM hook at end of hooks chain
+ * \param hookp Returned PCM hook handle
+ * \param pcm PCM handle
+ * \param type PCM hook type
+ * \param func PCM hook callback function
+ * \param private_data PCM hook private data
+ * \return 0 on success otherwise a negative error code
+ *
+ * Warning: an hook callback function cannot remove an hook of the same type
+ * different from itself
+ */
+int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,
+ snd_pcm_hook_type_t type,
+ snd_pcm_hook_func_t func, void *private_data)
+{
+ snd_pcm_hook_t *h;
+ snd_pcm_hooks_t *hooks;
+ assert(hookp && func);
+ assert(snd_pcm_type(pcm) == SND_PCM_TYPE_HOOKS);
+ h = calloc(1, sizeof(*h));
+ if (!h)
+ return -ENOMEM;
+ h->pcm = pcm;
+ h->func = func;
+ h->private_data = private_data;
+ hooks = pcm->private_data;
+ list_add_tail(&h->list, &hooks->hooks[type]);
+ *hookp = h;
+ return 0;
+}
+
+/**
+ * \brief Remove a PCM hook
+ * \param hook PCM hook handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Warning: an hook callback cannot remove an hook of the same type
+ * different from itself
+ */
+int snd_pcm_hook_remove(snd_pcm_hook_t *hook)
+{
+ assert(hook);
+ list_del(&hook->list);
+ free(hook);
+ return 0;
+}
+
+/*
+ *
+ */
+
+static int snd_pcm_hook_ctl_elems_hw_params(snd_pcm_hook_t *hook)
+{
+ snd_sctl_t *h = snd_pcm_hook_get_private(hook);
+ return snd_sctl_install(h);
+}
+
+static int snd_pcm_hook_ctl_elems_hw_free(snd_pcm_hook_t *hook)
+{
+ snd_sctl_t *h = snd_pcm_hook_get_private(hook);
+ return snd_sctl_remove(h);
+}
+
+static int snd_pcm_hook_ctl_elems_close(snd_pcm_hook_t *hook)
+{
+ snd_sctl_t *h = snd_pcm_hook_get_private(hook);
+ int err = snd_sctl_free(h);
+ snd_pcm_hook_set_private(hook, NULL);
+ return err;
+}
+
+/**
+ * \brief Install CTL settings using hardware associated with PCM handle
+ * \param pcm PCM handle
+ * \param conf Configuration node with CTL settings
+ * \return zero on success otherwise a negative error code
+ */
+int _snd_pcm_hook_ctl_elems_install(snd_pcm_t *pcm, snd_config_t *conf)
+{
+ int err;
+ int card;
+ snd_pcm_info_t *info;
+ char ctl_name[16];
+ snd_ctl_t *ctl;
+ snd_sctl_t *sctl = NULL;
+ snd_config_t *pcm_conf = NULL;
+ snd_pcm_hook_t *h_hw_params = NULL, *h_hw_free = NULL, *h_close = NULL;
+ assert(conf);
+ assert(snd_config_get_type(conf) == SND_CONFIG_TYPE_COMPOUND);
+ snd_pcm_info_alloca(&info);
+ err = snd_pcm_info(pcm, info);
+ if (err < 0)
+ return err;
+ card = snd_pcm_info_get_card(info);
+ if (card < 0) {
+ SNDERR("No card for this PCM");
+ return -EINVAL;
+ }
+ sprintf(ctl_name, "hw:%d", card);
+ err = snd_ctl_open(&ctl, ctl_name, 0);
+ if (err < 0) {
+ SNDERR("Cannot open CTL %s", ctl_name);
+ return err;
+ }
+ err = snd_config_imake_pointer(&pcm_conf, "pcm_handle", pcm);
+ if (err < 0)
+ goto _err;
+ err = snd_sctl_build(&sctl, ctl, conf, pcm_conf, 0);
+ if (err < 0)
+ goto _err;
+ err = snd_pcm_hook_add(&h_hw_params, pcm, SND_PCM_HOOK_TYPE_HW_PARAMS,
+ snd_pcm_hook_ctl_elems_hw_params, sctl);
+ if (err < 0)
+ goto _err;
+ err = snd_pcm_hook_add(&h_hw_free, pcm, SND_PCM_HOOK_TYPE_HW_FREE,
+ snd_pcm_hook_ctl_elems_hw_free, sctl);
+ if (err < 0)
+ goto _err;
+ err = snd_pcm_hook_add(&h_close, pcm, SND_PCM_HOOK_TYPE_CLOSE,
+ snd_pcm_hook_ctl_elems_close, sctl);
+ if (err < 0)
+ goto _err;
+ snd_config_delete(pcm_conf);
+ return 0;
+ _err:
+ if (h_hw_params)
+ snd_pcm_hook_remove(h_hw_params);
+ if (h_hw_free)
+ snd_pcm_hook_remove(h_hw_free);
+ if (h_close)
+ snd_pcm_hook_remove(h_close);
+ if (sctl)
+ snd_sctl_free(sctl);
+ if (pcm_conf)
+ snd_config_delete(pcm_conf);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_hook_ctl_elems_install, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_hw.c b/alsa-lib/src/pcm/pcm_hw.c
new file mode 100644
index 0000000..95bb2ac
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_hw.c
@@ -0,0 +1,1597 @@
+/**
+ * \file pcm/pcm_hw.c
+ * \ingroup PCM_Plugins
+ * \brief PCM HW Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Hardware
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include "pcm_local.h"
+#include "../control/control_local.h"
+#include "../timer/timer_local.h"
+
+//#define DEBUG_RW /* use to debug readi/writei/readn/writen */
+//#define DEBUG_MMAP /* debug mmap_commit */
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_hw = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+#ifndef F_SETSIG
+#define F_SETSIG 10
+#endif
+
+/*
+ * Compatibility
+ */
+
+struct sndrv_pcm_hw_params_old {
+ unsigned int flags;
+ unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT -
+ SNDRV_PCM_HW_PARAM_ACCESS + 1];
+ struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME -
+ SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1];
+ unsigned int rmask;
+ unsigned int cmask;
+ unsigned int info;
+ unsigned int msbits;
+ unsigned int rate_num;
+ unsigned int rate_den;
+ sndrv_pcm_uframes_t fifo_size;
+ unsigned char reserved[64];
+};
+
+#define SND_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old)
+#define SND_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old)
+
+static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t *params);
+static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm);
+static const snd_pcm_fast_ops_t snd_pcm_hw_fast_ops;
+static const snd_pcm_fast_ops_t snd_pcm_hw_fast_ops_timer;
+
+/*
+ *
+ */
+
+typedef struct {
+ int version;
+ int fd;
+ int card, device, subdevice;
+ int sync_ptr_ioctl;
+ volatile struct sndrv_pcm_mmap_status * mmap_status;
+ struct sndrv_pcm_mmap_control *mmap_control;
+ struct sndrv_pcm_sync_ptr *sync_ptr;
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_uframes_t appl_ptr;
+ int period_event;
+ snd_timer_t *period_timer;
+ struct pollfd period_timer_pfd;
+ int period_timer_need_poll;
+ /* restricted parameters */
+ snd_pcm_format_t format;
+ int rate;
+ int channels;
+} snd_pcm_hw_t;
+
+#define SNDRV_FILE_PCM_STREAM_PLAYBACK ALSA_DEVICE_DIRECTORY "pcmC%iD%ip"
+#define SNDRV_FILE_PCM_STREAM_CAPTURE ALSA_DEVICE_DIRECTORY "pcmC%iD%ic"
+#define SNDRV_PCM_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 9)
+
+/* update appl_ptr with driver */
+#define FAST_PCM_STATE(hw) \
+ ((enum sndrv_pcm_state) (hw)->mmap_status->state)
+#define FAST_PCM_TSTAMP(hw) \
+ ((hw)->mmap_status->tstamp)
+
+struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm)
+{
+ struct timespec res;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ res = FAST_PCM_TSTAMP(hw);
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 5) > hw->version)
+ res.tv_nsec *= 1000L;
+ return res;
+}
+#endif /* DOC_HIDDEN */
+
+static int sync_ptr1(snd_pcm_hw_t *hw, unsigned int flags)
+{
+ int err;
+ hw->sync_ptr->flags = flags;
+ err = ioctl((hw)->fd, SNDRV_PCM_IOCTL_SYNC_PTR, (hw)->sync_ptr);
+ if (err < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed");
+ return err;
+ }
+ return 0;
+}
+
+static inline int sync_ptr(snd_pcm_hw_t *hw, unsigned int flags)
+{
+ return hw->sync_ptr ? sync_ptr1(hw, flags) : 0;
+}
+
+static int snd_pcm_hw_clear_timer_queue(snd_pcm_hw_t *hw)
+{
+ if (hw->period_timer_need_poll) {
+ while (poll(&hw->period_timer_pfd, 1, 0) > 0) {
+ snd_timer_tread_t rbuf[4];
+ snd_timer_read(hw->period_timer, rbuf, sizeof(rbuf));
+ }
+ } else {
+ snd_timer_tread_t rbuf[4];
+ snd_timer_read(hw->period_timer, rbuf, sizeof(rbuf));
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_poll_descriptors_count(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 2;
+}
+
+static int snd_pcm_hw_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+
+ if (space < 2)
+ return -ENOMEM;
+ pfds[0].fd = hw->fd;
+ pfds[0].events = pcm->poll_events | POLLERR | POLLNVAL;
+ pfds[1].fd = hw->period_timer_pfd.fd;
+ pfds[1].events = POLLIN | POLLERR | POLLNVAL;
+ return 2;
+}
+
+static int snd_pcm_hw_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned nfds, unsigned short *revents)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ unsigned int events;
+
+ if (nfds != 2 || pfds[0].fd != hw->fd || pfds[1].fd != hw->period_timer_pfd.fd)
+ return -EINVAL;
+ events = pfds[0].revents;
+ if (pfds[1].revents & POLLIN) {
+ snd_pcm_hw_clear_timer_queue(hw);
+ events |= pcm->poll_events & ~(POLLERR|POLLNVAL);
+ }
+ *revents = events;
+ return 0;
+}
+
+static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
+{
+ long flags;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+
+ if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ err = -errno;
+ SYSMSG("F_GETFL failed");
+ return err;
+ }
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, flags) < 0) {
+ err = -errno;
+ SYSMSG("F_SETFL for O_NONBLOCK failed");
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ long flags;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+
+ if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ err = -errno;
+ SYSMSG("F_GETFL failed");
+ return err;
+ }
+ if (sig >= 0)
+ flags |= O_ASYNC;
+ else
+ flags &= ~O_ASYNC;
+ if (fcntl(fd, F_SETFL, flags) < 0) {
+ err = -errno;
+ SYSMSG("F_SETFL for O_ASYNC failed");
+ return err;
+ }
+ if (sig < 0)
+ return 0;
+ if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
+ err = -errno;
+ SYSMSG("F_SETSIG failed");
+ return err;
+ }
+ if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
+ err = -errno;
+ SYSMSG("F_SETOWN failed");
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, info) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_INFO failed");
+ return err;
+ }
+ return 0;
+}
+
+static inline int hw_refine_call(snd_pcm_hw_t *pcm_hw, snd_pcm_hw_params_t *params)
+{
+ /* check for new hw_params structure; it's available from 2.0.2 version of PCM API */
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 2) <= pcm_hw->version)
+ return ioctl(pcm_hw->fd, SNDRV_PCM_IOCTL_HW_REFINE, params);
+ return use_old_hw_params_ioctl(pcm_hw->fd, SND_PCM_IOCTL_HW_REFINE_OLD, params);
+}
+
+static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+
+ if (hw->format != SND_PCM_FORMAT_UNKNOWN) {
+ err = _snd_pcm_hw_params_set_format(params, hw->format);
+ if (err < 0)
+ return err;
+ }
+ if (hw->channels > 0) {
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS,
+ hw->channels, 0);
+ if (err < 0)
+ return err;
+ }
+ if (hw->rate > 0) {
+ err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_RATE,
+ hw->rate, 0, hw->rate + 1, -1);
+ if (err < 0)
+ return err;
+ }
+
+ if (hw_refine_call(hw, params) < 0) {
+ err = -errno;
+ // SYSMSG("SNDRV_PCM_IOCTL_HW_REFINE failed");
+ return err;
+ }
+
+ if (params->info != ~0U) {
+ params->info &= ~0xf0000000;
+ params->info |= (pcm->monotonic ? SND_PCM_INFO_MONOTONIC : 0);
+ }
+
+ return 0;
+}
+
+static inline int hw_params_call(snd_pcm_hw_t *pcm_hw, snd_pcm_hw_params_t *params)
+{
+ /* check for new hw_params structure; it's available from 2.0.2 version of PCM API */
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 2) <= pcm_hw->version)
+ return ioctl(pcm_hw->fd, SNDRV_PCM_IOCTL_HW_PARAMS, params);
+ return use_old_hw_params_ioctl(pcm_hw->fd, SND_PCM_IOCTL_HW_PARAMS_OLD, params);
+}
+
+static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (hw_params_call(hw, params) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_HW_PARAMS failed");
+ return err;
+ }
+ err = sync_ptr(hw, 0);
+ if (err < 0)
+ return err;
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
+ snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd,
+ SNDRV_PCM_MMAP_OFFSET_CONTROL);
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed");
+ return err;
+ }
+ return 0;
+}
+
+static void snd_pcm_hw_close_timer(snd_pcm_hw_t *hw)
+{
+ if (hw->period_timer) {
+ snd_timer_close(hw->period_timer);
+ hw->period_timer = NULL;
+ }
+}
+
+static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ snd_timer_params_t *params;
+ unsigned int suspend, resume;
+ int err;
+
+ if (enable) {
+ snd_timer_params_alloca(&params);
+ err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, hw->subdevice, SND_TIMER_OPEN_NONBLOCK | SND_TIMER_OPEN_TREAD);
+ if (err < 0) {
+ err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", SND_TIMER_CLASS_PCM, SND_TIMER_SCLASS_NONE, hw->card, hw->device, hw->subdevice, SND_TIMER_OPEN_NONBLOCK);
+ return err;
+ }
+ if (snd_timer_poll_descriptors_count(hw->period_timer) != 1) {
+ snd_pcm_hw_close_timer(hw);
+ return -EINVAL;
+ }
+ hw->period_timer_pfd.events = POLLIN;
+ hw->period_timer_pfd.revents = 0;
+ snd_timer_poll_descriptors(hw->period_timer, &hw->period_timer_pfd, 1);
+ hw->period_timer_need_poll = 0;
+ suspend = 1<<SND_TIMER_EVENT_MSUSPEND;
+ resume = 1<<SND_TIMER_EVENT_MRESUME;
+ /*
+ * hacks for older kernel drivers
+ */
+ {
+ int ver = 0;
+ ioctl(hw->period_timer_pfd.fd, SNDRV_TIMER_IOCTL_PVERSION, &ver);
+ /* In older versions, check via poll before read() is needed
+ * because of the confliction between TIMER_START and
+ * FIONBIO ioctls.
+ */
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ hw->period_timer_need_poll = 1;
+ /*
+ * In older versions, timer uses pause events instead
+ * suspend/resume events.
+ */
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
+ suspend = 1<<SND_TIMER_EVENT_MPAUSE;
+ resume = 1<<SND_TIMER_EVENT_MCONTINUE;
+ }
+ }
+ snd_timer_params_set_auto_start(params, 1);
+ snd_timer_params_set_ticks(params, 1);
+ snd_timer_params_set_filter(params, (1<<SND_TIMER_EVENT_TICK) |
+ suspend | resume);
+ err = snd_timer_params(hw->period_timer, params);
+ if (err < 0) {
+ snd_pcm_hw_close_timer(hw);
+ return err;
+ }
+ err = snd_timer_start(hw->period_timer);
+ if (err < 0) {
+ snd_pcm_hw_close_timer(hw);
+ return err;
+ }
+ pcm->fast_ops = &snd_pcm_hw_fast_ops_timer;
+ } else {
+ snd_pcm_hw_close_timer(hw);
+ pcm->fast_ops = &snd_pcm_hw_fast_ops;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ int old_period_event = params->period_event;
+ params->period_event = 0;
+ if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
+ params->period_step == pcm->period_step &&
+ params->start_threshold == pcm->start_threshold &&
+ params->stop_threshold == pcm->stop_threshold &&
+ params->silence_threshold == pcm->silence_threshold &&
+ params->silence_size == pcm->silence_size &&
+ old_period_event == hw->period_event) {
+ hw->mmap_control->avail_min = params->avail_min;
+ return sync_ptr(hw, 0);
+ }
+ if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed");
+ return err;
+ }
+ params->period_event = old_period_event;
+ hw->mmap_control->avail_min = params->avail_min;
+ if (hw->period_event != old_period_event) {
+ err = snd_pcm_hw_change_timer(pcm, old_period_event);
+ if (err < 0)
+ return err;
+ hw->period_event = old_period_event;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ struct sndrv_pcm_channel_info i;
+ int fd = hw->fd, err;
+ i.channel = info->channel;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_CHANNEL_INFO failed");
+ return err;
+ }
+ info->channel = i.channel;
+ info->addr = 0;
+ info->first = i.first;
+ info->step = i.step;
+ info->type = SND_PCM_AREA_MMAP;
+ info->u.mmap.fd = fd;
+ info->u.mmap.offset = i.offset;
+ return 0;
+}
+
+static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS, status) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_STATUS failed");
+ return err;
+ }
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 5) > hw->version) {
+ status->tstamp.tv_nsec *= 1000L;
+ status->trigger_tstamp.tv_nsec *= 1000L;
+ }
+ return 0;
+}
+
+static snd_pcm_state_t snd_pcm_hw_state(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err = sync_ptr(hw, 0);
+ if (err < 0)
+ return err;
+ return (snd_pcm_state_t) hw->mmap_status->state;
+}
+
+static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (hw->sync_ptr) {
+ err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC);
+ if (err < 0)
+ return err;
+ switch (FAST_PCM_STATE(hw)) {
+ case SNDRV_PCM_STATE_RUNNING:
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_PAUSED:
+ case SNDRV_PCM_STATE_PREPARED:
+ case SNDRV_PCM_STATE_SUSPENDED:
+ break;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ return -EBADFD;
+ }
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
+ else
+ *delayp = snd_pcm_mmap_capture_avail(pcm);
+ return 0;
+ }
+ if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_DELAY failed");
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 3) <= hw->version) {
+ if (hw->sync_ptr) {
+ err = sync_ptr1(hw, SNDRV_PCM_SYNC_PTR_HWSYNC);
+ if (err < 0)
+ return err;
+ } else {
+ if (ioctl(fd, SNDRV_PCM_IOCTL_HWSYNC) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_HWSYNC failed");
+ return err;
+ }
+ }
+ } else {
+ snd_pcm_sframes_t delay;
+ int err = snd_pcm_hw_delay(pcm, &delay);
+ if (err < 0) {
+ switch (FAST_PCM_STATE(hw)) {
+ case SND_PCM_STATE_PREPARED:
+ case SND_PCM_STATE_SUSPENDED:
+ return 0;
+ default:
+ return err;
+ }
+ }
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_PREPARE) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_PREPARE failed");
+ return err;
+ }
+ return sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+}
+
+static int snd_pcm_hw_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_RESET) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_RESET failed");
+ return err;
+ }
+ return sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+}
+
+static int snd_pcm_hw_start(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+#if 0
+ assert(pcm->stream != SND_PCM_STREAM_PLAYBACK ||
+ snd_pcm_mmap_playback_hw_avail(pcm) > 0);
+#endif
+ sync_ptr(hw, 0);
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_START) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_START failed");
+#if 0
+ if (err == -EBADFD)
+ SNDERR("PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
+#endif
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DROP) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_DROP failed");
+ return err;
+ } else {
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DRAIN) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_DRAIN failed");
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_PAUSE, enable) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_PAUSE failed");
+ return err;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_REWIND, &frames) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_REWIND failed");
+ return err;
+ }
+ err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+ if (err < 0)
+ return err;
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 4) <= hw->version) {
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_FORWARD, &frames) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed");
+ return err;
+ }
+ err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+ if (err < 0)
+ return err;
+ return frames;
+ } else {
+ snd_pcm_sframes_t avail;
+
+ err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_HWSYNC);
+ if (err < 0)
+ return err;
+ switch (FAST_PCM_STATE(hw)) {
+ case SNDRV_PCM_STATE_RUNNING:
+ case SNDRV_PCM_STATE_DRAINING:
+ case SNDRV_PCM_STATE_PAUSED:
+ case SNDRV_PCM_STATE_PREPARED:
+ break;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ return -EBADFD;
+ }
+ avail = snd_pcm_mmap_avail(pcm);
+ if (avail < 0)
+ return 0;
+ if (frames > (snd_pcm_uframes_t)avail)
+ frames = avail;
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ err = sync_ptr(hw, 0);
+ if (err < 0)
+ return err;
+ return frames;
+ }
+}
+
+static int snd_pcm_hw_resume(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd, err;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_RESUME) < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_RESUME failed");
+ return err;
+ }
+ return 0;
+}
+
+static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
+{
+ snd_pcm_hw_t *hw1 = pcm1->private_data;
+ snd_pcm_hw_t *hw2 = pcm2->private_data;
+ if (ioctl(hw1->fd, SNDRV_PCM_IOCTL_LINK, hw2->fd) < 0) {
+ SYSMSG("SNDRV_PCM_IOCTL_LINK failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
+{
+ if (master->type != SND_PCM_TYPE_HW) {
+ SYSMSG("Invalid type for SNDRV_PCM_IOCTL_LINK");
+ return -EINVAL;
+ }
+ return hw_link(master, pcm);
+}
+
+static int snd_pcm_hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
+{
+ if (pcm2->type != SND_PCM_TYPE_HW) {
+ if (pcm2->fast_ops->link_slaves)
+ return pcm2->fast_ops->link_slaves(pcm2, pcm1);
+ return -ENOSYS;
+ }
+ return hw_link(pcm1, pcm2);
+ }
+
+static int snd_pcm_hw_unlink(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_UNLINK) < 0) {
+ SYSMSG("SNDRV_PCM_IOCTL_UNLINK failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ int err;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd;
+ struct sndrv_xferi xferi;
+ xferi.buf = (char*) buffer;
+ xferi.frames = size;
+ xferi.result = 0; /* make valgrind happy */
+ err = ioctl(fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &xferi);
+ err = err >= 0 ? sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL) : -errno;
+#ifdef DEBUG_RW
+ fprintf(stderr, "hw_writei: frames = %li, xferi.result = %li, err = %i\n", size, xferi.result, err);
+#endif
+ if (err < 0)
+ return snd_pcm_check_error(pcm, err);
+ return xferi.result;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ int err;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd;
+ struct sndrv_xfern xfern;
+ memset(&xfern, 0, sizeof(xfern)); /* make valgrind happy */
+ xfern.bufs = bufs;
+ xfern.frames = size;
+ err = ioctl(fd, SNDRV_PCM_IOCTL_WRITEN_FRAMES, &xfern);
+ err = err >= 0 ? sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL) : -errno;
+#ifdef DEBUG_RW
+ fprintf(stderr, "hw_writen: frames = %li, result = %li, err = %i\n", size, xfern.result, err);
+#endif
+ if (err < 0)
+ return snd_pcm_check_error(pcm, err);
+ return xfern.result;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ int err;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd;
+ struct sndrv_xferi xferi;
+ xferi.buf = buffer;
+ xferi.frames = size;
+ xferi.result = 0; /* make valgrind happy */
+ err = ioctl(fd, SNDRV_PCM_IOCTL_READI_FRAMES, &xferi);
+ err = err >= 0 ? sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL) : -errno;
+#ifdef DEBUG_RW
+ fprintf(stderr, "hw_readi: frames = %li, result = %li, err = %i\n", size, xferi.result, err);
+#endif
+ if (err < 0)
+ return snd_pcm_check_error(pcm, err);
+ return xferi.result;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ int err;
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int fd = hw->fd;
+ struct sndrv_xfern xfern;
+ memset(&xfern, 0, sizeof(xfern)); /* make valgrind happy */
+ xfern.bufs = bufs;
+ xfern.frames = size;
+ err = ioctl(fd, SNDRV_PCM_IOCTL_READN_FRAMES, &xfern);
+ err = err >= 0 ? sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL) : -errno;
+#ifdef DEBUG_RW
+ fprintf(stderr, "hw_readn: frames = %li, result = %li, err = %i\n", size, xfern.result, err);
+#endif
+ if (err < 0)
+ return snd_pcm_check_error(pcm, err);
+ return xfern.result;
+}
+
+static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ struct sndrv_pcm_sync_ptr sync_ptr;
+ void *ptr;
+ int err;
+ ptr = MAP_FAILED;
+ if (hw->sync_ptr_ioctl == 0)
+ ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_status)),
+ PROT_READ, MAP_FILE|MAP_SHARED,
+ hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS);
+ if (ptr == MAP_FAILED || ptr == NULL) {
+ memset(&sync_ptr, 0, sizeof(sync_ptr));
+ sync_ptr.c.control.appl_ptr = 0;
+ sync_ptr.c.control.avail_min = 1;
+ err = ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, &sync_ptr);
+ if (err < 0) {
+ err = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed");
+ return err;
+ }
+ hw->sync_ptr = calloc(1, sizeof(struct sndrv_pcm_sync_ptr));
+ if (hw->sync_ptr == NULL)
+ return -ENOMEM;
+ hw->mmap_status = &hw->sync_ptr->s.status;
+ hw->mmap_control = &hw->sync_ptr->c.control;
+ hw->sync_ptr_ioctl = 1;
+ } else {
+ hw->mmap_status = ptr;
+ }
+ snd_pcm_set_hw_ptr(pcm, &hw->mmap_status->hw_ptr, hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS + offsetof(struct sndrv_pcm_mmap_status, hw_ptr));
+ return 0;
+}
+
+static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ void *ptr;
+ int err;
+ if (hw->sync_ptr == NULL) {
+ ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_control)),
+ PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED,
+ hw->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
+ if (ptr == MAP_FAILED || ptr == NULL) {
+ err = -errno;
+ SYSMSG("control mmap failed");
+ return err;
+ }
+ hw->mmap_control = ptr;
+ } else {
+ hw->mmap_control->avail_min = 1;
+ }
+ snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
+ return 0;
+}
+
+static int snd_pcm_hw_munmap_status(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (hw->sync_ptr_ioctl) {
+ free(hw->sync_ptr);
+ hw->sync_ptr = NULL;
+ } else {
+ if (munmap((void*)hw->mmap_status, page_align(sizeof(*hw->mmap_status))) < 0) {
+ err = -errno;
+ SYSMSG("status munmap failed");
+ return err;
+ }
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err;
+ if (hw->sync_ptr_ioctl) {
+ free(hw->sync_ptr);
+ hw->sync_ptr = NULL;
+ } else {
+ if (munmap(hw->mmap_control, page_align(sizeof(*hw->mmap_control))) < 0) {
+ err = -errno;
+ SYSMSG("control munmap failed");
+ return err;
+ }
+ }
+ return 0;
+}
+
+static int snd_pcm_hw_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_hw_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_hw_close(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ int err = 0;
+ if (close(hw->fd)) {
+ err = -errno;
+ SYSMSG("close failed\n");
+ }
+ snd_pcm_hw_munmap_status(pcm);
+ snd_pcm_hw_munmap_control(pcm);
+ free(hw);
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+
+ snd_pcm_mmap_appl_forward(pcm, size);
+ sync_ptr(hw, 0);
+#ifdef DEBUG_MMAP
+ fprintf(stderr, "appl_forward: hw_ptr = %li, appl_ptr = %li, size = %li\n", *pcm->hw.ptr, *pcm->appl.ptr, size);
+#endif
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ snd_pcm_uframes_t avail;
+
+ sync_ptr(hw, 0);
+ avail = snd_pcm_mmap_avail(pcm);
+ switch (FAST_PCM_STATE(hw)) {
+ case SNDRV_PCM_STATE_RUNNING:
+ if (avail >= pcm->stop_threshold) {
+ /* SNDRV_PCM_IOCTL_XRUN ioctl has been implemented since PCM kernel API 2.0.1 */
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 1) <= hw->version) {
+ if (ioctl(hw->fd, SNDRV_PCM_IOCTL_XRUN) < 0)
+ return -errno;
+ }
+ /* everything is ok, state == SND_PCM_STATE_XRUN at the moment */
+ return -EPIPE;
+ }
+ break;
+ case SNDRV_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ break;
+ }
+ return avail;
+}
+
+static int snd_pcm_hw_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_sframes_t avail1;
+ int ok = 0;
+
+ /* unfortunately, loop is necessary to ensure valid timestamp */
+ while (1) {
+ avail1 = snd_pcm_hw_avail_update(pcm);
+ if (avail1 < 0)
+ return avail1;
+ if (ok && (snd_pcm_uframes_t)avail1 == *avail)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ ok = 1;
+ }
+ return 0;
+}
+
+static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_hw_t *hw = pcm->private_data;
+ char *name;
+ int err = snd_card_get_name(hw->card, &name);
+ if (err < 0) {
+ SNDERR("cannot get card name");
+ return;
+ }
+ snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
+ hw->card, name, hw->device, hw->subdevice);
+ free(name);
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+}
+
+static const snd_pcm_ops_t snd_pcm_hw_ops = {
+ .close = snd_pcm_hw_close,
+ .info = snd_pcm_hw_info,
+ .hw_refine = snd_pcm_hw_hw_refine,
+ .hw_params = snd_pcm_hw_hw_params,
+ .hw_free = snd_pcm_hw_hw_free,
+ .sw_params = snd_pcm_hw_sw_params,
+ .channel_info = snd_pcm_hw_channel_info,
+ .dump = snd_pcm_hw_dump,
+ .nonblock = snd_pcm_hw_nonblock,
+ .async = snd_pcm_hw_async,
+ .mmap = snd_pcm_hw_mmap,
+ .munmap = snd_pcm_hw_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_hw_fast_ops = {
+ .status = snd_pcm_hw_status,
+ .state = snd_pcm_hw_state,
+ .hwsync = snd_pcm_hw_hwsync,
+ .delay = snd_pcm_hw_delay,
+ .prepare = snd_pcm_hw_prepare,
+ .reset = snd_pcm_hw_reset,
+ .start = snd_pcm_hw_start,
+ .drop = snd_pcm_hw_drop,
+ .drain = snd_pcm_hw_drain,
+ .pause = snd_pcm_hw_pause,
+ .rewindable = snd_pcm_hw_rewindable,
+ .rewind = snd_pcm_hw_rewind,
+ .forwardable = snd_pcm_hw_forwardable,
+ .forward = snd_pcm_hw_forward,
+ .resume = snd_pcm_hw_resume,
+ .link = snd_pcm_hw_link,
+ .link_slaves = snd_pcm_hw_link_slaves,
+ .unlink = snd_pcm_hw_unlink,
+ .writei = snd_pcm_hw_writei,
+ .writen = snd_pcm_hw_writen,
+ .readi = snd_pcm_hw_readi,
+ .readn = snd_pcm_hw_readn,
+ .avail_update = snd_pcm_hw_avail_update,
+ .mmap_commit = snd_pcm_hw_mmap_commit,
+ .htimestamp = snd_pcm_hw_htimestamp,
+ .poll_descriptors = NULL,
+ .poll_descriptors_count = NULL,
+ .poll_revents = NULL,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_hw_fast_ops_timer = {
+ .status = snd_pcm_hw_status,
+ .state = snd_pcm_hw_state,
+ .hwsync = snd_pcm_hw_hwsync,
+ .delay = snd_pcm_hw_delay,
+ .prepare = snd_pcm_hw_prepare,
+ .reset = snd_pcm_hw_reset,
+ .start = snd_pcm_hw_start,
+ .drop = snd_pcm_hw_drop,
+ .drain = snd_pcm_hw_drain,
+ .pause = snd_pcm_hw_pause,
+ .rewindable = snd_pcm_hw_rewindable,
+ .rewind = snd_pcm_hw_rewind,
+ .forwardable = snd_pcm_hw_forwardable,
+ .forward = snd_pcm_hw_forward,
+ .resume = snd_pcm_hw_resume,
+ .link = snd_pcm_hw_link,
+ .link_slaves = snd_pcm_hw_link_slaves,
+ .unlink = snd_pcm_hw_unlink,
+ .writei = snd_pcm_hw_writei,
+ .writen = snd_pcm_hw_writen,
+ .readi = snd_pcm_hw_readi,
+ .readn = snd_pcm_hw_readn,
+ .avail_update = snd_pcm_hw_avail_update,
+ .mmap_commit = snd_pcm_hw_mmap_commit,
+ .htimestamp = snd_pcm_hw_htimestamp,
+ .poll_descriptors = snd_pcm_hw_poll_descriptors,
+ .poll_descriptors_count = snd_pcm_hw_poll_descriptors_count,
+ .poll_revents = snd_pcm_hw_poll_revents,
+};
+
+/**
+ * \brief Creates a new hw PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param fd File descriptor
+ * \param mmap_emulation Obsoleted parameter
+ * \param sync_ptr_ioctl Boolean flag for sync_ptr ioctl
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
+ int fd, int mmap_emulation ATTRIBUTE_UNUSED,
+ int sync_ptr_ioctl)
+{
+ int ver, mode, monotonic = 0;
+ long fmode;
+ snd_pcm_t *pcm = NULL;
+ snd_pcm_hw_t *hw = NULL;
+ snd_pcm_info_t info;
+ int ret;
+
+ assert(pcmp);
+
+ memset(&info, 0, sizeof(info));
+ if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
+ ret = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_INFO failed");
+ close(fd);
+ return ret;
+
+ }
+
+ if ((fmode = fcntl(fd, F_GETFL)) < 0) {
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+ mode = 0;
+ if (fmode & O_NONBLOCK)
+ mode |= SND_PCM_NONBLOCK;
+ if (fmode & O_ASYNC)
+ mode |= SND_PCM_ASYNC;
+
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ ret = -errno;
+ SYSMSG("fcntl FD_CLOEXEC failed");
+ close(fd);
+ return ret;
+ }
+#endif
+
+ if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
+ ret = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_PVERSION failed");
+ close(fd);
+ return ret;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_PCM_VERSION_MAX))
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 9) <= ver) {
+ struct timespec timespec;
+ if (clock_gettime(CLOCK_MONOTONIC, &timespec) == 0) {
+ int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
+ ret = -errno;
+ SNDMSG("TTSTAMP failed\n");
+ return ret;
+ }
+ monotonic = 1;
+ }
+ } else
+#endif
+ if (SNDRV_PROTOCOL_VERSION(2, 0, 5) <= ver) {
+ int on = 1;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
+ ret = -errno;
+ SNDMSG("TSTAMP failed\n");
+ return ret;
+ }
+ }
+
+ hw = calloc(1, sizeof(snd_pcm_hw_t));
+ if (!hw) {
+ close(fd);
+ return -ENOMEM;
+ }
+
+ hw->version = ver;
+ hw->card = info.card;
+ hw->device = info.device;
+ hw->subdevice = info.subdevice;
+ hw->fd = fd;
+ hw->sync_ptr_ioctl = sync_ptr_ioctl;
+ /* no restriction */
+ hw->format = SND_PCM_FORMAT_UNKNOWN;
+ hw->rate = 0;
+ hw->channels = 0;
+
+ ret = snd_pcm_new(&pcm, SND_PCM_TYPE_HW, name, info.stream, mode);
+ if (ret < 0) {
+ free(hw);
+ close(fd);
+ return ret;
+ }
+
+ pcm->ops = &snd_pcm_hw_ops;
+ pcm->fast_ops = &snd_pcm_hw_fast_ops;
+ pcm->private_data = hw;
+ pcm->poll_fd = fd;
+ pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
+ pcm->monotonic = monotonic;
+
+ ret = snd_pcm_hw_mmap_status(pcm);
+ if (ret < 0) {
+ snd_pcm_close(pcm);
+ return ret;
+ }
+ ret = snd_pcm_hw_mmap_control(pcm);
+ if (ret < 0) {
+ snd_pcm_close(pcm);
+ return ret;
+ }
+
+ *pcmp = pcm;
+ return 0;
+}
+
+/**
+ * \brief Creates a new hw PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param card Number of card
+ * \param device Number of device
+ * \param subdevice Number of subdevice
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \param mmap_emulation Obsoleted parameter
+ * \param sync_ptr_ioctl Use SYNC_PTR ioctl rather than mmap for control structures
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ int card, int device, int subdevice,
+ snd_pcm_stream_t stream, int mode,
+ int mmap_emulation ATTRIBUTE_UNUSED,
+ int sync_ptr_ioctl)
+{
+ char filename[sizeof(SNDRV_FILE_PCM_STREAM_PLAYBACK) + 20];
+ const char *filefmt;
+ int ret = 0, fd = -1;
+ int attempt = 0;
+ snd_pcm_info_t info;
+ int fmode;
+ snd_ctl_t *ctl;
+
+ assert(pcmp);
+
+ if ((ret = snd_ctl_hw_open(&ctl, NULL, card, 0)) < 0)
+ return ret;
+
+ switch (stream) {
+ case SND_PCM_STREAM_PLAYBACK:
+ filefmt = SNDRV_FILE_PCM_STREAM_PLAYBACK;
+ break;
+ case SND_PCM_STREAM_CAPTURE:
+ filefmt = SNDRV_FILE_PCM_STREAM_CAPTURE;
+ break;
+ default:
+ SNDERR("invalid stream %d", stream);
+ return -EINVAL;
+ }
+ sprintf(filename, filefmt, card, device);
+
+ __again:
+ if (attempt++ > 3) {
+ ret = -EBUSY;
+ goto _err;
+ }
+ ret = snd_ctl_pcm_prefer_subdevice(ctl, subdevice);
+ if (ret < 0)
+ goto _err;
+ fmode = O_RDWR;
+ if (mode & SND_PCM_NONBLOCK)
+ fmode |= O_NONBLOCK;
+ if (mode & SND_PCM_ASYNC)
+ fmode |= O_ASYNC;
+ if (mode & SND_PCM_APPEND)
+ fmode |= O_APPEND;
+ fd = snd_open_device(filename, fmode);
+ if (fd < 0) {
+ ret = -errno;
+ SYSMSG("open %s failed", filename);
+ goto _err;
+ }
+ if (subdevice >= 0) {
+ memset(&info, 0, sizeof(info));
+ if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
+ ret = -errno;
+ SYSMSG("SNDRV_PCM_IOCTL_INFO failed");
+ goto _err;
+ }
+ if (info.subdevice != (unsigned int) subdevice) {
+ close(fd);
+ goto __again;
+ }
+ }
+ snd_ctl_close(ctl);
+ return snd_pcm_hw_open_fd(pcmp, name, fd, 0, sync_ptr_ioctl);
+ _err:
+ snd_ctl_close(ctl);
+ return ret;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_hw Plugin: hw
+
+This plugin communicates directly with the ALSA kernel driver. It is a raw
+communication without any conversions. The emulation of mmap access can be
+optionally enabled, but expect worse latency in the case.
+
+The nonblock option specifies whether the device is opened in a non-blocking
+manner. Note that the blocking behavior for read/write access won't be
+changed by this option. This influences only on the blocking behavior at
+opening the device. If you would like to keep the compatibility with the
+older ALSA stuff, turn this option off.
+
+\code
+pcm.name {
+ type hw # Kernel PCM
+ card INT/STR # Card name (string) or number (integer)
+ [device INT] # Device number (default 0)
+ [subdevice INT] # Subdevice number (default -1: first available)
+ [sync_ptr_ioctl BOOL] # Use SYNC_PTR ioctl rather than the direct mmap access for control structures
+ [nonblock BOOL] # Force non-blocking open mode
+ [format STR] # Restrict only to the given format
+ [channels INT] # Restrict only to the given channels
+ [rate INT] # Restrict only to the given rate
+}
+\endcode
+
+\subsection pcm_plugins_hw_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_hw_open()
+ <LI>_snd_pcm_hw_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new hw PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with hw PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ long card = -1, device = 0, subdevice = -1;
+ const char *str;
+ int err, sync_ptr_ioctl = 0;
+ int rate = 0, channels = 0;
+ snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN;
+ snd_config_t *n;
+ int nonblock = 1; /* non-block per default */
+ snd_pcm_hw_t *hw;
+
+ /* look for defaults.pcm.nonblock definition */
+ if (snd_config_search(root, "defaults.pcm.nonblock", &n) >= 0) {
+ err = snd_config_get_bool(n);
+ if (err >= 0)
+ nonblock = err;
+ }
+ snd_config_for_each(i, next, conf) {
+ const char *id;
+ n = snd_config_iterator_entry(i);
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ card = snd_card_get_index(str);
+ if (card < 0) {
+ SNDERR("Invalid value for %s", id);
+ return card;
+ }
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ continue;
+ }
+ if (strcmp(id, "sync_ptr_ioctl") == 0) {
+ err = snd_config_get_bool(n);
+ if (err < 0)
+ continue;
+ sync_ptr_ioctl = err;
+ continue;
+ }
+ if (strcmp(id, "nonblock") == 0) {
+ err = snd_config_get_bool(n);
+ if (err < 0)
+ continue;
+ nonblock = err;
+ continue;
+ }
+ if (strcmp(id, "rate") == 0) {
+ long val;
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ rate = val;
+ continue;
+ }
+ if (strcmp(id, "format") == 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ SNDERR("invalid type for %s", id);
+ return err;
+ }
+ format = snd_pcm_format_value(str);
+ continue;
+ }
+ if (strcmp(id, "channels") == 0) {
+ long val;
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ channels = val;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (card < 0) {
+ SNDERR("card is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream,
+ mode | (nonblock ? SND_PCM_NONBLOCK : 0),
+ 0, sync_ptr_ioctl);
+ if (err < 0)
+ return err;
+ if (nonblock && ! (mode & SND_PCM_NONBLOCK)) {
+ /* revert to blocking mode for read/write access */
+ snd_pcm_hw_nonblock(*pcmp, 0);
+ (*pcmp)->mode = mode;
+ } else
+ /* make sure the SND_PCM_NO_xxx flags don't get lost on the
+ * way */
+ (*pcmp)->mode |= mode & (SND_PCM_NO_AUTO_RESAMPLE|
+ SND_PCM_NO_AUTO_CHANNELS|
+ SND_PCM_NO_AUTO_FORMAT|
+ SND_PCM_NO_SOFTVOL);
+
+ hw = (*pcmp)->private_data;
+ if (format != SND_PCM_FORMAT_UNKNOWN)
+ hw->format = format;
+ if (channels > 0)
+ hw->channels = channels;
+ if (rate > 0)
+ hw->rate = rate;
+
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION);
+#endif
+
+/*
+ * To be removed helpers, but keep binary compatibility at the time
+ */
+
+#ifndef DOC_HIDDEN
+#define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5))
+#define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5))
+#endif
+
+static void snd_pcm_hw_convert_from_old_params(snd_pcm_hw_params_t *params,
+ struct sndrv_pcm_hw_params_old *oparams)
+{
+ unsigned int i;
+
+ memset(params, 0, sizeof(*params));
+ params->flags = oparams->flags;
+ for (i = 0; i < sizeof(oparams->masks) / sizeof(unsigned int); i++)
+ params->masks[i].bits[0] = oparams->masks[i];
+ memcpy(params->intervals, oparams->intervals, sizeof(oparams->intervals));
+ params->rmask = __OLD_TO_NEW_MASK(oparams->rmask);
+ params->cmask = __OLD_TO_NEW_MASK(oparams->cmask);
+ params->info = oparams->info;
+ params->msbits = oparams->msbits;
+ params->rate_num = oparams->rate_num;
+ params->rate_den = oparams->rate_den;
+ params->fifo_size = oparams->fifo_size;
+}
+
+static void snd_pcm_hw_convert_to_old_params(struct sndrv_pcm_hw_params_old *oparams,
+ snd_pcm_hw_params_t *params,
+ unsigned int *cmask)
+{
+ unsigned int i, j;
+
+ memset(oparams, 0, sizeof(*oparams));
+ oparams->flags = params->flags;
+ for (i = 0; i < sizeof(oparams->masks) / sizeof(unsigned int); i++) {
+ oparams->masks[i] = params->masks[i].bits[0];
+ for (j = 1; j < sizeof(params->masks[i].bits) / sizeof(unsigned int); j++)
+ if (params->masks[i].bits[j]) {
+ *cmask |= 1 << i;
+ break;
+ }
+ }
+ memcpy(oparams->intervals, params->intervals, sizeof(oparams->intervals));
+ oparams->rmask = __NEW_TO_OLD_MASK(params->rmask);
+ oparams->cmask = __NEW_TO_OLD_MASK(params->cmask);
+ oparams->info = params->info;
+ oparams->msbits = params->msbits;
+ oparams->rate_num = params->rate_num;
+ oparams->rate_den = params->rate_den;
+ oparams->fifo_size = params->fifo_size;
+}
+
+static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t *params)
+{
+ struct sndrv_pcm_hw_params_old oparams;
+ unsigned int cmask = 0;
+ int res;
+
+ snd_pcm_hw_convert_to_old_params(&oparams, params, &cmask);
+ res = ioctl(fd, cmd, &oparams);
+ snd_pcm_hw_convert_from_old_params(params, &oparams);
+ params->cmask |= cmask;
+ return res;
+}
diff --git a/alsa-lib/src/pcm/pcm_iec958.c b/alsa-lib/src/pcm/pcm_iec958.c
new file mode 100644
index 0000000..3d70ed0
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_iec958.c
@@ -0,0 +1,679 @@
+/**
+ * \file pcm/pcm_iec958.c
+ * \ingroup PCM_Plugins
+ * \brief PCM IEC958 Subframe Conversion Plugin Interface
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2004
+ */
+/*
+ * PCM - IEC958 Subframe Conversion Plugin
+ * Copyright (c) 2004 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_iec958 = "";
+#endif
+
+/*
+ */
+
+#ifndef DOC_HIDDEN
+
+typedef struct snd_pcm_iec958 snd_pcm_iec958_t;
+
+typedef void (*iec958_f)(snd_pcm_iec958_t *iec,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames);
+
+struct snd_pcm_iec958 {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int getput_idx;
+ iec958_f func;
+ snd_pcm_format_t sformat;
+ snd_pcm_format_t format;
+ unsigned int counter;
+ unsigned char status[24];
+ unsigned int byteswap;
+ unsigned char preamble[3]; /* B/M/W or Z/X/Y */
+};
+
+enum { PREAMBLE_Z, PREAMBLE_X, PREAMBLE_Y };
+
+#endif /* DOC_HIDDEN */
+
+/*
+ * Determine parity for time slots 4 upto 30
+ * to be sure that bit 4 upt 31 will carry
+ * an even number of ones and zeros.
+ */
+static unsigned int iec958_parity(unsigned int data)
+{
+ unsigned int parity;
+ int bit;
+
+ data >>= 4; /* start from bit 4 */
+ parity = 0;
+ for (bit = 4; bit <= 30; bit++) {
+ if (data & 1)
+ parity++;
+ data >>= 1;
+ }
+ return (parity & 1);
+}
+
+/*
+ * Compose 32bit IEC958 subframe, two sub frames
+ * build one frame with two channels.
+ *
+ * bit 0-3 = preamble
+ * 4-7 = AUX (=0)
+ * 8-27 = data (12-27 for 16bit, 8-27 for 20bit, and 24bit without AUX)
+ * 28 = validity (0 for valid data, else 'in error')
+ * 29 = user data (0)
+ * 30 = channel status (24 bytes for 192 frames)
+ * 31 = parity
+ */
+
+static inline u_int32_t iec958_subframe(snd_pcm_iec958_t *iec, u_int32_t data, int channel)
+{
+ unsigned int byte = iec->counter >> 3;
+ unsigned int mask = 1 << (iec->counter - (byte << 3));
+
+ /* bit 4-27 */
+ data >>= 4;
+ data &= ~0xf;
+
+ /* set IEC status bits (up to 192 bits) */
+ if (iec->status[byte] & mask)
+ data |= 0x40000000;
+
+ if (iec958_parity(data)) /* parity bit 4-30 */
+ data |= 0x80000000;
+
+ /* Preamble */
+ if (channel)
+ data |= iec->preamble[PREAMBLE_Y]; /* odd sub frame, 'Y' */
+ else if (! iec->counter)
+ data |= iec->preamble[PREAMBLE_Z]; /* Block start, 'Z' */
+ else
+ data |= iec->preamble[PREAMBLE_X]; /* even sub frame, 'X' */
+
+ if (iec->byteswap)
+ data = bswap_32(data);
+
+ return data;
+}
+
+static inline int32_t iec958_to_s32(snd_pcm_iec958_t *iec, u_int32_t data)
+{
+ if (iec->byteswap)
+ data = bswap_32(data);
+ data &= ~0xf;
+ data <<= 4;
+ return (int32_t)data;
+}
+
+#ifndef DOC_HIDDEN
+static void snd_pcm_iec958_decode(snd_pcm_iec958_t *iec,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames)
+{
+#define PUT32_LABELS
+#include "plugin_ops.h"
+#undef PUT32_LABELS
+ void *put = put32_labels[iec->getput_idx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const u_int32_t *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area) / sizeof(u_int32_t);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ int32_t sample = iec958_to_s32(iec, *src);
+ goto *put;
+#define PUT32_END after
+#include "plugin_ops.h"
+#undef PUT32_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+static void snd_pcm_iec958_encode(snd_pcm_iec958_t *iec,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames)
+{
+#define GET32_LABELS
+#include "plugin_ops.h"
+#undef GET32_LABELS
+ void *get = get32_labels[iec->getput_idx];
+ unsigned int channel;
+ int32_t sample = 0;
+ int counter = iec->counter;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ u_int32_t *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area) / sizeof(u_int32_t);
+ frames1 = frames;
+ iec->counter = counter;
+ while (frames1-- > 0) {
+ goto *get;
+#define GET32_END after
+#include "plugin_ops.h"
+#undef GET32_END
+ after:
+ sample = iec958_subframe(iec, sample, channel);
+ // fprintf(stderr, "%d:%08x\n", frames1, sample);
+ *dst = sample;
+ src += src_step;
+ dst += dst_step;
+ iec->counter++;
+ iec->counter %= 192;
+ }
+ }
+}
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_iec958_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ if (iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_LE ||
+ iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ } else {
+ snd_pcm_format_mask_t format_mask = {
+ { (1U << SND_PCM_FORMAT_IEC958_SUBFRAME_LE) |
+ (1U << SND_PCM_FORMAT_IEC958_SUBFRAME_BE) }
+ };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ }
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_iec958_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, iec->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_iec958_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_iec958_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_iec958_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_iec958_hw_refine_cprepare,
+ snd_pcm_iec958_hw_refine_cchange,
+ snd_pcm_iec958_hw_refine_sprepare,
+ snd_pcm_iec958_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_iec958_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ snd_pcm_format_t format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_iec958_hw_refine_cchange,
+ snd_pcm_iec958_hw_refine_sprepare,
+ snd_pcm_iec958_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
+ if (err < 0)
+ return err;
+
+ iec->format = format;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_LE ||
+ iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
+ iec->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S32);
+ iec->func = snd_pcm_iec958_encode;
+ iec->byteswap = iec->sformat != SND_PCM_FORMAT_IEC958_SUBFRAME;
+ } else {
+ iec->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, iec->sformat);
+ iec->func = snd_pcm_iec958_decode;
+ iec->byteswap = format != SND_PCM_FORMAT_IEC958_SUBFRAME;
+ }
+ } else {
+ if (iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_LE ||
+ iec->sformat == SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
+ iec->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, format);
+ iec->func = snd_pcm_iec958_decode;
+ iec->byteswap = iec->sformat != SND_PCM_FORMAT_IEC958_SUBFRAME;
+ } else {
+ iec->getput_idx = snd_pcm_linear_get_index(iec->sformat, SND_PCM_FORMAT_S32);
+ iec->func = snd_pcm_iec958_encode;
+ iec->byteswap = format != SND_PCM_FORMAT_IEC958_SUBFRAME;
+ }
+ }
+ /* FIXME: needs to adjust status_bits according to the format
+ * and sample rate
+ */
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_iec958_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ iec->func(iec, slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_iec958_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ iec->func(iec, areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size);
+ *slave_sizep = size;
+ return size;
+}
+
+static int snd_pcm_iec958_init(snd_pcm_t *pcm)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ iec->counter = 0;
+ return 0;
+}
+
+static void snd_pcm_iec958_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_iec958_t *iec = pcm->private_data;
+ snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n",
+ snd_pcm_format_name(iec->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(iec->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_iec958_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_iec958_hw_refine,
+ .hw_params = snd_pcm_iec958_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_iec958_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new IEC958 subframe conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \param status_bits The IEC958 status bits
+ * \param preamble_vals The preamble byte values
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat,
+ snd_pcm_t *slave, int close_slave,
+ const unsigned char *status_bits,
+ const unsigned char *preamble_vals)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_iec958_t *iec;
+ int err;
+ static const unsigned char default_status_bits[] = {
+ IEC958_AES0_CON_EMPHASIS_NONE,
+ IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
+ 0,
+ IEC958_AES3_CON_FS_48000
+ };
+
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
+ sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE)
+ return -EINVAL;
+ iec = calloc(1, sizeof(snd_pcm_iec958_t));
+ if (!iec) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&iec->plug);
+ iec->sformat = sformat;
+ iec->plug.read = snd_pcm_iec958_read_areas;
+ iec->plug.write = snd_pcm_iec958_write_areas;
+ iec->plug.init = snd_pcm_iec958_init;
+ iec->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ iec->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ iec->plug.gen.slave = slave;
+ iec->plug.gen.close_slave = close_slave;
+
+ if (status_bits)
+ memcpy(iec->status, status_bits, sizeof(iec->status));
+ else
+ memcpy(iec->status, default_status_bits, sizeof(default_status_bits));
+
+ memcpy(iec->preamble, preamble_vals, 3);
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_IEC958, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(iec);
+ return err;
+ }
+ pcm->ops = &snd_pcm_iec958_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = iec;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &iec->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &iec->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_iec958 Plugin: IEC958
+
+This plugin converts 32bit IEC958 subframe samples to linear, or linear to
+32bit IEC958 subframe samples.
+
+\code
+pcm.name {
+ type iec958 # IEC958 subframe conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ [status status-bytes] # IEC958 status bits (given in byte array)
+ # IEC958 preamble bits definitions
+ # B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe
+ # As default, Z = 0x08, Y = 0x04, X = 0x02
+ [preamble.z or preamble.b val]
+ [preamble.x or preamble.m val]
+ [preamble.y or preamble.w val]
+}
+\endcode
+
+\subsection pcm_plugins_iec958_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_iec958_open()
+ <LI>_snd_pcm_iec958_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new IEC958 subframe conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_t *status = NULL, *preamble = NULL;
+ snd_pcm_format_t sformat;
+ unsigned char status_bits[24];
+ unsigned char preamble_vals[3] = {
+ 0x08, 0x02, 0x04 /* Z, X, Y */
+ };
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "status") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ status = n;
+ continue;
+ }
+ if (strcmp(id, "preamble") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ preamble = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ memset(status_bits, 0, sizeof(status_bits));
+ if (status) {
+ snd_config_iterator_t i, inext;
+ int bytes = 0;
+ snd_config_for_each(i, inext, status) {
+ long val;
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
+ SNDERR("invalid IEC958 status bits");
+ return -EINVAL;
+ }
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("invalid IEC958 status bits");
+ return err;
+ }
+ status_bits[bytes] = val;
+ bytes++;
+ if (bytes >= (int)sizeof(status_bits))
+ break;
+ }
+ // fprintf(stderr, "STATUS bits: %02x %02x %02x %02x\n", status_bits[0], status_bits[1], status_bits[2], status_bits[3]);
+ }
+ if (preamble) {
+ snd_config_iterator_t i, inext;
+ snd_config_for_each(i, inext, preamble) {
+ long val;
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ int idx;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "b") == 0 || strcmp(id, "z") == 0)
+ idx = PREAMBLE_Z;
+ else if (strcmp(id, "m") == 0 || strcmp(id, "x") == 0)
+ idx = PREAMBLE_X;
+ else if (strcmp(id, "w") == 0 || strcmp(id, "y") == 0)
+ idx = PREAMBLE_Y;
+ else {
+ SNDERR("invalid IEC958 preamble type %s", id);
+ return -EINVAL;
+ }
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("invalid IEC958 preamble value");
+ return err;
+ }
+ preamble_vals[idx] = val;
+ }
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
+ sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
+ snd_config_delete(sconf);
+ SNDERR("invalid slave format");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_iec958_open(pcmp, name, sformat, spcm, 1,
+ status ? status_bits : NULL,
+ preamble_vals);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_iec958_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_ioplug.c b/alsa-lib/src/pcm/pcm_ioplug.c
new file mode 100644
index 0000000..e43d354
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_ioplug.c
@@ -0,0 +1,1072 @@
+/**
+ * \file pcm/pcm_ioplug.c
+ * \ingroup Plugin_SDK
+ * \brief I/O Plugin SDK
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2005
+ */
+/*
+ * PCM - External I/O Plugin SDK
+ * Copyright (c) 2005 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_ioplug.h"
+#include "pcm_ext_parm.h"
+#include "pcm_generic.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_ioplug = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+/* hw_params */
+typedef struct snd_pcm_ioplug_priv {
+ snd_pcm_ioplug_t *data;
+ struct snd_ext_parm params[SND_PCM_IOPLUG_HW_PARAMS];
+ unsigned int last_hw;
+ snd_pcm_uframes_t avail_max;
+ snd_htimestamp_t trigger_tstamp;
+} ioplug_priv_t;
+
+/* update the hw pointer */
+static void snd_pcm_ioplug_hw_ptr_update(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ snd_pcm_sframes_t hw;
+
+ hw = io->data->callback->pointer(io->data);
+ if (hw >= 0) {
+ unsigned int delta;
+ if ((unsigned int)hw >= io->last_hw)
+ delta = hw - io->last_hw;
+ else
+ delta = pcm->buffer_size + hw - io->last_hw;
+ io->data->hw_ptr += delta;
+ io->last_hw = hw;
+ } else
+ io->data->state = SNDRV_PCM_STATE_XRUN;
+}
+
+static int snd_pcm_ioplug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
+{
+ memset(info, 0, sizeof(*info));
+ info->stream = pcm->stream;
+ info->card = -1;
+ if (pcm->name) {
+ strncpy((char *)info->id, pcm->name, sizeof(info->id));
+ strncpy((char *)info->name, pcm->name, sizeof(info->name));
+ strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
+ }
+ info->subdevices_count = 1;
+ return 0;
+}
+
+static int snd_pcm_ioplug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+{
+ return snd_pcm_channel_info_shm(pcm, info, -1);
+}
+
+static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ memset(status, 0, sizeof(*status));
+ snd_pcm_ioplug_hw_ptr_update(pcm);
+ status->state = io->data->state;
+ status->trigger_tstamp = io->trigger_tstamp;
+ status->avail = snd_pcm_mmap_avail(pcm);
+ status->avail_max = io->avail_max;
+ return 0;
+}
+
+static snd_pcm_state_t snd_pcm_ioplug_state(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ return io->data->state;
+}
+
+static int snd_pcm_ioplug_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_ioplug_hw_ptr_update(pcm);
+ return 0;
+}
+
+static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->version >= 0x010001 &&
+ io->data->callback->delay)
+ return io->data->callback->delay(io->data, delayp);
+ else {
+ snd_pcm_ioplug_hw_ptr_update(pcm);
+ *delayp = snd_pcm_mmap_hw_avail(pcm);
+ }
+ return 0;
+}
+
+static int snd_pcm_ioplug_reset(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ io->data->appl_ptr = 0;
+ io->data->hw_ptr = 0;
+ io->last_hw = 0;
+ io->avail_max = 0;
+ return 0;
+}
+
+static int snd_pcm_ioplug_prepare(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ io->data->state = SND_PCM_STATE_PREPARED;
+ snd_pcm_ioplug_reset(pcm);
+ if (io->data->callback->prepare)
+ return io->data->callback->prepare(io->data);
+ return 0;
+}
+
+static const int hw_params_type[SND_PCM_IOPLUG_HW_PARAMS] = {
+ [SND_PCM_IOPLUG_HW_ACCESS] = SND_PCM_HW_PARAM_ACCESS,
+ [SND_PCM_IOPLUG_HW_FORMAT] = SND_PCM_HW_PARAM_FORMAT,
+ [SND_PCM_IOPLUG_HW_CHANNELS] = SND_PCM_HW_PARAM_CHANNELS,
+ [SND_PCM_IOPLUG_HW_RATE] = SND_PCM_HW_PARAM_RATE,
+ [SND_PCM_IOPLUG_HW_PERIOD_BYTES] = SND_PCM_HW_PARAM_PERIOD_BYTES,
+ [SND_PCM_IOPLUG_HW_BUFFER_BYTES] = SND_PCM_HW_PARAM_BUFFER_BYTES,
+ [SND_PCM_IOPLUG_HW_PERIODS] = SND_PCM_HW_PARAM_PERIODS,
+};
+
+/* x = a * b */
+static int rule_mul(snd_pcm_hw_params_t *params, int x, int a, int b)
+{
+ snd_interval_t t;
+
+ snd_interval_mul(hw_param_interval(params, a),
+ hw_param_interval(params, b), &t);
+ return snd_interval_refine(hw_param_interval(params, x), &t);
+}
+
+/* x = a / b */
+static int rule_div(snd_pcm_hw_params_t *params, int x, int a, int b)
+{
+ snd_interval_t t;
+
+ snd_interval_div(hw_param_interval(params, a),
+ hw_param_interval(params, b), &t);
+ return snd_interval_refine(hw_param_interval(params, x), &t);
+}
+
+/* x = a * b / k */
+static int rule_muldivk(snd_pcm_hw_params_t *params, int x, int a, int b, int k)
+{
+ snd_interval_t t;
+
+ snd_interval_muldivk(hw_param_interval(params, a),
+ hw_param_interval(params, b), k, &t);
+ return snd_interval_refine(hw_param_interval(params, x), &t);
+}
+
+/* x = a * k / b */
+static int rule_mulkdiv(snd_pcm_hw_params_t *params, int x, int a, int k, int b)
+{
+ snd_interval_t t;
+
+ snd_interval_mulkdiv(hw_param_interval(params, a), k,
+ hw_param_interval(params, b), &t);
+ return snd_interval_refine(hw_param_interval(params, x), &t);
+}
+
+#if 0
+static void dump_parm(snd_pcm_hw_params_t *params)
+{
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr, 0);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_close(log);
+}
+#endif
+
+/* refine *_TIME and *_SIZE, then update *_BYTES */
+static int refine_time_and_size(snd_pcm_hw_params_t *params,
+ int time, int size, int bytes)
+{
+ int err, change1 = 0;
+
+ /* size = time * rate / 1000000 */
+ err = rule_muldivk(params, size, time,
+ SND_PCM_HW_PARAM_RATE, 1000000);
+ if (err < 0)
+ return err;
+ change1 |= err;
+
+ /* bytes = size * framebits / 8 */
+ err = rule_muldivk(params, bytes, size,
+ SND_PCM_HW_PARAM_FRAME_BITS, 8);
+ if (err < 0)
+ return err;
+ change1 |= err;
+ return change1;
+}
+
+/* refine *_TIME and *_SIZE from *_BYTES */
+static int refine_back_time_and_size(snd_pcm_hw_params_t *params,
+ int time, int size, int bytes)
+{
+ int err;
+
+ /* size = bytes * 8 / framebits */
+ err = rule_mulkdiv(params, size, bytes, 8, SND_PCM_HW_PARAM_FRAME_BITS);
+ if (err < 0)
+ return err;
+ /* time = size * 1000000 / rate */
+ err = rule_mulkdiv(params, time, size, 1000000, SND_PCM_HW_PARAM_RATE);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+
+static int snd_pcm_ioplug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int change = 0, change1, change2, err;
+ ioplug_priv_t *io = pcm->private_data;
+ struct snd_ext_parm *p;
+ unsigned int i;
+
+ /* access, format */
+ for (i = SND_PCM_IOPLUG_HW_ACCESS; i <= SND_PCM_IOPLUG_HW_FORMAT; i++) {
+ err = snd_ext_parm_mask_refine(hw_param_mask(params, hw_params_type[i]),
+ io->params, i);
+ if (err < 0)
+ return err;
+ change |= err;
+ }
+ /* channels, rate */
+ for (; i <= SND_PCM_IOPLUG_HW_RATE; i++) {
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, hw_params_type[i]),
+ io->params, i);
+ if (err < 0)
+ return err;
+ change |= err;
+ }
+
+ if (params->rmask & ((1 << SND_PCM_HW_PARAM_ACCESS) |
+ (1 << SND_PCM_HW_PARAM_FORMAT) |
+ (1 << SND_PCM_HW_PARAM_SUBFORMAT) |
+ (1 << SND_PCM_HW_PARAM_CHANNELS) |
+ (1 << SND_PCM_HW_PARAM_RATE))) {
+ err = snd_pcm_hw_refine_soft(pcm, params);
+ if (err < 0)
+ return err;
+ change |= err;
+ }
+
+ change1 = refine_time_and_size(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_PERIOD_BYTES);
+ if (change1 < 0)
+ return change1;
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_BYTES),
+ io->params, SND_PCM_IOPLUG_HW_PERIOD_BYTES);
+ if (err < 0)
+ return err;
+ change1 |= err;
+ if (change1) {
+ change |= change1;
+ err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_PERIOD_BYTES);
+ if (err < 0)
+ return err;
+ }
+
+ change1 = refine_time_and_size(params, SND_PCM_HW_PARAM_BUFFER_TIME,
+ SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_BUFFER_BYTES);
+ if (change1 < 0)
+ return change1;
+ change |= change1;
+
+ do {
+ change2 = 0;
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_BUFFER_BYTES),
+ io->params, SND_PCM_IOPLUG_HW_BUFFER_BYTES);
+ if (err < 0)
+ return err;
+ change2 |= err;
+ /* periods = buffer_bytes / period_bytes */
+ err = rule_div(params, SND_PCM_HW_PARAM_PERIODS,
+ SND_PCM_HW_PARAM_BUFFER_BYTES,
+ SND_PCM_HW_PARAM_PERIOD_BYTES);
+ if (err < 0)
+ return err;
+ change2 |= err;
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_PERIODS),
+ io->params, SND_PCM_IOPLUG_HW_PERIODS);
+ if (err < 0)
+ return err;
+ change2 |= err;
+ /* buffer_bytes = periods * period_bytes */
+ err = rule_mul(params, SND_PCM_HW_PARAM_BUFFER_BYTES,
+ SND_PCM_HW_PARAM_PERIOD_BYTES,
+ SND_PCM_HW_PARAM_PERIODS);
+ if (err < 0)
+ return err;
+ change2 |= err;
+ change1 |= change2;
+ } while (change2);
+ change |= change1;
+
+ if (change1) {
+ err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_BUFFER_TIME,
+ SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_BUFFER_BYTES);
+ if (err < 0)
+ return err;
+ }
+
+ /* period_bytes = buffer_bytes / periods */
+ err = rule_div(params, SND_PCM_HW_PARAM_PERIOD_BYTES,
+ SND_PCM_HW_PARAM_BUFFER_BYTES,
+ SND_PCM_HW_PARAM_PERIODS);
+ if (err < 0)
+ return err;
+ if (err) {
+ /* update period_size and period_time */
+ change |= err;
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_BYTES),
+ io->params, SND_PCM_IOPLUG_HW_PERIOD_BYTES);
+ if (err < 0)
+ return err;
+ err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_PERIOD_BYTES);
+ if (err < 0)
+ return err;
+ }
+
+ params->info = SND_PCM_INFO_BLOCK_TRANSFER;
+ p = &io->params[SND_PCM_IOPLUG_HW_ACCESS];
+ if (p->active) {
+ for (i = 0; i < p->num_list; i++)
+ switch (p->list[i]) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ case SND_PCM_ACCESS_RW_INTERLEAVED:
+ params->info |= SND_PCM_INFO_INTERLEAVED;
+ break;
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ case SND_PCM_ACCESS_RW_NONINTERLEAVED:
+ params->info |= SND_PCM_INFO_NONINTERLEAVED;
+ break;
+ }
+ }
+ if (io->data->callback->pause)
+ params->info |= SND_PCM_INFO_PAUSE;
+ if (io->data->callback->resume)
+ params->info |= SND_PCM_INFO_RESUME;
+
+#if 0
+ fprintf(stderr, "XXX\n");
+ dump_parm(params);
+#endif
+ return change;
+}
+
+static int snd_pcm_ioplug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ int err;
+
+ INTERNAL(snd_pcm_hw_params_get_access)(params, &io->data->access);
+ INTERNAL(snd_pcm_hw_params_get_format)(params, &io->data->format);
+ INTERNAL(snd_pcm_hw_params_get_channels)(params, &io->data->channels);
+ INTERNAL(snd_pcm_hw_params_get_rate)(params, &io->data->rate, 0);
+ INTERNAL(snd_pcm_hw_params_get_period_size)(params, &io->data->period_size, 0);
+ INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &io->data->buffer_size);
+ if (io->data->callback->hw_params) {
+ err = io->data->callback->hw_params(io->data, params);
+ if (err < 0)
+ return err;
+ INTERNAL(snd_pcm_hw_params_get_access)(params, &io->data->access);
+ INTERNAL(snd_pcm_hw_params_get_format)(params, &io->data->format);
+ INTERNAL(snd_pcm_hw_params_get_channels)(params, &io->data->channels);
+ INTERNAL(snd_pcm_hw_params_get_rate)(params, &io->data->rate, 0);
+ INTERNAL(snd_pcm_hw_params_get_period_size)(params, &io->data->period_size, 0);
+ INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &io->data->buffer_size);
+ }
+ return 0;
+}
+
+static int snd_pcm_ioplug_hw_free(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->hw_free)
+ return io->data->callback->hw_free(io->data);
+ return 0;
+}
+
+static int snd_pcm_ioplug_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->sw_params)
+ return io->data->callback->sw_params(io->data, params);
+ return 0;
+}
+
+
+static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ int err;
+
+ if (io->data->state != SND_PCM_STATE_PREPARED)
+ return -EBUSY;
+
+ err = io->data->callback->start(io->data);
+ if (err < 0)
+ return err;
+
+ gettimestamp(&io->trigger_tstamp, pcm->monotonic);
+ io->data->state = SND_PCM_STATE_RUNNING;
+
+ return 0;
+}
+
+static int snd_pcm_ioplug_drop(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+
+ io->data->callback->stop(io->data);
+
+ gettimestamp(&io->trigger_tstamp, pcm->monotonic);
+ io->data->state = SND_PCM_STATE_SETUP;
+
+ return 0;
+}
+
+static int snd_pcm_ioplug_drain(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->state == SND_PCM_STATE_OPEN)
+ return -EBADFD;
+ if (io->data->callback->drain)
+ io->data->callback->drain(io->data);
+ return snd_pcm_ioplug_drop(pcm);
+}
+
+static int snd_pcm_ioplug_pause(snd_pcm_t *pcm, int enable)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ static const snd_pcm_state_t states[2] = {
+ SND_PCM_STATE_RUNNING, SND_PCM_STATE_PAUSED
+ };
+ int prev, err;
+
+ prev = !enable;
+ enable = !prev;
+ if (io->data->state != states[prev])
+ return -EBADFD;
+ if (io->data->callback->pause) {
+ err = io->data->callback->pause(io->data, enable);
+ if (err < 0)
+ return err;
+ }
+ io->data->state = states[enable];
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+}
+
+static int snd_pcm_ioplug_resume(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->resume)
+ io->data->callback->resume(io->data);
+ return 0;
+}
+
+static snd_pcm_sframes_t ioplug_priv_transfer_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ snd_pcm_sframes_t result;
+
+ if (! size)
+ return 0;
+ if (io->data->callback->transfer)
+ result = io->data->callback->transfer(io->data, areas, offset, size);
+ else
+ result = size;
+ if (result > 0)
+ snd_pcm_mmap_appl_forward(pcm, result);
+ return result;
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ if (pcm->mmap_rw)
+ return snd_pcm_mmap_writei(pcm, buffer, size);
+ else {
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ ioplug_priv_transfer_areas);
+ }
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ if (pcm->mmap_rw)
+ return snd_pcm_mmap_writen(pcm, bufs, size);
+ else {
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ ioplug_priv_transfer_areas);
+ }
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ if (pcm->mmap_rw)
+ return snd_pcm_mmap_readi(pcm, buffer, size);
+ else {
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, buffer);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ ioplug_priv_transfer_areas);
+ }
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ if (pcm->mmap_rw)
+ return snd_pcm_mmap_readn(pcm, bufs, size);
+ else {
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ ioplug_priv_transfer_areas);
+ }
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK &&
+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
+ pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_uframes_t ofs, frames = size;
+
+ snd_pcm_mmap_begin(pcm, &areas, &ofs, &frames);
+ if (ofs != offset)
+ return -EIO;
+ return ioplug_priv_transfer_areas(pcm, areas, offset, frames);
+ }
+
+ snd_pcm_mmap_appl_forward(pcm, size);
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_ioplug_avail_update(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+ snd_pcm_uframes_t avail;
+
+ snd_pcm_ioplug_hw_ptr_update(pcm);
+ if (io->data->state == SNDRV_PCM_STATE_XRUN)
+ return -EPIPE;
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
+ pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
+ if (io->data->callback->transfer) {
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_uframes_t offset, size = UINT_MAX;
+ snd_pcm_sframes_t result;
+
+ snd_pcm_mmap_begin(pcm, &areas, &offset, &size);
+ result = io->data->callback->transfer(io->data, areas, offset, size);
+ if (result < 0)
+ return result;
+ }
+ }
+ avail = snd_pcm_mmap_avail(pcm);
+ if (avail > io->avail_max)
+ io->avail_max = avail;
+ return (snd_pcm_sframes_t)avail;
+}
+
+static int snd_pcm_ioplug_nonblock(snd_pcm_t *pcm, int nonblock)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ io->data->nonblock = nonblock;
+ return 0;
+}
+
+static int snd_pcm_ioplug_poll_descriptors_count(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->poll_descriptors_count)
+ return io->data->callback->poll_descriptors_count(io->data);
+ else
+ return 1;
+}
+
+static int snd_pcm_ioplug_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->poll_descriptors)
+ return io->data->callback->poll_descriptors(io->data, pfds, space);
+ if (pcm->poll_fd < 0)
+ return -EIO;
+ if (space >= 1 && pfds) {
+ pfds->fd = pcm->poll_fd;
+ pfds->events = pcm->poll_events | POLLERR | POLLNVAL;
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+static int snd_pcm_ioplug_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->poll_revents)
+ return io->data->callback->poll_revents(io->data, pfds, nfds, revents);
+ else
+ *revents = pfds->revents;
+ return 0;
+}
+
+static int snd_pcm_ioplug_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_ioplug_async(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ int sig ATTRIBUTE_UNUSED,
+ pid_t pid ATTRIBUTE_UNUSED)
+{
+ return -ENOSYS;
+}
+
+static int snd_pcm_ioplug_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void snd_pcm_ioplug_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ if (io->data->callback->dump)
+ io->data->callback->dump(io->data, out);
+ else {
+ if (io->data->name)
+ snd_output_printf(out, "%s\n", io->data->name);
+ else
+ snd_output_printf(out, "IO-PCM Plugin\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ }
+}
+
+static void clear_io_params(ioplug_priv_t *io)
+{
+ int i;
+ for (i = 0; i < SND_PCM_IOPLUG_HW_PARAMS; i++)
+ snd_ext_parm_clear(&io->params[i]);
+}
+
+static int snd_pcm_ioplug_close(snd_pcm_t *pcm)
+{
+ ioplug_priv_t *io = pcm->private_data;
+
+ clear_io_params(io);
+ if (io->data->callback->close)
+ io->data->callback->close(io->data);
+ free(io);
+
+ return 0;
+}
+
+static const snd_pcm_ops_t snd_pcm_ioplug_ops = {
+ .close = snd_pcm_ioplug_close,
+ .nonblock = snd_pcm_ioplug_nonblock,
+ .async = snd_pcm_ioplug_async,
+ .info = snd_pcm_ioplug_info,
+ .hw_refine = snd_pcm_ioplug_hw_refine,
+ .hw_params = snd_pcm_ioplug_hw_params,
+ .hw_free = snd_pcm_ioplug_hw_free,
+ .sw_params = snd_pcm_ioplug_sw_params,
+ .channel_info = snd_pcm_ioplug_channel_info,
+ .dump = snd_pcm_ioplug_dump,
+ .mmap = snd_pcm_ioplug_mmap,
+ .munmap = snd_pcm_ioplug_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_ioplug_fast_ops = {
+ .status = snd_pcm_ioplug_status,
+ .prepare = snd_pcm_ioplug_prepare,
+ .reset = snd_pcm_ioplug_reset,
+ .start = snd_pcm_ioplug_start,
+ .drop = snd_pcm_ioplug_drop,
+ .drain = snd_pcm_ioplug_drain,
+ .pause = snd_pcm_ioplug_pause,
+ .state = snd_pcm_ioplug_state,
+ .hwsync = snd_pcm_ioplug_hwsync,
+ .delay = snd_pcm_ioplug_delay,
+ .resume = snd_pcm_ioplug_resume,
+ .link = NULL,
+ .link_slaves = NULL,
+ .unlink = NULL,
+ .rewindable = snd_pcm_ioplug_rewindable,
+ .rewind = snd_pcm_ioplug_rewind,
+ .forwardable = snd_pcm_ioplug_forwardable,
+ .forward = snd_pcm_ioplug_forward,
+ .writei = snd_pcm_ioplug_writei,
+ .writen = snd_pcm_ioplug_writen,
+ .readi = snd_pcm_ioplug_readi,
+ .readn = snd_pcm_ioplug_readn,
+ .avail_update = snd_pcm_ioplug_avail_update,
+ .mmap_commit = snd_pcm_ioplug_mmap_commit,
+ .htimestamp = snd_pcm_generic_real_htimestamp,
+ .poll_descriptors_count = snd_pcm_ioplug_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_ioplug_poll_descriptors,
+ .poll_revents = snd_pcm_ioplug_poll_revents,
+};
+
+#endif /* !DOC_HIDDEN */
+
+/*
+ * Exported functions
+ */
+
+/*! \page pcm_external_plugins PCM External Plugin SDK
+
+\section pcm_ioplug External Plugin: I/O Plugin
+
+The I/O-type plugin is a PCM plugin to work as the input or output terminal point,
+i.e. as a user-space PCM driver.
+
+The new plugin is created via #snd_pcm_ioplug_create() function.
+The first argument is a pointer of the pluging information. Some of
+this struct must be initialized in prior to call
+#snd_pcm_ioplug_create(). Then the function fills other fields in
+return. The rest arguments, name, stream and mode, are usually
+identical with the values passed from the ALSA plugin constructor.
+
+The following fields are mandatory: version, name, callback.
+Otherfields are optional and should be initialized with zero.
+
+The constant #SND_PCM_IOPLUG_VERSION must be passed to the version
+field for the version check in alsa-lib. A non-NULL ASCII string
+has to be passed to the name field. The callback field contains the
+table of callback functions for this plugin (defined as
+#snd_pcm_ioplug_callback_t).
+
+flags field specifies the optional bit-flags. poll_fd and poll_events
+specify the poll file descriptor and the corresponding poll events
+(POLLIN, POLLOUT) for the plugin. If the plugin requires multiple
+poll descriptors or poll descriptor(s) dynamically varying, set
+poll_descriptors and poll_descriptors_count callbacks to the callback
+table. Then the poll_fd and poll_events field are ignored.
+
+mmap_rw specifies whether the plugin behaves in the pseudo mmap mode.
+When this value is set to 1, the plugin creates always a local buffer
+and performs read/write calls using this buffer as if it's mmapped.
+The address of local buffer can be obtained via
+#snd_pcm_ioplug_mmap_areas() function.
+When poll_fd, poll_events and mmap_rw fields are changed after
+#snd_pcm_ioplug_create(), call #snd_pcm_ioplug_reinit_status() to
+reflect the changes.
+
+The driver can set an arbitrary value (pointer) to private_data
+field to refer its own data in the callbacks.
+
+The rest fields are filled by #snd_pcm_ioplug_create(). The pcm field
+is the resultant PCM handle. The others are the current status of the
+PCM.
+
+The callback functions in #snd_pcm_ioplug_callback_t define the real
+behavior of the driver.
+At least, start, stop and pointer callbacks must be given. Other
+callbacks are optional. The start and stop callbacks are called when
+the PCM stream is started and stopped, repsectively. The pointer
+callback returns the current DMA position, which may be called at any
+time.
+
+The transfer callback is called when any data transfer happens. It
+receives the area array, offset and the size to transfer. The area
+array contains the array of snd_pcm_channel_area_t with the elements
+of number of channels.
+
+When the PCM is closed, close callback is called. If the driver
+allocates any internal buffers, they should be released in this
+callback. The hw_params and hw_free callbacks are called when
+hw_params are set and reset, respectively. Note that they may be
+called multiple times according to the application. Similarly,
+sw_params callback is called when sw_params is set or changed.
+
+The prepare, drain, pause and resume callbacks are called when
+#snd_pcm_prepare(), #snd_pcm_drain(), #snd_pcm_pause(), and
+#snd_pcm_resume() are called. The poll_descriptors_count and
+poll_descriptors callbacks are used to return the multiple or dynamic
+poll descriptors as mentioned above. The poll_revents callback is
+used to modify poll events. If the driver needs to mangle the native
+poll events to proper poll events for PCM, you can do it in this
+callback.
+
+Finally, the dump callback is used to print the status of the plugin.
+
+The hw_params constraints can be defined via either
+#snd_pcm_iplug_set_param_minmax() and #snd_pcm_ioplug_set_param_list()
+functions after calling #snd_pcm_ioplug_create().
+The former defines the minimal and maximal acceptable values for the
+given hw_params parameter (SND_PCM_IOPLUG_HW_XXX).
+This function can't be used for the format parameter. The latter
+function specifies the available parameter values as the list.
+
+To clear the parameter constraints, call #snd_pcm_ioplug_params_reset() function.
+
+*/
+
+/**
+ * \brief Create an ioplug instance
+ * \param ioplug the ioplug handle
+ * \param name name of PCM
+ * \param stream stream direction
+ * \param mode PCM open mode
+ * \return 0 if successful, or a negative error code
+ *
+ * Creates the ioplug instance.
+ *
+ * The callback is the mandatory field of ioplug handle. At least, start, stop and
+ * pointer callbacks must be set before calling this function.
+ *
+ */
+int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name,
+ snd_pcm_stream_t stream, int mode)
+{
+ ioplug_priv_t *io;
+ int err;
+ snd_pcm_t *pcm;
+
+ assert(ioplug && ioplug->callback);
+ assert(ioplug->callback->start &&
+ ioplug->callback->stop &&
+ ioplug->callback->pointer);
+
+ /* We support 1.0.0 to current */
+ if (ioplug->version < 0x010000 ||
+ ioplug->version > SND_PCM_IOPLUG_VERSION) {
+ SNDERR("ioplug: Plugin version mismatch\n");
+ return -ENXIO;
+ }
+
+ io = calloc(1, sizeof(*io));
+ if (! io)
+ return -ENOMEM;
+
+ io->data = ioplug;
+ ioplug->state = SND_PCM_STATE_OPEN;
+ ioplug->stream = stream;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_IOPLUG, name, stream, mode);
+ if (err < 0) {
+ free(io);
+ return err;
+ }
+
+ ioplug->pcm = pcm;
+ pcm->ops = &snd_pcm_ioplug_ops;
+ pcm->fast_ops = &snd_pcm_ioplug_fast_ops;
+ pcm->private_data = io;
+
+ snd_pcm_set_hw_ptr(pcm, &ioplug->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &ioplug->appl_ptr, -1, 0);
+
+ snd_pcm_ioplug_reinit_status(ioplug);
+
+ return 0;
+}
+
+/**
+ * \brief Delete the ioplug instance
+ * \param ioplug the ioplug handle
+ * \return 0 if successful, or a negative error code
+ */
+int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *ioplug)
+{
+ return snd_pcm_close(ioplug->pcm);
+}
+
+
+/**
+ * \brief Reset ioplug parameters
+ * \param ioplug the ioplug handle
+ *
+ * Resets the all parameters for the given ioplug handle.
+ */
+void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *ioplug)
+{
+ ioplug_priv_t *io = ioplug->pcm->private_data;
+ clear_io_params(io);
+}
+
+/**
+ * \brief Set parameter as the list
+ * \param ioplug the ioplug handle
+ * \param type parameter type
+ * \param num_list number of available values
+ * \param list the list of available values
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the parameter as the list.
+ * The available values of the given parameter type is restricted to the ones of the given list.
+ */
+int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned int num_list, const unsigned int *list)
+{
+ ioplug_priv_t *io = ioplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_IOPLUG_HW_PARAMS) {
+ SNDERR("IOPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ if (type == SND_PCM_IOPLUG_HW_PERIODS)
+ io->params[type].integer = 1;
+ return snd_ext_parm_set_list(&io->params[type], num_list, list);
+}
+
+/**
+ * \brief Set parameter as the min/max values
+ * \param ioplug the ioplug handle
+ * \param type parameter type
+ * \param min the minimum value
+ * \param max the maximum value
+ * \return 0 if successful, or a negative error code
+ *
+ * Sets the parameter as the min/max values.
+ * The available values of the given parameter type is restricted between the given
+ * minimum and maximum values.
+ */
+int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned int min, unsigned int max)
+{
+ ioplug_priv_t *io = ioplug->pcm->private_data;
+ if (type < 0 && type >= SND_PCM_IOPLUG_HW_PARAMS) {
+ SNDERR("IOPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ if (type == SND_PCM_IOPLUG_HW_ACCESS || type == SND_PCM_IOPLUG_HW_FORMAT) {
+ SNDERR("IOPLUG: invalid parameter type %d", type);
+ return -EINVAL;
+ }
+ if (type == SND_PCM_IOPLUG_HW_PERIODS)
+ io->params[type].integer = 1;
+ return snd_ext_parm_set_minmax(&io->params[type], min, max);
+}
+
+/**
+ * \brief Reinitialize the poll and mmap status
+ * \param ioplug the ioplug handle
+ * \return 0 if successful, or a negative error code
+ *
+ * Reinitializes the poll and the mmap status of the PCM.
+ * Call this function to propagate the status change in the ioplug instance to
+ * its PCM internals.
+ */
+int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug)
+{
+ ioplug->pcm->poll_fd = ioplug->poll_fd;
+ ioplug->pcm->poll_events = ioplug->poll_events;
+ ioplug->pcm->monotonic = (ioplug->flags & SND_PCM_IOPLUG_FLAG_MONOTONIC) != 0;
+ ioplug->pcm->mmap_rw = ioplug->mmap_rw;
+ return 0;
+}
+
+/**
+ * \brief Get mmap area of ioplug
+ * \param ioplug the ioplug handle
+ * \return the mmap channel areas if available, or NULL
+ *
+ * Returns the mmap channel areas if available. When mmap_rw field is not set,
+ * this function always returns NULL.
+ */
+const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug)
+{
+ if (ioplug->mmap_rw)
+ return snd_pcm_mmap_areas(ioplug->pcm);
+ return NULL;
+}
+
+/**
+ * \brief Change the ioplug PCM status
+ * \param ioplug the ioplug handle
+ * \param state the PCM status
+ * \return zero if successful or a negative error code
+ *
+ * Changes the PCM status of the ioplug to the given value.
+ * This function can be used for external plugins to notify the status
+ * change, e.g. XRUN.
+ */
+int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state)
+{
+ ioplug->state = state;
+ return 0;
+}
diff --git a/alsa-lib/src/pcm/pcm_ladspa.c b/alsa-lib/src/pcm/pcm_ladspa.c
new file mode 100644
index 0000000..5161820
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_ladspa.c
@@ -0,0 +1,1801 @@
+/**
+ * \file pcm/pcm_ladspa.c
+ * \ingroup PCM_Plugins
+ * \brief ALSA Plugin <-> LADSPA Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2001,2006
+ */
+/*
+ * PCM - LADSPA integration plugin
+ * Copyright (c) 2001-2006 by Jaroslav Kysela <perex@perex.cz>
+ * Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * perex@perex.cz 2005/12/13
+ * The LADSPA plugin rewrite was sponsored by MediaNet AG
+ * http://www.medianet.ag
+ */
+
+#include <dirent.h>
+#include <locale.h>
+#include <math.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "ladspa.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_ladspa = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+#define NO_ASSIGN 0xffffffff
+
+typedef enum _snd_pcm_ladspa_policy {
+ SND_PCM_LADSPA_POLICY_NONE, /* use bindings only */
+ SND_PCM_LADSPA_POLICY_DUPLICATE /* duplicate bindings for all channels */
+} snd_pcm_ladspa_policy_t;
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ /* Plugin custom fields */
+ struct list_head pplugins;
+ struct list_head cplugins;
+ unsigned int channels; /* forced input channels, 0 = auto */
+ unsigned int allocated; /* count of allocated samples */
+ LADSPA_Data *zero[2]; /* zero input or dummy output */
+} snd_pcm_ladspa_t;
+
+typedef struct {
+ unsigned int size;
+ unsigned int *array;
+} snd_pcm_ladspa_array_t;
+
+typedef struct {
+ snd_pcm_ladspa_array_t channels;
+ snd_pcm_ladspa_array_t ports;
+ LADSPA_Data **m_data;
+ LADSPA_Data **data;
+} snd_pcm_ladspa_eps_t;
+
+typedef struct snd_pcm_ladspa_instance {
+ struct list_head list;
+ const LADSPA_Descriptor *desc;
+ LADSPA_Handle *handle;
+ unsigned int depth;
+ snd_pcm_ladspa_eps_t input;
+ snd_pcm_ladspa_eps_t output;
+ struct snd_pcm_ladspa_instance *prev;
+ struct snd_pcm_ladspa_instance *next;
+} snd_pcm_ladspa_instance_t;
+
+typedef struct {
+ LADSPA_PortDescriptor pdesc; /* port description */
+ unsigned int port_bindings_size; /* size of array */
+ unsigned int *port_bindings; /* index = channel number, value = LADSPA port */
+ unsigned int controls_size; /* size of array */
+ unsigned char *controls_initialized; /* initialized by ALSA user */
+ LADSPA_Data *controls; /* index = LADSPA control port index */
+} snd_pcm_ladspa_plugin_io_t;
+
+typedef struct {
+ struct list_head list;
+ snd_pcm_ladspa_policy_t policy;
+ char *filename;
+ void *dl_handle;
+ const LADSPA_Descriptor *desc;
+ snd_pcm_ladspa_plugin_io_t input;
+ snd_pcm_ladspa_plugin_io_t output;
+ struct list_head instances; /* one LADSPA plugin might be used multiple times */
+} snd_pcm_ladspa_plugin_t;
+
+#endif /* DOC_HIDDEN */
+
+static unsigned int snd_pcm_ladspa_count_ports(snd_pcm_ladspa_plugin_t *lplug,
+ LADSPA_PortDescriptor pdesc)
+{
+ unsigned int res = 0, idx;
+ for (idx = 0; idx < lplug->desc->PortCount; idx++) {
+ if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc)
+ res++;
+ }
+ return res;
+}
+
+static int snd_pcm_ladspa_find_port(unsigned int *res,
+ snd_pcm_ladspa_plugin_t *lplug,
+ LADSPA_PortDescriptor pdesc,
+ unsigned int port_idx)
+{
+ unsigned long idx;
+
+ for (idx = 0; idx < lplug->desc->PortCount; idx++)
+ if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc) {
+ if (port_idx == 0) {
+ *res = idx;
+ return 0;
+ }
+ port_idx--;
+ }
+ return -EINVAL;
+}
+
+static int snd_pcm_ladspa_find_sport(unsigned int *res,
+ snd_pcm_ladspa_plugin_t *lplug,
+ LADSPA_PortDescriptor pdesc,
+ const char *port_name)
+{
+ unsigned long idx;
+
+ for (idx = 0; idx < lplug->desc->PortCount; idx++)
+ if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc &&
+ !strcmp(lplug->desc->PortNames[idx], port_name)) {
+ *res = idx;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+static int snd_pcm_ladspa_find_port_idx(unsigned int *res,
+ snd_pcm_ladspa_plugin_t *lplug,
+ LADSPA_PortDescriptor pdesc,
+ unsigned int port)
+{
+ unsigned long idx;
+ unsigned int r = 0;
+
+ if (port >= lplug->desc->PortCount)
+ return -EINVAL;
+ for (idx = 0; idx < port; idx++)
+ if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc)
+ r++;
+ *res = r;
+ return 0;
+}
+
+static void snd_pcm_ladspa_free_io(snd_pcm_ladspa_plugin_io_t *io)
+{
+ free(io->controls);
+ free(io->controls_initialized);
+}
+
+static void snd_pcm_ladspa_free_plugins(struct list_head *plugins)
+{
+ while (!list_empty(plugins)) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(plugins->next, snd_pcm_ladspa_plugin_t, list);
+ snd_pcm_ladspa_free_io(&plugin->input);
+ snd_pcm_ladspa_free_io(&plugin->output);
+ if (plugin->dl_handle)
+ dlclose(plugin->dl_handle);
+ free(plugin->filename);
+ list_del(&plugin->list);
+ free(plugin);
+ }
+}
+
+static void snd_pcm_ladspa_free(snd_pcm_ladspa_t *ladspa)
+{
+ unsigned int idx;
+
+ snd_pcm_ladspa_free_plugins(&ladspa->pplugins);
+ snd_pcm_ladspa_free_plugins(&ladspa->cplugins);
+ for (idx = 0; idx < 2; idx++) {
+ free(ladspa->zero[idx]);
+ ladspa->zero[idx] = NULL;
+ }
+ ladspa->allocated = 0;
+}
+
+static int snd_pcm_ladspa_close(snd_pcm_t *pcm)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+
+ snd_pcm_ladspa_free(ladspa);
+ return snd_pcm_generic_close(pcm);
+}
+
+static int snd_pcm_ladspa_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHMN };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_format(params, SND_PCM_FORMAT_FLOAT);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0);
+ if (err < 0)
+ return err;
+ }
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_ladspa_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAPN };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, SND_PCM_FORMAT_FLOAT);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_CAPTURE)
+ _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0);
+ return 0;
+}
+
+static int snd_pcm_ladspa_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_ladspa_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_ladspa_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_ladspa_hw_refine_cprepare,
+ snd_pcm_ladspa_hw_refine_cchange,
+ snd_pcm_ladspa_hw_refine_sprepare,
+ snd_pcm_ladspa_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_ladspa_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ // snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_ladspa_hw_refine_cchange,
+ snd_pcm_ladspa_hw_refine_sprepare,
+ snd_pcm_ladspa_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static void snd_pcm_ladspa_free_eps(snd_pcm_ladspa_eps_t *eps)
+{
+ free(eps->channels.array);
+ free(eps->ports.array);
+}
+
+static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa, int cleanup)
+{
+ struct list_head *list, *pos, *pos1, *next1;
+ unsigned int idx;
+
+ list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins;
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each_safe(pos1, next1, &plugin->instances) {
+ snd_pcm_ladspa_instance_t *instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ if (plugin->desc->deactivate)
+ plugin->desc->deactivate(instance->handle);
+ if (cleanup) {
+ if (plugin->desc->cleanup)
+ plugin->desc->cleanup(instance->handle);
+ if (instance->input.m_data) {
+ for (idx = 0; idx < instance->input.channels.size; idx++)
+ free(instance->input.m_data[idx]);
+ free(instance->input.m_data);
+ }
+ if (instance->output.m_data) {
+ for (idx = 0; idx < instance->output.channels.size; idx++)
+ free(instance->output.m_data[idx]);
+ free(instance->output.m_data);
+ }
+ list_del(&(instance->list));
+ snd_pcm_ladspa_free_eps(&instance->input);
+ snd_pcm_ladspa_free_eps(&instance->output);
+ free(instance);
+ } else {
+ if (plugin->desc->activate)
+ plugin->desc->activate(instance->handle);
+ }
+ }
+ if (cleanup) {
+ assert(list_empty(&plugin->instances));
+ }
+ }
+}
+
+static int snd_pcm_ladspa_add_to_carray(snd_pcm_ladspa_array_t *array,
+ unsigned int idx,
+ unsigned int val)
+{
+ unsigned int *narray;
+ unsigned int idx1;
+
+ if (idx >= array->size) {
+ narray = realloc(array->array, sizeof(unsigned int) * (idx + 1));
+ if (narray == NULL)
+ return -ENOMEM;
+ for (idx1 = array->size; idx1 < idx; idx1++)
+ narray[idx1] = NO_ASSIGN;
+ array->array = narray;
+ array->size = idx + 1;
+ array->array[idx] = val;
+ return 0;
+ }
+ if (array->array[idx] == NO_ASSIGN)
+ array->array[idx] = val;
+ else
+ return -EINVAL;
+ return 0;
+}
+
+static int snd_pcm_ladspa_add_to_array(snd_pcm_ladspa_array_t *array,
+ unsigned int idx,
+ unsigned int val)
+{
+ unsigned int *narray;
+ unsigned int idx1;
+
+ if (idx >= array->size) {
+ narray = realloc(array->array, sizeof(unsigned int) * (idx + 1));
+ if (narray == NULL)
+ return -ENOMEM;
+ for (idx1 = array->size; idx1 < idx; idx1++)
+ narray[idx1] = NO_ASSIGN;
+ array->array = narray;
+ array->size = idx + 1;
+ }
+ array->array[idx] = val;
+ return 0;
+}
+
+static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_pcm_ladspa_eps_t *eps)
+{
+ unsigned int port, channels, idx, idx1;
+ int err;
+
+ assert(plugin->policy == SND_PCM_LADSPA_POLICY_NONE);
+ channels = io->port_bindings_size > 0 ?
+ io->port_bindings_size :
+ snd_pcm_ladspa_count_ports(plugin, io->pdesc | LADSPA_PORT_AUDIO);
+ for (idx = idx1 = 0; idx < channels; idx++) {
+ if (io->port_bindings_size > 0)
+ port = io->port_bindings[idx];
+ else {
+ err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx);
+ if (err < 0) {
+ SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
+ return err;
+ }
+ }
+ if (port == NO_ASSIGN)
+ continue;
+ err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx);
+ if (err < 0) {
+ SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ return err;
+ }
+ err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port);
+ if (err < 0) {
+ SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ return err;
+ }
+ idx1++;
+ }
+ return 0;
+}
+
+static int snd_pcm_ladspa_connect_plugin(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_instance_t *instance)
+{
+ int err;
+
+ err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->input, &instance->input);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->output, &instance->output);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_ladspa_connect_plugin_duplicate1(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_pcm_ladspa_eps_t *eps,
+ unsigned int idx)
+{
+ unsigned int port;
+ int err;
+
+ assert(plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE);
+ if (io->port_bindings_size > 0) {
+ port = io->port_bindings[0];
+ } else {
+ err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, 0);
+ if (err < 0) {
+ SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
+ return err;
+ }
+ }
+ err = snd_pcm_ladspa_add_to_carray(&eps->channels, 0, idx);
+ if (err < 0) {
+ SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ return err;
+ }
+ err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port);
+ if (err < 0) {
+ SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_ladspa_connect_plugin_duplicate(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *in_io,
+ snd_pcm_ladspa_plugin_io_t *out_io,
+ snd_pcm_ladspa_instance_t *instance,
+ unsigned int idx)
+{
+ int err;
+
+ err = snd_pcm_ladspa_connect_plugin_duplicate1(plugin, in_io, &instance->input, idx);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_connect_plugin_duplicate1(plugin, out_io, &instance->output, idx);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static void snd_pcm_ladspa_get_default_cvalue(const LADSPA_Descriptor * desc, unsigned int port, LADSPA_Data *val)
+{
+ LADSPA_PortRangeHintDescriptor hdesc;
+
+ hdesc = desc->PortRangeHints[port].HintDescriptor;
+ switch (hdesc & LADSPA_HINT_DEFAULT_MASK) {
+ case LADSPA_HINT_DEFAULT_MINIMUM:
+ *val = desc->PortRangeHints[port].LowerBound;
+ break;
+ case LADSPA_HINT_DEFAULT_LOW:
+ if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+ *val = exp(log(desc->PortRangeHints[port].LowerBound)
+ * 0.75
+ + log(desc->PortRangeHints[port].UpperBound)
+ * 0.25);
+ } else {
+ *val = (desc->PortRangeHints[port].LowerBound * 0.75) +
+ (desc->PortRangeHints[port].UpperBound * 0.25);
+ }
+ break;
+ case LADSPA_HINT_DEFAULT_MIDDLE:
+ if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+ *val = sqrt(desc->PortRangeHints[port].LowerBound *
+ desc->PortRangeHints[port].UpperBound);
+ } else {
+ *val = 0.5 *
+ (desc->PortRangeHints[port].LowerBound +
+ desc->PortRangeHints[port].UpperBound);
+ }
+ break;
+ case LADSPA_HINT_DEFAULT_HIGH:
+ if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) {
+ *val = exp(log(desc->PortRangeHints[port].LowerBound)
+ * 0.25
+ + log(desc->PortRangeHints[port].UpperBound)
+ * 0.75);
+ } else {
+ *val = (desc->PortRangeHints[port].LowerBound * 0.25) +
+ (desc->PortRangeHints[port].UpperBound * 0.75);
+ }
+ break;
+ case LADSPA_HINT_DEFAULT_MAXIMUM:
+ *val = desc->PortRangeHints[port].UpperBound;
+ break;
+ case LADSPA_HINT_DEFAULT_0:
+ *val = 0;
+ break;
+ case LADSPA_HINT_DEFAULT_1:
+ *val = 1;
+ break;
+ case LADSPA_HINT_DEFAULT_100:
+ *val = 100;
+ break;
+ case LADSPA_HINT_DEFAULT_440:
+ *val = 440;
+ break;
+ default:
+ *val = 0; /* reasonable default, if everything fails */
+ break;
+ }
+}
+
+static int snd_pcm_ladspa_connect_controls(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_pcm_ladspa_instance_t *instance)
+{
+ unsigned long idx, midx;
+
+ for (idx = midx = 0; idx < plugin->desc->PortCount; idx++)
+ if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL)) {
+ if (io->controls_size > midx) {
+ if (!io->controls_initialized[midx])
+ snd_pcm_ladspa_get_default_cvalue(plugin->desc, idx, &io->controls[midx]);
+ plugin->desc->connect_port(instance->handle, idx, &io->controls[midx]);
+ } else {
+ return -EINVAL;
+ }
+ midx++;
+ }
+ return 0;
+}
+
+static int snd_pcm_ladspa_check_connect(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_pcm_ladspa_eps_t *eps,
+ unsigned int depth)
+{
+ unsigned int idx, midx;
+ int err = 0;
+
+ for (idx = midx = 0; idx < plugin->desc->PortCount; idx++)
+ if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_AUDIO)) == (io->pdesc | LADSPA_PORT_AUDIO)) {
+ if (eps->channels.array[midx] == NO_ASSIGN) {
+ SNDERR("%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
+ err++;
+ }
+ midx++;
+ }
+ if (err > 0) {
+ SNDERR("%i connection errors total", err);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa)
+{
+ struct list_head *list, *pos;
+ unsigned int depth, idx, count;
+ unsigned int in_channel, out_channel;
+ unsigned int in_channels, out_channels;
+ unsigned int in_ports, out_ports;
+ snd_pcm_ladspa_instance_t *instance = NULL;
+ int err;
+
+ list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins;
+ in_channels = ladspa->channels > 0 ? ladspa->channels :
+ (pcm->stream == SND_PCM_STREAM_PLAYBACK ? pcm->channels : ladspa->plug.gen.slave->channels);
+ depth = 0;
+ out_channels = 0;
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ if (pos->next == list) /* last entry */
+ out_channels = pcm->stream == SND_PCM_STREAM_PLAYBACK ? ladspa->plug.gen.slave->channels : pcm->channels;
+ in_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO);
+ out_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO);
+ count = 1;
+ if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
+ if (in_ports == 1 && out_ports == 1)
+ count = in_channels;
+ else
+ plugin->policy = SND_PCM_LADSPA_POLICY_NONE;
+ }
+ in_channel = 0;
+ out_channel = 0;
+ for (idx = 0; idx < count; idx++) {
+ instance = (snd_pcm_ladspa_instance_t *)calloc(1, sizeof(snd_pcm_ladspa_instance_t));
+ if (instance == NULL)
+ return -ENOMEM;
+ instance->desc = plugin->desc;
+ instance->handle = plugin->desc->instantiate(plugin->desc, pcm->rate);
+ instance->depth = depth;
+ if (instance->handle == NULL) {
+ SNDERR("Unable to create instance of LADSPA plugin '%s'", plugin->desc->Name);
+ free(instance);
+ return -EINVAL;
+ }
+ list_add_tail(&instance->list, &plugin->instances);
+ if (plugin->desc->activate)
+ plugin->desc->activate(instance->handle);
+ if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
+ err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, &plugin->output, instance, idx);
+ if (err < 0) {
+ SNDERR("Unable to connect duplicate port of plugin '%s' channel %u depth %u", plugin->desc->Name, idx, instance->depth);
+ return err;
+ }
+ } else {
+ err = snd_pcm_ladspa_connect_plugin(plugin, instance);
+ if (err < 0) {
+ SNDERR("Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth);
+ return err;
+ }
+ }
+ err = snd_pcm_ladspa_connect_controls(plugin, &plugin->input, instance);
+ assert(err >= 0);
+ err = snd_pcm_ladspa_connect_controls(plugin, &plugin->output, instance);
+ assert(err >= 0);
+ }
+ err = snd_pcm_ladspa_check_connect(plugin, &plugin->input, &instance->input, depth);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_check_connect(plugin, &plugin->output, &instance->output, depth);
+ if (err < 0)
+ return err;
+ depth++;
+ }
+ return 0;
+}
+
+static LADSPA_Data *snd_pcm_ladspa_allocate_zero(snd_pcm_ladspa_t *ladspa, unsigned int idx)
+{
+ if (ladspa->zero[idx] == NULL)
+ ladspa->zero[idx] = calloc(ladspa->allocated, sizeof(LADSPA_Data));
+ return ladspa->zero[idx];
+}
+
+static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa)
+{
+ struct list_head *list, *pos, *pos1;
+ snd_pcm_ladspa_instance_t *instance;
+ unsigned int channels = 16, nchannels;
+ unsigned int ichannels, ochannels;
+ void **pchannels, **npchannels;
+ unsigned int idx, chn;
+
+ ladspa->allocated = 2048;
+ if (pcm->buffer_size > ladspa->allocated)
+ ladspa->allocated = pcm->buffer_size;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ ichannels = pcm->channels;
+ ochannels = ladspa->plug.gen.slave->channels;
+ } else {
+ ichannels = ladspa->plug.gen.slave->channels;
+ ochannels = pcm->channels;
+ }
+ pchannels = calloc(1, sizeof(void *) * channels);
+ if (pchannels == NULL)
+ return -ENOMEM;
+ list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins;
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each(pos1, &plugin->instances) {
+ instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ nchannels = channels;
+ for (idx = 0; idx < instance->input.channels.size; idx++) {
+ chn = instance->input.channels.array[idx];
+ assert(instance->input.ports.array[idx] != NO_ASSIGN);
+ if (chn >= nchannels)
+ nchannels = chn + 1;
+ }
+ for (idx = 0; idx < instance->output.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ assert(instance->output.ports.array[idx] != NO_ASSIGN);
+ if (chn >= nchannels)
+ nchannels = chn + 1;
+ }
+ if (nchannels != channels) {
+ npchannels = realloc(pchannels, nchannels * sizeof(void *));
+ if (npchannels == NULL) {
+ free(pchannels);
+ return -ENOMEM;
+ }
+ for (idx = channels; idx < nchannels; idx++)
+ npchannels[idx] = NULL;
+ pchannels = npchannels;
+ }
+ assert(instance->input.data == NULL);
+ assert(instance->input.m_data == NULL);
+ assert(instance->output.data == NULL);
+ assert(instance->output.m_data == NULL);
+ instance->input.data = calloc(instance->input.channels.size, sizeof(void *));
+ instance->input.m_data = calloc(instance->input.channels.size, sizeof(void *));
+ instance->output.data = calloc(instance->output.channels.size, sizeof(void *));
+ instance->output.m_data = calloc(instance->output.channels.size, sizeof(void *));
+ if (instance->input.data == NULL ||
+ instance->input.m_data == NULL ||
+ instance->output.data == NULL ||
+ instance->output.m_data == NULL)
+ return -ENOMEM;
+ for (idx = 0; idx < instance->input.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ if (pchannels[chn] == NULL && chn < ichannels) {
+ instance->input.data[idx] = NULL;
+ continue;
+ }
+ instance->input.data[idx] = pchannels[chn];
+ if (instance->input.data[idx] == NULL) {
+ instance->input.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 0);
+ if (instance->input.data[idx] == NULL)
+ return -ENOMEM;
+ }
+ }
+ for (idx = 0; idx < instance->output.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ /* FIXME/OPTIMIZE: check if we can remove double alloc */
+ /* if LADSPA plugin has no broken inplace */
+ instance->output.data[idx] = malloc(sizeof(LADSPA_Data) * ladspa->allocated);
+ if (instance->output.data[idx] == NULL)
+ return -ENOMEM;
+ pchannels[chn] = instance->output.m_data[idx] = instance->output.data[idx];
+ }
+ }
+ }
+ /* OPTIMIZE: we have already allocated areas for ALSA output channels */
+ /* next loop deallocates the last output LADSPA areas and connects */
+ /* them to ALSA areas (NULL) or dummy area ladpsa->free[1] ; */
+ /* this algorithm might be optimized to not allocate the last LADSPA outputs */
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each(pos1, &plugin->instances) {
+ instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ for (idx = 0; idx < instance->output.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ if (instance->output.data[idx] == pchannels[chn]) {
+ free(instance->output.m_data[idx]);
+ instance->output.m_data[idx] = NULL;
+ if (chn < ochannels) {
+ instance->output.data[idx] = NULL;
+ } else {
+ instance->output.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 1);
+ if (instance->output.data[idx] == NULL)
+ return -ENOMEM;
+ }
+ }
+ }
+ }
+ }
+#if 0
+ printf("zero[0] = %p\n", ladspa->zero[0]);
+ printf("zero[1] = %p\n", ladspa->zero[1]);
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each(pos1, &plugin->instances) {
+ instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ for (idx = 0; idx < instance->input.channels.size; idx++)
+ printf("%i:alloc-input%i: data = %p, m_data = %p\n", instance->depth, idx, instance->input.data[idx], instance->input.m_data[idx]);
+ for (idx = 0; idx < instance->output.channels.size; idx++)
+ printf("%i:alloc-output%i: data = %p, m_data = %p\n", instance->depth, idx, instance->output.data[idx], instance->output.m_data[idx]);
+ }
+ }
+#endif
+ free(pchannels);
+ return 0;
+}
+
+static int snd_pcm_ladspa_init(snd_pcm_t *pcm)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ int err;
+
+ snd_pcm_ladspa_free_instances(pcm, ladspa, 1);
+ err = snd_pcm_ladspa_allocate_instances(pcm, ladspa);
+ if (err < 0) {
+ snd_pcm_ladspa_free_instances(pcm, ladspa, 1);
+ return err;
+ }
+ err = snd_pcm_ladspa_allocate_memory(pcm, ladspa);
+ if (err < 0) {
+ snd_pcm_ladspa_free_instances(pcm, ladspa, 1);
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_ladspa_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+
+ snd_pcm_ladspa_free_instances(pcm, ladspa, 1);
+ return snd_pcm_generic_hw_free(pcm);
+}
+
+static snd_pcm_uframes_t
+snd_pcm_ladspa_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ snd_pcm_ladspa_instance_t *instance;
+ struct list_head *pos, *pos1;
+ LADSPA_Data *data;
+ unsigned int idx, chn, size1, size2;
+
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ size2 = size;
+#if 0 /* no processing - for testing purposes only */
+ snd_pcm_areas_copy(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size, pcm->format);
+#else
+ while (size > 0) {
+ size1 = size;
+ if (size1 > ladspa->allocated)
+ size1 = ladspa->allocated;
+ list_for_each(pos, &ladspa->pplugins) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each(pos1, &plugin->instances) {
+ instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ for (idx = 0; idx < instance->input.channels.size; idx++) {
+ chn = instance->input.channels.array[idx];
+ data = instance->input.data[idx];
+ if (data == NULL) {
+ data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8));
+ data += offset;
+ }
+ instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data);
+ }
+ for (idx = 0; idx < instance->output.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ data = instance->output.data[idx];
+ if (data == NULL) {
+ data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8));
+ data += slave_offset;
+ }
+ instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data);
+ }
+ instance->desc->run(instance->handle, size1);
+ }
+ }
+ offset += size1;
+ slave_offset += size1;
+ size -= size1;
+ }
+#endif
+ *slave_sizep = size2;
+ return size2;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_ladspa_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+ snd_pcm_ladspa_instance_t *instance;
+ struct list_head *pos, *pos1;
+ LADSPA_Data *data;
+ unsigned int idx, chn, size1, size2;;
+
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ size2 = size;
+#if 0 /* no processing - for testing purposes only */
+ snd_pcm_areas_copy(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size, pcm->format);
+#else
+ while (size > 0) {
+ size1 = size;
+ if (size1 > ladspa->allocated)
+ size1 = ladspa->allocated;
+ list_for_each(pos, &ladspa->cplugins) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ list_for_each(pos1, &plugin->instances) {
+ instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list);
+ for (idx = 0; idx < instance->input.channels.size; idx++) {
+ chn = instance->input.channels.array[idx];
+ data = instance->input.data[idx];
+ if (data == NULL) {
+ data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8));
+ data += slave_offset;
+ }
+ instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data);
+ }
+ for (idx = 0; idx < instance->output.channels.size; idx++) {
+ chn = instance->output.channels.array[idx];
+ data = instance->output.data[idx];
+ if (data == NULL) {
+ data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8));
+ data += offset;
+ }
+ instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data);
+ }
+ instance->desc->run(instance->handle, size1);
+ }
+ }
+ offset += size1;
+ slave_offset += size1;
+ size -= size1;
+ }
+#endif
+ *slave_sizep = size2;
+ return size2;
+}
+
+static void snd_pcm_ladspa_dump_direction(snd_pcm_ladspa_plugin_t *plugin,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_output_t *out)
+{
+ unsigned int idx, midx;
+
+ if (io->port_bindings_size == 0)
+ goto __control;
+ snd_output_printf(out, " Audio %s port bindings:\n", io->pdesc == LADSPA_PORT_INPUT ? "input" : "output");
+ for (idx = 0; idx < io->port_bindings_size; idx++) {
+ if (io->port_bindings[idx] == NO_ASSIGN)
+ snd_output_printf(out, " %i -> NONE\n", idx);
+ else
+ snd_output_printf(out, " %i -> %i\n", idx, io->port_bindings[idx]);
+ }
+ __control:
+ if (io->controls_size == 0)
+ return;
+ snd_output_printf(out, " Control %s port initial values:\n", io->pdesc == LADSPA_PORT_INPUT ? "input" : "output");
+ for (idx = midx = 0; idx < plugin->desc->PortCount; idx++) {
+ if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL)) {
+ snd_output_printf(out, " %i \"%s\" = %.8f\n", idx, plugin->desc->PortNames[idx], io->controls[midx]);
+ midx++;
+ }
+ }
+}
+
+static void snd_pcm_ladspa_dump_array(snd_output_t *out,
+ snd_pcm_ladspa_array_t *array,
+ snd_pcm_ladspa_plugin_t *plugin)
+{
+ unsigned int size = array->size;
+ unsigned int val, idx = 0;
+
+ while (size-- > 0) {
+ if (idx > 0) {
+ snd_output_putc(out, ',');
+ snd_output_putc(out, ' ');
+ }
+ val = array->array[idx++];
+ if (val == NO_ASSIGN)
+ snd_output_putc(out, '-');
+ else
+ snd_output_printf(out, "%u", val);
+ if (plugin && val != NO_ASSIGN)
+ snd_output_printf(out, " \"%s\"", plugin->desc->PortNames[val]);
+ }
+}
+
+static void snd_pcm_ladspa_plugins_dump(struct list_head *list, snd_output_t *out)
+{
+ struct list_head *pos, *pos2;
+
+ list_for_each(pos, list) {
+ snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list);
+ snd_output_printf(out, " Policy: %s\n", plugin->policy == SND_PCM_LADSPA_POLICY_NONE ? "none" : "duplicate");
+ snd_output_printf(out, " Filename: %s\n", plugin->filename);
+ snd_output_printf(out, " Plugin Name: %s\n", plugin->desc->Name);
+ snd_output_printf(out, " Plugin Label: %s\n", plugin->desc->Label);
+ snd_output_printf(out, " Plugin Unique ID: %lu\n", plugin->desc->UniqueID);
+ snd_output_printf(out, " Instances:\n");
+ list_for_each(pos2, &plugin->instances) {
+ snd_pcm_ladspa_instance_t *in = (snd_pcm_ladspa_instance_t *) pos2;
+ snd_output_printf(out, " Depth: %i\n", in->depth);
+ snd_output_printf(out, " InChannels: ");
+ snd_pcm_ladspa_dump_array(out, &in->input.channels, NULL);
+ snd_output_printf(out, "\n InPorts: ");
+ snd_pcm_ladspa_dump_array(out, &in->input.ports, plugin);
+ snd_output_printf(out, "\n OutChannels: ");
+ snd_pcm_ladspa_dump_array(out, &in->output.channels, NULL);
+ snd_output_printf(out, "\n OutPorts: ");
+ snd_pcm_ladspa_dump_array(out, &in->output.ports, plugin);
+ snd_output_printf(out, "\n");
+ }
+ snd_pcm_ladspa_dump_direction(plugin, &plugin->input, out);
+ snd_pcm_ladspa_dump_direction(plugin, &plugin->output, out);
+ }
+}
+
+static void snd_pcm_ladspa_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_ladspa_t *ladspa = pcm->private_data;
+
+ snd_output_printf(out, "LADSPA PCM\n");
+ snd_output_printf(out, " Playback:\n");
+ snd_pcm_ladspa_plugins_dump(&ladspa->pplugins, out);
+ snd_output_printf(out, " Capture:\n");
+ snd_pcm_ladspa_plugins_dump(&ladspa->cplugins, out);
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(ladspa->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_ladspa_ops = {
+ .close = snd_pcm_ladspa_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_ladspa_hw_refine,
+ .hw_params = snd_pcm_ladspa_hw_params,
+ .hw_free = snd_pcm_ladspa_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_ladspa_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static int snd_pcm_ladspa_check_file(snd_pcm_ladspa_plugin_t * const plugin,
+ const char *filename,
+ const char *label,
+ const unsigned long ladspa_id)
+{
+ void *handle;
+
+ assert(filename);
+ handle = dlopen(filename, RTLD_LAZY);
+ if (handle) {
+ LADSPA_Descriptor_Function fcn = (LADSPA_Descriptor_Function)dlsym(handle, "ladspa_descriptor");
+ if (fcn) {
+ long idx;
+ const LADSPA_Descriptor *d;
+ for (idx = 0; (d = fcn(idx)) != NULL; idx++) {
+/*
+ * avoid locale problems - see ALSA bug#1553
+ */
+#if 0
+ if (strcmp(label, d->Label))
+ continue;
+#else
+ char *labellocale;
+ struct lconv *lc;
+ if (label != NULL) {
+ lc = localeconv ();
+ labellocale = malloc (strlen (label) + 1);
+ if (labellocale == NULL) {
+ dlclose(handle);
+ return -ENOMEM;
+ }
+ strcpy (labellocale, label);
+ if (strrchr(labellocale, '.'))
+ *strrchr (labellocale, '.') = *lc->decimal_point;
+ if (strcmp(label, d->Label) && strcmp(labellocale, d->Label)) {
+ free(labellocale);
+ continue;
+ }
+ free (labellocale);
+ }
+#endif
+ if (ladspa_id > 0 && d->UniqueID != ladspa_id)
+ continue;
+ plugin->filename = strdup(filename);
+ if (plugin->filename == NULL) {
+ dlclose(handle);
+ return -ENOMEM;
+ }
+ plugin->dl_handle = handle;
+ plugin->desc = d;
+ return 1;
+ }
+ }
+ dlclose(handle);
+ }
+ return -ENOENT;
+}
+
+static int snd_pcm_ladspa_check_dir(snd_pcm_ladspa_plugin_t * const plugin,
+ const char *path,
+ const char *label,
+ const unsigned long ladspa_id)
+{
+ DIR *dir;
+ struct dirent * dirent;
+ int len = strlen(path), err;
+ int need_slash;
+ char *filename;
+
+ if (len < 1)
+ return 0;
+ need_slash = path[len - 1] != '/';
+
+ dir = opendir(path);
+ if (!dir)
+ return -ENOENT;
+
+ while (1) {
+ dirent = readdir(dir);
+ if (!dirent) {
+ closedir(dir);
+ return 0;
+ }
+
+ filename = malloc(len + strlen(dirent->d_name) + 1 + need_slash);
+ if (filename == NULL) {
+ closedir(dir);
+ return -ENOMEM;
+ }
+ strcpy(filename, path);
+ if (need_slash)
+ strcat(filename, "/");
+ strcat(filename, dirent->d_name);
+ err = snd_pcm_ladspa_check_file(plugin, filename, label, ladspa_id);
+ free(filename);
+ if (err < 0 && err != -ENOENT) {
+ closedir(dir);
+ return err;
+ }
+ if (err > 0) {
+ closedir(dir);
+ return 1;
+ }
+ }
+ /* never reached */
+ return 0;
+}
+
+static int snd_pcm_ladspa_look_for_plugin(snd_pcm_ladspa_plugin_t * const plugin,
+ const char *path,
+ const char *label,
+ const long ladspa_id)
+{
+ const char *c;
+ size_t l;
+ int err;
+
+ for (c = path; (l = strcspn(c, ": ")) > 0; ) {
+ char name[l + 1];
+ char *fullpath;
+ memcpy(name, c, l);
+ name[l] = 0;
+ err = snd_user_file(name, &fullpath);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_check_dir(plugin, fullpath, label, ladspa_id);
+ free(fullpath);
+ if (err < 0)
+ return err;
+ if (err > 0)
+ return 0;
+ c += l;
+ if (!*c)
+ break;
+ c++;
+ }
+ return -ENOENT;
+}
+
+static int snd_pcm_ladspa_add_default_controls(snd_pcm_ladspa_plugin_t *lplug,
+ snd_pcm_ladspa_plugin_io_t *io)
+{
+ unsigned int count = 0;
+ LADSPA_Data *array;
+ unsigned char *initialized;
+ unsigned long idx;
+
+ for (idx = 0; idx < lplug->desc->PortCount; idx++)
+ if ((lplug->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL))
+ count++;
+ array = (LADSPA_Data *)calloc(count, sizeof(LADSPA_Data));
+ if (!array)
+ return -ENOMEM;
+ initialized = (unsigned char *)calloc(count, sizeof(unsigned char));
+ if (!initialized) {
+ free(array);
+ return -ENOMEM;
+ }
+ io->controls_size = count;
+ io->controls_initialized = initialized;
+ io->controls = array;
+
+ return 0;
+}
+
+static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_config_t *controls)
+{
+ snd_config_iterator_t i, next;
+ int err;
+
+ if (snd_config_get_type(controls) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("controls definition must be a compound");
+ return -EINVAL;
+ }
+
+ snd_config_for_each(i, next, controls) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long lval;
+ unsigned int port, uval;
+ double dval;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &lval);
+ if (err >= 0) {
+ err = snd_pcm_ladspa_find_port(&port, lplug, io->pdesc | LADSPA_PORT_CONTROL, lval);
+ } else {
+ err = snd_pcm_ladspa_find_sport(&port, lplug, io->pdesc | LADSPA_PORT_CONTROL, id);
+ }
+ if (err < 0) {
+ SNDERR("Unable to find an control port (%s)", id);
+ return err;
+ }
+ if (snd_config_get_ireal(n, &dval) < 0) {
+ SNDERR("Control port %s has not an float or integer value", id);
+ return err;
+ }
+ err = snd_pcm_ladspa_find_port_idx(&uval, lplug, io->pdesc | LADSPA_PORT_CONTROL, port);
+ if (err < 0) {
+ SNDERR("internal error");
+ return err;
+ }
+ io->controls_initialized[uval] = 1;
+ io->controls[uval] = (LADSPA_Data)dval;
+ }
+
+ return 0;
+}
+
+static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_config_t *bindings)
+{
+ unsigned int count = 0;
+ unsigned int *array;
+ snd_config_iterator_t i, next;
+ int err;
+
+ if (snd_config_get_type(bindings) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("bindings definition must be a compound");
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, bindings) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long channel;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &channel);
+ if (err < 0 || channel < 0) {
+ SNDERR("Invalid channel number: %s", id);
+ return -EINVAL;
+ }
+ if (lplug->policy == SND_PCM_LADSPA_POLICY_DUPLICATE && channel > 0) {
+ SNDERR("Wrong channel specification for duplicate policy");
+ return -EINVAL;
+ }
+ if (count < (unsigned int)(channel + 1))
+ count = (unsigned int)(channel + 1);
+ }
+ if (count > 0) {
+ array = (unsigned int *)calloc(count, sizeof(unsigned int));
+ if (! array)
+ return -ENOMEM;
+ memset(array, 0xff, count * sizeof(unsigned int));
+ io->port_bindings_size = count;
+ io->port_bindings = array;
+ snd_config_for_each(i, next, bindings) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id, *sport;
+ long channel, port;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &channel);
+ if (err < 0 || channel < 0) {
+ assert(0); /* should never happen */
+ return -EINVAL;
+ }
+ err = snd_config_get_integer(n, &port);
+ if (err >= 0) {
+ err = snd_pcm_ladspa_find_port(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, port);
+ if (err < 0) {
+ SNDERR("Unable to find an audio port (%li) for channel %s", port, id);
+ return err;
+ }
+ continue;
+ }
+ err = snd_config_get_string(n, &sport);
+ if (err < 0) {
+ SNDERR("Invalid LADSPA port field type for %s", id);
+ return -EINVAL;
+ }
+ err = snd_pcm_ladspa_find_sport(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, sport);
+ if (err < 0) {
+ SNDERR("Unable to find an audio port (%s) for channel %s", sport, id);
+ return err;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug,
+ snd_pcm_ladspa_plugin_io_t *io,
+ snd_config_t *conf)
+{
+ snd_config_iterator_t i, next;
+ snd_config_t *bindings = NULL, *controls = NULL;
+ int err;
+
+ /* always add default controls for both input and output */
+ err = snd_pcm_ladspa_add_default_controls(lplug, io);
+ if (err < 0) {
+ SNDERR("error adding default controls");
+ return err;
+ }
+
+ if (conf == NULL) {
+ return 0;
+ }
+
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("input or output definition must be a compound");
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "bindings") == 0) {
+ bindings = n;
+ continue;
+ }
+ if (strcmp(id, "controls") == 0) {
+ controls = n;
+ continue;
+ }
+ }
+
+ /* ignore values of parameters for output controls */
+ if (controls && !(io->pdesc & LADSPA_PORT_OUTPUT)) {
+ err = snd_pcm_ladspa_parse_controls(lplug, io, controls);
+ if (err < 0)
+ return err;
+ }
+
+ if (bindings) {
+ err = snd_pcm_ladspa_parse_bindings(lplug, io, bindings);
+ if (err < 0)
+ return err;
+ }
+
+
+ return 0;
+}
+
+static int snd_pcm_ladspa_add_plugin(struct list_head *list,
+ const char *path,
+ snd_config_t *plugin,
+ int reverse)
+{
+ snd_config_iterator_t i, next;
+ const char *label = NULL, *filename = NULL;
+ long ladspa_id = 0;
+ int err;
+ snd_pcm_ladspa_plugin_t *lplug;
+ snd_pcm_ladspa_policy_t policy = SND_PCM_LADSPA_POLICY_DUPLICATE;
+ snd_config_t *input = NULL, *output = NULL;
+
+ snd_config_for_each(i, next, plugin) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "label") == 0) {
+ err = snd_config_get_string(n, &label);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "id") == 0) {
+ err = snd_config_get_integer(n, &ladspa_id);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "filename") == 0) {
+ err = snd_config_get_string(n, &filename);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "input") == 0) {
+ input = n;
+ continue;
+ }
+ if (strcmp(id, "output") == 0) {
+ output = n;
+ continue;
+ }
+ if (strcmp(id, "policy") == 0) {
+ const char *str;
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ SNDERR("policy field must be a string");
+ return err;
+ }
+ if (strcmp(str, "none") == 0)
+ policy = SND_PCM_LADSPA_POLICY_NONE;
+ else if (strcmp(str, "duplicate") == 0)
+ policy = SND_PCM_LADSPA_POLICY_DUPLICATE;
+ else {
+ SNDERR("unknown policy definition");
+ return -EINVAL;
+ }
+ continue;
+ }
+ }
+ if (label == NULL && ladspa_id <= 0) {
+ SNDERR("no plugin label or id");
+ return -EINVAL;
+ }
+ lplug = (snd_pcm_ladspa_plugin_t *)calloc(1, sizeof(snd_pcm_ladspa_plugin_t));
+ if (lplug == NULL)
+ return -ENOMEM;
+ lplug->policy = policy;
+ lplug->input.pdesc = LADSPA_PORT_INPUT;
+ lplug->output.pdesc = LADSPA_PORT_OUTPUT;
+ INIT_LIST_HEAD(&lplug->instances);
+ if (filename) {
+ err = snd_pcm_ladspa_check_file(lplug, filename, label, ladspa_id);
+ if (err < 0) {
+ SNDERR("Unable to load plugin '%s' ID %li, filename '%s'", label, ladspa_id, filename);
+ free(lplug);
+ return err;
+ }
+ } else {
+ err = snd_pcm_ladspa_look_for_plugin(lplug, path, label, ladspa_id);
+ if (err < 0) {
+ SNDERR("Unable to find or load plugin '%s' ID %li, path '%s'", label, ladspa_id, path);
+ free(lplug);
+ return err;
+ }
+ }
+ if (!reverse) {
+ list_add_tail(&lplug->list, list);
+ } else {
+ list_add(&lplug->list, list);
+ }
+ err = snd_pcm_ladspa_parse_ioconfig(lplug, &lplug->input, input);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_parse_ioconfig(lplug, &lplug->output, output);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_ladspa_build_plugins(struct list_head *list,
+ const char *path,
+ snd_config_t *plugins,
+ int reverse)
+{
+ snd_config_iterator_t i, next;
+ int idx = 0, hit, err;
+
+ if (plugins == NULL) /* nothing TODO */
+ return 0;
+ if (snd_config_get_type(plugins) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("plugins must be defined inside a compound");
+ return -EINVAL;
+ }
+ do {
+ hit = 0;
+ snd_config_for_each(i, next, plugins) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long i;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &i);
+ if (err < 0) {
+ SNDERR("id of field %s is not an integer", id);
+ return err;
+ }
+ if (i == idx) {
+ idx++;
+ err = snd_pcm_ladspa_add_plugin(list, path, n, reverse);
+ if (err < 0)
+ return err;
+ hit = 1;
+ }
+ }
+ } while (hit);
+ if (list_empty(list)) {
+ SNDERR("empty plugin list is not accepted");
+ return -EINVAL;
+ }
+ return 0;
+}
+
+/**
+ * \brief Creates a new LADSPA<->ALSA Plugin
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param ladspa_path The path for LADSPA plugins
+ * \param channels Force input channel count to LADSPA plugin chain, 0 = no force (auto)
+ * \param ladspa_pplugins The playback configuration
+ * \param ladspa_cplugins The capture configuration
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ const char *ladspa_path,
+ unsigned int channels,
+ snd_config_t *ladspa_pplugins,
+ snd_config_t *ladspa_cplugins,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_ladspa_t *ladspa;
+ int err, reverse = 0;
+
+ assert(pcmp && (ladspa_pplugins || ladspa_cplugins) && slave);
+
+ if (!ladspa_path && !(ladspa_path = getenv("LADSPA_PATH")))
+ return -ENOENT;
+ ladspa = calloc(1, sizeof(snd_pcm_ladspa_t));
+ if (!ladspa)
+ return -ENOMEM;
+ snd_pcm_plugin_init(&ladspa->plug);
+ ladspa->plug.init = snd_pcm_ladspa_init;
+ ladspa->plug.read = snd_pcm_ladspa_read_areas;
+ ladspa->plug.write = snd_pcm_ladspa_write_areas;
+ ladspa->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ ladspa->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ ladspa->plug.gen.slave = slave;
+ ladspa->plug.gen.close_slave = close_slave;
+
+ INIT_LIST_HEAD(&ladspa->pplugins);
+ INIT_LIST_HEAD(&ladspa->cplugins);
+ ladspa->channels = channels;
+
+ if (slave->stream == SND_PCM_STREAM_PLAYBACK) {
+ err = snd_pcm_ladspa_build_plugins(&ladspa->pplugins, ladspa_path, ladspa_pplugins, reverse);
+ if (err < 0) {
+ snd_pcm_ladspa_free(ladspa);
+ return err;
+ }
+ }
+ if (slave->stream == SND_PCM_STREAM_CAPTURE) {
+ if (ladspa_cplugins == ladspa_pplugins)
+ reverse = 1;
+ err = snd_pcm_ladspa_build_plugins(&ladspa->cplugins, ladspa_path, ladspa_cplugins, reverse);
+ if (err < 0) {
+ snd_pcm_ladspa_free(ladspa);
+ return err;
+ }
+ }
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_LADSPA, name, slave->stream, slave->mode);
+ if (err < 0) {
+ snd_pcm_ladspa_free(ladspa);
+ return err;
+ }
+ pcm->ops = &snd_pcm_ladspa_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = ladspa;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &ladspa->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &ladspa->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_ladpsa Plugin: LADSPA <-> ALSA
+
+This plugin allows to apply a set of LADPSA plugins.
+The input and output format is always #SND_PCM_FORMAT_FLOAT (note: this type
+can be either little or big-endian depending on architecture).
+
+The policy duplicate means that there must be only one binding definition for
+channel zero. This definition is automatically duplicated for all channels.
+If the LADSPA plugin has multiple audio inputs or outputs the policy duplicate
+is automatically switched to policy none.
+
+The plugin serialization works as expected. You can eventually use more
+channels (inputs / outputs) inside the LADPSA plugin chain than processed
+in the ALSA plugin chain. If ALSA channel does not exist for given LADSPA
+input audio port, zero samples are given to this LADSPA port. On the output
+side (ALSA next plugin input), the valid channels are checked, too.
+If specific ALSA channel does not exist, the LADSPA output port is
+connected to a dummy sample area.
+
+Instances of LADSPA plugins are created dynamically.
+
+\code
+pcm.name {
+ type ladspa # ALSA<->LADSPA PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ [channels INT] # count input channels (input to LADSPA plugin chain)
+ [path STR] # Path (directory) with LADSPA plugins
+ plugins | # Definition for both directions
+ playback_plugins | # Definition for playback direction
+ capture_plugins { # Definition for capture direction
+ N { # Configuration for LADPSA plugin N
+ [id INT] # LADSPA plugin ID (for example 1043)
+ [label STR] # LADSPA plugin label (for example 'delay_5s')
+ [filename STR] # Full filename of .so library with LADSPA plugin code
+ [policy STR] # Policy can be 'none' or 'duplicate'
+ input | output {
+ bindings {
+ C INT or STR # C - channel, INT - audio port index, STR - audio port name
+ }
+ controls {
+ # valid only in the input block
+ I INT or REAL # I - control port index, INT or REAL - control value
+ # or
+ STR INT or REAL # STR - control port name, INT or REAL - control value
+ }
+ }
+ }
+ }
+}
+\endcode
+
+\subsection pcm_plugins_ladspa_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_ladspa_open()
+ <LI>_snd_pcm_ladspa_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new LADSPA<->ALSA PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with LADSPA<->ALSA PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ const char *path = NULL;
+ long channels = 0;
+ snd_config_t *plugins = NULL, *pplugins = NULL, *cplugins = NULL;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "path") == 0) {
+ snd_config_get_string(n, &path);
+ continue;
+ }
+ if (strcmp(id, "channels") == 0) {
+ snd_config_get_integer(n, &channels);
+ if (channels > 1024)
+ channels = 1024;
+ if (channels < 0)
+ channels = 0;
+ continue;
+ }
+ if (strcmp(id, "plugins") == 0) {
+ plugins = n;
+ continue;
+ }
+ if (strcmp(id, "playback_plugins") == 0) {
+ pplugins = n;
+ continue;
+ }
+ if (strcmp(id, "capture_plugins") == 0) {
+ cplugins = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ if (plugins) {
+ if (pplugins || cplugins) {
+ SNDERR("'plugins' definition cannot be combined with 'playback_plugins' or 'capture_plugins'");
+ return -EINVAL;
+ }
+ pplugins = plugins;
+ cplugins = plugins;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_ladspa_open(pcmp, name, path, channels, pplugins, cplugins, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_ladspa_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_lfloat.c b/alsa-lib/src/pcm/pcm_lfloat.c
new file mode 100644
index 0000000..62eb398
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_lfloat.c
@@ -0,0 +1,537 @@
+/**
+ * \file pcm/pcm_lfloat.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Linear<->Float Conversion Plugin Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2001
+ */
+/*
+ * PCM - Linear Integer <-> Linear Float conversion
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef DOC_HIDDEN
+
+typedef float float_t;
+typedef double double_t;
+
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 91)
+#define BUGGY_GCC
+#endif
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_lfloat = "";
+#endif
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int int32_idx;
+ unsigned int float32_idx;
+ snd_pcm_format_t sformat;
+ void (*func)(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int get32idx, unsigned int put32floatidx);
+} snd_pcm_lfloat_t;
+
+int snd_pcm_lfloat_get_s32_index(snd_pcm_format_t format)
+{
+ int width, endian;
+
+ switch (format) {
+ case SND_PCM_FORMAT_FLOAT_LE:
+ case SND_PCM_FORMAT_FLOAT_BE:
+ width = 32;
+ break;
+ case SND_PCM_FORMAT_FLOAT64_LE:
+ case SND_PCM_FORMAT_FLOAT64_BE:
+ width = 64;
+ break;
+ default:
+ return -EINVAL;
+ }
+#ifdef SND_LITTLE_ENDIAN
+ endian = snd_pcm_format_big_endian(format);
+#else
+ endian = snd_pcm_format_little_endian(format);
+#endif
+ return ((width / 32)-1) * 2 + endian;
+}
+
+int snd_pcm_lfloat_put_s32_index(snd_pcm_format_t format)
+{
+ return snd_pcm_lfloat_get_s32_index(format);
+}
+
+#endif /* DOC_HIDDEN */
+
+#ifndef BUGGY_GCC
+
+#ifndef DOC_HIDDEN
+
+void snd_pcm_lfloat_convert_integer_float(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int get32idx, unsigned int put32floatidx)
+{
+#define GET32_LABELS
+#define PUT32F_LABELS
+#include "plugin_ops.h"
+#undef PUT32F_LABELS
+#undef GET32_LABELS
+ void *get32 = get32_labels[get32idx];
+ void *put32float = put32float_labels[put32floatidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ int32_t sample = 0;
+ snd_tmp_float_t tmp_float;
+ snd_tmp_double_t tmp_double;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *get32;
+#define GET32_END sample_loaded
+#include "plugin_ops.h"
+#undef GET32_END
+ sample_loaded:
+ goto *put32float;
+#define PUT32F_END sample_put
+#include "plugin_ops.h"
+#undef PUT32F_END
+ sample_put:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+void snd_pcm_lfloat_convert_float_integer(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int put32idx, unsigned int get32floatidx)
+{
+#define PUT32_LABELS
+#define GET32F_LABELS
+#include "plugin_ops.h"
+#undef GET32F_LABELS
+#undef PUT32_LABELS
+ void *put32 = put32_labels[put32idx];
+ void *get32float = get32float_labels[get32floatidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ int32_t sample = 0;
+ snd_tmp_float_t tmp_float;
+ snd_tmp_double_t tmp_double;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *get32float;
+#define GET32F_END sample_loaded
+#include "plugin_ops.h"
+#undef GET32F_END
+ sample_loaded:
+ goto *put32;
+#define PUT32_END sample_put
+#include "plugin_ops.h"
+#undef PUT32_END
+ sample_put:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_lfloat_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ snd_pcm_format_mask_t lformat_mask = { SND_PCM_FMTBIT_LINEAR };
+ snd_pcm_format_mask_t fformat_mask = { SND_PCM_FMTBIT_FLOAT };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ snd_pcm_format_linear(lfloat->sformat) ?
+ &fformat_mask : &lformat_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_lfloat_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, lfloat->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_lfloat_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_lfloat_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_lfloat_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_lfloat_hw_refine_cprepare,
+ snd_pcm_lfloat_hw_refine_cchange,
+ snd_pcm_lfloat_hw_refine_sprepare,
+ snd_pcm_lfloat_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_lfloat_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ snd_pcm_t *slave = lfloat->plug.gen.slave;
+ snd_pcm_format_t src_format, dst_format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_lfloat_hw_refine_cchange,
+ snd_pcm_lfloat_hw_refine_sprepare,
+ snd_pcm_lfloat_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format);
+ dst_format = slave->format;
+ } else {
+ src_format = slave->format;
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
+ }
+ if (snd_pcm_format_linear(src_format)) {
+ lfloat->int32_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32);
+ lfloat->float32_idx = snd_pcm_lfloat_put_s32_index(dst_format);
+ lfloat->func = snd_pcm_lfloat_convert_integer_float;
+ } else {
+ lfloat->int32_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
+ lfloat->float32_idx = snd_pcm_lfloat_get_s32_index(src_format);
+ lfloat->func = snd_pcm_lfloat_convert_float_integer;
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_lfloat_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ lfloat->func(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size,
+ lfloat->int32_idx, lfloat->float32_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_lfloat_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ lfloat->func(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size,
+ lfloat->int32_idx, lfloat->float32_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_lfloat_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_lfloat_t *lfloat = pcm->private_data;
+ snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n",
+ snd_pcm_format_name(lfloat->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(lfloat->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_lfloat_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_lfloat_hw_refine,
+ .hw_params = snd_pcm_lfloat_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_lfloat_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new linear conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_lfloat_t *lfloat;
+ int err;
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ snd_pcm_format_float(sformat) != 1)
+ return -EINVAL;
+ lfloat = calloc(1, sizeof(snd_pcm_lfloat_t));
+ if (!lfloat) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&lfloat->plug);
+ lfloat->sformat = sformat;
+ lfloat->plug.read = snd_pcm_lfloat_read_areas;
+ lfloat->plug.write = snd_pcm_lfloat_write_areas;
+ lfloat->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ lfloat->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ lfloat->plug.gen.slave = slave;
+ lfloat->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_LINEAR_FLOAT, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(lfloat);
+ return err;
+ }
+ pcm->ops = &snd_pcm_lfloat_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = lfloat;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_lfloat Plugin: linear<->float
+
+This plugin converts linear to float samples and float to linear samples from master
+linear<->float conversion PCM to given slave PCM. The channel count, format and rate must
+match for both of them.
+
+\code
+pcm.name {
+ type lfloat # Linear<->Float conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+}
+\endcode
+
+\subsection pcm_plugins_lfloat_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_lfloat_open()
+ <LI>_snd_pcm_lfloat_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new linear<->float conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ snd_pcm_format_float(sformat) != 1) {
+ snd_config_delete(sconf);
+ SNDERR("slave format is not linear integer or linear float");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_lfloat_open(pcmp, name, sformat, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_lfloat_open, SND_PCM_DLSYM_VERSION);
+#endif
+
+#else /* BUGGY_GCC */
+
+int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ snd_pcm_format_t sformat ATTRIBUTE_UNUSED,
+ snd_pcm_t *slave ATTRIBUTE_UNUSED,
+ int close_slave ATTRIBUTE_UNUSED)
+{
+ SNDERR("please, upgrade your GCC to use lfloat plugin");
+ return -EINVAL;
+}
+
+int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf ATTRIBUTE_UNUSED,
+ snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
+ int mode ATTRIBUTE_UNUSED)
+{
+ SNDERR("please, upgrade your GCC to use lfloat plugin");
+ return -EINVAL;
+}
+
+#endif /* BUGGY_GCC */
diff --git a/alsa-lib/src/pcm/pcm_linear.c b/alsa-lib/src/pcm/pcm_linear.c
new file mode 100644
index 0000000..12e2e7f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_linear.c
@@ -0,0 +1,567 @@
+/**
+ * \file pcm/pcm_linear.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Linear Conversion Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Linear conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_linear = "";
+#endif
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int use_getput;
+ unsigned int conv_idx;
+ unsigned int get_idx, put_idx;
+ snd_pcm_format_t sformat;
+} snd_pcm_linear_t;
+#endif
+
+#ifndef DOC_HIDDEN
+
+int snd_pcm_linear_convert_index(snd_pcm_format_t src_format,
+ snd_pcm_format_t dst_format)
+{
+ int src_endian, dst_endian, sign, src_width, dst_width;
+
+ sign = (snd_pcm_format_signed(src_format) !=
+ snd_pcm_format_signed(dst_format));
+#ifdef SND_LITTLE_ENDIAN
+ src_endian = snd_pcm_format_big_endian(src_format);
+ dst_endian = snd_pcm_format_big_endian(dst_format);
+#else
+ src_endian = snd_pcm_format_little_endian(src_format);
+ dst_endian = snd_pcm_format_little_endian(dst_format);
+#endif
+
+ if (src_endian < 0)
+ src_endian = 0;
+ if (dst_endian < 0)
+ dst_endian = 0;
+
+ src_width = snd_pcm_format_width(src_format) / 8 - 1;
+ dst_width = snd_pcm_format_width(dst_format) / 8 - 1;
+
+ return src_width * 32 + src_endian * 16 + sign * 8 + dst_width * 2 + dst_endian;
+}
+
+int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
+{
+ int sign, width, pwidth, endian;
+ sign = (snd_pcm_format_signed(src_format) !=
+ snd_pcm_format_signed(dst_format));
+#ifdef SND_LITTLE_ENDIAN
+ endian = snd_pcm_format_big_endian(src_format);
+#else
+ endian = snd_pcm_format_little_endian(src_format);
+#endif
+ if (endian < 0)
+ endian = 0;
+ pwidth = snd_pcm_format_physical_width(src_format);
+ width = snd_pcm_format_width(src_format);
+ if (pwidth == 24) {
+ switch (width) {
+ case 24:
+ width = 0; break;
+ case 20:
+ width = 1; break;
+ case 18:
+ default:
+ width = 2; break;
+ }
+ return width * 4 + endian * 2 + sign + 16;
+ } else {
+ width = width / 8 - 1;
+ return width * 4 + endian * 2 + sign;
+ }
+}
+
+int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
+{
+ return snd_pcm_linear_get_index(src_format, dst_format);
+}
+
+int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
+{
+ int sign, width, endian;
+ sign = (snd_pcm_format_signed(src_format) !=
+ snd_pcm_format_signed(dst_format));
+ width = snd_pcm_format_width(dst_format) / 8 - 1;
+#ifdef SND_LITTLE_ENDIAN
+ endian = snd_pcm_format_big_endian(dst_format);
+#else
+ endian = snd_pcm_format_little_endian(dst_format);
+#endif
+ if (endian < 0)
+ endian = 0;
+ return width * 4 + endian * 2 + sign;
+}
+
+int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
+{
+ int sign, width, pwidth, endian;
+ sign = (snd_pcm_format_signed(src_format) !=
+ snd_pcm_format_signed(dst_format));
+#ifdef SND_LITTLE_ENDIAN
+ endian = snd_pcm_format_big_endian(dst_format);
+#else
+ endian = snd_pcm_format_little_endian(dst_format);
+#endif
+ if (endian < 0)
+ endian = 0;
+ pwidth = snd_pcm_format_physical_width(dst_format);
+ width = snd_pcm_format_width(dst_format);
+ if (pwidth == 24) {
+ switch (width) {
+ case 24:
+ width = 0; break;
+ case 20:
+ width = 1; break;
+ case 18:
+ default:
+ width = 2; break;
+ }
+ return width * 4 + endian * 2 + sign + 16;
+ } else {
+ width = width / 8 - 1;
+ return width * 4 + endian * 2 + sign;
+ }
+}
+
+void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int convidx)
+{
+#define CONV_LABELS
+#include "plugin_ops.h"
+#undef CONV_LABELS
+ void *conv = conv_labels[convidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *conv;
+#define CONV_END after
+#include "plugin_ops.h"
+#undef CONV_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int get_idx, unsigned int put_idx)
+{
+#define CONV24_LABELS
+#include "plugin_ops.h"
+#undef CONV24_LABELS
+ void *get = get32_labels[get_idx];
+ void *put = put32_labels[put_idx];
+ unsigned int channel;
+ u_int32_t sample = 0;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *get;
+#define CONV24_END after
+#include "plugin_ops.h"
+#undef CONV24_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_linear_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_linear_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_linear_t *linear = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, linear->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_linear_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_linear_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_linear_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_linear_hw_refine_cprepare,
+ snd_pcm_linear_hw_refine_cchange,
+ snd_pcm_linear_hw_refine_sprepare,
+ snd_pcm_linear_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_linear_t *linear = pcm->private_data;
+ snd_pcm_format_t format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_linear_hw_refine_cchange,
+ snd_pcm_linear_hw_refine_sprepare,
+ snd_pcm_linear_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
+ if (err < 0)
+ return err;
+ linear->use_getput = (snd_pcm_format_physical_width(format) == 24 ||
+ snd_pcm_format_physical_width(linear->sformat) == 24);
+ if (linear->use_getput) {
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ linear->get_idx = snd_pcm_linear_get32_index(format, SND_PCM_FORMAT_S32);
+ linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, linear->sformat);
+ } else {
+ linear->get_idx = snd_pcm_linear_get32_index(linear->sformat, SND_PCM_FORMAT_S32);
+ linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, format);
+ }
+ } else {
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ linear->conv_idx = snd_pcm_linear_convert_index(format,
+ linear->sformat);
+ else
+ linear->conv_idx = snd_pcm_linear_convert_index(linear->sformat,
+ format);
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_linear_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_linear_t *linear = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ if (linear->use_getput)
+ snd_pcm_linear_getput(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size,
+ linear->get_idx, linear->put_idx);
+ else
+ snd_pcm_linear_convert(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size, linear->conv_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_linear_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_linear_t *linear = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ if (linear->use_getput)
+ snd_pcm_linear_getput(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size,
+ linear->get_idx, linear->put_idx);
+ else
+ snd_pcm_linear_convert(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size, linear->conv_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_linear_t *linear = pcm->private_data;
+ snd_output_printf(out, "Linear conversion PCM (%s)\n",
+ snd_pcm_format_name(linear->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(linear->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_linear_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_linear_hw_refine,
+ .hw_params = snd_pcm_linear_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_linear_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+
+/**
+ * \brief Creates a new linear conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_linear_t *linear;
+ int err;
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1)
+ return -EINVAL;
+ linear = calloc(1, sizeof(snd_pcm_linear_t));
+ if (!linear) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&linear->plug);
+ linear->sformat = sformat;
+ linear->plug.read = snd_pcm_linear_read_areas;
+ linear->plug.write = snd_pcm_linear_write_areas;
+ linear->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ linear->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ linear->plug.gen.slave = slave;
+ linear->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_LINEAR, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(linear);
+ return err;
+ }
+ pcm->ops = &snd_pcm_linear_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = linear;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &linear->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &linear->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_linear Plugin: linear
+
+This plugin converts linear samples from master linear conversion PCM to given
+slave PCM. The channel count, format and rate must match for both of them.
+
+\code
+pcm.name {
+ type linear # Linear conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+}
+\endcode
+
+\subsection pcm_plugins_linear_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_linear_open()
+ <LI>_snd_pcm_linear_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new linear conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1) {
+ snd_config_delete(sconf);
+ SNDERR("slave format is not linear");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_local.h b/alsa-lib/src/pcm/pcm_local.h
new file mode 100644
index 0000000..9aa81e1
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_local.h
@@ -0,0 +1,967 @@
+/*
+ * PCM Interface - local header file
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <sys/uio.h>
+
+#define _snd_mask sndrv_mask
+#define _snd_pcm_access_mask _snd_mask
+#define _snd_pcm_format_mask _snd_mask
+#define _snd_pcm_subformat_mask _snd_mask
+
+#include "local.h"
+
+#define SND_INTERVAL_INLINE
+#include "interval.h"
+
+#define SND_MASK_INLINE
+#include "mask.h"
+
+typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
+#define SND_PCM_HW_PARAM_ACCESS SNDRV_PCM_HW_PARAM_ACCESS
+#define SND_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_FIRST_MASK
+#define SND_PCM_HW_PARAM_FORMAT SNDRV_PCM_HW_PARAM_FORMAT
+#define SND_PCM_HW_PARAM_SUBFORMAT SNDRV_PCM_HW_PARAM_SUBFORMAT
+#define SND_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_LAST_MASK
+#define SND_PCM_HW_PARAM_SAMPLE_BITS SNDRV_PCM_HW_PARAM_SAMPLE_BITS
+#define SND_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
+#define SND_PCM_HW_PARAM_FRAME_BITS SNDRV_PCM_HW_PARAM_FRAME_BITS
+#define SND_PCM_HW_PARAM_CHANNELS SNDRV_PCM_HW_PARAM_CHANNELS
+#define SND_PCM_HW_PARAM_RATE SNDRV_PCM_HW_PARAM_RATE
+#define SND_PCM_HW_PARAM_PERIOD_TIME SNDRV_PCM_HW_PARAM_PERIOD_TIME
+#define SND_PCM_HW_PARAM_PERIOD_SIZE SNDRV_PCM_HW_PARAM_PERIOD_SIZE
+#define SND_PCM_HW_PARAM_PERIOD_BYTES SNDRV_PCM_HW_PARAM_PERIOD_BYTES
+#define SND_PCM_HW_PARAM_PERIODS SNDRV_PCM_HW_PARAM_PERIODS
+#define SND_PCM_HW_PARAM_BUFFER_TIME SNDRV_PCM_HW_PARAM_BUFFER_TIME
+#define SND_PCM_HW_PARAM_BUFFER_SIZE SNDRV_PCM_HW_PARAM_BUFFER_SIZE
+#define SND_PCM_HW_PARAM_BUFFER_BYTES SNDRV_PCM_HW_PARAM_BUFFER_BYTES
+#define SND_PCM_HW_PARAM_TICK_TIME SNDRV_PCM_HW_PARAM_TICK_TIME
+#define SND_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_LAST_INTERVAL
+#define SND_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_LAST_MASK
+#define SND_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_FIRST_MASK
+#define SND_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_LAST_INTERVAL
+#define SND_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
+
+/** device accepts mmaped access */
+#define SND_PCM_INFO_MMAP SNDRV_PCM_INFO_MMAP
+/** device accepts mmaped access with sample resolution */
+#define SND_PCM_INFO_MMAP_VALID SNDRV_PCM_INFO_MMAP_VALID
+/** device is doing double buffering */
+#define SND_PCM_INFO_DOUBLE SNDRV_PCM_INFO_DOUBLE
+/** device transfers samples in batch */
+#define SND_PCM_INFO_BATCH SNDRV_PCM_INFO_BATCH
+/** device accepts interleaved samples */
+#define SND_PCM_INFO_INTERLEAVED SNDRV_PCM_INFO_INTERLEAVED
+/** device accepts non-interleaved samples */
+#define SND_PCM_INFO_NONINTERLEAVED SNDRV_PCM_INFO_NONINTERLEAVED
+/** device accepts complex sample organization */
+#define SND_PCM_INFO_COMPLEX SNDRV_PCM_INFO_COMPLEX
+/** device is capable block transfers */
+#define SND_PCM_INFO_BLOCK_TRANSFER SNDRV_PCM_INFO_BLOCK_TRANSFER
+/** device can detect DAC/ADC overrange */
+#define SND_PCM_INFO_OVERRANGE SNDRV_PCM_INFO_OVERRANGE
+/** device supports resume */
+#define SND_PCM_INFO_RESUME SNDRV_PCM_INFO_RESUME
+/** device is capable to pause */
+#define SND_PCM_INFO_PAUSE SNDRV_PCM_INFO_PAUSE
+/** device can do only half duplex */
+#define SND_PCM_INFO_HALF_DUPLEX SNDRV_PCM_INFO_HALF_DUPLEX
+/** device can do only joint duplex (same parameters) */
+#define SND_PCM_INFO_JOINT_DUPLEX SNDRV_PCM_INFO_JOINT_DUPLEX
+/** device can do a kind of synchronized start */
+#define SND_PCM_INFO_SYNC_START SNDRV_PCM_INFO_SYNC_START
+
+#define SND_PCM_HW_PARAMS_NORESAMPLE SNDRV_PCM_HW_PARAMS_NORESAMPLE
+#define SND_PCM_HW_PARAMS_EXPORT_BUFFER SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER
+
+#define SND_PCM_INFO_MONOTONIC 0x80000000
+
+typedef struct _snd_pcm_rbptr {
+ snd_pcm_t *master;
+ volatile snd_pcm_uframes_t *ptr;
+ int fd;
+ off_t offset;
+ int link_dst_count;
+ snd_pcm_t **link_dst;
+ void *private_data;
+ void (*changed)(snd_pcm_t *pcm, snd_pcm_t *src);
+} snd_pcm_rbptr_t;
+
+typedef struct _snd_pcm_channel_info {
+ unsigned int channel;
+ void *addr; /* base address of channel samples */
+ unsigned int first; /* offset to first sample in bits */
+ unsigned int step; /* samples distance in bits */
+ enum { SND_PCM_AREA_SHM, SND_PCM_AREA_MMAP, SND_PCM_AREA_LOCAL } type;
+ union {
+ struct {
+ struct snd_shm_area *area;
+ int shmid;
+ } shm;
+ struct {
+ int fd;
+ off_t offset;
+ } mmap;
+ } u;
+ char reserved[64];
+} snd_pcm_channel_info_t;
+
+typedef struct {
+ int (*close)(snd_pcm_t *pcm);
+ int (*nonblock)(snd_pcm_t *pcm, int nonblock);
+ int (*async)(snd_pcm_t *pcm, int sig, pid_t pid);
+ int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);
+ int (*hw_refine)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+ int (*hw_params)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+ int (*hw_free)(snd_pcm_t *pcm);
+ int (*sw_params)(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
+ int (*channel_info)(snd_pcm_t *pcm, snd_pcm_channel_info_t *info);
+ void (*dump)(snd_pcm_t *pcm, snd_output_t *out);
+ int (*mmap)(snd_pcm_t *pcm);
+ int (*munmap)(snd_pcm_t *pcm);
+} snd_pcm_ops_t;
+
+typedef struct {
+ int (*status)(snd_pcm_t *pcm, snd_pcm_status_t *status);
+ int (*prepare)(snd_pcm_t *pcm);
+ int (*reset)(snd_pcm_t *pcm);
+ int (*start)(snd_pcm_t *pcm);
+ int (*drop)(snd_pcm_t *pcm);
+ int (*drain)(snd_pcm_t *pcm);
+ int (*pause)(snd_pcm_t *pcm, int enable);
+ snd_pcm_state_t (*state)(snd_pcm_t *pcm);
+ int (*hwsync)(snd_pcm_t *pcm);
+ int (*delay)(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
+ int (*resume)(snd_pcm_t *pcm);
+ int (*link)(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
+ int (*link_slaves)(snd_pcm_t *pcm, snd_pcm_t *master);
+ int (*unlink)(snd_pcm_t *pcm);
+ snd_pcm_sframes_t (*rewindable)(snd_pcm_t *pcm);
+ snd_pcm_sframes_t (*rewind)(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+ snd_pcm_sframes_t (*forwardable)(snd_pcm_t *pcm);
+ snd_pcm_sframes_t (*forward)(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+ snd_pcm_sframes_t (*writei)(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+ snd_pcm_sframes_t (*writen)(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+ snd_pcm_sframes_t (*readi)(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+ snd_pcm_sframes_t (*readn)(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+ snd_pcm_sframes_t (*avail_update)(snd_pcm_t *pcm);
+ snd_pcm_sframes_t (*mmap_commit)(snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t size);
+ int (*htimestamp)(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
+ int (*poll_descriptors_count)(snd_pcm_t *pcm);
+ int (*poll_descriptors)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
+ int (*poll_revents)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
+} snd_pcm_fast_ops_t;
+
+struct _snd_pcm {
+ void *dl_handle;
+ char *name;
+ snd_pcm_type_t type;
+ snd_pcm_stream_t stream;
+ int mode;
+ int poll_fd_count;
+ int poll_fd;
+ unsigned short poll_events;
+ int setup: 1,
+ monotonic: 1;
+ snd_pcm_access_t access; /* access mode */
+ snd_pcm_format_t format; /* SND_PCM_FORMAT_* */
+ snd_pcm_subformat_t subformat; /* subformat */
+ unsigned int channels; /* channels */
+ unsigned int rate; /* rate in Hz */
+ snd_pcm_uframes_t period_size;
+ unsigned int period_time; /* period duration */
+ snd_interval_t periods;
+ snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */
+ unsigned int period_step;
+ snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
+ int period_event;
+ snd_pcm_uframes_t start_threshold;
+ snd_pcm_uframes_t stop_threshold;
+ snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
+ noise is nearest than this */
+ snd_pcm_uframes_t silence_size; /* Silence filling size */
+ snd_pcm_uframes_t boundary; /* pointers wrap point */
+ unsigned int info; /* Info for returned setup */
+ unsigned int msbits; /* used most significant bits */
+ unsigned int rate_num; /* rate numerator */
+ unsigned int rate_den; /* rate denominator */
+ unsigned int hw_flags; /* actual hardware flags */
+ snd_pcm_uframes_t fifo_size; /* chip FIFO size in frames */
+ snd_pcm_uframes_t buffer_size;
+ snd_interval_t buffer_time;
+ unsigned int sample_bits;
+ unsigned int frame_bits;
+ snd_pcm_rbptr_t appl;
+ snd_pcm_rbptr_t hw;
+ snd_pcm_uframes_t min_align;
+ unsigned int mmap_rw: 1; /* use always mmapped buffer */
+ unsigned int mmap_shadow: 1; /* don't call actual mmap,
+ * use the mmaped buffer of the slave
+ */
+ unsigned int donot_close: 1; /* don't close this PCM */
+ snd_pcm_channel_info_t *mmap_channels;
+ snd_pcm_channel_area_t *running_areas;
+ snd_pcm_channel_area_t *stopped_areas;
+ const snd_pcm_ops_t *ops;
+ const snd_pcm_fast_ops_t *fast_ops;
+ snd_pcm_t *op_arg;
+ snd_pcm_t *fast_op_arg;
+ void *private_data;
+ struct list_head async_handlers;
+};
+
+/* make local functions really local */
+/* Grrr, these cannot be local - a bad aserver uses them!
+#define snd_pcm_async \
+ snd1_pcm_async
+#define snd_pcm_mmap \
+ snd1_pcm_mmap
+#define snd_pcm_munmap \
+ snd1_pcm_munmap
+#define snd_pcm_hw_refine \
+ snd1_pcm_hw_refine
+*/
+#define snd_pcm_new \
+ snd1_pcm_new
+#define snd_pcm_free \
+ snd1_pcm_free
+#define snd_pcm_areas_from_buf \
+ snd1_pcm_areas_from_buf
+#define snd_pcm_areas_from_bufs \
+ snd1_pcm_areas_from_bufs
+#define snd_pcm_open_named_slave \
+ snd1_pcm_open_named_slave
+#define snd_pcm_conf_generic_id \
+ snd1_pcm_conf_generic_id
+#define snd_pcm_hw_open_fd \
+ snd1_pcm_hw_open_fd
+#define snd_pcm_wait_nocheck \
+ snd1_pcm_wait_nocheck
+#define snd_pcm_rate_get_default_converter \
+ snd1_pcm_rate_get_default_converter
+#define snd_pcm_set_hw_ptr \
+ snd1_pcm_set_hw_ptr
+#define snd_pcm_set_appl_ptr \
+ snd1_pcm_set_appl_ptr
+#define snd_pcm_link_hw_ptr \
+ snd1_pcm_link_hw_ptr
+#define snd_pcm_link_appl_ptr \
+ snd1_pcm_link_appl_ptr
+#define snd_pcm_unlink_hw_ptr \
+ snd1_pcm_unlink_hw_ptr
+#define snd_pcm_unlink_appl_ptr \
+ snd1_pcm_unlink_appl_ptr
+#define snd_pcm_mmap_appl_ptr \
+ snd1_pcm_mmap_appl_ptr
+#define snd_pcm_mmap_appl_backward \
+ snd1_pcm_mmap_appl_backward
+#define snd_pcm_mmap_appl_forward \
+ snd1_pcm_mmap_appl_forward
+#define snd_pcm_mmap_hw_backward \
+ snd1_pcm_mmap_hw_backward
+#define snd_pcm_mmap_hw_forward \
+ snd1_pcm_mmap_hw_forward
+#define snd_pcm_read_areas \
+ snd1_pcm_read_areas
+#define snd_pcm_write_areas \
+ snd1_pcm_write_areas
+#define snd_pcm_read_mmap \
+ snd1_pcm_read_mmap
+#define snd_pcm_write_mmap \
+ snd1_pcm_write_mmap
+#define snd_pcm_channel_info_shm \
+ snd1_pcm_channel_info_shm
+#define snd_pcm_hw_refine_soft \
+ snd1_pcm_hw_refine_soft
+#define snd_pcm_hw_refine_slave \
+ snd1_pcm_hw_refine_slave
+#define snd_pcm_hw_params_slave \
+ snd1_pcm_hw_params_slave
+#define snd_pcm_hw_param_refine_near \
+ snd1_pcm_hw_param_refine_near
+#define snd_pcm_hw_param_refine_multiple \
+ snd1_pcm_hw_param_refine_multiple
+#define snd_pcm_hw_param_empty \
+ snd1_pcm_hw_param_empty
+#define snd_pcm_hw_param_always_eq \
+ snd1_pcm_hw_param_always_eq
+#define snd_pcm_hw_param_never_eq \
+ snd1_pcm_hw_param_never_eq
+#define snd_pcm_hw_param_get_mask \
+ snd1_pcm_hw_param_get_mask
+#define snd_pcm_hw_param_get_interval \
+ snd1_pcm_hw_param_get_interval
+#define snd_pcm_hw_param_any \
+ snd1_pcm_hw_param_any
+#define snd_pcm_hw_param_set_integer \
+ snd1_pcm_hw_param_set_integer
+#define snd_pcm_hw_param_set_first \
+ snd1_pcm_hw_param_set_first
+#define snd_pcm_hw_param_set_last \
+ snd1_pcm_hw_param_set_last
+#define snd_pcm_hw_param_set_near \
+ snd1_pcm_hw_param_set_near
+#define snd_pcm_hw_param_set_min \
+ snd1_pcm_hw_param_set_min
+#define snd_pcm_hw_param_set_max \
+ snd1_pcm_hw_param_set_max
+#define snd_pcm_hw_param_set_minmax \
+ snd1_pcm_hw_param_set_minmax
+#define snd_pcm_hw_param_set \
+ snd1_pcm_hw_param_set
+#define snd_pcm_hw_param_set_mask \
+ snd1_pcm_hw_param_set_mask
+#define snd_pcm_hw_param_get \
+ snd1_pcm_hw_param_get
+#define snd_pcm_hw_param_get_min \
+ snd1_pcm_hw_param_get_min
+#define snd_pcm_hw_param_get_max \
+ snd1_pcm_hw_param_get_max
+#define snd_pcm_hw_param_name \
+ snd1_pcm_hw_param_name
+
+int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
+ snd_pcm_stream_t stream, int mode);
+int snd_pcm_free(snd_pcm_t *pcm);
+
+void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void *buf);
+void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void **bufs);
+
+int snd_pcm_async(snd_pcm_t *pcm, int sig, pid_t pid);
+int snd_pcm_mmap(snd_pcm_t *pcm);
+int snd_pcm_munmap(snd_pcm_t *pcm);
+int snd_pcm_mmap_ready(snd_pcm_t *pcm);
+void snd_pcm_set_hw_ptr(snd_pcm_t *pcm, volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset);
+void snd_pcm_set_appl_ptr(snd_pcm_t *pcm, volatile snd_pcm_uframes_t *appl_ptr, int fd, off_t offset);
+void snd_pcm_link_hw_ptr(snd_pcm_t *pcm, snd_pcm_t *slave);
+void snd_pcm_link_appl_ptr(snd_pcm_t *pcm, snd_pcm_t *slave);
+void snd_pcm_unlink_hw_ptr(snd_pcm_t *pcm, snd_pcm_t *slave);
+void snd_pcm_unlink_appl_ptr(snd_pcm_t *pcm, snd_pcm_t *slave);
+snd_pcm_sframes_t snd_pcm_mmap_appl_ptr(snd_pcm_t *pcm, off_t offset);
+void snd_pcm_mmap_appl_backward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+void snd_pcm_mmap_appl_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+void snd_pcm_mmap_hw_backward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+void snd_pcm_mmap_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+
+snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
+
+typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+
+snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, snd_pcm_uframes_t size,
+ snd_pcm_xfer_areas_func_t func);
+snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, snd_pcm_uframes_t size,
+ snd_pcm_xfer_areas_func_t func);
+snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size);
+static inline int snd_pcm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+{
+ return pcm->ops->channel_info(pcm, info);
+}
+int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int shmid);
+int _snd_pcm_poll_descriptor(snd_pcm_t *pcm);
+#define _snd_pcm_link_descriptor _snd_pcm_poll_descriptor /* FIXME */
+#define _snd_pcm_async_descriptor _snd_pcm_poll_descriptor /* FIXME */
+
+/* handle special error cases */
+static inline int snd_pcm_check_error(snd_pcm_t *pcm, int err)
+{
+ if (err == -EINTR) {
+ switch (snd_pcm_state(pcm)) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ case SND_PCM_STATE_DISCONNECTED:
+ return -ENODEV;
+ default:
+ break;
+ }
+ }
+ return err;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_playback_avail(snd_pcm_t *pcm)
+{
+ snd_pcm_sframes_t avail;
+ avail = *pcm->hw.ptr + pcm->buffer_size - *pcm->appl.ptr;
+ if (avail < 0)
+ avail += pcm->boundary;
+ else if ((snd_pcm_uframes_t) avail >= pcm->boundary)
+ avail -= pcm->boundary;
+ return avail;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_capture_avail(snd_pcm_t *pcm)
+{
+ snd_pcm_sframes_t avail;
+ avail = *pcm->hw.ptr - *pcm->appl.ptr;
+ if (avail < 0)
+ avail += pcm->boundary;
+ return avail;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_avail(snd_pcm_t *pcm)
+{
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ return snd_pcm_mmap_playback_avail(pcm);
+ else
+ return snd_pcm_mmap_capture_avail(pcm);
+}
+
+static inline snd_pcm_sframes_t snd_pcm_mmap_playback_hw_avail(snd_pcm_t *pcm)
+{
+ return pcm->buffer_size - snd_pcm_mmap_playback_avail(pcm);
+}
+
+static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_avail(snd_pcm_t *pcm)
+{
+ return pcm->buffer_size - snd_pcm_mmap_capture_avail(pcm);
+}
+
+static inline snd_pcm_sframes_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm)
+{
+ snd_pcm_sframes_t avail;
+ avail = *pcm->hw.ptr - *pcm->appl.ptr;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ avail += pcm->buffer_size;
+ if (avail < 0)
+ avail += pcm->boundary;
+ return pcm->buffer_size - avail;
+}
+
+static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm)
+{
+ if (pcm->stopped_areas &&
+ snd_pcm_state(pcm) != SND_PCM_STATE_RUNNING)
+ return pcm->stopped_areas;
+ return pcm->running_areas;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return *pcm->appl.ptr % pcm->buffer_size;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
+{
+ assert(pcm);
+ return *pcm->hw.ptr % pcm->buffer_size;
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_playback_delay(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_playback_hw_avail(pcm);
+}
+
+static inline snd_pcm_uframes_t snd_pcm_mmap_capture_delay(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_capture_hw_avail(pcm);
+}
+
+static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm)
+{
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ return snd_pcm_mmap_playback_delay(pcm);
+ else
+ return snd_pcm_mmap_capture_delay(pcm);
+}
+
+static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area, snd_pcm_uframes_t offset)
+{
+ unsigned int bitofs = area->first + area->step * offset;
+ assert(bitofs % 8 == 0);
+ return (char *) area->addr + bitofs / 8;
+}
+
+static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area)
+{
+ assert(area->step % 8 == 0);
+ return area->step / 8;
+}
+
+static inline snd_pcm_sframes_t _snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ return pcm->fast_ops->writei(pcm->fast_op_arg, buffer, size);
+}
+
+static inline snd_pcm_sframes_t _snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ return pcm->fast_ops->writen(pcm->fast_op_arg, bufs, size);
+}
+
+static inline snd_pcm_sframes_t _snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ return pcm->fast_ops->readi(pcm->fast_op_arg, buffer, size);
+}
+
+static inline snd_pcm_sframes_t _snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ return pcm->fast_ops->readn(pcm->fast_op_arg, bufs, size);
+}
+
+static inline int muldiv(int a, int b, int c, int *r)
+{
+ int64_t n = (int64_t)a * b;
+ int64_t v = n / c;
+ if (v > INT_MAX) {
+ *r = 0;
+ return INT_MAX;
+ }
+ if (v < INT_MIN) {
+ *r = 0;
+ return INT_MIN;
+ }
+ *r = n % c;
+ return v;
+}
+
+static inline int muldiv_down(int a, int b, int c)
+{
+ int64_t v = (int64_t)a * b / c;
+ if (v > INT_MAX) {
+ return INT_MAX;
+ }
+ if (v < INT_MIN) {
+ return INT_MIN;
+ }
+ return v;
+}
+
+static inline int muldiv_near(int a, int b, int c)
+{
+ int r;
+ int n = muldiv(a, b, c, &r);
+ if (r >= (c + 1) / 2)
+ n++;
+ return n;
+}
+
+int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_refine_soft(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ int (*cprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*cchange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*schange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*srefine)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *sparams));
+int snd_pcm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ int (*cchange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*schange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sparams)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *sparams));
+
+
+void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params);
+void _snd_pcm_hw_param_set_empty(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+int _snd_pcm_hw_param_set_interval(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_interval_t *val);
+int _snd_pcm_hw_param_set_mask(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, const snd_mask_t *mask);
+int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir);
+static inline int _snd_pcm_hw_params_set_format(snd_pcm_hw_params_t *params,
+ snd_pcm_format_t val)
+{
+ return _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_FORMAT,
+ (unsigned long) val, 0);
+}
+
+static inline int _snd_pcm_hw_params_set_subformat(snd_pcm_hw_params_t *params,
+ snd_pcm_subformat_t val)
+{
+ return _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_SUBFORMAT,
+ (unsigned long) val, 0);
+}
+
+int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir);
+int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir);
+int _snd_pcm_hw_param_set_minmax(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int min, int mindir,
+ unsigned int max, int maxdir);
+int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src);
+int _snd_pcm_hw_params_refine(snd_pcm_hw_params_t *params,
+ unsigned int vars,
+ const snd_pcm_hw_params_t *src);
+int snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src);
+int snd_pcm_hw_param_refine_multiple(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src);
+int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *params1);
+int snd_pcm_hw_param_never_eq(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *params1);
+const snd_mask_t *snd_pcm_hw_param_get_mask(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+const snd_interval_t *snd_pcm_hw_param_get_interval(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+
+int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var);
+int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var);
+int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int *rval, int *dir);
+int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int *rval, int *dir);
+int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int *val, int *dir);
+int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir);
+int snd_pcm_hw_param_set_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, unsigned int *val, int *dir);
+int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var,
+ unsigned int *min, int *mindir,
+ unsigned int *max, int *maxdir);
+int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, unsigned int val, int dir);
+int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, const snd_mask_t *mask);
+int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir);
+int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir);
+int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir);
+
+#ifdef INTERNAL
+snd_pcm_sframes_t INTERNAL(snd_pcm_forward)(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
+
+int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
+int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
+int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
+int INTERNAL(snd_pcm_hw_params_set_access_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
+int INTERNAL(snd_pcm_hw_params_set_access_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access);
+int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
+
+int INTERNAL(snd_pcm_hw_params_get_format)(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val);
+int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
+int INTERNAL(snd_pcm_hw_params_set_format_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int INTERNAL(snd_pcm_hw_params_set_format_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);
+int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
+
+int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
+int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);
+int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
+
+int INTERNAL(snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *params, unsigned int *val);
+int INTERNAL(snd_pcm_hw_params_get_channels_min)(const snd_pcm_hw_params_t *params, unsigned int *val);
+int INTERNAL(snd_pcm_hw_params_get_channels_max)(const snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
+int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
+int INTERNAL(snd_pcm_hw_params_set_channels_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int INTERNAL(snd_pcm_hw_params_set_channels_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+int INTERNAL(snd_pcm_hw_params_set_channels_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
+
+int INTERNAL(snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_rate_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_rate_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int INTERNAL(snd_pcm_hw_params_set_rate_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_rate_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_rate_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int INTERNAL(snd_pcm_hw_params_get_period_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_period_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_period_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int INTERNAL(snd_pcm_hw_params_set_period_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_period_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_period_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int INTERNAL(snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_period_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_period_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
+int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
+int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
+int INTERNAL(snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_period_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_period_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
+int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int INTERNAL(snd_pcm_hw_params_get_periods)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_periods_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_periods_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int INTERNAL(snd_pcm_hw_params_set_periods_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_periods_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_periods_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
+
+int INTERNAL(snd_pcm_hw_params_get_buffer_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_buffer_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_get_buffer_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
+int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+int INTERNAL(snd_pcm_hw_params_set_buffer_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
+
+int INTERNAL(snd_pcm_hw_params_get_buffer_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int INTERNAL(snd_pcm_hw_params_get_buffer_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int INTERNAL(snd_pcm_hw_params_get_buffer_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
+int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
+
+int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
+int INTERNAL(snd_pcm_sw_params_get_tstamp_mode)(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);
+int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int INTERNAL(snd_pcm_sw_params_get_avail_min)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int INTERNAL(snd_pcm_sw_params_get_start_threshold)(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int INTERNAL(snd_pcm_sw_params_get_stop_threshold)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int INTERNAL(snd_pcm_sw_params_get_silence_threshold)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
+int INTERNAL(snd_pcm_sw_params_get_silence_size)(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
+#endif /* INTERNAL */
+
+const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param);
+void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, snd_output_t *out);
+#if 0
+int snd_pcm_hw_strategy_simple_near(snd_pcm_hw_strategy_t *strategy, int order,
+ snd_pcm_hw_param_t var,
+ unsigned int best,
+ unsigned int mul);
+int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy, int order,
+ snd_pcm_hw_param_t var,
+ unsigned int count,
+ snd_pcm_hw_strategy_simple_choices_list_t *choices);
+#endif
+
+#define SCONF_MANDATORY 1
+#define SCONF_UNCHANGED 2
+
+int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
+ snd_config_t **pcm_conf, unsigned int count, ...);
+
+#define SND_PCM_APPEND (1<<8)
+
+int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root,
+ snd_config_t *conf, snd_pcm_stream_t stream,
+ int mode, snd_config_t *parent_conf);
+static inline int
+snd_pcm_open_slave(snd_pcm_t **pcmp, snd_config_t *root,
+ snd_config_t *conf, snd_pcm_stream_t stream,
+ int mode, snd_config_t *parent_conf)
+{
+ return snd_pcm_open_named_slave(pcmp, NULL, root, conf, stream,
+ mode, parent_conf);
+}
+int snd_pcm_conf_generic_id(const char *id);
+
+int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, int mmap_emulation, int sync_ptr_ioctl);
+int __snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave);
+
+int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout);
+
+const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root);
+
+#define SND_PCM_HW_PARBIT_ACCESS (1U << SND_PCM_HW_PARAM_ACCESS)
+#define SND_PCM_HW_PARBIT_FORMAT (1U << SND_PCM_HW_PARAM_FORMAT)
+#define SND_PCM_HW_PARBIT_SUBFORMAT (1U << SND_PCM_HW_PARAM_SUBFORMAT)
+#define SND_PCM_HW_PARBIT_CHANNELS (1U << SND_PCM_HW_PARAM_CHANNELS)
+#define SND_PCM_HW_PARBIT_RATE (1U << SND_PCM_HW_PARAM_RATE)
+#define SND_PCM_HW_PARBIT_PERIOD_TIME (1U << SND_PCM_HW_PARAM_PERIOD_TIME)
+#define SND_PCM_HW_PARBIT_PERIOD_SIZE (1U << SND_PCM_HW_PARAM_PERIOD_SIZE)
+#define SND_PCM_HW_PARBIT_PERIODS (1U << SND_PCM_HW_PARAM_PERIODS)
+#define SND_PCM_HW_PARBIT_BUFFER_TIME (1U << SND_PCM_HW_PARAM_BUFFER_TIME)
+#define SND_PCM_HW_PARBIT_BUFFER_SIZE (1U << SND_PCM_HW_PARAM_BUFFER_SIZE)
+#define SND_PCM_HW_PARBIT_SAMPLE_BITS (1U << SND_PCM_HW_PARAM_SAMPLE_BITS)
+#define SND_PCM_HW_PARBIT_FRAME_BITS (1U << SND_PCM_HW_PARAM_FRAME_BITS)
+#define SND_PCM_HW_PARBIT_PERIOD_BYTES (1U << SND_PCM_HW_PARAM_PERIOD_BYTES)
+#define SND_PCM_HW_PARBIT_BUFFER_BYTES (1U << SND_PCM_HW_PARAM_BUFFER_BYTES)
+#define SND_PCM_HW_PARBIT_TICK_TIME (1U << SND_PCM_HW_PARAM_TICK_TIME)
+
+
+#define SND_PCM_ACCBIT_MMAP { ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_COMPLEX)) }
+#define SND_PCM_ACCBIT_MMAPI { (1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) }
+#define SND_PCM_ACCBIT_MMAPN { (1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) }
+#define SND_PCM_ACCBIT_MMAPC { (1U << SND_PCM_ACCESS_MMAP_COMPLEX) }
+
+#define SND_PCM_ACCBIT_SHM { ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_NONINTERLEAVED)) }
+#define SND_PCM_ACCBIT_SHMI { ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_INTERLEAVED)) }
+#define SND_PCM_ACCBIT_SHMN { ((1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_NONINTERLEAVED)) }
+
+#define SND_PCM_FMTBIT_LINEAR \
+ { ((1U << SND_PCM_FORMAT_S8) | \
+ (1U << SND_PCM_FORMAT_U8) | \
+ (1U << SND_PCM_FORMAT_S16_LE) | \
+ (1U << SND_PCM_FORMAT_S16_BE) | \
+ (1U << SND_PCM_FORMAT_U16_LE) | \
+ (1U << SND_PCM_FORMAT_U16_BE) | \
+ (1U << SND_PCM_FORMAT_S24_LE) | \
+ (1U << SND_PCM_FORMAT_S24_BE) | \
+ (1U << SND_PCM_FORMAT_U24_LE) | \
+ (1U << SND_PCM_FORMAT_U24_BE) | \
+ (1U << SND_PCM_FORMAT_S32_LE) | \
+ (1U << SND_PCM_FORMAT_S32_BE) | \
+ (1U << SND_PCM_FORMAT_U32_LE) | \
+ (1U << SND_PCM_FORMAT_U32_BE)), \
+ ((1U << (SND_PCM_FORMAT_S24_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U24_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_S24_3BE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U24_3BE - 32)) | \
+ (1U << (SND_PCM_FORMAT_S20_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U20_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_S20_3BE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U20_3BE - 32)) | \
+ (1U << (SND_PCM_FORMAT_S18_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U18_3LE - 32)) | \
+ (1U << (SND_PCM_FORMAT_S18_3BE - 32)) | \
+ (1U << (SND_PCM_FORMAT_U18_3BE - 32))) }
+
+
+#define SND_PCM_FMTBIT_FLOAT \
+ { ((1U << SND_PCM_FORMAT_FLOAT_LE) | \
+ (1U << SND_PCM_FORMAT_FLOAT_BE) | \
+ (1U << SND_PCM_FORMAT_FLOAT64_LE) | \
+ (1U << SND_PCM_FORMAT_FLOAT64_BE)) }
+
+
+typedef union snd_tmp_float {
+ float f;
+ int32_t i;
+} snd_tmp_float_t;
+
+typedef union snd_tmp_double {
+ double d;
+ int64_t l;
+} snd_tmp_double_t;
+
+/* get the current timestamp */
+static inline void gettimestamp(snd_htimestamp_t *tstamp, int monotonic)
+{
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ if (monotonic) {
+ clock_gettime(CLOCK_MONOTONIC, tstamp);
+ } else {
+#endif
+ struct timeval tv;
+
+ gettimeofday(&tv, 0);
+ tstamp->tv_sec = tv.tv_sec;
+ tstamp->tv_nsec = tv.tv_usec * 1000L;
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ }
+#endif
+}
diff --git a/alsa-lib/src/pcm/pcm_meter.c b/alsa-lib/src/pcm/pcm_meter.c
new file mode 100644
index 0000000..0357921
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_meter.c
@@ -0,0 +1,1228 @@
+/**
+ * \file pcm/pcm_meter.c
+ * \brief Helper functions for #SND_PCM_TYPE_METER PCM scopes
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2001
+ *
+ * Helper functions for #SND_PCM_TYPE_METER PCM scopes
+ */
+/*
+ * PCM - Meter plugin
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#include <byteswap.h>
+#include <time.h>
+#include <pthread.h>
+#include <dlfcn.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+#include "iatomic.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_meter = "";
+#endif
+
+#ifndef DOC_HIDDEN
+#define FREQUENCY 50
+
+struct _snd_pcm_scope {
+ int enabled;
+ char *name;
+ snd_pcm_scope_ops_t *ops;
+ void *private_data;
+ struct list_head list;
+};
+
+typedef struct _snd_pcm_meter {
+ snd_pcm_generic_t gen;
+ snd_pcm_uframes_t rptr;
+ snd_pcm_uframes_t buf_size;
+ snd_pcm_channel_area_t *buf_areas;
+ snd_pcm_uframes_t now;
+ unsigned char *buf;
+ struct list_head scopes;
+ int closed;
+ int running;
+ atomic_t reset;
+ pthread_t thread;
+ pthread_mutex_t update_mutex;
+ pthread_mutex_t running_mutex;
+ pthread_cond_t running_cond;
+ struct timespec delay;
+ void *dl_handle;
+} snd_pcm_meter_t;
+
+static void snd_pcm_meter_add_frames(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t ptr,
+ snd_pcm_uframes_t frames)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ while (frames > 0) {
+ snd_pcm_uframes_t n = frames;
+ snd_pcm_uframes_t dst_offset = ptr % meter->buf_size;
+ snd_pcm_uframes_t src_offset = ptr % pcm->buffer_size;
+ snd_pcm_uframes_t dst_cont = meter->buf_size - dst_offset;
+ snd_pcm_uframes_t src_cont = pcm->buffer_size - src_offset;
+ if (n > dst_cont)
+ n = dst_cont;
+ if (n > src_cont)
+ n = src_cont;
+ snd_pcm_areas_copy(meter->buf_areas, dst_offset,
+ areas, src_offset,
+ pcm->channels, n, pcm->format);
+ frames -= n;
+ ptr += n;
+ if (ptr == pcm->boundary)
+ ptr = 0;
+ }
+}
+
+static void snd_pcm_meter_update_main(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_sframes_t frames;
+ snd_pcm_uframes_t rptr, old_rptr;
+ const snd_pcm_channel_area_t *areas;
+ int locked;
+ locked = (pthread_mutex_trylock(&meter->update_mutex) >= 0);
+ areas = snd_pcm_mmap_areas(pcm);
+ rptr = *pcm->hw.ptr;
+ old_rptr = meter->rptr;
+ meter->rptr = rptr;
+ frames = rptr - old_rptr;
+ if (frames < 0)
+ frames += pcm->boundary;
+ if (frames > 0) {
+ assert((snd_pcm_uframes_t) frames <= pcm->buffer_size);
+ snd_pcm_meter_add_frames(pcm, areas, old_rptr,
+ (snd_pcm_uframes_t) frames);
+ }
+ if (locked)
+ pthread_mutex_unlock(&meter->update_mutex);
+}
+
+static int snd_pcm_meter_update_scope(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_sframes_t frames;
+ snd_pcm_uframes_t rptr, old_rptr;
+ const snd_pcm_channel_area_t *areas;
+ int reset = 0;
+ /* Wait main thread */
+ pthread_mutex_lock(&meter->update_mutex);
+ areas = snd_pcm_mmap_areas(pcm);
+ _again:
+ rptr = *pcm->hw.ptr;
+ old_rptr = meter->rptr;
+ rmb();
+ if (atomic_read(&meter->reset)) {
+ reset = 1;
+ atomic_dec(&meter->reset);
+ goto _again;
+ }
+ meter->rptr = rptr;
+ frames = rptr - old_rptr;
+ if (frames < 0)
+ frames += pcm->boundary;
+ if (frames > 0) {
+ assert((snd_pcm_uframes_t) frames <= pcm->buffer_size);
+ snd_pcm_meter_add_frames(pcm, areas, old_rptr,
+ (snd_pcm_uframes_t) frames);
+ }
+ pthread_mutex_unlock(&meter->update_mutex);
+ return reset;
+}
+
+static int snd_pcm_scope_remove(snd_pcm_scope_t *scope)
+{
+ free(scope->name);
+ scope->ops->close(scope);
+ list_del(&scope->list);
+ free(scope);
+ return 0;
+}
+
+static int snd_pcm_scope_enable(snd_pcm_scope_t *scope)
+{
+ int err;
+ assert(!scope->enabled);
+ err = scope->ops->enable(scope);
+ scope->enabled = (err >= 0);
+ return err;
+}
+
+static int snd_pcm_scope_disable(snd_pcm_scope_t *scope)
+{
+ assert(scope->enabled);
+ scope->ops->disable(scope);
+ scope->enabled = 0;
+ return 0;
+}
+
+static void *snd_pcm_meter_thread(void *data)
+{
+ snd_pcm_t *pcm = data;
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_t *spcm = meter->gen.slave;
+ struct list_head *pos;
+ snd_pcm_scope_t *scope;
+ int reset;
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ snd_pcm_scope_enable(scope);
+ }
+ while (!meter->closed) {
+ snd_pcm_sframes_t now;
+ snd_pcm_status_t status;
+ int err;
+ pthread_mutex_lock(&meter->running_mutex);
+ err = snd_pcm_status(spcm, &status);
+ assert(err >= 0);
+ if (status.state != SND_PCM_STATE_RUNNING &&
+ (status.state != SND_PCM_STATE_DRAINING ||
+ spcm->stream != SND_PCM_STREAM_PLAYBACK)) {
+ if (meter->running) {
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ scope->ops->stop(scope);
+ }
+ meter->running = 0;
+ }
+ pthread_cond_wait(&meter->running_cond,
+ &meter->running_mutex);
+ pthread_mutex_unlock(&meter->running_mutex);
+ continue;
+ }
+ pthread_mutex_unlock(&meter->running_mutex);
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ now = status.appl_ptr - status.delay;
+ if (now < 0)
+ now += pcm->boundary;
+ } else {
+ now = status.appl_ptr + status.delay;
+ if ((snd_pcm_uframes_t) now >= pcm->boundary)
+ now -= pcm->boundary;
+ }
+ meter->now = now;
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
+ reset = snd_pcm_meter_update_scope(pcm);
+ else {
+ reset = 0;
+ while (atomic_read(&meter->reset)) {
+ reset = 1;
+ atomic_dec(&meter->reset);
+ }
+ }
+ if (reset) {
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ if (scope->enabled)
+ scope->ops->reset(scope);
+ }
+ continue;
+ }
+ if (!meter->running) {
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ if (scope->enabled)
+ scope->ops->start(scope);
+ }
+ meter->running = 1;
+ }
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ if (scope->enabled)
+ scope->ops->update(scope);
+ }
+ nanosleep(&meter->delay, NULL);
+ }
+ list_for_each(pos, &meter->scopes) {
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ if (scope->enabled)
+ snd_pcm_scope_disable(scope);
+ }
+ return NULL;
+}
+
+static int snd_pcm_meter_close(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ struct list_head *pos, *npos;
+ int err = 0;
+ pthread_mutex_destroy(&meter->update_mutex);
+ pthread_mutex_destroy(&meter->running_mutex);
+ pthread_cond_destroy(&meter->running_cond);
+ if (meter->gen.close_slave)
+ err = snd_pcm_close(meter->gen.slave);
+ list_for_each_safe(pos, npos, &meter->scopes) {
+ snd_pcm_scope_t *scope;
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ snd_pcm_scope_remove(scope);
+ }
+ if (meter->dl_handle)
+ snd_dlclose(meter->dl_handle);
+ free(meter);
+ return err;
+}
+
+static int snd_pcm_meter_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ int err;
+ atomic_inc(&meter->reset);
+ err = snd_pcm_prepare(meter->gen.slave);
+ if (err >= 0) {
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ meter->rptr = *pcm->appl.ptr;
+ else
+ meter->rptr = *pcm->hw.ptr;
+ }
+ return err;
+}
+
+static int snd_pcm_meter_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ int err = snd_pcm_reset(meter->gen.slave);
+ if (err >= 0) {
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ meter->rptr = *pcm->appl.ptr;
+ }
+ return err;
+}
+
+static int snd_pcm_meter_start(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ int err;
+ pthread_mutex_lock(&meter->running_mutex);
+ err = snd_pcm_start(meter->gen.slave);
+ if (err >= 0)
+ pthread_cond_signal(&meter->running_cond);
+ pthread_mutex_unlock(&meter->running_mutex);
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_meter_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_sframes_t err = snd_pcm_rewind(meter->gen.slave, frames);
+ if (err > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ meter->rptr = *pcm->appl.ptr;
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_meter_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_sframes_t err = INTERNAL(snd_pcm_forward)(meter->gen.slave, frames);
+ if (err > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ meter->rptr = *pcm->appl.ptr;
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_meter_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_uframes_t old_rptr = *pcm->appl.ptr;
+ snd_pcm_sframes_t result = snd_pcm_mmap_commit(meter->gen.slave, offset, size);
+ if (result <= 0)
+ return result;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ snd_pcm_meter_add_frames(pcm, snd_pcm_mmap_areas(pcm), old_rptr, result);
+ meter->rptr = *pcm->appl.ptr;
+ }
+ return result;
+}
+
+static snd_pcm_sframes_t snd_pcm_meter_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_pcm_sframes_t result = snd_pcm_avail_update(meter->gen.slave);
+ if (result <= 0)
+ return result;
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
+ snd_pcm_meter_update_main(pcm);
+ return result;
+}
+
+static int snd_pcm_meter_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_meter_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ return 0;
+}
+
+static int snd_pcm_meter_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_meter_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ return snd_pcm_hw_refine(meter->gen.slave, params);
+}
+
+static int snd_pcm_meter_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ return _snd_pcm_hw_params(meter->gen.slave, params);
+}
+
+static int snd_pcm_meter_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_meter_hw_refine_cprepare,
+ snd_pcm_meter_hw_refine_cchange,
+ snd_pcm_meter_hw_refine_sprepare,
+ snd_pcm_meter_hw_refine_schange,
+ snd_pcm_meter_hw_refine_slave);
+}
+
+static int snd_pcm_meter_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ unsigned int channel;
+ snd_pcm_t *slave = meter->gen.slave;
+ size_t buf_size_bytes;
+ int err;
+ err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_meter_hw_refine_cchange,
+ snd_pcm_meter_hw_refine_sprepare,
+ snd_pcm_meter_hw_refine_schange,
+ snd_pcm_meter_hw_params_slave);
+ if (err < 0)
+ return err;
+ /* more than 1 second of buffer */
+ meter->buf_size = slave->buffer_size;
+ while (meter->buf_size < slave->rate)
+ meter->buf_size *= 2;
+ buf_size_bytes = snd_pcm_frames_to_bytes(slave, meter->buf_size);
+ assert(!meter->buf);
+ meter->buf = malloc(buf_size_bytes);
+ if (!meter->buf)
+ return -ENOMEM;
+ meter->buf_areas = malloc(sizeof(*meter->buf_areas) * slave->channels);
+ if (!meter->buf_areas) {
+ free(meter->buf);
+ return -ENOMEM;
+ }
+ for (channel = 0; channel < slave->channels; ++channel) {
+ snd_pcm_channel_area_t *a = &meter->buf_areas[channel];
+ a->addr = meter->buf + buf_size_bytes / slave->channels * channel;
+ a->first = 0;
+ a->step = slave->sample_bits;
+ }
+ meter->closed = 0;
+ err = pthread_create(&meter->thread, NULL, snd_pcm_meter_thread, pcm);
+ assert(err == 0);
+ return 0;
+}
+
+static int snd_pcm_meter_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ int err;
+ meter->closed = 1;
+ pthread_mutex_lock(&meter->running_mutex);
+ pthread_cond_signal(&meter->running_cond);
+ pthread_mutex_unlock(&meter->running_mutex);
+ err = pthread_join(meter->thread, 0);
+ assert(err == 0);
+ free(meter->buf);
+ free(meter->buf_areas);
+ meter->buf = NULL;
+ meter->buf_areas = NULL;
+ return snd_pcm_hw_free(meter->gen.slave);
+}
+
+static void snd_pcm_meter_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_meter_t *meter = pcm->private_data;
+ snd_output_printf(out, "Meter PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(meter->gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_meter_ops = {
+ .close = snd_pcm_meter_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_meter_hw_refine,
+ .hw_params = snd_pcm_meter_hw_params,
+ .hw_free = snd_pcm_meter_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_meter_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_meter_fast_ops = {
+ .status = snd_pcm_generic_status,
+ .state = snd_pcm_generic_state,
+ .hwsync = snd_pcm_generic_hwsync,
+ .delay = snd_pcm_generic_delay,
+ .prepare = snd_pcm_meter_prepare,
+ .reset = snd_pcm_meter_reset,
+ .start = snd_pcm_meter_start,
+ .drop = snd_pcm_generic_drop,
+ .drain = snd_pcm_generic_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewindable = snd_pcm_generic_rewindable,
+ .rewind = snd_pcm_meter_rewind,
+ .forwardable = snd_pcm_generic_forwardable,
+ .forward = snd_pcm_meter_forward,
+ .resume = snd_pcm_generic_resume,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .avail_update = snd_pcm_meter_avail_update,
+ .mmap_commit = snd_pcm_meter_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_revents = snd_pcm_generic_poll_revents,
+};
+
+/**
+ * \brief Creates a new Meter PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param frequency Update frequency
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, unsigned int frequency,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_meter_t *meter;
+ int err;
+ assert(pcmp);
+ meter = calloc(1, sizeof(snd_pcm_meter_t));
+ if (!meter)
+ return -ENOMEM;
+ meter->gen.slave = slave;
+ meter->gen.close_slave = close_slave;
+ meter->delay.tv_sec = 0;
+ meter->delay.tv_nsec = 1000000000 / frequency;
+ INIT_LIST_HEAD(&meter->scopes);
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_METER, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(meter);
+ return err;
+ }
+ pcm->mmap_rw = 1;
+ pcm->mmap_shadow = 1;
+ pcm->ops = &snd_pcm_meter_ops;
+ pcm->fast_ops = &snd_pcm_meter_fast_ops;
+ pcm->private_data = meter;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_link_hw_ptr(pcm, slave);
+ snd_pcm_link_appl_ptr(pcm, slave);
+ *pcmp = pcm;
+
+ pthread_mutex_init(&meter->update_mutex, NULL);
+ pthread_mutex_init(&meter->running_mutex, NULL);
+ pthread_cond_init(&meter->running_cond, NULL);
+ return 0;
+}
+
+
+static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
+ snd_config_t *root, snd_config_t *conf)
+{
+ char buf[256];
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL, *str = NULL;
+ snd_config_t *c, *type_conf = NULL;
+ int (*open_func)(snd_pcm_t *, const char *,
+ snd_config_t *, snd_config_t *) = NULL;
+ snd_pcm_meter_t *meter = pcm->private_data;
+ void *h = NULL;
+ int err;
+
+ if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for scope %s", str);
+ err = -EINVAL;
+ goto _err;
+ }
+ err = snd_config_search(conf, "type", &c);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ goto _err;
+ }
+ err = snd_config_get_id(c, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ goto _err;
+ }
+ err = snd_config_get_string(c, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ err = snd_config_search_definition(root, "pcm_scope_type", str, &type_conf);
+ if (err >= 0) {
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_pcm_scope_%s_open", str);
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ open_func = h ? dlsym(h, open_name) : NULL;
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (! err) {
+ err = open_func(pcm, name, root, conf);
+ if (err < 0)
+ snd_dlclose(h);
+ else
+ meter->dl_handle = h;
+ }
+ return err;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_meter Plugin: Meter
+
+Show meter (visual waveform representation).
+
+\code
+pcm_scope_type.NAME {
+ [lib STR] # Library file (default libasound.so)
+ [open STR] # Open function (default _snd_pcm_scope_NAME_open)
+}
+
+pcm_scope.name {
+ type STR # Scope type
+ ...
+}
+
+pcm.name {
+ type meter # Meter PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ }
+ [frequency INT] # Updates per second
+ scopes {
+ ID STR # Scope name (see pcm_scope)
+ # or
+ ID { } # Scope definition (see pcm_scope)
+ }
+}
+\endcode
+
+\subsection pcm_plugins_meter_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_meter_open()
+ <LI>_snd_pcm_meter_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Meter PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Meter PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ long frequency = -1;
+ snd_config_t *scopes = NULL;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "frequency") == 0) {
+ err = snd_config_get_integer(n, &frequency);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "scopes") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ scopes = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_meter_open(pcmp, name, frequency > 0 ? (unsigned int) frequency : FREQUENCY, spcm, 1);
+ if (err < 0) {
+ snd_pcm_close(spcm);
+ return err;
+ }
+ if (!scopes)
+ return 0;
+ snd_config_for_each(i, next, scopes) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id, *str;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_config_get_string(n, &str) >= 0) {
+ err = snd_config_search_definition(root, "pcm_scope", str, &n);
+ if (err < 0) {
+ SNDERR("unknown pcm_scope %s", str);
+ } else {
+ err = snd_pcm_meter_add_scope_conf(*pcmp, id, root, n);
+ snd_config_delete(n);
+ }
+ } else
+ err = snd_pcm_meter_add_scope_conf(*pcmp, id, root, n);
+ if (err < 0) {
+ snd_pcm_close(*pcmp);
+ return err;
+ }
+ }
+ return 0;
+}
+SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION);
+
+#endif
+
+/**
+ * \brief Add a scope to a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \param scope Scope handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ list_add_tail(&scope->list, &meter->scopes);
+ return 0;
+}
+
+/**
+ * \brief Search an installed scope inside a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \param name scope name
+ * \return pointer to found scope or NULL if none is found
+ */
+snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name)
+{
+ snd_pcm_meter_t *meter;
+ struct list_head *pos;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ list_for_each(pos, &meter->scopes) {
+ snd_pcm_scope_t *scope;
+ scope = list_entry(pos, snd_pcm_scope_t, list);
+ if (scope->name && strcmp(scope->name, name) == 0)
+ return scope;
+ }
+ return NULL;
+}
+
+/**
+ * \brief Get meter buffer size from a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \return meter buffer size in frames
+ */
+snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ assert(meter->gen.slave->setup);
+ return meter->buf_size;
+}
+
+/**
+ * \brief Get meter channels from a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \return meter channels count
+ */
+unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ assert(meter->gen.slave->setup);
+ return meter->gen.slave->channels;
+}
+
+/**
+ * \brief Get meter rate from a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \return approximate rate
+ */
+unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ assert(meter->gen.slave->setup);
+ return meter->gen.slave->rate;
+}
+
+/**
+ * \brief Get meter "now" frame pointer from a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \return "now" frame pointer in frames (0 ... boundary - 1) see #snd_pcm_meter_get_boundary
+ */
+snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ assert(meter->gen.slave->setup);
+ return meter->now;
+}
+
+/**
+ * \brief Get boundary for frame pointers from a #SND_PCM_TYPE_METER PCM
+ * \param pcm PCM handle
+ * \return boundary in frames
+ */
+snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm)
+{
+ snd_pcm_meter_t *meter;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ assert(meter->gen.slave->setup);
+ return meter->gen.slave->boundary;
+}
+
+/**
+ * \brief Set name of a #SND_PCM_TYPE_METER PCM scope
+ * \param scope PCM meter scope
+ * \param val scope name
+ */
+void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val)
+{
+ scope->name = strdup(val);
+}
+
+/**
+ * \brief Get name of a #SND_PCM_TYPE_METER PCM scope
+ * \param scope PCM meter scope
+ * \return scope name
+ */
+const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope)
+{
+ return scope->name;
+}
+
+/**
+ * \brief Set callbacks for a #SND_PCM_TYPE_METER PCM scope
+ * \param scope PCM meter scope
+ * \param val callbacks
+ */
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val)
+{
+ scope->ops = val;
+}
+
+/**
+ * \brief Get callbacks private value for a #SND_PCM_TYPE_METER PCM scope
+ * \param scope PCM meter scope
+ * \return Private data value
+ */
+void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope)
+{
+ return scope->private_data;
+}
+
+/**
+ * \brief Get callbacks private value for a #SND_PCM_TYPE_METER PCM scope
+ * \param scope PCM meter scope
+ * \param val Private data value
+ */
+void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val)
+{
+ scope->private_data = val;
+}
+
+#ifndef DOC_HIDDEN
+typedef struct _snd_pcm_scope_s16 {
+ snd_pcm_t *pcm;
+ snd_pcm_adpcm_state_t *adpcm_states;
+ unsigned int index;
+ snd_pcm_uframes_t old;
+ int16_t *buf;
+ snd_pcm_channel_area_t *buf_areas;
+} snd_pcm_scope_s16_t;
+
+static int s16_enable(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_s16_t *s16 = scope->private_data;
+ snd_pcm_meter_t *meter = s16->pcm->private_data;
+ snd_pcm_t *spcm = meter->gen.slave;
+ snd_pcm_channel_area_t *a;
+ unsigned int c;
+ int idx;
+ if (spcm->format == SND_PCM_FORMAT_S16 &&
+ spcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) {
+ s16->buf = (int16_t *) meter->buf;
+ return -EINVAL;
+ }
+ switch (spcm->format) {
+ case SND_PCM_FORMAT_A_LAW:
+ case SND_PCM_FORMAT_MU_LAW:
+ case SND_PCM_FORMAT_IMA_ADPCM:
+ idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, SND_PCM_FORMAT_S16);
+ break;
+ case SND_PCM_FORMAT_S8:
+ case SND_PCM_FORMAT_S16_LE:
+ case SND_PCM_FORMAT_S16_BE:
+ case SND_PCM_FORMAT_S24_LE:
+ case SND_PCM_FORMAT_S24_BE:
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_S32_BE:
+ case SND_PCM_FORMAT_U8:
+ case SND_PCM_FORMAT_U16_LE:
+ case SND_PCM_FORMAT_U16_BE:
+ case SND_PCM_FORMAT_U24_LE:
+ case SND_PCM_FORMAT_U24_BE:
+ case SND_PCM_FORMAT_U32_LE:
+ case SND_PCM_FORMAT_U32_BE:
+ idx = snd_pcm_linear_convert_index(spcm->format, SND_PCM_FORMAT_S16);
+ break;
+ default:
+ return -EINVAL;
+ }
+ s16->index = idx;
+ if (spcm->format == SND_PCM_FORMAT_IMA_ADPCM) {
+ s16->adpcm_states = calloc(spcm->channels, sizeof(*s16->adpcm_states));
+ if (!s16->adpcm_states)
+ return -ENOMEM;
+ }
+ s16->buf = malloc(meter->buf_size * 2 * spcm->channels);
+ if (!s16->buf) {
+ free(s16->adpcm_states);
+ return -ENOMEM;
+ }
+ a = calloc(spcm->channels, sizeof(*a));
+ if (!a) {
+ free(s16->buf);
+ free(s16->adpcm_states);
+ return -ENOMEM;
+ }
+ s16->buf_areas = a;
+ for (c = 0; c < spcm->channels; c++, a++) {
+ a->addr = s16->buf + c * meter->buf_size;
+ a->first = 0;
+ a->step = 16;
+ }
+ return 0;
+}
+
+static void s16_disable(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_s16_t *s16 = scope->private_data;
+ free(s16->adpcm_states);
+ s16->adpcm_states = NULL;
+ free(s16->buf);
+ s16->buf = NULL;
+ free(s16->buf_areas);
+ s16->buf_areas = 0;
+}
+
+static void s16_close(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_s16_t *s16 = scope->private_data;
+ free(s16);
+}
+
+static void s16_start(snd_pcm_scope_t *scope ATTRIBUTE_UNUSED)
+{
+}
+
+static void s16_stop(snd_pcm_scope_t *scope ATTRIBUTE_UNUSED)
+{
+}
+
+static void s16_update(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_s16_t *s16 = scope->private_data;
+ snd_pcm_meter_t *meter = s16->pcm->private_data;
+ snd_pcm_t *spcm = meter->gen.slave;
+ snd_pcm_sframes_t size;
+ snd_pcm_uframes_t offset;
+ size = meter->now - s16->old;
+ if (size < 0)
+ size += spcm->boundary;
+ offset = s16->old % meter->buf_size;
+ while (size > 0) {
+ snd_pcm_uframes_t frames = size;
+ snd_pcm_uframes_t cont = meter->buf_size - offset;
+ if (frames > cont)
+ frames = cont;
+ switch (spcm->format) {
+ case SND_PCM_FORMAT_A_LAW:
+ snd_pcm_alaw_decode(s16->buf_areas, offset,
+ meter->buf_areas, offset,
+ spcm->channels, frames,
+ s16->index);
+ break;
+ case SND_PCM_FORMAT_MU_LAW:
+ snd_pcm_mulaw_decode(s16->buf_areas, offset,
+ meter->buf_areas, offset,
+ spcm->channels, frames,
+ s16->index);
+ break;
+ case SND_PCM_FORMAT_IMA_ADPCM:
+ snd_pcm_adpcm_decode(s16->buf_areas, offset,
+ meter->buf_areas, offset,
+ spcm->channels, frames,
+ s16->index,
+ s16->adpcm_states);
+ break;
+ default:
+ snd_pcm_linear_convert(s16->buf_areas, offset,
+ meter->buf_areas, offset,
+ spcm->channels, frames,
+ s16->index);
+ break;
+ }
+ if (frames == cont)
+ offset = 0;
+ else
+ offset += frames;
+ size -= frames;
+ }
+ s16->old = meter->now;
+}
+
+static void s16_reset(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_s16_t *s16 = scope->private_data;
+ snd_pcm_meter_t *meter = s16->pcm->private_data;
+ s16->old = meter->now;
+}
+
+static const snd_pcm_scope_ops_t s16_ops = {
+ .enable = s16_enable,
+ .disable = s16_disable,
+ .close = s16_close,
+ .start = s16_start,
+ .stop = s16_stop,
+ .update = s16_update,
+ .reset = s16_reset,
+};
+
+#endif
+
+/**
+ * \brief Add a s16 pseudo scope to a #SND_PCM_TYPE_METER PCM
+ * \param pcm The pcm handle
+ * \param name Scope name
+ * \param scopep Pointer to newly created and added scope
+ * \return 0 on success otherwise a negative error code
+ *
+ * s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian
+ * 16 bit frames for use with other scopes. Don't forget to insert it before
+ * and to not insert it more time (see #snd_pcm_meter_search_scope)
+ */
+int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
+ snd_pcm_scope_t **scopep)
+{
+ snd_pcm_meter_t *meter;
+ snd_pcm_scope_t *scope;
+ snd_pcm_scope_s16_t *s16;
+ assert(pcm->type == SND_PCM_TYPE_METER);
+ meter = pcm->private_data;
+ scope = calloc(1, sizeof(*scope));
+ if (!scope)
+ return -ENOMEM;
+ s16 = calloc(1, sizeof(*s16));
+ if (!s16) {
+ free(scope);
+ return -ENOMEM;
+ }
+ if (name)
+ scope->name = strdup(name);
+ s16->pcm = pcm;
+ scope->ops = &s16_ops;
+ scope->private_data = s16;
+ list_add_tail(&scope->list, &meter->scopes);
+ *scopep = scope;
+ return 0;
+}
+
+/**
+ * \brief Get s16 pseudo scope frames buffer for a channel
+ * \param scope s16 pseudo scope handle
+ * \param channel Channel
+ * \return Pointer to channel buffer
+ */
+int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
+ unsigned int channel)
+{
+ snd_pcm_scope_s16_t *s16;
+ snd_pcm_meter_t *meter;
+ assert(scope->ops == &s16_ops);
+ s16 = scope->private_data;
+ meter = s16->pcm->private_data;
+ assert(meter->gen.slave->setup);
+ assert(s16->buf_areas);
+ assert(channel < meter->gen.slave->channels);
+ return s16->buf_areas[channel].addr;
+}
+
+/**
+ * \brief allocate an invalid #snd_pcm_scope_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_pcm_scope_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
diff --git a/alsa-lib/src/pcm/pcm_misc.c b/alsa-lib/src/pcm/pcm_misc.c
new file mode 100644
index 0000000..d52160c
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_misc.c
@@ -0,0 +1,833 @@
+/*
+ * PCM Interface - misc routines
+ * Copyright (c) 1998 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <byteswap.h>
+#include "pcm_local.h"
+
+
+/**
+ * \brief Return sign info for a PCM sample linear format
+ * \param format Format
+ * \return 0 unsigned, 1 signed, a negative error code if format is not linear
+ */
+int snd_pcm_format_signed(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S8:
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ return 1;
+ case SNDRV_PCM_FORMAT_U8:
+ case SNDRV_PCM_FORMAT_U16_LE:
+ case SNDRV_PCM_FORMAT_U16_BE:
+ case SNDRV_PCM_FORMAT_U24_LE:
+ case SNDRV_PCM_FORMAT_U24_BE:
+ case SNDRV_PCM_FORMAT_U32_LE:
+ case SNDRV_PCM_FORMAT_U32_BE:
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ return 0;
+ default:
+ return -EINVAL;
+ }
+}
+
+/**
+ * \brief Return sign info for a PCM sample linear format
+ * \param format Format
+ * \return 0 signed, 1 unsigned, a negative error code if format is not linear
+ */
+int snd_pcm_format_unsigned(snd_pcm_format_t format)
+{
+ int val;
+
+ val = snd_pcm_format_signed(format);
+ if (val < 0)
+ return val;
+ return !val;
+}
+
+/**
+ * \brief Return linear info for a PCM sample format
+ * \param format Format
+ * \return 0 non linear, 1 linear
+ */
+int snd_pcm_format_linear(snd_pcm_format_t format)
+{
+ return snd_pcm_format_signed(format) >= 0;
+}
+
+/**
+ * \brief Return float info for a PCM sample format
+ * \param format Format
+ * \return 0 non float, 1 float
+ */
+int snd_pcm_format_float(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+/**
+ * \brief Return endian info for a PCM sample format
+ * \param format Format
+ * \return 0 big endian, 1 little endian, a negative error code if endian independent
+ */
+int snd_pcm_format_little_endian(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_U16_LE:
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_U24_LE:
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_U32_LE:
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ return 1;
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_U16_BE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_U24_BE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_U32_BE:
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ return 0;
+ default:
+ return -EINVAL;
+ }
+}
+
+/**
+ * \brief Return endian info for a PCM sample format
+ * \param format Format
+ * \return 0 little endian, 1 big endian, a negative error code if endian independent
+ */
+int snd_pcm_format_big_endian(snd_pcm_format_t format)
+{
+ int val;
+
+ val = snd_pcm_format_little_endian(format);
+ if (val < 0)
+ return val;
+ return !val;
+}
+
+/**
+ * \brief Return endian info for a PCM sample format
+ * \param format Format
+ * \return 0 swapped, 1 CPU endian, a negative error code if endian independent
+ */
+int snd_pcm_format_cpu_endian(snd_pcm_format_t format)
+{
+#ifdef SNDRV_LITTLE_ENDIAN
+ return snd_pcm_format_little_endian(format);
+#else
+ return snd_pcm_format_big_endian(format);
+#endif
+}
+
+/**
+ * \brief Return nominal bits per a PCM sample
+ * \param format Sample format
+ * \return bits per sample, a negative error code if not applicable
+ */
+int snd_pcm_format_width(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S8:
+ case SNDRV_PCM_FORMAT_U8:
+ return 8;
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_U16_LE:
+ case SNDRV_PCM_FORMAT_U16_BE:
+ return 16;
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ return 18;
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ return 20;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_U24_LE:
+ case SNDRV_PCM_FORMAT_U24_BE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ return 24;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_U32_LE:
+ case SNDRV_PCM_FORMAT_U32_BE:
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ return 32;
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ return 64;
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ return 32;
+ case SNDRV_PCM_FORMAT_MU_LAW:
+ case SNDRV_PCM_FORMAT_A_LAW:
+ return 8;
+ case SNDRV_PCM_FORMAT_IMA_ADPCM:
+ return 4;
+ default:
+ return -EINVAL;
+ }
+}
+
+/**
+ * \brief Return bits needed to store a PCM sample
+ * \param format Sample format
+ * \return bits per sample, a negative error code if not applicable
+ */
+int snd_pcm_format_physical_width(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S8:
+ case SNDRV_PCM_FORMAT_U8:
+ return 8;
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_U16_LE:
+ case SNDRV_PCM_FORMAT_U16_BE:
+ return 16;
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ return 24;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_U24_LE:
+ case SNDRV_PCM_FORMAT_U24_BE:
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_U32_LE:
+ case SNDRV_PCM_FORMAT_U32_BE:
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ return 32;
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ return 64;
+ case SNDRV_PCM_FORMAT_MU_LAW:
+ case SNDRV_PCM_FORMAT_A_LAW:
+ return 8;
+ case SNDRV_PCM_FORMAT_IMA_ADPCM:
+ return 4;
+ default:
+ return -EINVAL;
+ }
+}
+
+/**
+ * \brief Return bytes needed to store a quantity of PCM sample
+ * \param format Sample format
+ * \param samples Samples count
+ * \return bytes needed, a negative error code if not integer or unknown
+ */
+ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S8:
+ case SNDRV_PCM_FORMAT_U8:
+ return samples;
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_U16_LE:
+ case SNDRV_PCM_FORMAT_U16_BE:
+ return samples * 2;
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ return samples * 3;
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_U24_LE:
+ case SNDRV_PCM_FORMAT_U24_BE:
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_U32_LE:
+ case SNDRV_PCM_FORMAT_U32_BE:
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ return samples * 4;
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ return samples * 8;
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ return samples * 4;
+ case SNDRV_PCM_FORMAT_MU_LAW:
+ case SNDRV_PCM_FORMAT_A_LAW:
+ return samples;
+ case SNDRV_PCM_FORMAT_IMA_ADPCM:
+ if (samples & 1)
+ return -EINVAL;
+ return samples / 2;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+}
+
+/**
+ * \brief Return 64 bit expressing silence for a PCM sample format
+ * \param format Sample format
+ * \return silence 64 bit word
+ */
+u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
+{
+ switch (format) {
+ case SNDRV_PCM_FORMAT_S8:
+ case SNDRV_PCM_FORMAT_S16_LE:
+ case SNDRV_PCM_FORMAT_S16_BE:
+ case SNDRV_PCM_FORMAT_S24_LE:
+ case SNDRV_PCM_FORMAT_S24_BE:
+ case SNDRV_PCM_FORMAT_S32_LE:
+ case SNDRV_PCM_FORMAT_S32_BE:
+ case SNDRV_PCM_FORMAT_S24_3LE:
+ case SNDRV_PCM_FORMAT_S24_3BE:
+ case SNDRV_PCM_FORMAT_S20_3LE:
+ case SNDRV_PCM_FORMAT_S20_3BE:
+ case SNDRV_PCM_FORMAT_S18_3LE:
+ case SNDRV_PCM_FORMAT_S18_3BE:
+ return 0;
+ case SNDRV_PCM_FORMAT_U8:
+ return 0x8080808080808080ULL;
+#ifdef SNDRV_LITTLE_ENDIAN
+ case SNDRV_PCM_FORMAT_U16_LE:
+ return 0x8000800080008000ULL;
+ case SNDRV_PCM_FORMAT_U24_LE:
+ return 0x0080000000800000ULL;
+ case SNDRV_PCM_FORMAT_U32_LE:
+ return 0x8000000080000000ULL;
+ case SNDRV_PCM_FORMAT_U16_BE:
+ return 0x0080008000800080ULL;
+ case SNDRV_PCM_FORMAT_U24_BE:
+ return 0x0000800000008000ULL;
+ case SNDRV_PCM_FORMAT_U32_BE:
+ return 0x0000008000000080ULL;
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ return 0x0000800000800000ULL;
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ return 0x0080000080000080ULL;
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ return 0x0000080000080000ULL;
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ return 0x0008000008000008ULL;
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ return 0x0000020000020000ULL;
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ return 0x0002000002000002ULL;
+#else
+ case SNDRV_PCM_FORMAT_U16_LE:
+ return 0x0080008000800080ULL;
+ case SNDRV_PCM_FORMAT_U24_LE:
+ return 0x0000800000008000ULL;
+ case SNDRV_PCM_FORMAT_U32_LE:
+ return 0x0000008000000080ULL;
+ case SNDRV_PCM_FORMAT_U16_BE:
+ return 0x8000800080008000ULL;
+ case SNDRV_PCM_FORMAT_U24_BE:
+ return 0x0080000000800000ULL;
+ case SNDRV_PCM_FORMAT_U32_BE:
+ return 0x8000000080000000ULL;
+ case SNDRV_PCM_FORMAT_U24_3LE:
+ return 0x0080000080000080ULL;
+ case SNDRV_PCM_FORMAT_U24_3BE:
+ return 0x0000800000800000ULL;
+ case SNDRV_PCM_FORMAT_U20_3LE:
+ return 0x0008000008000008ULL;
+ case SNDRV_PCM_FORMAT_U20_3BE:
+ return 0x0000080000080000ULL;
+ case SNDRV_PCM_FORMAT_U18_3LE:
+ return 0x0002000002000002ULL;
+ case SNDRV_PCM_FORMAT_U18_3BE:
+ return 0x0000020000020000ULL;
+#endif
+ case SNDRV_PCM_FORMAT_FLOAT_LE:
+ {
+ union {
+ float f[2];
+ u_int64_t i;
+ } u;
+ u.f[0] = u.f[1] = 0.0;
+#ifdef SNDRV_LITTLE_ENDIAN
+ return u.i;
+#else
+ return bswap_64(u.i);
+#endif
+ }
+ case SNDRV_PCM_FORMAT_FLOAT64_LE:
+ {
+ union {
+ double f;
+ u_int64_t i;
+ } u;
+ u.f = 0.0;
+#ifdef SNDRV_LITTLE_ENDIAN
+ return u.i;
+#else
+ return bswap_64(u.i);
+#endif
+ }
+ case SNDRV_PCM_FORMAT_FLOAT_BE:
+ {
+ union {
+ float f[2];
+ u_int64_t i;
+ } u;
+ u.f[0] = u.f[1] = 0.0;
+#ifdef SNDRV_LITTLE_ENDIAN
+ return bswap_64(u.i);
+#else
+ return u.i;
+#endif
+ }
+ case SNDRV_PCM_FORMAT_FLOAT64_BE:
+ {
+ union {
+ double f;
+ u_int64_t i;
+ } u;
+ u.f = 0.0;
+#ifdef SNDRV_LITTLE_ENDIAN
+ return bswap_64(u.i);
+#else
+ return u.i;
+#endif
+ }
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ return 0;
+ case SNDRV_PCM_FORMAT_MU_LAW:
+ return 0x7f7f7f7f7f7f7f7fULL;
+ case SNDRV_PCM_FORMAT_A_LAW:
+ return 0x5555555555555555ULL;
+ case SNDRV_PCM_FORMAT_IMA_ADPCM: /* special case */
+ case SNDRV_PCM_FORMAT_MPEG:
+ case SNDRV_PCM_FORMAT_GSM:
+ case SNDRV_PCM_FORMAT_SPECIAL:
+ return 0;
+ default:
+ assert(0);
+ return 0;
+ }
+ return 0;
+}
+
+/**
+ * \brief Return 32 bit expressing silence for a PCM sample format
+ * \param format Sample format
+ * \return silence 32 bit word
+ */
+u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
+{
+ assert(snd_pcm_format_physical_width(format) <= 32);
+ return (u_int32_t)snd_pcm_format_silence_64(format);
+}
+
+/**
+ * \brief Return 16 bit expressing silence for a PCM sample format
+ * \param format Sample format
+ * \return silence 16 bit word
+ */
+u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
+{
+ assert(snd_pcm_format_physical_width(format) <= 16);
+ return (u_int16_t)snd_pcm_format_silence_64(format);
+}
+
+/**
+ * \brief Return 8 bit expressing silence for a PCM sample format
+ * \param format Sample format
+ * \return silence 8 bit word
+ */
+u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
+{
+ assert(snd_pcm_format_physical_width(format) <= 8);
+ return (u_int8_t)snd_pcm_format_silence_64(format);
+}
+
+/**
+ * \brief Silence a PCM samples buffer
+ * \param format Sample format
+ * \param data Buffer
+ * \param samples Samples count
+ * \return 0 if successful or a negative error code
+ */
+int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int samples)
+{
+ if (samples == 0)
+ return 0;
+ switch (snd_pcm_format_physical_width(format)) {
+ case 4: {
+ u_int8_t silence = snd_pcm_format_silence_64(format);
+ unsigned int samples1;
+ if (samples % 2 != 0)
+ return -EINVAL;
+ samples1 = samples / 2;
+ memset(data, silence, samples1);
+ break;
+ }
+ case 8: {
+ u_int8_t silence = snd_pcm_format_silence_64(format);
+ memset(data, silence, samples);
+ break;
+ }
+ case 16: {
+ u_int16_t silence = snd_pcm_format_silence_64(format);
+ u_int16_t *pdata = (u_int16_t *)data;
+ if (! silence)
+ memset(data, 0, samples * 2);
+ else {
+ while (samples-- > 0)
+ *pdata++ = silence;
+ }
+ break;
+ }
+ case 24: {
+ u_int32_t silence = snd_pcm_format_silence_64(format);
+ u_int8_t *pdata = (u_int8_t *)data;
+ if (! silence)
+ memset(data, 0, samples * 3);
+ else {
+ while (samples-- > 0) {
+#ifdef SNDRV_LITTLE_ENDIAN
+ *pdata++ = silence >> 0;
+ *pdata++ = silence >> 8;
+ *pdata++ = silence >> 16;
+#else
+ *pdata++ = silence >> 16;
+ *pdata++ = silence >> 8;
+ *pdata++ = silence >> 0;
+#endif
+ }
+ }
+ break;
+ }
+ case 32: {
+ u_int32_t silence = snd_pcm_format_silence_64(format);
+ u_int32_t *pdata = (u_int32_t *)data;
+ if (! silence)
+ memset(data, 0, samples * 4);
+ else {
+ while (samples-- > 0)
+ *pdata++ = silence;
+ }
+ break;
+ }
+ case 64: {
+ u_int64_t silence = snd_pcm_format_silence_64(format);
+ u_int64_t *pdata = (u_int64_t *)data;
+ if (! silence)
+ memset(data, 0, samples * 8);
+ else {
+ while (samples-- > 0)
+ *pdata++ = silence;
+ }
+ break;
+ }
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static const int linear_formats[4][2][2] = {
+ { { SNDRV_PCM_FORMAT_S8, SNDRV_PCM_FORMAT_S8 },
+ { SNDRV_PCM_FORMAT_U8, SNDRV_PCM_FORMAT_U8 } },
+ { { SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_FORMAT_S16_BE },
+ { SNDRV_PCM_FORMAT_U16_LE, SNDRV_PCM_FORMAT_U16_BE } },
+ { { SNDRV_PCM_FORMAT_S24_LE, SNDRV_PCM_FORMAT_S24_BE },
+ { SNDRV_PCM_FORMAT_U24_LE, SNDRV_PCM_FORMAT_U24_BE } },
+ { { SNDRV_PCM_FORMAT_S32_LE, SNDRV_PCM_FORMAT_S32_BE },
+ { SNDRV_PCM_FORMAT_U32_LE, SNDRV_PCM_FORMAT_U32_BE } }
+};
+
+static const int linear24_formats[3][2][2] = {
+ { { SNDRV_PCM_FORMAT_S24_3LE, SNDRV_PCM_FORMAT_S24_3BE },
+ { SNDRV_PCM_FORMAT_U24_3LE, SNDRV_PCM_FORMAT_U24_3BE } },
+ { { SNDRV_PCM_FORMAT_S20_3LE, SNDRV_PCM_FORMAT_S20_3BE },
+ { SNDRV_PCM_FORMAT_U20_3LE, SNDRV_PCM_FORMAT_U20_3BE } },
+ { { SNDRV_PCM_FORMAT_S18_3LE, SNDRV_PCM_FORMAT_S18_3BE },
+ { SNDRV_PCM_FORMAT_U18_3LE, SNDRV_PCM_FORMAT_U18_3BE } },
+};
+
+/**
+ * \brief Compose a PCM sample linear format
+ * \param width Nominal bits per sample
+ * \param pwidth Physical bit width of the format
+ * \param unsignd Sign: 0 signed, 1 unsigned
+ * \param big_endian Endian: 0 little endian, 1 big endian
+ * \return The matching format type, or #SND_PCM_FORMAT_UNKNOWN if no match
+ */
+snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian)
+{
+ if (pwidth == 24) {
+ switch (width) {
+ case 24:
+ width = 0;
+ break;
+ case 20:
+ width = 1;
+ break;
+ case 18:
+ width = 2;
+ break;
+ default:
+ return SND_PCM_FORMAT_UNKNOWN;
+ }
+ return linear24_formats[width][!!unsignd][!!big_endian];
+ } else {
+ switch (width) {
+ case 8:
+ width = 0;
+ break;
+ case 16:
+ width = 1;
+ break;
+ case 24:
+ width = 2;
+ break;
+ case 32:
+ width = 3;
+ break;
+ default:
+ return SND_PCM_FORMAT_UNKNOWN;
+ }
+ return linear_formats[width][!!unsignd][!!big_endian];
+ }
+}
+
+/**
+ * \brief Parse control element id from the config
+ * \param conf the config tree to parse
+ * \param ctl_id the pointer to store the resultant control element id
+ * \param cardp the pointer to store the card index
+ * \param cchannelsp the pointer to store the number of channels (optional)
+ * \param hwctlp the pointer to store the h/w control flag (optional)
+ * \return 0 if successful, or a negative error code
+ *
+ * This function parses the given config tree to retrieve the control element id
+ * and the card index. It's used by softvol. External PCM plugins can use this
+ * function for creating or assigining their controls.
+ *
+ * cchannelsp and hwctlp arguments are optional. Set NULL if not necessary.
+ */
+int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
+ int *cchannelsp, int *hwctlp)
+{
+ snd_config_iterator_t i, next;
+ int iface = SND_CTL_ELEM_IFACE_MIXER;
+ const char *name = NULL;
+ long index = 0;
+ long device = -1;
+ long subdevice = -1;
+ int err;
+
+ assert(ctl_id && cardp);
+
+ *cardp = -1;
+ if (cchannelsp)
+ *cchannelsp = 2;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "card") == 0) {
+ const char *str;
+ long v;
+ if ((err = snd_config_get_integer(n, &v)) < 0) {
+ if ((err = snd_config_get_string(n, &str)) < 0) {
+ SNDERR("Invalid field %s", id);
+ goto _err;
+ }
+ *cardp = snd_card_get_index(str);
+ if (*cardp < 0) {
+ SNDERR("Cannot get index for %s", str);
+ err = *cardp;
+ goto _err;
+ }
+ } else
+ *cardp = v;
+ continue;
+ }
+ if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
+ const char *ptr;
+ if ((err = snd_config_get_string(n, &ptr)) < 0) {
+ SNDERR("field %s is not a string", id);
+ goto _err;
+ }
+ if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
+ SNDERR("Invalid value for '%s'", id);
+ goto _err;
+ }
+ iface = err;
+ continue;
+ }
+ if (strcmp(id, "name") == 0) {
+ if ((err = snd_config_get_string(n, &name)) < 0) {
+ SNDERR("field %s is not a string", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "index") == 0) {
+ if ((err = snd_config_get_integer(n, &index)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ if ((err = snd_config_get_integer(n, &device)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (cchannelsp && strcmp(id, "count") == 0) {
+ long v;
+ if ((err = snd_config_get_integer(n, &v)) < 0) {
+ SNDERR("field %s is not an integer", id);
+ goto _err;
+ }
+ if (v < 1 || v > 2) {
+ SNDERR("Invalid count %ld", v);
+ goto _err;
+ }
+ *cchannelsp = v;
+ continue;
+ }
+ if (hwctlp && strcmp(id, "hwctl") == 0) {
+ if ((err = snd_config_get_bool(n)) < 0) {
+ SNDERR("The field %s must be a boolean type", id);
+ return err;
+ }
+ *hwctlp = err;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (name == NULL) {
+ SNDERR("Missing control name");
+ err = -EINVAL;
+ goto _err;
+ }
+ if (device < 0)
+ device = 0;
+ if (subdevice < 0)
+ subdevice = 0;
+
+ snd_ctl_elem_id_set_interface(ctl_id, iface);
+ snd_ctl_elem_id_set_name(ctl_id, name);
+ snd_ctl_elem_id_set_index(ctl_id, index);
+ snd_ctl_elem_id_set_device(ctl_id, device);
+ snd_ctl_elem_id_set_subdevice(ctl_id, subdevice);
+
+ return 0;
+
+ _err:
+ return err;
+}
diff --git a/alsa-lib/src/pcm/pcm_mmap.c b/alsa-lib/src/pcm/pcm_mmap.c
new file mode 100644
index 0000000..4b7a353
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_mmap.c
@@ -0,0 +1,639 @@
+/*
+ * PCM Interface - mmap
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+#include <sys/poll.h>
+#include <sys/mman.h>
+#ifndef ANDROID
+#include <sys/shm.h>
+#endif
+#include "pcm_local.h"
+
+size_t page_size(void)
+{
+ long s = sysconf(_SC_PAGE_SIZE);
+ assert(s > 0);
+ return s;
+}
+
+size_t page_align(size_t size)
+{
+ size_t r;
+ long psz = page_size();
+ r = size % psz;
+ if (r)
+ return size + psz - r;
+ return size;
+}
+
+size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t *mmap_offset)
+{
+ size_t r;
+ long psz = page_size();
+ assert(offset);
+ assert(mmap_offset);
+ *mmap_offset = object_offset;
+ object_offset %= psz;
+ *mmap_offset -= object_offset;
+ object_size += object_offset;
+ r = object_size % psz;
+ if (r)
+ r = object_size + psz - r;
+ else
+ r = object_size;
+ *offset = object_offset;
+ return r;
+}
+
+void snd_pcm_mmap_appl_backward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t appl_ptr = *pcm->appl.ptr;
+ appl_ptr -= frames;
+ if (appl_ptr < 0)
+ appl_ptr += pcm->boundary;
+ *pcm->appl.ptr = appl_ptr;
+}
+
+void snd_pcm_mmap_appl_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_uframes_t appl_ptr = *pcm->appl.ptr;
+ appl_ptr += frames;
+ if (appl_ptr >= pcm->boundary)
+ appl_ptr -= pcm->boundary;
+ *pcm->appl.ptr = appl_ptr;
+}
+
+void snd_pcm_mmap_hw_backward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_sframes_t hw_ptr = *pcm->hw.ptr;
+ hw_ptr -= frames;
+ if (hw_ptr < 0)
+ hw_ptr += pcm->boundary;
+ *pcm->hw.ptr = hw_ptr;
+}
+
+void snd_pcm_mmap_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_uframes_t hw_ptr = *pcm->hw.ptr;
+ hw_ptr += frames;
+ if (hw_ptr >= pcm->boundary)
+ hw_ptr -= pcm->boundary;
+ *pcm->hw.ptr = hw_ptr;
+}
+
+static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_uframes_t xfer = 0;
+
+ if (snd_pcm_mmap_playback_avail(pcm) < size) {
+ SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
+ return -EPIPE;
+ }
+ while (size > 0) {
+ const snd_pcm_channel_area_t *pcm_areas;
+ snd_pcm_uframes_t pcm_offset;
+ snd_pcm_uframes_t frames = size;
+ snd_pcm_sframes_t result;
+
+ snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
+ snd_pcm_areas_copy(pcm_areas, pcm_offset,
+ areas, offset,
+ pcm->channels,
+ frames, pcm->format);
+ result = snd_pcm_mmap_commit(pcm, pcm_offset, frames);
+ if (result < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ offset += result;
+ xfer += result;
+ size -= result;
+ }
+ return (snd_pcm_sframes_t)xfer;
+}
+
+static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_uframes_t xfer = 0;
+
+ if (snd_pcm_mmap_capture_avail(pcm) < size) {
+ SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
+ return -EPIPE;
+ }
+ while (size > 0) {
+ const snd_pcm_channel_area_t *pcm_areas;
+ snd_pcm_uframes_t pcm_offset;
+ snd_pcm_uframes_t frames = size;
+ snd_pcm_sframes_t result;
+
+ snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
+ snd_pcm_areas_copy(areas, offset,
+ pcm_areas, pcm_offset,
+ pcm->channels,
+ frames, pcm->format);
+ result = snd_pcm_mmap_commit(pcm, pcm_offset, frames);
+ if (result < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ offset += result;
+ xfer += result;
+ size -= result;
+ }
+ return (snd_pcm_sframes_t)xfer;
+}
+
+/**
+ * \brief Write interleaved frames to a PCM using direct buffer (mmap)
+ * \param pcm PCM handle
+ * \param buffer frames containing buffer
+ * \param size frames to be written
+ * \return a positive number of frames actually written otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an underrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour is selected, then routine waits until
+ * all requested bytes are played or put to the playback ring buffer.
+ * The count of bytes can be less only if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ snd_pcm_mmap_write_areas);
+}
+
+/**
+ * \brief Write non interleaved frames to a PCM using direct buffer (mmap)
+ * \param pcm PCM handle
+ * \param bufs frames containing buffers (one for each channel)
+ * \param size frames to be written
+ * \return a positive number of frames actually written otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an underrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour is selected, then routine waits until
+ * all requested bytes are played or put to the playback ring buffer.
+ * The count of bytes can be less only if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ snd_pcm_mmap_write_areas);
+}
+
+/**
+ * \brief Read interleaved frames from a PCM using direct buffer (mmap)
+ * \param pcm PCM handle
+ * \param buffer frames containing buffer
+ * \param size frames to be written
+ * \return a positive number of frames actually read otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an overrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour was selected, then routine waits until
+ * all requested bytes are filled. The count of bytes can be less only
+ * if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, buffer);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ snd_pcm_mmap_read_areas);
+}
+
+/**
+ * \brief Read non interleaved frames to a PCM using direct buffer (mmap)
+ * \param pcm PCM handle
+ * \param bufs frames containing buffers (one for each channel)
+ * \param size frames to be written
+ * \return a positive number of frames actually read otherwise a
+ * negative error code
+ * \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
+ * \retval -EPIPE an overrun occurred
+ * \retval -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
+ *
+ * If the blocking behaviour was selected, then routine waits until
+ * all requested bytes are filled. The count of bytes can be less only
+ * if a signal or underrun occurred.
+ *
+ * If the non-blocking behaviour is selected, then routine doesn't wait at all.
+ */
+snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ snd_pcm_mmap_read_areas);
+}
+
+int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int shmid)
+{
+ switch (pcm->access) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ case SND_PCM_ACCESS_RW_INTERLEAVED:
+ info->first = info->channel * pcm->sample_bits;
+ info->step = pcm->frame_bits;
+ break;
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ case SND_PCM_ACCESS_RW_NONINTERLEAVED:
+ info->first = 0;
+ info->step = pcm->sample_bits;
+ break;
+ default:
+ SNDMSG("invalid access type %d", pcm->access);
+ return -EINVAL;
+ }
+ info->addr = 0;
+ if (pcm->hw_flags & SND_PCM_HW_PARAMS_EXPORT_BUFFER) {
+ info->type = SND_PCM_AREA_SHM;
+ info->u.shm.shmid = shmid;
+ info->u.shm.area = NULL;
+ } else
+ info->type = SND_PCM_AREA_LOCAL;
+ return 0;
+}
+
+int snd_pcm_mmap(snd_pcm_t *pcm)
+{
+ int err;
+ unsigned int c;
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ if (CHECK_SANITY(pcm->mmap_channels || pcm->running_areas)) {
+ SNDMSG("Already mmapped");
+ return -EBUSY;
+ }
+ err = pcm->ops->mmap(pcm);
+ if (err < 0)
+ return err;
+ if (pcm->mmap_shadow)
+ return 0;
+ pcm->mmap_channels = calloc(pcm->channels, sizeof(pcm->mmap_channels[0]));
+ if (!pcm->mmap_channels)
+ return -ENOMEM;
+ pcm->running_areas = calloc(pcm->channels, sizeof(pcm->running_areas[0]));
+ if (!pcm->running_areas) {
+ free(pcm->mmap_channels);
+ pcm->mmap_channels = NULL;
+ return -ENOMEM;
+ }
+ for (c = 0; c < pcm->channels; ++c) {
+ snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
+ i->channel = c;
+ err = snd_pcm_channel_info(pcm, i);
+ if (err < 0)
+ return err;
+ }
+ for (c = 0; c < pcm->channels; ++c) {
+ snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
+ snd_pcm_channel_area_t *a = &pcm->running_areas[c];
+ char *ptr;
+ size_t size;
+ unsigned int c1;
+ if (i->addr) {
+ a->addr = i->addr;
+ a->first = i->first;
+ a->step = i->step;
+ continue;
+ }
+ size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
+ for (c1 = c + 1; c1 < pcm->channels; ++c1) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ size_t s;
+ if (i1->type != i->type)
+ continue;
+ switch (i1->type) {
+ case SND_PCM_AREA_MMAP:
+ if (i1->u.mmap.fd != i->u.mmap.fd ||
+ i1->u.mmap.offset != i->u.mmap.offset)
+ continue;
+ break;
+ case SND_PCM_AREA_SHM:
+ if (i1->u.shm.shmid != i->u.shm.shmid)
+ continue;
+ break;
+ case SND_PCM_AREA_LOCAL:
+ break;
+ default:
+ assert(0);
+ }
+ s = i1->first + i1->step * (pcm->buffer_size - 1) + pcm->sample_bits;
+ if (s > size)
+ size = s;
+ }
+ size = (size + 7) / 8;
+ size = page_align(size);
+ switch (i->type) {
+ case SND_PCM_AREA_MMAP:
+ ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, i->u.mmap.fd, i->u.mmap.offset);
+ if (ptr == MAP_FAILED) {
+ SYSERR("mmap failed");
+ return -errno;
+ }
+ i->addr = ptr;
+ break;
+#ifndef ANDROID
+ case SND_PCM_AREA_SHM:
+ if (i->u.shm.shmid < 0) {
+ int id;
+ /* FIXME: safer permission? */
+ id = shmget(IPC_PRIVATE, size, 0666);
+ if (id < 0) {
+ SYSERR("shmget failed");
+ return -errno;
+ }
+ i->u.shm.shmid = id;
+ ptr = shmat(i->u.shm.shmid, 0, 0);
+ if (ptr == (void *) -1) {
+ SYSERR("shmat failed");
+ return -errno;
+ }
+ /* automatically remove segment if not used */
+ if (shmctl(id, IPC_RMID, NULL) < 0){
+ SYSERR("shmctl mark remove failed");
+ return -errno;
+ }
+ i->u.shm.area = snd_shm_area_create(id, ptr);
+ if (i->u.shm.area == NULL) {
+ SYSERR("snd_shm_area_create failed");
+ return -ENOMEM;
+ }
+ if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
+ pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED) {
+ unsigned int c1;
+ for (c1 = c + 1; c1 < pcm->channels; c1++) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ if (i1->u.shm.shmid < 0) {
+ i1->u.shm.shmid = id;
+ i1->u.shm.area = snd_shm_area_share(i->u.shm.area);
+ }
+ }
+ }
+ } else {
+ ptr = shmat(i->u.shm.shmid, 0, 0);
+ if (ptr == (void*) -1) {
+ SYSERR("shmat failed");
+ return -errno;
+ }
+ }
+ i->addr = ptr;
+ break;
+#endif
+ case SND_PCM_AREA_LOCAL:
+ ptr = malloc(size);
+ if (ptr == NULL) {
+ SYSERR("malloc failed");
+ return -errno;
+ }
+ i->addr = ptr;
+ break;
+ default:
+ assert(0);
+ }
+ for (c1 = c + 1; c1 < pcm->channels; ++c1) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ if (i1->type != i->type)
+ continue;
+ switch (i1->type) {
+ case SND_PCM_AREA_MMAP:
+ if (i1->u.mmap.fd != i->u.mmap.fd ||
+ i1->u.mmap.offset != i->u.mmap.offset)
+ continue;
+ break;
+ case SND_PCM_AREA_SHM:
+ if (i1->u.shm.shmid != i->u.shm.shmid)
+ continue;
+ /* follow thru */
+ case SND_PCM_AREA_LOCAL:
+ if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED &&
+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED)
+ continue;
+ break;
+ default:
+ assert(0);
+ }
+ i1->addr = i->addr;
+ }
+ a->addr = i->addr;
+ a->first = i->first;
+ a->step = i->step;
+ }
+ return 0;
+}
+
+int snd_pcm_munmap(snd_pcm_t *pcm)
+{
+ int err;
+ unsigned int c;
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->mmap_channels)) {
+ SNDMSG("Not mmapped");
+ return -ENXIO;
+ }
+ if (pcm->mmap_shadow)
+ return pcm->ops->munmap(pcm);
+ for (c = 0; c < pcm->channels; ++c) {
+ snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
+ unsigned int c1;
+ size_t size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
+ if (!i->addr)
+ continue;
+ for (c1 = c + 1; c1 < pcm->channels; ++c1) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ size_t s;
+ if (i1->addr != i->addr)
+ continue;
+ i1->addr = NULL;
+ s = i1->first + i1->step * (pcm->buffer_size - 1) + pcm->sample_bits;
+ if (s > size)
+ size = s;
+ }
+ size = (size + 7) / 8;
+ size = page_align(size);
+ switch (i->type) {
+ case SND_PCM_AREA_MMAP:
+ err = munmap(i->addr, size);
+ if (err < 0) {
+ SYSERR("mmap failed");
+ return -errno;
+ }
+ errno = 0;
+ break;
+#ifndef ANDROID
+ case SND_PCM_AREA_SHM:
+ if (i->u.shm.area) {
+ snd_shm_area_destroy(i->u.shm.area);
+ i->u.shm.area = NULL;
+ if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
+ pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED) {
+ unsigned int c1;
+ for (c1 = c + 1; c1 < pcm->channels; c1++) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ if (i1->u.shm.area) {
+ snd_shm_area_destroy(i1->u.shm.area);
+ i1->u.shm.area = NULL;
+ }
+ }
+ }
+ }
+ break;
+#endif
+ case SND_PCM_AREA_LOCAL:
+ free(i->addr);
+ break;
+ default:
+ assert(0);
+ }
+ i->addr = NULL;
+ }
+ err = pcm->ops->munmap(pcm);
+ if (err < 0)
+ return err;
+ free(pcm->mmap_channels);
+ free(pcm->running_areas);
+ pcm->mmap_channels = NULL;
+ pcm->running_areas = NULL;
+ return 0;
+}
+
+snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t err = 0;
+ if (! size)
+ return 0;
+ while (xfer < size) {
+ snd_pcm_uframes_t frames = size - xfer;
+ snd_pcm_uframes_t cont = pcm->buffer_size - offset;
+ if (cont < frames)
+ frames = cont;
+ switch (pcm->access) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ {
+ const snd_pcm_channel_area_t *a = snd_pcm_mmap_areas(pcm);
+ const char *buf = snd_pcm_channel_area_addr(a, offset);
+ err = _snd_pcm_writei(pcm, buf, frames);
+ if (err >= 0)
+ frames = err;
+ break;
+ }
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ {
+ unsigned int channels = pcm->channels;
+ unsigned int c;
+ void *bufs[channels];
+ const snd_pcm_channel_area_t *areas = snd_pcm_mmap_areas(pcm);
+ for (c = 0; c < channels; ++c) {
+ const snd_pcm_channel_area_t *a = &areas[c];
+ bufs[c] = snd_pcm_channel_area_addr(a, offset);
+ }
+ err = _snd_pcm_writen(pcm, bufs, frames);
+ if (err >= 0)
+ frames = err;
+ break;
+ }
+ default:
+ SNDMSG("invalid access type %d", pcm->access);
+ return -EINVAL;
+ }
+ if (err < 0)
+ break;
+ xfer += frames;
+ offset = (offset + frames) % pcm->buffer_size;
+ }
+ if (xfer > 0)
+ return xfer;
+ return err;
+}
+
+snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t err = 0;
+ if (! size)
+ return 0;
+ while (xfer < size) {
+ snd_pcm_uframes_t frames = size - xfer;
+ snd_pcm_uframes_t cont = pcm->buffer_size - offset;
+ if (cont < frames)
+ frames = cont;
+ switch (pcm->access) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ {
+ const snd_pcm_channel_area_t *a = snd_pcm_mmap_areas(pcm);
+ char *buf = snd_pcm_channel_area_addr(a, offset);
+ err = _snd_pcm_readi(pcm, buf, frames);
+ if (err >= 0)
+ frames = err;
+ break;
+ }
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ {
+ snd_pcm_uframes_t channels = pcm->channels;
+ unsigned int c;
+ void *bufs[channels];
+ const snd_pcm_channel_area_t *areas = snd_pcm_mmap_areas(pcm);
+ for (c = 0; c < channels; ++c) {
+ const snd_pcm_channel_area_t *a = &areas[c];
+ bufs[c] = snd_pcm_channel_area_addr(a, offset);
+ }
+ err = _snd_pcm_readn(pcm->fast_op_arg, bufs, frames);
+ if (err >= 0)
+ frames = err;
+ }
+ default:
+ SNDMSG("invalid access type %d", pcm->access);
+ return -EINVAL;
+ }
+ if (err < 0)
+ break;
+ xfer += frames;
+ offset = (offset + frames) % pcm->buffer_size;
+ }
+ if (xfer > 0)
+ return xfer;
+ return err;
+}
diff --git a/alsa-lib/src/pcm/pcm_mmap_emul.c b/alsa-lib/src/pcm/pcm_mmap_emul.c
new file mode 100644
index 0000000..0dc1973
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_mmap_emul.c
@@ -0,0 +1,486 @@
+/**
+ * \file pcm/pcm_mmap_emul.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Mmap-Emulation Plugin Interface
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2007
+ */
+/*
+ * PCM - Mmap-Emulation
+ * Copyright (c) 2007 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_generic.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_mmap_emul = "";
+#endif
+
+/*
+ *
+ */
+
+typedef struct {
+ snd_pcm_generic_t gen;
+ unsigned int mmap_emul :1;
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_uframes_t appl_ptr;
+} mmap_emul_t;
+
+/*
+ * here goes a really tricky part; hw_refine falls back to ACCESS_RW_* type
+ * when ACCESS_MMAP_* isn't supported by the hardware.
+ */
+static int snd_pcm_mmap_emul_hw_refine(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ mmap_emul_t *map = pcm->private_data;
+ int err = 0;
+ snd_pcm_access_mask_t oldmask =
+ *snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ snd_pcm_access_mask_t mask;
+ const snd_mask_t *pmask;
+
+ snd_mask_none(&mask);
+ err = snd_pcm_hw_refine(map->gen.slave, params);
+ if (err < 0) {
+ snd_pcm_hw_params_t new = *params;
+
+ /* try to use RW_* */
+ if (snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_MMAP_INTERLEAVED) &&
+ !snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_RW_INTERLEAVED))
+ snd_pcm_access_mask_set(&mask,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED) &&
+ !snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED))
+ snd_pcm_access_mask_set(&mask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ if (snd_pcm_access_mask_empty(&mask))
+ return err;
+ pmask = snd_pcm_hw_param_get_mask(&new,
+ SND_PCM_HW_PARAM_ACCESS);
+ *(snd_mask_t *)pmask = mask;
+ err = snd_pcm_hw_refine(map->gen.slave, &new);
+ if (err < 0)
+ return err;
+ *params = new;
+ }
+
+ pmask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ if (snd_pcm_access_mask_test(pmask, SND_PCM_ACCESS_MMAP_INTERLEAVED) ||
+ snd_pcm_access_mask_test(pmask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED) ||
+ snd_pcm_access_mask_test(pmask, SND_PCM_ACCESS_MMAP_COMPLEX))
+ return 0;
+ if (snd_pcm_access_mask_test(&mask, SND_PCM_ACCESS_RW_INTERLEAVED)) {
+ if (snd_pcm_access_mask_test(pmask,
+ SND_PCM_ACCESS_RW_INTERLEAVED))
+ snd_pcm_access_mask_set((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ snd_pcm_access_mask_reset((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ params->cmask |= 1<<SND_PCM_HW_PARAM_ACCESS;
+ }
+ if (snd_pcm_access_mask_test(&mask, SND_PCM_ACCESS_RW_NONINTERLEAVED)) {
+ if (snd_pcm_access_mask_test(pmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED))
+ snd_pcm_access_mask_set((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ snd_pcm_access_mask_reset((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ params->cmask |= 1<<SND_PCM_HW_PARAM_ACCESS;
+ }
+ if (snd_pcm_access_mask_test(&oldmask, SND_PCM_ACCESS_MMAP_INTERLEAVED)) {
+ if (snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_RW_INTERLEAVED)) {
+ if (snd_pcm_access_mask_test(pmask,
+ SND_PCM_ACCESS_RW_INTERLEAVED)) {
+ snd_pcm_access_mask_set((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ params->cmask |= 1<<SND_PCM_HW_PARAM_ACCESS;
+ }
+ }
+ }
+ if (snd_pcm_access_mask_test(&oldmask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) {
+ if (snd_pcm_access_mask_test(&oldmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED)) {
+ if (snd_pcm_access_mask_test(pmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED)) {
+ snd_pcm_access_mask_set((snd_pcm_access_mask_t *)pmask,
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ params->cmask |= 1<<SND_PCM_HW_PARAM_ACCESS;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ * hw_params needs a similar hack like hw_refine, but it's much simpler
+ * because now snd_pcm_hw_params_t takes only one choice for each item.
+ *
+ * Here, when the normal hw_params call fails, it turns on the mmap_emul
+ * flag and tries to use ACCESS_RW_* mode.
+ *
+ * In mmap_emul mode, the appl_ptr and hw_ptr are handled individually
+ * from the layering slave PCM, and they are sync'ed appropriately in
+ * each read/write or avail_update/commit call.
+ */
+static int snd_pcm_mmap_emul_hw_params(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ mmap_emul_t *map = pcm->private_data;
+ snd_pcm_hw_params_t old = *params;
+ snd_pcm_access_t access;
+ snd_pcm_access_mask_t oldmask;
+ snd_pcm_access_mask_t *pmask;
+ int err;
+
+ err = _snd_pcm_hw_params(map->gen.slave, params);
+ if (err >= 0) {
+ map->mmap_emul = 0;
+ return err;
+ }
+
+ *params = old;
+ pmask = (snd_pcm_access_mask_t *)snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ oldmask = *pmask;
+ if (INTERNAL(snd_pcm_hw_params_get_access)(params, &access) < 0)
+ goto _err;
+ switch (access) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ snd_pcm_access_mask_reset(pmask,
+ SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ snd_pcm_access_mask_set(pmask, SND_PCM_ACCESS_RW_INTERLEAVED);
+ break;
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ snd_pcm_access_mask_reset(pmask,
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ snd_pcm_access_mask_set(pmask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ break;
+ default:
+ goto _err;
+ }
+ err = _snd_pcm_hw_params(map->gen.slave, params);
+ if (err < 0)
+ goto _err;
+
+ /* need to back the access type to relieve apps */
+ *pmask = oldmask;
+
+ /* OK, we do fake */
+ map->mmap_emul = 1;
+ map->appl_ptr = 0;
+ map->hw_ptr = 0;
+ snd_pcm_set_hw_ptr(pcm, &map->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &map->appl_ptr, -1, 0);
+ return 0;
+
+ _err:
+ err = -errno;
+ return err;
+}
+
+static int snd_pcm_mmap_emul_prepare(snd_pcm_t *pcm)
+{
+ mmap_emul_t *map = pcm->private_data;
+ int err;
+
+ err = snd_pcm_generic_prepare(pcm);
+ if (err < 0)
+ return err;
+ map->hw_ptr = map->appl_ptr = 0;
+ return err;
+}
+
+static int snd_pcm_mmap_emul_reset(snd_pcm_t *pcm)
+{
+ mmap_emul_t *map = pcm->private_data;
+ int err;
+
+ err = snd_pcm_generic_reset(pcm);
+ if (err < 0)
+ return err;
+ map->hw_ptr = map->appl_ptr = 0;
+ return err;
+}
+
+static snd_pcm_sframes_t
+snd_pcm_mmap_emul_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ frames = snd_pcm_generic_rewind(pcm, frames);
+ if (frames > 0)
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ return frames;
+}
+
+static snd_pcm_sframes_t
+snd_pcm_mmap_emul_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ frames = snd_pcm_generic_forward(pcm, frames);
+ if (frames > 0)
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+}
+
+/* write out the uncommitted chunk on mmap buffer to the slave PCM */
+static snd_pcm_sframes_t
+sync_slave_write(snd_pcm_t *pcm)
+{
+ mmap_emul_t *map = pcm->private_data;
+ snd_pcm_t *slave = map->gen.slave;
+ snd_pcm_uframes_t offset;
+ snd_pcm_sframes_t size;
+
+ size = map->appl_ptr - *slave->appl.ptr;
+ if (size < 0)
+ size += pcm->boundary;
+ if (!size)
+ return 0;
+ offset = *slave->appl.ptr % pcm->buffer_size;
+ return snd_pcm_write_mmap(pcm, offset, size);
+}
+
+/* read the available chunk on the slave PCM to mmap buffer */
+static snd_pcm_sframes_t
+sync_slave_read(snd_pcm_t *pcm)
+{
+ mmap_emul_t *map = pcm->private_data;
+ snd_pcm_t *slave = map->gen.slave;
+ snd_pcm_uframes_t offset;
+ snd_pcm_sframes_t size;
+
+ size = *slave->hw.ptr - map->hw_ptr;
+ if (size < 0)
+ size += pcm->boundary;
+ if (!size)
+ return 0;
+ offset = map->hw_ptr % pcm->buffer_size;
+ size = snd_pcm_read_mmap(pcm, offset, size);
+ if (size > 0)
+ snd_pcm_mmap_hw_forward(pcm, size);
+ return 0;
+}
+
+static snd_pcm_sframes_t
+snd_pcm_mmap_emul_mmap_commit(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ mmap_emul_t *map = pcm->private_data;
+ snd_pcm_t *slave = map->gen.slave;
+
+ if (!map->mmap_emul)
+ return snd_pcm_mmap_commit(slave, offset, size);
+ snd_pcm_mmap_appl_forward(pcm, size);
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ sync_slave_write(pcm);
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_mmap_emul_avail_update(snd_pcm_t *pcm)
+{
+ mmap_emul_t *map = pcm->private_data;
+ snd_pcm_t *slave = map->gen.slave;
+ snd_pcm_sframes_t avail;
+
+ avail = snd_pcm_avail_update(slave);
+ if (!map->mmap_emul)
+ return avail;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ map->hw_ptr = *slave->hw.ptr;
+ else
+ sync_slave_read(pcm);
+ return snd_pcm_mmap_avail(pcm);
+}
+
+static void snd_pcm_mmap_emul_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ mmap_emul_t *map = pcm->private_data;
+
+ snd_output_printf(out, "Mmap emulation PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(map->gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_mmap_emul_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_mmap_emul_hw_refine,
+ .hw_params = snd_pcm_mmap_emul_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_mmap_emul_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_mmap_emul_fast_ops = {
+ .status = snd_pcm_generic_status,
+ .state = snd_pcm_generic_state,
+ .hwsync = snd_pcm_generic_hwsync,
+ .delay = snd_pcm_generic_delay,
+ .prepare = snd_pcm_mmap_emul_prepare,
+ .reset = snd_pcm_mmap_emul_reset,
+ .start = snd_pcm_generic_start,
+ .drop = snd_pcm_generic_drop,
+ .drain = snd_pcm_generic_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewindable = snd_pcm_generic_rewindable,
+ .rewind = snd_pcm_mmap_emul_rewind,
+ .forwardable = snd_pcm_generic_forwardable,
+ .forward = snd_pcm_mmap_emul_forward,
+ .resume = snd_pcm_generic_resume,
+ .link = snd_pcm_generic_link,
+ .link_slaves = snd_pcm_generic_link_slaves,
+ .unlink = snd_pcm_generic_unlink,
+ .writei = snd_pcm_generic_writei,
+ .writen = snd_pcm_generic_writen,
+ .readi = snd_pcm_generic_readi,
+ .readn = snd_pcm_generic_readn,
+ .avail_update = snd_pcm_mmap_emul_avail_update,
+ .mmap_commit = snd_pcm_mmap_emul_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_revents = snd_pcm_generic_poll_revents,
+};
+
+#ifndef DOC_HIDDEN
+int __snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ mmap_emul_t *map;
+ int err;
+
+ map = calloc(1, sizeof(*map));
+ if (!map)
+ return -ENOMEM;
+ map->gen.slave = slave;
+ map->gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_MMAP_EMUL, name,
+ slave->stream, slave->mode);
+ if (err < 0) {
+ free(map);
+ return err;
+ }
+ pcm->ops = &snd_pcm_mmap_emul_ops;
+ pcm->fast_ops = &snd_pcm_mmap_emul_fast_ops;
+ pcm->private_data = map;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &map->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &map->appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+#endif
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_mmap_emul Plugin: mmap_emul
+
+\code
+pcm.name {
+ type mmap_emul
+ slave PCM
+}
+\endcode
+
+\subsection pcm_plugins_mmap_emul_funcref Function reference
+
+<UL>
+ <LI>_snd_pcm_hw_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new mmap_emul PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with hw PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = __snd_pcm_mmap_emul_open(pcmp, name, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_mmap_emul_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_mulaw.c b/alsa-lib/src/pcm/pcm_mulaw.c
new file mode 100644
index 0000000..22e7d96
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_mulaw.c
@@ -0,0 +1,568 @@
+/**
+ * \file pcm/pcm_mulaw.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Mu-Law Conversion Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Mu-Law conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_mulaw = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef void (*mulaw_f)(const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx);
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ unsigned int getput_idx;
+ mulaw_f func;
+ snd_pcm_format_t sformat;
+} snd_pcm_mulaw_t;
+
+#endif
+
+static inline int val_seg(int val)
+{
+ int r = 0;
+ val >>= 7;
+ if (val & 0xf0) {
+ val >>= 4;
+ r += 4;
+ }
+ if (val & 0x0c) {
+ val >>= 2;
+ r += 2;
+ }
+ if (val & 0x02)
+ r += 1;
+ return r;
+}
+
+/*
+ * s16_to_ulaw() - Convert a linear PCM value to u-law
+ *
+ * In order to simplify the encoding process, the original linear magnitude
+ * is biased by adding 33 which shifts the encoding range from (0 - 8158) to
+ * (33 - 8191). The result can be seen in the following encoding table:
+ *
+ * Biased Linear Input Code Compressed Code
+ * ------------------------ ---------------
+ * 00000001wxyza 000wxyz
+ * 0000001wxyzab 001wxyz
+ * 000001wxyzabc 010wxyz
+ * 00001wxyzabcd 011wxyz
+ * 0001wxyzabcde 100wxyz
+ * 001wxyzabcdef 101wxyz
+ * 01wxyzabcdefg 110wxyz
+ * 1wxyzabcdefgh 111wxyz
+ *
+ * Each biased linear code has a leading 1 which identifies the segment
+ * number. The value of the segment number is equal to 7 minus the number
+ * of leading 0's. The quantization interval is directly available as the
+ * four bits wxyz. * The trailing bits (a - h) are ignored.
+ *
+ * Ordinarily the complement of the resulting code word is used for
+ * transmission, and so the code word is complemented before it is returned.
+ *
+ * For further information see John C. Bellamy's Digital Telephony, 1982,
+ * John Wiley & Sons, pps 98-111 and 472-476.
+ */
+
+static unsigned char s16_to_ulaw(int pcm_val) /* 2's complement (16-bit range) */
+{
+ int mask;
+ int seg;
+ unsigned char uval;
+
+ if (pcm_val < 0) {
+ pcm_val = 0x84 - pcm_val;
+ mask = 0x7f;
+ } else {
+ pcm_val += 0x84;
+ mask = 0xff;
+ }
+ if (pcm_val > 0x7fff)
+ pcm_val = 0x7fff;
+
+ /* Convert the scaled magnitude to segment number. */
+ seg = val_seg(pcm_val);
+
+ /*
+ * Combine the sign, segment, quantization bits;
+ * and complement the code word.
+ */
+ uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0x0f);
+ return uval ^ mask;
+}
+
+/*
+ * ulaw_to_s16() - Convert a u-law value to 16-bit linear PCM
+ *
+ * First, a biased linear code is derived from the code word. An unbiased
+ * output can then be obtained by subtracting 33 from the biased code.
+ *
+ * Note that this function expects to be passed the complement of the
+ * original code word. This is in keeping with ISDN conventions.
+ */
+static int ulaw_to_s16(unsigned char u_val)
+{
+ int t;
+
+ /* Complement to obtain normal u-law value. */
+ u_val = ~u_val;
+
+ /*
+ * Extract and bias the quantization bits. Then
+ * shift up by the segment number and subtract out the bias.
+ */
+ t = ((u_val & 0x0f) << 3) + 0x84;
+ t <<= (u_val & 0x70) >> 4;
+
+ return ((u_val & 0x80) ? (0x84 - t) : (t - 0x84));
+}
+
+#ifndef DOC_HIDDEN
+
+void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx)
+{
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef PUT16_LABELS
+ void *put = put16_labels[putidx];
+ unsigned int channel;
+ for (channel = 0; channel < channels; ++channel) {
+ const unsigned char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ int16_t sample = ulaw_to_s16(*src);
+ goto *put;
+#define PUT16_END after
+#include "plugin_ops.h"
+#undef PUT16_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx)
+{
+#define GET16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+ void *get = get16_labels[getidx];
+ unsigned int channel;
+ int16_t sample = 0;
+ for (channel = 0; channel < channels; ++channel) {
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ snd_pcm_uframes_t frames1;
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ frames1 = frames;
+ while (frames1-- > 0) {
+ goto *get;
+#define GET16_END after
+#include "plugin_ops.h"
+#undef GET16_END
+ after:
+ *dst = s16_to_ulaw(sample);
+ src += src_step;
+ dst += dst_step;
+ }
+ }
+}
+
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_mulaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ if (mulaw->sformat == SND_PCM_FORMAT_MU_LAW) {
+ snd_pcm_format_mask_t format_mask= { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ } else {
+ err = _snd_pcm_hw_params_set_format(params,
+ SND_PCM_FORMAT_MU_LAW);
+ }
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_mulaw_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_params_set_format(sparams, mulaw->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ return 0;
+}
+
+static int snd_pcm_mulaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_mulaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_mulaw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_mulaw_hw_refine_cprepare,
+ snd_pcm_mulaw_hw_refine_cchange,
+ snd_pcm_mulaw_hw_refine_sprepare,
+ snd_pcm_mulaw_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_mulaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ snd_pcm_format_t format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_mulaw_hw_refine_cchange,
+ snd_pcm_mulaw_hw_refine_sprepare,
+ snd_pcm_mulaw_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
+ if (err < 0)
+ return err;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (mulaw->sformat == SND_PCM_FORMAT_MU_LAW) {
+ mulaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16);
+ mulaw->func = snd_pcm_mulaw_encode;
+ } else {
+ mulaw->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, mulaw->sformat);
+ mulaw->func = snd_pcm_mulaw_decode;
+ }
+ } else {
+ if (mulaw->sformat == SND_PCM_FORMAT_MU_LAW) {
+ mulaw->getput_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, format);
+ mulaw->func = snd_pcm_mulaw_decode;
+ } else {
+ mulaw->getput_idx = snd_pcm_linear_get_index(mulaw->sformat, SND_PCM_FORMAT_S16);
+ mulaw->func = snd_pcm_mulaw_encode;
+ }
+ }
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_mulaw_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ mulaw->func(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels, size,
+ mulaw->getput_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ mulaw->func(areas, offset,
+ slave_areas, slave_offset,
+ pcm->channels, size,
+ mulaw->getput_idx);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_mulaw_t *mulaw = pcm->private_data;
+ snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
+ snd_pcm_format_name(mulaw->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(mulaw->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_mulaw_ops = {
+ .close = snd_pcm_generic_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_mulaw_hw_refine,
+ .hw_params = snd_pcm_mulaw_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_mulaw_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new Mu-Law conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_mulaw_t *mulaw;
+ int err;
+ assert(pcmp && slave);
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_MU_LAW)
+ return -EINVAL;
+ mulaw = calloc(1, sizeof(snd_pcm_mulaw_t));
+ if (!mulaw) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&mulaw->plug);
+ mulaw->sformat = sformat;
+ mulaw->plug.read = snd_pcm_mulaw_read_areas;
+ mulaw->plug.write = snd_pcm_mulaw_write_areas;
+ mulaw->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ mulaw->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ mulaw->plug.gen.slave = slave;
+ mulaw->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_MULAW, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(mulaw);
+ return err;
+ }
+ pcm->ops = &snd_pcm_mulaw_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = mulaw;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &mulaw->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &mulaw->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_mulaw Plugin: Mu-Law
+
+This plugin converts Mu-Law samples to linear or linear to Mu-Law samples
+from master Mu-Law conversion PCM to given slave PCM. The channel count,
+format and rate must match for both of them.
+
+\code
+pcm.name {
+ type mulaw # Mu-Law conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ format STR # Slave format
+ }
+}
+\endcode
+
+\subsection pcm_plugins_mulaw_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_mulaw_open()
+ <LI>_snd_pcm_mulaw_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Mu-Law conversion PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with copy PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_MANDATORY, &sformat);
+ if (err < 0)
+ return err;
+ if (snd_pcm_format_linear(sformat) != 1 &&
+ sformat != SND_PCM_FORMAT_MU_LAW) {
+ snd_config_delete(sconf);
+ SNDERR("invalid slave format");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_multi.c b/alsa-lib/src/pcm/pcm_multi.c
new file mode 100644
index 0000000..68f2d68
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_multi.c
@@ -0,0 +1,1214 @@
+/**
+ * \file pcm/pcm_multi.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Multi Streams to One Conversion Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Multi
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <math.h>
+#include "pcm_local.h"
+#include "pcm_generic.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_multi = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef struct {
+ snd_pcm_t *pcm;
+ unsigned int channels_count;
+ int close_slave;
+ snd_pcm_t *linked;
+} snd_pcm_multi_slave_t;
+
+typedef struct {
+ int slave_idx;
+ unsigned int slave_channel;
+} snd_pcm_multi_channel_t;
+
+typedef struct {
+ unsigned int slaves_count;
+ unsigned int master_slave;
+ snd_pcm_multi_slave_t *slaves;
+ unsigned int channels_count;
+ snd_pcm_multi_channel_t *channels;
+} snd_pcm_multi_t;
+
+#endif
+
+static int snd_pcm_multi_close(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ int ret = 0;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_multi_slave_t *slave = &multi->slaves[i];
+ if (slave->close_slave) {
+ int err = snd_pcm_close(slave->pcm);
+ if (err < 0)
+ ret = err;
+ }
+ }
+ free(multi->slaves);
+ free(multi->channels);
+ free(multi);
+ return ret;
+}
+
+static int snd_pcm_multi_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_multi_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_async(slave_0, sig, pid);
+}
+
+static int snd_pcm_multi_poll_descriptors_count(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_poll_descriptors_count(slave_0);
+}
+
+static int snd_pcm_multi_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave;
+ snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm;
+ int err;
+ unsigned int i;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ slave = multi->slaves[i].pcm;
+ if (slave == slave_0)
+ continue;
+ err = snd_pcm_poll_descriptors(slave, pfds, space);
+ if (err < 0)
+ return err;
+ }
+ /* finally overwrite with master's pfds */
+ return snd_pcm_poll_descriptors(slave_0, pfds, space);
+}
+
+static int snd_pcm_multi_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_poll_descriptors_revents(slave_0, pfds, nfds, revents);
+}
+
+static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err, n;
+ assert(info->subdevice < multi->slaves_count);
+ n = info->subdevice;
+ info->subdevice = 0;
+ err = snd_pcm_info(multi->slaves[n].pcm, info);
+ if (err < 0)
+ return err;
+ info->subdevices_count = multi->slaves_count;
+ return 0;
+}
+
+static int snd_pcm_multi_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_access_mask_t access_mask;
+ int err;
+ snd_pcm_access_mask_any(&access_mask);
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS,
+ multi->channels_count, 0);
+ if (err < 0)
+ return err;
+ params->info = ~0U;
+ return 0;
+}
+
+static int snd_pcm_multi_hw_refine_sprepare(snd_pcm_t *pcm, unsigned int slave_idx,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_multi_slave_t *slave = &multi->slaves[slave_idx];
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS,
+ slave->channels_count, 0);
+ return 0;
+}
+
+static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ unsigned int slave_idx ATTRIBUTE_UNUSED,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ const snd_pcm_access_mask_t *access_mask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ if (!snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
+ !snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED) &&
+ !snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) {
+ snd_pcm_access_mask_t saccess_mask;
+ snd_pcm_access_mask_any(&saccess_mask);
+ snd_pcm_access_mask_reset(&saccess_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ err = _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ if (err < 0)
+ return err;
+ }
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ unsigned int slave_idx ATTRIBUTE_UNUSED,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ snd_pcm_access_mask_t access_mask;
+ const snd_pcm_access_mask_t *saccess_mask = snd_pcm_hw_param_get_mask(sparams, SND_PCM_HW_PARAM_ACCESS);
+ snd_pcm_access_mask_any(&access_mask);
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ if (!snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED))
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ if (!snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_COMPLEX) &&
+ !snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED))
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_COMPLEX);
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ params->info &= sparams->info;
+ return 0;
+}
+
+static int snd_pcm_multi_hw_refine_slave(snd_pcm_t *pcm,
+ unsigned int slave_idx,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[slave_idx].pcm;
+ return snd_pcm_hw_refine(slave, sparams);
+}
+
+static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int k;
+ snd_pcm_hw_params_t sparams[multi->slaves_count];
+ int err;
+ unsigned int cmask, changed;
+ err = snd_pcm_multi_hw_refine_cprepare(pcm, params);
+ if (err < 0)
+ return err;
+ for (k = 0; k < multi->slaves_count; ++k) {
+ err = snd_pcm_multi_hw_refine_sprepare(pcm, k, &sparams[k]);
+ if (err < 0) {
+ SNDERR("Slave PCM #%d not usable", k);
+ return err;
+ }
+ }
+ do {
+ cmask = params->cmask;
+ params->cmask = 0;
+ for (k = 0; k < multi->slaves_count; ++k) {
+ err = snd_pcm_multi_hw_refine_schange(pcm, k, params, &sparams[k]);
+ if (err >= 0)
+ err = snd_pcm_multi_hw_refine_slave(pcm, k, &sparams[k]);
+ if (err < 0) {
+ snd_pcm_multi_hw_refine_cchange(pcm, k, params, &sparams[k]);
+ return err;
+ }
+ err = snd_pcm_multi_hw_refine_cchange(pcm, k, params, &sparams[k]);
+ if (err < 0)
+ return err;
+ }
+ err = snd_pcm_hw_refine_soft(pcm, params);
+ changed = params->cmask;
+ params->cmask |= cmask;
+ if (err < 0)
+ return err;
+ } while (changed);
+ return 0;
+}
+
+static int snd_pcm_multi_hw_params_slave(snd_pcm_t *pcm,
+ unsigned int slave_idx,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[slave_idx].pcm;
+ int err = snd_pcm_hw_params(slave, sparams);
+ if (err < 0)
+ return err;
+ err = snd_pcm_areas_silence(slave->running_areas, 0, slave->channels, slave->buffer_size, slave->format);
+ if (err < 0)
+ return err;
+ if (slave->stopped_areas) {
+ err = snd_pcm_areas_silence(slave->stopped_areas, 0, slave->channels, slave->buffer_size, slave->format);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+/* reset links to the normal state
+ * slave #0 = trigger master
+ * slave #1-(N-1) = trigger slaves, linked is set to #0
+ */
+static void reset_links(snd_pcm_multi_t *multi)
+{
+ unsigned int i;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ snd_pcm_unlink(multi->slaves[i].linked);
+ multi->slaves[0].linked = NULL;
+ if (! i)
+ continue;
+ if (snd_pcm_link(multi->slaves[0].pcm, multi->slaves[i].pcm) >= 0)
+ multi->slaves[i].linked = multi->slaves[0].pcm;
+ }
+}
+
+static int snd_pcm_multi_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ snd_pcm_hw_params_t sparams[multi->slaves_count];
+ int err;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ err = snd_pcm_multi_hw_refine_sprepare(pcm, i, &sparams[i]);
+ assert(err >= 0);
+ err = snd_pcm_multi_hw_refine_schange(pcm, i, params, &sparams[i]);
+ assert(err >= 0);
+ err = snd_pcm_multi_hw_params_slave(pcm, i, &sparams[i]);
+ if (err < 0) {
+ snd_pcm_multi_hw_refine_cchange(pcm, i, params, &sparams[i]);
+ return err;
+ }
+ }
+ reset_links(multi);
+ return 0;
+}
+
+static int snd_pcm_multi_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ int err = 0;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave = multi->slaves[i].pcm;
+ int e = snd_pcm_hw_free(slave);
+ if (e < 0)
+ err = e;
+ if (!multi->slaves[i].linked)
+ continue;
+ e = snd_pcm_unlink(slave);
+ if (e < 0)
+ err = e;
+ multi->slaves[i].linked = NULL;
+ }
+ return err;
+}
+
+static int snd_pcm_multi_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ int err;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave = multi->slaves[i].pcm;
+ err = snd_pcm_sw_params(slave, params);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_multi_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_status(slave, status);
+}
+
+static snd_pcm_state_t snd_pcm_multi_state(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_state(slave);
+}
+
+static int snd_pcm_multi_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_hwsync(slave);
+}
+
+static int snd_pcm_multi_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_delay(slave, delayp);
+}
+
+static snd_pcm_sframes_t snd_pcm_multi_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_sframes_t ret = LONG_MAX;
+ unsigned int i;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_sframes_t avail;
+ avail = snd_pcm_avail_update(multi->slaves[i].pcm);
+ if (avail < 0)
+ return avail;
+ if (ret > avail)
+ ret = avail;
+ }
+ return ret;
+}
+
+static int snd_pcm_multi_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_htimestamp(slave, avail, tstamp);
+}
+
+static int snd_pcm_multi_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int result = 0, err;
+ unsigned int i;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ /* We call prepare to each slave even if it's linked.
+ * This is to make sure to sync non-mmaped control/status.
+ */
+ err = snd_pcm_prepare(multi->slaves[i].pcm);
+ if (err < 0)
+ result = err;
+ }
+ return result;
+}
+
+static int snd_pcm_multi_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int result = 0, err;
+ unsigned int i;
+ for (i = 0; i < multi->slaves_count; ++i) {
+ /* Reset each slave, as well as in prepare */
+ err = snd_pcm_reset(multi->slaves[i].pcm);
+ if (err < 0)
+ result = err;
+ }
+ return result;
+}
+
+/* when the first slave PCM is linked, it means that the whole multi
+ * plugin instance is linked manually to another PCM. in this case,
+ * we need to trigger the master.
+ */
+static int snd_pcm_multi_start(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err = 0;
+ unsigned int i;
+ if (multi->slaves[0].linked)
+ return snd_pcm_start(multi->slaves[0].linked);
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ continue;
+ err = snd_pcm_start(multi->slaves[i].pcm);
+ if (err < 0)
+ return err;
+ }
+ return err;
+}
+
+static int snd_pcm_multi_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err = 0;
+ unsigned int i;
+ if (multi->slaves[0].linked)
+ return snd_pcm_drop(multi->slaves[0].linked);
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ continue;
+ err = snd_pcm_drop(multi->slaves[i].pcm);
+ if (err < 0)
+ return err;
+ }
+ return err;
+}
+
+static int snd_pcm_multi_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err = 0;
+ unsigned int i;
+ if (multi->slaves[0].linked)
+ return snd_pcm_drain(multi->slaves[0].linked);
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ continue;
+ err = snd_pcm_drain(multi->slaves[i].pcm);
+ if (err < 0)
+ return err;
+ }
+ return err;
+}
+
+static int snd_pcm_multi_pause(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err = 0;
+ unsigned int i;
+ if (multi->slaves[0].linked)
+ return snd_pcm_pause(multi->slaves[0].linked, enable);
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ continue;
+ err = snd_pcm_pause(multi->slaves[i].pcm, enable);
+ if (err < 0)
+ return err;
+ }
+ return err;
+}
+
+static int snd_pcm_multi_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int channel = info->channel;
+ snd_pcm_multi_channel_t *c = &multi->channels[channel];
+ int err;
+ if (c->slave_idx < 0)
+ return -ENXIO;
+ info->channel = c->slave_channel;
+ err = snd_pcm_channel_info(multi->slaves[c->slave_idx].pcm, info);
+ info->channel = channel;
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_multi_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ snd_pcm_uframes_t pos[multi->slaves_count];
+ memset(pos, 0, sizeof(pos));
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave_i = multi->slaves[i].pcm;
+ snd_pcm_sframes_t f = snd_pcm_rewind(slave_i, frames);
+ if (f < 0)
+ return f;
+ pos[i] = f;
+ frames = f;
+ }
+ /* Realign the pointers */
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave_i = multi->slaves[i].pcm;
+ snd_pcm_uframes_t f = pos[i] - frames;
+ snd_pcm_sframes_t result;
+ if (f > 0) {
+ result = INTERNAL(snd_pcm_forward)(slave_i, f);
+ if (result < 0)
+ return result;
+ if ((snd_pcm_uframes_t)result != f)
+ return -EIO;
+ }
+ }
+ return frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_multi_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ snd_pcm_uframes_t pos[multi->slaves_count];
+ memset(pos, 0, sizeof(pos));
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave_i = multi->slaves[i].pcm;
+ snd_pcm_sframes_t f = INTERNAL(snd_pcm_forward)(slave_i, frames);
+ if (f < 0)
+ return f;
+ pos[i] = f;
+ frames = f;
+ }
+ /* Realign the pointers */
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_t *slave_i = multi->slaves[i].pcm;
+ snd_pcm_uframes_t f = pos[i] - frames;
+ snd_pcm_sframes_t result;
+ if (f > 0) {
+ result = snd_pcm_rewind(slave_i, f);
+ if (result < 0)
+ return result;
+ if ((snd_pcm_uframes_t)result != f)
+ return -EIO;
+ }
+ }
+ return frames;
+}
+
+static int snd_pcm_multi_resume(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ int err = 0;
+ unsigned int i;
+ if (multi->slaves[0].linked)
+ return snd_pcm_resume(multi->slaves[0].linked);
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ continue;
+ err = snd_pcm_resume(multi->slaves[i].pcm);
+ if (err < 0)
+ return err;
+ }
+ return err;
+}
+
+/* if a multi plugin instance is linked as slaves, every slave PCMs
+ * including the first one has to be relinked to the given master.
+ */
+static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+ int err;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ snd_pcm_unlink(multi->slaves[i].pcm);
+ multi->slaves[i].linked = NULL;
+ err = snd_pcm_link(master, multi->slaves[i].pcm);
+ if (err < 0) {
+ reset_links(multi);
+ return err;
+ }
+ multi->slaves[i].linked = master;
+ }
+ return 0;
+}
+
+/* linking to a multi as a master is easy - simply link to the first
+ * slave element as its own slaves are already linked.
+ */
+static int snd_pcm_multi_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
+{
+ snd_pcm_multi_t *multi = pcm1->private_data;
+ if (multi->slaves[0].pcm->fast_ops->link)
+ return multi->slaves[0].pcm->fast_ops->link(multi->slaves[0].pcm, pcm2);
+ return -ENOSYS;
+}
+
+static int snd_pcm_multi_unlink(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int i;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ if (multi->slaves[i].linked)
+ snd_pcm_unlink(multi->slaves[i].linked);
+ multi->slaves[0].linked = NULL;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_multi_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave;
+ unsigned int i;
+ snd_pcm_sframes_t result;
+
+ for (i = 0; i < multi->slaves_count; ++i) {
+ slave = multi->slaves[i].pcm;
+ result = snd_pcm_mmap_commit(slave, offset, size);
+ if (result < 0)
+ return result;
+ if ((snd_pcm_uframes_t)result != size)
+ return -EIO;
+ }
+ return size;
+}
+
+static int snd_pcm_multi_munmap(snd_pcm_t *pcm)
+{
+ free(pcm->mmap_channels);
+ free(pcm->running_areas);
+ pcm->mmap_channels = NULL;
+ pcm->running_areas = NULL;
+ return 0;
+}
+
+static int snd_pcm_multi_mmap(snd_pcm_t *pcm)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int c;
+
+ pcm->mmap_channels = calloc(pcm->channels,
+ sizeof(pcm->mmap_channels[0]));
+ pcm->running_areas = calloc(pcm->channels,
+ sizeof(pcm->running_areas[0]));
+ if (!pcm->mmap_channels || !pcm->running_areas) {
+ snd_pcm_multi_munmap(pcm);
+ return -ENOMEM;
+ }
+
+ /* Copy the slave mmapped buffer data */
+ for (c = 0; c < pcm->channels; c++) {
+ snd_pcm_multi_channel_t *chan = &multi->channels[c];
+ snd_pcm_t *slave;
+ if (chan->slave_idx < 0) {
+ snd_pcm_multi_munmap(pcm);
+ return -ENXIO;
+ }
+ slave = multi->slaves[chan->slave_idx].pcm;
+ pcm->mmap_channels[c] =
+ slave->mmap_channels[chan->slave_channel];
+ pcm->mmap_channels[c].channel = c;
+ pcm->running_areas[c] =
+ slave->running_areas[chan->slave_channel];
+ }
+ return 0;
+}
+
+static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ unsigned int k;
+ snd_output_printf(out, "Multi PCM\n");
+ snd_output_printf(out, " Channel bindings:\n");
+ for (k = 0; k < multi->channels_count; ++k) {
+ snd_pcm_multi_channel_t *c = &multi->channels[k];
+ if (c->slave_idx < 0)
+ continue;
+ snd_output_printf(out, " %d: slave %d, channel %d\n",
+ k, c->slave_idx, c->slave_channel);
+ }
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ for (k = 0; k < multi->slaves_count; ++k) {
+ snd_output_printf(out, "Slave #%d: ", k);
+ snd_pcm_dump(multi->slaves[k].pcm, out);
+ }
+}
+
+static const snd_pcm_ops_t snd_pcm_multi_ops = {
+ .close = snd_pcm_multi_close,
+ .info = snd_pcm_multi_info,
+ .hw_refine = snd_pcm_multi_hw_refine,
+ .hw_params = snd_pcm_multi_hw_params,
+ .hw_free = snd_pcm_multi_hw_free,
+ .sw_params = snd_pcm_multi_sw_params,
+ .channel_info = snd_pcm_multi_channel_info,
+ .dump = snd_pcm_multi_dump,
+ .nonblock = snd_pcm_multi_nonblock,
+ .async = snd_pcm_multi_async,
+ .mmap = snd_pcm_multi_mmap,
+ .munmap = snd_pcm_multi_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_multi_fast_ops = {
+ .status = snd_pcm_multi_status,
+ .state = snd_pcm_multi_state,
+ .hwsync = snd_pcm_multi_hwsync,
+ .delay = snd_pcm_multi_delay,
+ .prepare = snd_pcm_multi_prepare,
+ .reset = snd_pcm_multi_reset,
+ .start = snd_pcm_multi_start,
+ .drop = snd_pcm_multi_drop,
+ .drain = snd_pcm_multi_drain,
+ .pause = snd_pcm_multi_pause,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .rewind = snd_pcm_multi_rewind,
+ .forward = snd_pcm_multi_forward,
+ .resume = snd_pcm_multi_resume,
+ .link = snd_pcm_multi_link,
+ .link_slaves = snd_pcm_multi_link_slaves,
+ .unlink = snd_pcm_multi_unlink,
+ .avail_update = snd_pcm_multi_avail_update,
+ .mmap_commit = snd_pcm_multi_mmap_commit,
+ .htimestamp = snd_pcm_multi_htimestamp,
+ .poll_descriptors_count = snd_pcm_multi_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_multi_poll_descriptors,
+ .poll_revents = snd_pcm_multi_poll_revents,
+};
+
+/**
+ * \brief Creates a new Multi PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param slaves_count Count of slaves
+ * \param master_slave Master slave number
+ * \param slaves_pcm Array with slave PCMs
+ * \param schannels_count Array with slave channel counts
+ * \param channels_count Count of channels
+ * \param sidxs Array with channels indexes to slaves
+ * \param schannels Array with slave channels
+ * \param close_slaves When set, the slave PCM handle is closed
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
+ unsigned int slaves_count, unsigned int master_slave,
+ snd_pcm_t **slaves_pcm, unsigned int *schannels_count,
+ unsigned int channels_count,
+ int *sidxs, unsigned int *schannels,
+ int close_slaves)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_multi_t *multi;
+ unsigned int i;
+ snd_pcm_stream_t stream;
+ char slave_map[64][64] = { { 0 } };
+ int err;
+
+ assert(pcmp);
+ assert(slaves_count > 0 && slaves_pcm && schannels_count);
+ assert(channels_count > 0 && sidxs && schannels);
+ assert(master_slave < slaves_count);
+
+ multi = calloc(1, sizeof(snd_pcm_multi_t));
+ if (!multi) {
+ return -ENOMEM;
+ }
+
+ stream = slaves_pcm[0]->stream;
+
+ multi->slaves_count = slaves_count;
+ multi->master_slave = master_slave;
+ multi->slaves = calloc(slaves_count, sizeof(*multi->slaves));
+ if (!multi->slaves) {
+ free(multi);
+ return -ENOMEM;
+ }
+ multi->channels_count = channels_count;
+ multi->channels = calloc(channels_count, sizeof(*multi->channels));
+ if (!multi->channels) {
+ free(multi->slaves);
+ free(multi);
+ return -ENOMEM;
+ }
+ for (i = 0; i < slaves_count; ++i) {
+ snd_pcm_multi_slave_t *slave = &multi->slaves[i];
+ assert(slaves_pcm[i]->stream == stream);
+ slave->pcm = slaves_pcm[i];
+ slave->channels_count = schannels_count[i];
+ slave->close_slave = close_slaves;
+ }
+ for (i = 0; i < channels_count; ++i) {
+ snd_pcm_multi_channel_t *bind = &multi->channels[i];
+ assert(sidxs[i] < (int)slaves_count);
+ assert(schannels[i] < schannels_count[sidxs[i]]);
+ bind->slave_idx = sidxs[i];
+ bind->slave_channel = schannels[i];
+ if (sidxs[i] < 0)
+ continue;
+ assert(!slave_map[sidxs[i]][schannels[i]]);
+ slave_map[sidxs[i]][schannels[i]] = 1;
+ }
+ multi->channels_count = channels_count;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_MULTI, name, stream,
+ multi->slaves[0].pcm->mode);
+ if (err < 0) {
+ free(multi);
+ return err;
+ }
+ pcm->mmap_rw = 1;
+ pcm->mmap_shadow = 1; /* has own mmap method */
+ pcm->ops = &snd_pcm_multi_ops;
+ pcm->fast_ops = &snd_pcm_multi_fast_ops;
+ pcm->private_data = multi;
+ pcm->poll_fd = multi->slaves[master_slave].pcm->poll_fd;
+ pcm->poll_events = multi->slaves[master_slave].pcm->poll_events;
+ pcm->monotonic = multi->slaves[master_slave].pcm->monotonic;
+ snd_pcm_link_hw_ptr(pcm, multi->slaves[master_slave].pcm);
+ snd_pcm_link_appl_ptr(pcm, multi->slaves[master_slave].pcm);
+ *pcmp = pcm;
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_multi Plugin: Multiple streams to One
+
+This plugin converts multiple streams to one.
+
+\code
+pcm.name {
+ type multi # Multiple streams conversion PCM
+ slaves { # Slaves definition
+ ID STR # Slave PCM name
+ # or
+ ID {
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ channels INT # Slave channels
+ }
+ }
+ bindings { # Bindings table
+ N {
+ slave STR # Slave key
+ channel INT # Slave channel
+ }
+ }
+ [master INT] # Define the master slave
+}
+\endcode
+
+For example, to bind two PCM streams with two-channel stereo (hw:0,0 and
+hw:0,1) as one 4-channel stereo PCM stream, define like this:
+\code
+pcm.quad {
+ type multi
+
+ slaves.a.pcm "hw:0,0"
+ slaves.a.channels 2
+ slaves.b.pcm "hw:0,1"
+ slaves.b.channels 2
+
+ bindings.0.slave a
+ bindings.0.channel 0
+ bindings.1.slave a
+ bindings.1.channel 1
+ bindings.2.slave b
+ bindings.2.channel 0
+ bindings.3.slave b
+ bindings.3.channel 1
+}
+\endcode
+Note that the resultant pcm "quad" is not in the interleaved format
+but in the "complex" format. Hence, it's not accessible by applications
+which can handle only the interleaved (or the non-interleaved) format.
+In such a case, wrap this PCM with \ref pcm_plugins_route "route" or
+\ref pcm_plugins_plug "plug" plugin.
+\code
+pcm.quad2 {
+ type route
+ slave.pcm "quad"
+ ttable.0.0 1
+ ttable.1.1 1
+ ttable.2.2 1
+ ttable.3.3 1
+}
+\endcode
+
+\subsection pcm_plugins_multi_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_multi_open()
+ <LI>_snd_pcm_multi_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Multi PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Multi PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, inext, j, jnext;
+ snd_config_t *slaves = NULL;
+ snd_config_t *bindings = NULL;
+ int err;
+ unsigned int idx;
+ const char **slaves_id = NULL;
+ snd_config_t **slaves_conf = NULL;
+ snd_pcm_t **slaves_pcm = NULL;
+ unsigned int *slaves_channels = NULL;
+ int *channels_sidx = NULL;
+ unsigned int *channels_schannel = NULL;
+ unsigned int slaves_count = 0;
+ long master_slave = 0;
+ unsigned int channels_count = 0;
+ snd_config_for_each(i, inext, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slaves") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ slaves = n;
+ continue;
+ }
+ if (strcmp(id, "bindings") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ bindings = n;
+ continue;
+ }
+ if (strcmp(id, "master") == 0) {
+ if (snd_config_get_integer(n, &master_slave) < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slaves) {
+ SNDERR("slaves is not defined");
+ return -EINVAL;
+ }
+ if (!bindings) {
+ SNDERR("bindings is not defined");
+ return -EINVAL;
+ }
+ snd_config_for_each(i, inext, slaves) {
+ ++slaves_count;
+ }
+ if (master_slave < 0 || master_slave >= (long)slaves_count) {
+ SNDERR("Master slave is out of range (0-%u)\n", slaves_count-1);
+ return -EINVAL;
+ }
+ snd_config_for_each(i, inext, bindings) {
+ long cchannel;
+ snd_config_t *m = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(m, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0 || cchannel < 0) {
+ SNDERR("Invalid channel number: %s", id);
+ return -EINVAL;
+ }
+ if ((unsigned long)cchannel >= channels_count)
+ channels_count = cchannel + 1;
+ }
+ if (channels_count == 0) {
+ SNDERR("No channels defined");
+ return -EINVAL;
+ }
+ slaves_id = calloc(slaves_count, sizeof(*slaves_id));
+ slaves_conf = calloc(slaves_count, sizeof(*slaves_conf));
+ slaves_pcm = calloc(slaves_count, sizeof(*slaves_pcm));
+ slaves_channels = calloc(slaves_count, sizeof(*slaves_channels));
+ channels_sidx = calloc(channels_count, sizeof(*channels_sidx));
+ channels_schannel = calloc(channels_count, sizeof(*channels_schannel));
+ if (!slaves_id || !slaves_conf || !slaves_pcm || !slaves_channels ||
+ !channels_sidx || !channels_schannel) {
+ err = -ENOMEM;
+ goto _free;
+ }
+ idx = 0;
+ for (idx = 0; idx < channels_count; ++idx)
+ channels_sidx[idx] = -1;
+ idx = 0;
+ snd_config_for_each(i, inext, slaves) {
+ snd_config_t *m = snd_config_iterator_entry(i);
+ const char *id;
+ int channels;
+ if (snd_config_get_id(m, &id) < 0)
+ continue;
+ slaves_id[idx] = id;
+ err = snd_pcm_slave_conf(root, m, &slaves_conf[idx], 1,
+ SND_PCM_HW_PARAM_CHANNELS, SCONF_MANDATORY, &channels);
+ if (err < 0)
+ goto _free;
+ slaves_channels[idx] = channels;
+ ++idx;
+ }
+
+ snd_config_for_each(i, inext, bindings) {
+ snd_config_t *m = snd_config_iterator_entry(i);
+ long cchannel = -1;
+ long schannel = -1;
+ int slave = -1;
+ long val;
+ const char *str;
+ const char *id;
+ if (snd_config_get_id(m, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0 || cchannel < 0) {
+ SNDERR("Invalid channel number: %s", id);
+ err = -EINVAL;
+ goto _free;
+ }
+ snd_config_for_each(j, jnext, m) {
+ snd_config_t *n = snd_config_iterator_entry(j);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ char buf[32];
+ unsigned int k;
+ err = snd_config_get_string(n, &str);
+ if (err < 0) {
+ err = snd_config_get_integer(n, &val);
+ if (err < 0) {
+ SNDERR("Invalid value for %s", id);
+ goto _free;
+ }
+ sprintf(buf, "%ld", val);
+ str = buf;
+ }
+ for (k = 0; k < slaves_count; ++k) {
+ if (strcmp(slaves_id[k], str) == 0)
+ slave = k;
+ }
+ continue;
+ }
+ if (strcmp(id, "channel") == 0) {
+ err = snd_config_get_integer(n, &schannel);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _free;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _free;
+ }
+ if (slave < 0 || (unsigned int)slave >= slaves_count) {
+ SNDERR("Invalid or missing sidx for channel %s", id);
+ err = -EINVAL;
+ goto _free;
+ }
+ if (schannel < 0 ||
+ (unsigned int) schannel >= slaves_channels[slave]) {
+ SNDERR("Invalid or missing schannel for channel %s", id);
+ err = -EINVAL;
+ goto _free;
+ }
+ channels_sidx[cchannel] = slave;
+ channels_schannel[cchannel] = schannel;
+ }
+
+ for (idx = 0; idx < slaves_count; ++idx) {
+ err = snd_pcm_open_slave(&slaves_pcm[idx], root,
+ slaves_conf[idx], stream, mode,
+ conf);
+ if (err < 0)
+ goto _free;
+ snd_config_delete(slaves_conf[idx]);
+ slaves_conf[idx] = NULL;
+ }
+ err = snd_pcm_multi_open(pcmp, name, slaves_count, master_slave,
+ slaves_pcm, slaves_channels,
+ channels_count,
+ channels_sidx, channels_schannel,
+ 1);
+_free:
+ if (err < 0) {
+ for (idx = 0; idx < slaves_count; ++idx) {
+ if (slaves_pcm[idx])
+ snd_pcm_close(slaves_pcm[idx]);
+ }
+ }
+ if (slaves_conf) {
+ for (idx = 0; idx < slaves_count; ++idx) {
+ if (slaves_conf[idx])
+ snd_config_delete(slaves_conf[idx]);
+ }
+ free(slaves_conf);
+ }
+ free(slaves_pcm);
+ free(slaves_channels);
+ free(channels_sidx);
+ free(channels_schannel);
+ free(slaves_id);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_null.c b/alsa-lib/src/pcm/pcm_null.c
new file mode 100644
index 0000000..2f2a42f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_null.c
@@ -0,0 +1,431 @@
+/**
+ * \file pcm/pcm_null.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Null Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Null plugin
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include <limits.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_null = "";
+#endif
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ snd_htimestamp_t trigger_tstamp;
+ snd_pcm_state_t state;
+ snd_pcm_uframes_t appl_ptr;
+ snd_pcm_uframes_t hw_ptr;
+ int poll_fd;
+} snd_pcm_null_t;
+#endif
+
+static int snd_pcm_null_close(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ close(null->poll_fd);
+ free(null);
+ return 0;
+}
+
+static int snd_pcm_null_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_null_async(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int sig ATTRIBUTE_UNUSED, pid_t pid ATTRIBUTE_UNUSED)
+{
+ return -ENOSYS;
+}
+
+static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
+{
+ memset(info, 0, sizeof(*info));
+ info->stream = pcm->stream;
+ info->card = -1;
+ if (pcm->name) {
+ strncpy((char *)info->id, pcm->name, sizeof(info->id));
+ strncpy((char *)info->name, pcm->name, sizeof(info->name));
+ strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
+ }
+ info->subdevices_count = 1;
+ return 0;
+}
+
+static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ memset(status, 0, sizeof(*status));
+ status->state = null->state;
+ status->trigger_tstamp = null->trigger_tstamp;
+ gettimestamp(&status->tstamp, pcm->monotonic);
+ status->avail = pcm->buffer_size;
+ status->avail_max = status->avail;
+ return 0;
+}
+
+static snd_pcm_state_t snd_pcm_null_state(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ return null->state;
+}
+
+static int snd_pcm_null_hwsync(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_null_delay(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sframes_t *delayp)
+{
+ *delayp = 0;
+ return 0;
+}
+
+static int snd_pcm_null_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ null->state = SND_PCM_STATE_PREPARED;
+ *pcm->appl.ptr = 0;
+ *pcm->hw.ptr = 0;
+ return 0;
+}
+
+static int snd_pcm_null_reset(snd_pcm_t *pcm)
+{
+ *pcm->appl.ptr = 0;
+ *pcm->hw.ptr = 0;
+ return 0;
+}
+
+static int snd_pcm_null_start(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ assert(null->state == SND_PCM_STATE_PREPARED);
+ null->state = SND_PCM_STATE_RUNNING;
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
+ *pcm->hw.ptr = *pcm->appl.ptr + pcm->buffer_size;
+ else
+ *pcm->hw.ptr = *pcm->appl.ptr;
+ return 0;
+}
+
+static int snd_pcm_null_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ assert(null->state != SND_PCM_STATE_OPEN);
+ null->state = SND_PCM_STATE_SETUP;
+ return 0;
+}
+
+static int snd_pcm_null_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ assert(null->state != SND_PCM_STATE_OPEN);
+ null->state = SND_PCM_STATE_SETUP;
+ return 0;
+}
+
+static int snd_pcm_null_pause(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ if (enable) {
+ if (null->state != SND_PCM_STATE_RUNNING)
+ return -EBADFD;
+ null->state = SND_PCM_STATE_PAUSED;
+ } else {
+ if (null->state != SND_PCM_STATE_PAUSED)
+ return -EBADFD;
+ null->state = SND_PCM_STATE_RUNNING;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_null_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ switch (null->state) {
+ case SND_PCM_STATE_RUNNING:
+ snd_pcm_mmap_hw_backward(pcm, frames);
+ /* Fall through */
+ case SND_PCM_STATE_PREPARED:
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ return frames;
+ default:
+ return -EBADFD;
+ }
+}
+
+static snd_pcm_sframes_t snd_pcm_null_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_null_t *null = pcm->private_data;
+ switch (null->state) {
+ case SND_PCM_STATE_RUNNING:
+ snd_pcm_mmap_hw_forward(pcm, frames);
+ /* Fall through */
+ case SND_PCM_STATE_PREPARED:
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ return frames;
+ default:
+ return -EBADFD;
+ }
+}
+
+static int snd_pcm_null_resume(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_null_xfer_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_mmap_appl_forward(pcm, size);
+ snd_pcm_mmap_hw_forward(pcm, size);
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_null_writei(snd_pcm_t *pcm, const void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
+{
+ return snd_pcm_write_areas(pcm, NULL, 0, size, snd_pcm_null_xfer_areas);
+}
+
+static snd_pcm_sframes_t snd_pcm_null_writen(snd_pcm_t *pcm, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
+{
+ return snd_pcm_write_areas(pcm, NULL, 0, size, snd_pcm_null_xfer_areas);
+}
+
+static snd_pcm_sframes_t snd_pcm_null_readi(snd_pcm_t *pcm, void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
+{
+ return snd_pcm_read_areas(pcm, NULL, 0, size, snd_pcm_null_xfer_areas);
+}
+
+static snd_pcm_sframes_t snd_pcm_null_readn(snd_pcm_t *pcm, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
+{
+ return snd_pcm_read_areas(pcm, NULL, 0, size, snd_pcm_null_xfer_areas);
+}
+
+static snd_pcm_sframes_t snd_pcm_null_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ return snd_pcm_null_forward(pcm, size);
+}
+
+static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
+{
+ return pcm->buffer_size;
+}
+
+static int snd_pcm_null_hw_refine(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err = snd_pcm_hw_refine_soft(pcm, params);
+ params->info = SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID |
+ SND_PCM_INFO_RESUME | SND_PCM_INFO_PAUSE;
+ params->fifo_size = 0;
+ return err;
+}
+
+static int snd_pcm_null_hw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t * params ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_null_hw_free(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_null_sw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t * params ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void snd_pcm_null_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_output_printf(out, "Null PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+}
+
+static const snd_pcm_ops_t snd_pcm_null_ops = {
+ .close = snd_pcm_null_close,
+ .info = snd_pcm_null_info,
+ .hw_refine = snd_pcm_null_hw_refine,
+ .hw_params = snd_pcm_null_hw_params,
+ .hw_free = snd_pcm_null_hw_free,
+ .sw_params = snd_pcm_null_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_null_dump,
+ .nonblock = snd_pcm_null_nonblock,
+ .async = snd_pcm_null_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_null_fast_ops = {
+ .status = snd_pcm_null_status,
+ .state = snd_pcm_null_state,
+ .hwsync = snd_pcm_null_hwsync,
+ .delay = snd_pcm_null_delay,
+ .prepare = snd_pcm_null_prepare,
+ .reset = snd_pcm_null_reset,
+ .start = snd_pcm_null_start,
+ .drop = snd_pcm_null_drop,
+ .drain = snd_pcm_null_drain,
+ .pause = snd_pcm_null_pause,
+ .rewind = snd_pcm_null_rewind,
+ .forward = snd_pcm_null_forward,
+ .resume = snd_pcm_null_resume,
+ .writei = snd_pcm_null_writei,
+ .writen = snd_pcm_null_writen,
+ .readi = snd_pcm_null_readi,
+ .readn = snd_pcm_null_readn,
+ .avail_update = snd_pcm_null_avail_update,
+ .mmap_commit = snd_pcm_null_mmap_commit,
+ .htimestamp = snd_pcm_generic_real_htimestamp,
+};
+
+/**
+ * \brief Creates a new null PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_null_t *null;
+ int fd;
+ int err;
+ assert(pcmp);
+ if (stream == SND_PCM_STREAM_PLAYBACK) {
+ fd = open("/dev/null", O_WRONLY);
+ if (fd < 0) {
+ SYSERR("Cannot open /dev/null");
+ return -errno;
+ }
+ } else {
+ fd = open("/dev/full", O_RDONLY);
+ if (fd < 0) {
+ SYSERR("Cannot open /dev/full");
+ return -errno;
+ }
+ }
+ null = calloc(1, sizeof(snd_pcm_null_t));
+ if (!null) {
+ close(fd);
+ return -ENOMEM;
+ }
+ null->poll_fd = fd;
+ null->state = SND_PCM_STATE_OPEN;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_NULL, name, stream, mode);
+ if (err < 0) {
+ close(fd);
+ free(null);
+ return err;
+ }
+ pcm->ops = &snd_pcm_null_ops;
+ pcm->fast_ops = &snd_pcm_null_fast_ops;
+ pcm->private_data = null;
+ pcm->poll_fd = fd;
+ pcm->poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
+ snd_pcm_set_hw_ptr(pcm, &null->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &null->appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_null Plugin: Null
+
+This plugin discards contents of a PCM stream or creates a stream with zero
+samples.
+
+Note: This implementation uses devices /dev/null (playback, must be writable)
+and /dev/full (capture, must be readable).
+
+\code
+pcm.name {
+ type null # Null PCM
+}
+\endcode
+
+\subsection pcm_plugins_null_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_null_open()
+ <LI>_snd_pcm_null_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Null PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Null PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ return snd_pcm_null_open(pcmp, name, stream, mode);
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_params.c b/alsa-lib/src/pcm/pcm_params.c
new file mode 100644
index 0000000..80b3fd2
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_params.c
@@ -0,0 +1,2345 @@
+/*
+ * PCM - Params functions
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+
+#ifndef NDEBUG
+/*
+ * dump hw_params when $LIBASOUND_DEBUG is set to >= 1
+ */
+static void dump_hw_params(snd_pcm_hw_params_t *params, const char *type,
+ snd_pcm_hw_param_t var, unsigned int val, int err)
+{
+ const char *verbose = getenv("LIBASOUND_DEBUG");
+ snd_output_t *out;
+
+ if (! verbose || ! *verbose || atoi(verbose) < 1)
+ return;
+ if (snd_output_stdio_attach(&out, stderr, 0) < 0)
+ return;
+ fprintf(stderr, "ALSA ERROR hw_params: %s (%s)\n",
+ type, snd_pcm_hw_param_name(var));
+ fprintf(stderr, " value = ");
+ switch (var) {
+ case SND_PCM_HW_PARAM_ACCESS:
+ fprintf(stderr, "%s", snd_pcm_access_name(val));
+ break;
+ case SND_PCM_HW_PARAM_FORMAT:
+ fprintf(stderr, "%s", snd_pcm_format_name(val));
+ break;
+ case SND_PCM_HW_PARAM_SUBFORMAT:
+ fprintf(stderr, "%s", snd_pcm_subformat_name(val));
+ break;
+ default:
+ fprintf(stderr, "%u", val);
+ }
+ fprintf(stderr, " : %s\n", snd_strerror(err));
+ snd_pcm_hw_params_dump(params, out);
+ snd_output_close(out);
+}
+#else
+static inline void dump_hw_params(snd_pcm_hw_params_t *params, const char *type,
+ snd_pcm_hw_param_t var, unsigned int val, int err)
+{
+}
+#endif
+
+static inline int hw_is_mask(snd_pcm_hw_param_t var)
+{
+#if SND_PCM_HW_PARAM_FIRST_MASK == 0
+ return var <= SND_PCM_HW_PARAM_LAST_MASK;
+#else
+ return var >= SND_PCM_HW_PARAM_FIRST_MASK &&
+ var <= SND_PCM_HW_PARAM_LAST_MASK;
+#endif
+}
+
+static inline int hw_is_interval(snd_pcm_hw_param_t var)
+{
+ return var >= SND_PCM_HW_PARAM_FIRST_INTERVAL &&
+ var <= SND_PCM_HW_PARAM_LAST_INTERVAL;
+}
+
+#define hw_param_mask(params,var) \
+ &((params)->masks[(var) - SND_PCM_HW_PARAM_FIRST_MASK])
+
+#define hw_param_interval(params,var) \
+ &((params)->intervals[(var) - SND_PCM_HW_PARAM_FIRST_INTERVAL])
+
+#define hw_param_mask_c hw_param_mask
+#define hw_param_interval_c hw_param_interval
+
+static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var)
+{
+ if (hw_is_mask(var)) {
+ snd_mask_any(hw_param_mask(params, var));
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ return;
+ }
+ if (hw_is_interval(var)) {
+ snd_interval_any(hw_param_interval(params, var));
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ return;
+ }
+ assert(0);
+}
+
+int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ _snd_pcm_hw_param_any(params, var);
+ return snd_pcm_hw_refine(pcm, params);
+}
+
+void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
+{
+ unsigned int k;
+ memset(params, 0, sizeof(*params));
+ for (k = SND_PCM_HW_PARAM_FIRST_MASK; k <= SND_PCM_HW_PARAM_LAST_MASK; k++)
+ _snd_pcm_hw_param_any(params, k);
+ for (k = SND_PCM_HW_PARAM_FIRST_INTERVAL; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; k++)
+ _snd_pcm_hw_param_any(params, k);
+ params->rmask = ~0U;
+ params->cmask = 0;
+ params->info = ~0U;
+}
+
+/* Return the value for field PAR if it's fixed in configuration space
+ defined by PARAMS. Return -EINVAL otherwise
+*/
+int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir)
+{
+ if (hw_is_mask(var)) {
+ const snd_mask_t *mask = hw_param_mask_c(params, var);
+ if (snd_mask_empty(mask) || !snd_mask_single(mask))
+ return -EINVAL;
+ if (dir)
+ *dir = 0;
+ if (val)
+ *val = snd_mask_value(mask);
+ return 0;
+ } else if (hw_is_interval(var)) {
+ const snd_interval_t *i = hw_param_interval_c(params, var);
+ if (snd_interval_empty(i) || !snd_interval_single(i))
+ return -EINVAL;
+ if (dir)
+ *dir = i->openmin;
+ if (val)
+ *val = snd_interval_value(i);
+ return 0;
+ }
+ assert(0);
+ return -EINVAL;
+}
+
+/* Return the minimum value for field PAR. */
+int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir)
+{
+ if (hw_is_mask(var)) {
+ const snd_mask_t *m = hw_param_mask_c(params, var);
+ assert(!snd_mask_empty(m));
+ if (dir)
+ *dir = 0;
+ if (val)
+ *val = snd_mask_min(m);
+ return 0;
+ } else if (hw_is_interval(var)) {
+ const snd_interval_t *i = hw_param_interval_c(params, var);
+ assert(!snd_interval_empty(i));
+ if (dir)
+ *dir = i->openmin;
+ if (val)
+ *val = snd_interval_min(i);
+ return 0;
+ }
+ assert(0);
+ return 0;
+}
+
+/* Return the maximum value for field PAR. */
+int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir)
+{
+ if (hw_is_mask(var)) {
+ const snd_mask_t *m = hw_param_mask_c(params, var);
+ assert(!snd_mask_empty(m));
+ if (dir)
+ *dir = 0;
+ if (val)
+ *val = snd_mask_max(m);
+ return 0;
+ } else if (hw_is_interval(var)) {
+ const snd_interval_t *i = hw_param_interval_c(params, var);
+ assert(!snd_interval_empty(i));
+ if (dir)
+ *dir = - (int) i->openmax;
+ if (val)
+ *val = snd_interval_max(i);
+ return 0;
+ }
+ assert(0);
+ return 0;
+}
+
+/* Return the mask for field PAR.
+ This function can be called only for SND_PCM_HW_PARAM_ACCESS,
+ SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SUBFORMAT. */
+const snd_mask_t *snd_pcm_hw_param_get_mask(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ assert(hw_is_mask(var));
+ return hw_param_mask_c(params, var);
+}
+
+/* Return the interval for field PAR.
+ This function cannot be called for SND_PCM_HW_PARAM_ACCESS,
+ SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SUBFORMAT. */
+const snd_interval_t *snd_pcm_hw_param_get_interval(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ assert(hw_is_interval(var));
+ return hw_param_interval_c(params, var);
+}
+
+/* --- Refinement functions --- */
+
+int _snd_pcm_hw_param_set_interval(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_interval_t *val)
+{
+ int changed;
+ assert(hw_is_interval(var));
+ changed = snd_interval_refine(hw_param_interval(params, var), val);
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+void _snd_pcm_hw_param_set_empty(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ if (hw_is_mask(var)) {
+ snd_mask_none(hw_param_mask(params, var));
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ } else if (hw_is_interval(var)) {
+ snd_interval_none(hw_param_interval(params, var));
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ } else {
+ assert(0);
+ }
+}
+
+static int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ int changed;
+ assert(hw_is_interval(var));
+ changed = snd_interval_setinteger(hw_param_interval(params, var));
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ non integer values. Reduce configuration space accordingly.
+ Return -EINVAL if the configuration space is empty
+*/
+int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set_integer(params, var);
+ if (err < 0)
+ goto _fail;
+ if (params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ }
+ return 0;
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ return err;
+}
+
+static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ int changed;
+ if (hw_is_mask(var))
+ changed = snd_mask_refine_first(hw_param_mask(params, var));
+ else if (hw_is_interval(var))
+ changed = snd_interval_refine_first(hw_param_interval(params, var));
+ else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed > 0) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values > minimum. Reduce configuration space accordingly.
+ Return the minimum.
+*/
+int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int *rval, int *dir)
+{
+ int err;
+
+ err = _snd_pcm_hw_param_set_first(params, var);
+ if (err < 0)
+ return err;
+ if (params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ return err;
+ }
+ return snd_pcm_hw_param_get(params, var, rval, dir);
+}
+
+static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ int changed;
+ if (hw_is_mask(var))
+ changed = snd_mask_refine_last(hw_param_mask(params, var));
+ else if (hw_is_interval(var))
+ changed = snd_interval_refine_last(hw_param_interval(params, var));
+ else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed > 0) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values < maximum. Reduce configuration space accordingly.
+ Return the maximum.
+*/
+int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int *rval, int *dir)
+{
+ int err;
+
+ err = _snd_pcm_hw_param_set_last(params, var);
+ if (err < 0)
+ return err;
+ if (params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ return err;
+ }
+ return snd_pcm_hw_param_get(params, var, rval, dir);
+}
+
+int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir)
+{
+ int changed;
+ int openmin = 0;
+ if (dir) {
+ if (dir > 0) {
+ openmin = 1;
+ } else if (dir < 0) {
+ if (val > 0) {
+ openmin = 1;
+ val--;
+ }
+ }
+ }
+ if (hw_is_mask(var))
+ changed = snd_mask_refine_min(hw_param_mask(params, var), val + !!openmin);
+ else if (hw_is_interval(var))
+ changed = snd_interval_refine_min(hw_param_interval(params, var), val, openmin);
+ else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values < VAL. Reduce configuration space accordingly.
+ Return new minimum or -EINVAL if the configuration space is empty
+*/
+int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, unsigned int *val, int *dir)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set_min(params, var, *val, dir ? *dir : 0);
+ if (err < 0)
+ goto _fail;
+ if ((mode != SND_TEST || hw_is_interval(var)) && params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ if (snd_pcm_hw_param_empty(params, var)) {
+ err = -ENOENT;
+ goto _fail;
+ }
+ }
+ return snd_pcm_hw_param_get_min(params, var, val, dir);
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ if (err < 0 && mode == SND_TRY)
+ dump_hw_params(params, "set_min", var, *val, err);
+ return err;
+}
+
+int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir)
+{
+ int changed;
+ int openmax = 0;
+ if (dir) {
+ if (dir < 0) {
+ openmax = 1;
+ } else if (dir > 0) {
+ openmax = 1;
+ val++;
+ }
+ }
+ if (hw_is_mask(var)) {
+ if (val == 0 && openmax) {
+ snd_mask_none(hw_param_mask(params, var));
+ changed = -EINVAL;
+ } else
+ changed = snd_mask_refine_max(hw_param_mask(params, var), val - !!openmax);
+ } else if (hw_is_interval(var))
+ changed = snd_interval_refine_max(hw_param_interval(params, var), val, openmax);
+ else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values >= VAL + 1. Reduce configuration space accordingly.
+ Return new maximum or -EINVAL if the configuration space is empty
+*/
+int snd_pcm_hw_param_set_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, unsigned int *val, int *dir)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set_max(params, var, *val, dir ? *dir : 0);
+ if (err < 0)
+ goto _fail;
+ if ((mode != SND_TEST || hw_is_interval(var)) && params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ if (snd_pcm_hw_param_empty(params, var)) {
+ err = -ENOENT;
+ goto _fail;
+ }
+ }
+ return snd_pcm_hw_param_get_max(params, var, val, dir);
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ if (err < 0 && mode == SND_TRY)
+ dump_hw_params(params, "set_max", var, *val, err);
+ return err;
+}
+
+int _snd_pcm_hw_param_set_minmax(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int min, int mindir,
+ unsigned int max, int maxdir)
+{
+ int changed, c1, c2;
+ int openmin = 0, openmax = 0;
+ if (mindir) {
+ if (mindir > 0) {
+ openmin = 1;
+ } else if (mindir < 0) {
+ if (min > 0) {
+ openmin = 1;
+ min--;
+ }
+ }
+ }
+ if (maxdir) {
+ if (maxdir < 0) {
+ openmax = 1;
+ } else if (maxdir > 0) {
+ openmax = 1;
+ max++;
+ }
+ }
+ if (hw_is_mask(var)) {
+ snd_mask_t *mask = hw_param_mask(params, var);
+ if (max == 0 && openmax) {
+ snd_mask_none(mask);
+ changed = -EINVAL;
+ } else {
+ c1 = snd_mask_refine_min(mask, min + !!openmin);
+ if (c1 < 0)
+ changed = c1;
+ else {
+ c2 = snd_mask_refine_max(mask, max - !!openmax);
+ if (c2 < 0)
+ changed = c2;
+ else
+ changed = (c1 || c2);
+ }
+ }
+ }
+ else if (hw_is_interval(var)) {
+ snd_interval_t *i = hw_param_interval(params, var);
+ c1 = snd_interval_refine_min(i, min, openmin);
+ if (c1 < 0)
+ changed = c1;
+ else {
+ c2 = snd_interval_refine_max(i, max, openmax);
+ if (c2 < 0)
+ changed = c2;
+ else
+ changed = (c1 || c2);
+ }
+ } else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values < MIN and all values > MAX. Reduce configuration space accordingly.
+ Return 0 or -EINVAL if the configuration space is empty
+*/
+int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var,
+ unsigned int *min, int *mindir,
+ unsigned int *max, int *maxdir)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set_minmax(params, var,
+ *min, mindir ? *mindir : 0,
+ *max, maxdir ? *maxdir : 0);
+ if (err < 0)
+ goto _fail;
+ if ((mode != SND_TEST || hw_is_interval(var)) && params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ }
+ err = snd_pcm_hw_param_get_min(params, var, min, mindir);
+ if (err < 0)
+ return err;
+ return snd_pcm_hw_param_get_max(params, var, max, maxdir);
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ if (err < 0)
+ dump_hw_params(params, "set_minmax", var, *min, err);
+ return err;
+}
+
+int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, unsigned int val, int dir)
+{
+ int changed;
+ if (hw_is_mask(var)) {
+ snd_mask_t *m = hw_param_mask(params, var);
+ if (val == 0 && dir < 0) {
+ changed = -EINVAL;
+ snd_mask_none(m);
+ } else {
+ if (dir > 0)
+ val++;
+ else if (dir < 0)
+ val--;
+ changed = snd_mask_refine_set(hw_param_mask(params, var), val);
+ }
+ } else if (hw_is_interval(var)) {
+ snd_interval_t *i = hw_param_interval(params, var);
+ if (val == 0 && dir < 0) {
+ changed = -EINVAL;
+ snd_interval_none(i);
+ } else if (dir == 0)
+ changed = snd_interval_refine_set(i, val);
+ else {
+ snd_interval_t t;
+ t.openmin = 1;
+ t.openmax = 1;
+ t.empty = 0;
+ t.integer = 0;
+ if (dir < 0) {
+ t.min = val - 1;
+ t.max = val;
+ } else {
+ t.min = val;
+ t.max = val+1;
+ }
+ changed = snd_interval_refine(i, &t);
+ }
+ } else {
+ assert(0);
+ return -EINVAL;
+ }
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all
+ values != VAL. Reduce configuration space accordingly.
+ Return -EINVAL if the configuration space is empty
+*/
+int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, unsigned int val, int dir)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set(params, var, val, dir);
+ if (err < 0)
+ goto _fail;
+ if ((mode != SND_TEST || hw_is_interval(var)) && params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ }
+ return 0;
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ if (err < 0 && mode == SND_TRY)
+ dump_hw_params(params, "set", var, val, err);
+ return err;
+}
+
+int _snd_pcm_hw_param_set_mask(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, const snd_mask_t *val)
+{
+ int changed;
+ assert(hw_is_mask(var));
+ changed = snd_mask_refine(hw_param_mask(params, var), val);
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+/* Inside configuration space defined by PARAMS remove from PAR all values
+ not contained in MASK. Reduce configuration space accordingly.
+ This function can be called only for SND_PCM_HW_PARAM_ACCESS,
+ SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SUBFORMAT.
+ Return 0 on success or -EINVAL
+ if the configuration space is empty
+*/
+int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_set_mode_t mode,
+ snd_pcm_hw_param_t var, const snd_mask_t *val)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ switch (mode) {
+ case SND_CHANGE:
+ break;
+ case SND_TRY:
+ save = *params;
+ break;
+ case SND_TEST:
+ save = *params;
+ params = &save;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+ err = _snd_pcm_hw_param_set_mask(params, var, val);
+ if (err < 0)
+ goto _fail;
+ if (mode != SND_TEST && params->rmask) {
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ goto _fail;
+ }
+ return 0;
+ _fail:
+ if (mode == SND_TRY)
+ *params = save;
+ return err;
+}
+
+/* Inside configuration space defined by PARAMS set PAR to the available value
+ nearest to VAL. Reduce configuration space accordingly.
+ This function cannot be called for SND_PCM_HW_PARAM_ACCESS,
+ SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SUBFORMAT.
+ Return the value found.
+ */
+int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int *val, int *dir)
+{
+ snd_pcm_hw_params_t save;
+ int err;
+ unsigned int best = *val, saved_min;
+ int last = 0;
+ unsigned int min, max;
+ int mindir, maxdir;
+ int valdir = dir ? *dir : 0;
+ snd_interval_t *i;
+ /* FIXME */
+ if (best > INT_MAX)
+ best = INT_MAX;
+ min = max = best;
+ mindir = maxdir = valdir;
+ if (maxdir > 0)
+ maxdir = 0;
+ else if (maxdir == 0)
+ maxdir = -1;
+ else {
+ maxdir = 1;
+ max--;
+ }
+ save = *params;
+ saved_min = min;
+ err = snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, var, &min, &mindir);
+
+ i = hw_param_interval(params, var);
+ if (!snd_interval_empty(i) && snd_interval_single(i)) {
+ err = snd_pcm_hw_param_get_min(params, var, val, dir);
+ if (err < 0)
+ dump_hw_params(params, "set_near", var, *val, err);
+ return err;
+ }
+
+ if (err >= 0) {
+ snd_pcm_hw_params_t params1;
+ if (min == saved_min && mindir == valdir)
+ goto _end;
+ params1 = save;
+ err = snd_pcm_hw_param_set_max(pcm, &params1, SND_CHANGE, var, &max, &maxdir);
+ if (err < 0)
+ goto _end;
+ if (boundary_nearer(max, maxdir, best, valdir, min, mindir)) {
+ *params = params1;
+ last = 1;
+ }
+ } else {
+ *params = save;
+ err = snd_pcm_hw_param_set_max(pcm, params, SND_CHANGE, var, &max, &maxdir);
+ if (err < 0) {
+ dump_hw_params(params, "set_near", var, *val, err);
+ return err;
+ }
+ last = 1;
+ }
+ _end:
+ if (last)
+ err = snd_pcm_hw_param_set_last(pcm, params, var, val, dir);
+ else
+ err = snd_pcm_hw_param_set_first(pcm, params, var, val, dir);
+ if (err < 0)
+ dump_hw_params(params, "set_near", var, *val, err);
+ return err;
+}
+
+#if 0
+/* Inside configuration space defined by PARAMS set PAR to the available value
+ nearest to BEST after VAL (on equal difference values less than BEST are
+ returned first).
+ Reduce configuration space accordingly.
+ This function cannot be called for SND_PCM_HW_PARAM_ACCESS,
+ SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SUBFORMAT.
+ Return the value found.
+ */
+int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int best, int bestdir,
+ unsigned int val, int *dir)
+{
+ snd_pcm_hw_params_t save;
+ int v, err;
+ int last = 0;
+ int min, max;
+ int mindir, maxdir;
+ int diff, diffdir;
+ int valdir = dir ? *dir : 0;
+ /* FIXME */
+ if (best > INT_MAX)
+ best = INT_MAX;
+ boundary_sub(val, valdir, best, bestdir, &diff, &diffdir);
+ if (diff < 0 || (diff == 0 && diffdir < 0)) {
+ min = best - diff;
+ mindir = bestdir - diffdir;
+ max = val;
+ maxdir = bestdir - 1;
+ } else {
+ min = val;
+ mindir = bestdir + 1;
+ max = best + diff;
+ maxdir = bestdir + diffdir + 1;
+ }
+ min += mindir / 2;
+ mindir %= 2;
+ max += maxdir / 2;
+ maxdir %= 2;
+ save = *params;
+ if (min >= 0 &&
+ (err = snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, var, &min, &mindir)) >= 0) {
+ snd_pcm_hw_params_t params1;
+ if (max < 0)
+ goto _end;
+ params1 = save;
+ err = snd_pcm_hw_param_set_max(pcm, &params1, SND_CHANGE, var, &max, &maxdir);
+ if (err < 0)
+ goto _end;
+ if (boundary_nearer(max, maxdir, best, bestdir, min, mindir)) {
+ *params = params1;
+ last = 1;
+ }
+ } else {
+ if (max < 0)
+ return -EINVAL;
+ *params = save;
+ err = snd_pcm_hw_param_set_max(pcm, params, SND_CHANGE, var, &max, &maxdir);
+ if (err < 0)
+ return max;
+ last = 1;
+ }
+ _end:
+ if (last)
+ v = snd_pcm_hw_param_set_last(pcm, params, var, dir);
+ else
+ v = snd_pcm_hw_param_set_first(pcm, params, var, dir);
+ assert(v >= 0);
+ return v;
+}
+#endif
+
+static int snd_pcm_hw_param_set_near_minmax(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int min, int *mindir,
+ unsigned int max, int *maxdir)
+{
+ snd_pcm_hw_params_t tmp;
+ int err;
+ if (!boundary_lt(min, *mindir, max, *maxdir))
+ return snd_pcm_hw_param_set_near(pcm, params, var, &min, mindir);
+ tmp = *params;
+ err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &min, mindir);
+ if (err < 0)
+ return err;
+ if (boundary_lt(min, *mindir, max, *maxdir)) {
+ tmp = *params;
+ err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &max, maxdir);
+ } else {
+ max = min;
+ *maxdir = *mindir;
+ }
+ err = snd_pcm_hw_param_set_minmax(pcm, params, SND_CHANGE, var, &min, mindir,
+ &max, maxdir);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+int snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src)
+{
+ unsigned int min, max;
+ int mindir, maxdir, err;
+
+ if ((err = snd_pcm_hw_param_get_min(src, var, &min, &mindir)) < 0)
+ return err;
+ if ((err = snd_pcm_hw_param_get_max(src, var, &max, &maxdir)) < 0)
+ return err;
+ if ((err = snd_pcm_hw_param_set_near_minmax(pcm, params, var,
+ min, &mindir, max, &maxdir)) < 0)
+ return err;
+ return 0;
+}
+
+int snd_pcm_hw_param_refine_multiple(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src)
+{
+ const snd_interval_t *it = hw_param_interval_c(src, var);
+ const snd_interval_t *st = hw_param_interval_c(params, var);
+ if (snd_interval_single(it)) {
+ unsigned int best = snd_interval_min(it), cur, prev;
+ cur = best;
+ for (;;) {
+ if (st->max < cur || (st->max == cur && st->openmax))
+ break;
+ if (it->min <= cur && ! (it->min == cur && st->openmin)) {
+ if (! snd_pcm_hw_param_set(pcm, params, SND_TRY, var, cur, 0))
+ return 0; /* ok */
+ }
+ prev = cur;
+ cur += best;
+ if (cur <= prev)
+ break;
+ }
+ }
+ return snd_pcm_hw_param_refine_near(pcm, params, var, src);
+}
+
+/* ---- end of refinement functions ---- */
+
+int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ if (hw_is_mask(var))
+ return snd_mask_empty(hw_param_mask_c(params, var));
+ if (hw_is_interval(var))
+ return snd_interval_empty(hw_param_interval_c(params, var));
+ assert(0);
+ return -EINVAL;
+}
+
+int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *params1)
+{
+ if (hw_is_mask(var))
+ return snd_mask_always_eq(hw_param_mask_c(params, var),
+ hw_param_mask_c(params1, var));
+ if (hw_is_interval(var))
+ return snd_interval_always_eq(hw_param_interval_c(params, var),
+ hw_param_interval_c(params1, var));
+ assert(0);
+ return -EINVAL;
+}
+
+int snd_pcm_hw_param_never_eq(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *params1)
+{
+ if (hw_is_mask(var))
+ return snd_mask_never_eq(hw_param_mask_c(params, var),
+ hw_param_mask_c(params1, var));
+ if (hw_is_interval(var))
+ return snd_interval_never_eq(hw_param_interval_c(params, var),
+ hw_param_interval_c(params1, var));
+ assert(0);
+ return -EINVAL;
+}
+
+#if 0
+#define CHOOSE_DEBUG
+#endif
+
+/* Choose one configuration from configuration space defined by PARAMS
+ The configuration chosen is that obtained fixing in this order:
+ first access
+ first format
+ first subformat
+ min channels
+ min rate
+ min period time
+ max buffer size
+ min tick time
+*/
+static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int err;
+#ifdef CHOOSE_DEBUG
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr, 0);
+ snd_output_printf(log, "CHOOSE called:\n");
+ snd_pcm_hw_params_dump(params, log);
+#endif
+
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, NULL, 0);
+ if (err < 0)
+ return err;
+#ifdef CHOOSE_DEBUG
+ snd_output_printf(log, "choose done\n");
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_close(log);
+#endif
+ return 0;
+}
+
+#if 0
+static unsigned int snd_pcm_hw_param_count(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
+{
+ if (hw_is_mask(var)) {
+ const snd_mask_t *mask = hw_param_mask_c(params, var);
+ return snd_mask_count(mask);
+ }
+ if (hw_is_interval(var)) {
+ const snd_interval_t *i = hw_param_interval_c(params, var);
+ return snd_interval_max(i) - snd_interval_min(i) + 1;
+ }
+ assert(0);
+ return 0;
+}
+#endif
+
+int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src)
+{
+ int changed = 0;
+ if (hw_is_mask(var)) {
+ snd_mask_t *d = hw_param_mask(params, var);
+ const snd_mask_t *s = hw_param_mask_c(src, var);
+ changed = snd_mask_refine(d, s);
+ } else if (hw_is_interval(var)) {
+ snd_interval_t *d = hw_param_interval(params, var);
+ const snd_interval_t *s = hw_param_interval_c(src, var);
+ changed = snd_interval_refine(d, s);
+ } else
+ return 0; /* NOP / reserved */
+ if (changed) {
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ }
+ return changed;
+}
+
+#if 0
+static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src)
+{
+ if (hw_is_mask(var)) {
+ snd_mask_t *d = hw_param_mask(params, var);
+ const snd_mask_t *s = hw_param_mask_c(src, var);
+ snd_mask_copy(d, s);
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ return;
+ }
+ if (hw_is_interval(var)) {
+ snd_interval_t *d = hw_param_interval(params, var);
+ const snd_interval_t *s = hw_param_interval_c(src, var);
+ snd_interval_copy(d, s);
+ params->cmask |= 1 << var;
+ params->rmask |= 1 << var;
+ return;
+ }
+ assert(0);
+}
+#endif
+
+void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var, snd_output_t *out)
+{
+ if (hw_is_mask(var)) {
+ const snd_mask_t *mask = hw_param_mask_c(params, var);
+ if (snd_mask_empty(mask))
+ snd_output_puts(out, " NONE");
+ else if (snd_mask_full(mask))
+ snd_output_puts(out, " ALL");
+ else {
+ unsigned int k;
+ for (k = 0; k <= SND_MASK_MAX; ++k) {
+ if (snd_mask_test(mask, k)) {
+ const char *s;
+ switch (var) {
+ case SND_PCM_HW_PARAM_ACCESS:
+ s = snd_pcm_access_name(k);
+ break;
+ case SND_PCM_HW_PARAM_FORMAT:
+ s = snd_pcm_format_name(k);
+ break;
+ case SND_PCM_HW_PARAM_SUBFORMAT:
+ s = snd_pcm_subformat_name(k);
+ break;
+ default:
+ assert(0);
+ s = NULL;
+ }
+ if (s) {
+ snd_output_putc(out, ' ');
+ snd_output_puts(out, s);
+ }
+ }
+ }
+ }
+ return;
+ }
+ if (hw_is_interval(var)) {
+ snd_interval_print(hw_param_interval_c(params, var), out);
+ return;
+ }
+ assert(0);
+}
+
+#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
+
+static const char *const snd_pcm_hw_param_names[] = {
+ HW_PARAM(ACCESS),
+ HW_PARAM(FORMAT),
+ HW_PARAM(SUBFORMAT),
+ HW_PARAM(SAMPLE_BITS),
+ HW_PARAM(FRAME_BITS),
+ HW_PARAM(CHANNELS),
+ HW_PARAM(RATE),
+ HW_PARAM(PERIOD_TIME),
+ HW_PARAM(PERIOD_SIZE),
+ HW_PARAM(PERIOD_BYTES),
+ HW_PARAM(PERIODS),
+ HW_PARAM(BUFFER_TIME),
+ HW_PARAM(BUFFER_SIZE),
+ HW_PARAM(BUFFER_BYTES),
+ HW_PARAM(TICK_TIME),
+};
+
+const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param)
+{
+ assert(param <= SND_PCM_HW_PARAM_LAST_INTERVAL);
+ return snd_pcm_hw_param_names[param];
+}
+
+#if 0
+/* Strategies */
+
+struct _snd_pcm_hw_strategy {
+ unsigned int badness_min, badness_max;
+ int (*choose_param)(const snd_pcm_hw_params_t *params,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_t *strategy);
+ int (*next_value)(snd_pcm_hw_params_t *params,
+ unsigned int param,
+ int value, int *dir,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_t *strategy);
+ int (*min_badness)(const snd_pcm_hw_params_t *params,
+ unsigned int max_badness,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_t *strategy);
+ void *private_data;
+ void (*free)(snd_pcm_hw_strategy_t *strategy);
+};
+
+/* Independent badness */
+typedef struct _snd_pcm_hw_strategy_simple snd_pcm_hw_strategy_simple_t;
+
+struct _snd_pcm_hw_strategy_simple {
+ int valid;
+ unsigned int order;
+ int (*next_value)(snd_pcm_hw_params_t *params,
+ unsigned int param,
+ int value, int *dir,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par);
+ unsigned int (*min_badness)(const snd_pcm_hw_params_t *params,
+ unsigned int param,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par);
+ void *private_data;
+ void (*free)(snd_pcm_hw_strategy_simple_t *strategy);
+};
+
+typedef struct _snd_pcm_hw_strategy_simple_near {
+ int best;
+ unsigned int mul;
+} snd_pcm_hw_strategy_simple_near_t;
+
+typedef struct _snd_pcm_hw_strategy_simple_choices {
+ unsigned int count;
+ /* choices need to be sorted on ascending badness */
+ snd_pcm_hw_strategy_simple_choices_list_t *choices;
+} snd_pcm_hw_strategy_simple_choices_t;
+
+int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_strategy_t *strategy,
+ unsigned int badness_min,
+ unsigned int badness_max)
+{
+ snd_pcm_hw_params_t best_params;
+ int var;
+ int value, dir;
+ unsigned int best_badness;
+ int badness = strategy->min_badness(params, badness_max, pcm, strategy);
+ snd_pcm_hw_params_t params1;
+#if 0
+ printf("\nBadness: %d\n", badness);
+ snd_pcm_hw_params_dump(params, stdout);
+#endif
+ if (badness < 0)
+ return badness;
+ if ((unsigned int)badness > badness_min)
+ badness_min = badness_min;
+ var = strategy->choose_param(params, pcm, strategy);
+ if (var < 0)
+ return badness;
+ best_badness = UINT_MAX;
+ value = -1;
+ while (1) {
+ params1 = *params;
+ value = strategy->next_value(&params1, var, value, &dir, pcm, strategy);
+ if (value < 0)
+ break;
+ badness = snd_pcm_hw_params_strategy(pcm, &params1, strategy, badness_min, badness_max);
+ if (badness >= 0) {
+ if ((unsigned int) badness <= badness_min) {
+ *params = params1;
+ return badness;
+ }
+ best_badness = badness;
+ best_params = params1;
+ badness_max = badness - 1;
+ }
+ }
+ if (best_badness == UINT_MAX) {
+ return -EINVAL;
+ }
+ *params = best_params;
+ return best_badness;
+}
+
+void snd_pcm_hw_strategy_simple_free(snd_pcm_hw_strategy_t *strategy)
+{
+ snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
+ int k;
+ for (k = 0; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; ++k) {
+ if (pars[k].valid && pars[k].free)
+ pars[k].free(&pars[k]);
+ }
+ free(pars);
+}
+
+int snd_pcm_hw_strategy_simple_choose_param(const snd_pcm_hw_params_t *params,
+ snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ const snd_pcm_hw_strategy_t *strategy)
+{
+ snd_pcm_hw_param_t var;
+ int best_var = -1;
+ const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
+ unsigned int min_choices = UINT_MAX;
+ unsigned int min_order = UINT_MAX;
+ for (var = 0; var <= SND_PCM_HW_PARAM_LAST_INTERVAL; ++var) {
+ const snd_pcm_hw_strategy_simple_t *p = &pars[var];
+ unsigned int choices;
+ if (!p->valid)
+ continue;
+ choices = snd_pcm_hw_param_count(params, var);
+ if (choices == 1)
+ continue;
+ assert(choices != 0);
+ if (p->order < min_order ||
+ (p->order == min_order &&
+ choices < min_choices)) {
+ min_order = p->order;
+ min_choices = choices;
+ best_var = var;
+ }
+ }
+ return best_var;
+}
+
+int snd_pcm_hw_strategy_simple_next_value(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ int value, int *dir,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_t *strategy)
+{
+ const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
+ assert(pars[var].valid);
+ return pars[var].next_value(params, var, value, dir, pcm, &pars[var]);
+}
+
+
+int snd_pcm_hw_strategy_simple_min_badness(const snd_pcm_hw_params_t *params,
+ unsigned int max_badness,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_t *strategy)
+{
+ snd_pcm_hw_param_t var;
+ unsigned int badness = 0;
+ const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
+ for (var = 0; var <= SND_PCM_HW_PARAM_LAST_INTERVAL; ++var) {
+ unsigned int b;
+ if (!pars[var].valid)
+ continue;
+ b = pars[var].min_badness(params, var, pcm, &pars[var]);
+ if (b > max_badness || max_badness - b < badness)
+ return -E2BIG;
+ badness += b;
+ }
+ return badness;
+}
+
+
+void snd_pcm_hw_strategy_simple_near_free(snd_pcm_hw_strategy_simple_t *par)
+{
+ snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
+ free(p);
+}
+
+unsigned int snd_pcm_hw_strategy_simple_near_min_badness(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par)
+{
+ const snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
+ snd_pcm_hw_params_t params1 = *params;
+ int value = snd_pcm_hw_param_set_near(pcm, &params1, var, p->best, 0);
+ int diff;
+ assert(value >= 0);
+ diff = p->best - value;
+ if (diff < 0)
+ diff = -diff;
+ return diff * p->mul;
+}
+
+int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ int value, int *dir,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par)
+{
+ const snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
+ if (value < 0) {
+ *dir = 0;
+ return snd_pcm_hw_param_set_near(pcm, params, var, p->best, dir);
+ } else
+ return snd_pcm_hw_param_set_next(pcm, params, var, p->best, 0, value, dir);
+}
+
+void snd_pcm_hw_strategy_simple_choices_free(snd_pcm_hw_strategy_simple_t *par)
+{
+ snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
+// free(p->choices);
+ free(p);
+}
+
+unsigned int snd_pcm_hw_strategy_simple_choices_min_badness(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par)
+{
+ const snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
+ unsigned int k;
+ for (k = 0; k < p->count; ++k) {
+ if (snd_pcm_hw_param_set(pcm, (snd_pcm_hw_params_t *) params, SND_TEST, var, p->choices[k].value, 0))
+ return p->choices[k].badness;
+ }
+ assert(0);
+ return UINT_MAX;
+}
+
+int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ int value, int *dir,
+ snd_pcm_t *pcm,
+ const snd_pcm_hw_strategy_simple_t *par)
+{
+ const snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
+ unsigned int k = 0;
+ if (value >= 0) {
+ for (; k < p->count; ++k) {
+ if (p->choices[k].value == (unsigned int) value) {
+ k++;
+ break;
+ }
+ }
+ }
+ for (; k < p->count; ++k) {
+ unsigned int v = p->choices[k].value;
+ int err = snd_pcm_hw_param_set(pcm, params, SND_TRY, var, v, 0);
+ if (err < 0)
+ continue;
+ *dir = 0;
+ return v;
+ }
+ return -1;
+}
+
+void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy)
+{
+ if (strategy->free)
+ strategy->free(strategy);
+ free(strategy);
+}
+
+int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
+ unsigned int badness_min,
+ unsigned int badness_max)
+{
+ snd_pcm_hw_strategy_simple_t *data;
+ snd_pcm_hw_strategy_t *s;
+ assert(strategyp);
+ data = calloc(SND_PCM_HW_PARAM_LAST_INTERVAL + 1, sizeof(*data));
+ if (!data)
+ return -ENOMEM;
+ s = calloc(1, sizeof(*s));
+ if (!s) {
+ free(data);
+ return -ENOMEM;
+ }
+ s->choose_param = snd_pcm_hw_strategy_simple_choose_param;
+ s->next_value = snd_pcm_hw_strategy_simple_next_value;
+ s->min_badness = snd_pcm_hw_strategy_simple_min_badness;
+ s->badness_min = badness_min;
+ s->badness_max = badness_max;
+ s->private_data = data;
+ s->free = snd_pcm_hw_strategy_simple_free;
+ *strategyp = s;
+ return 0;
+}
+
+int snd_pcm_hw_strategy_simple_near(snd_pcm_hw_strategy_t *strategy,
+ int order,
+ snd_pcm_hw_param_t var,
+ unsigned int best,
+ unsigned int mul)
+{
+ snd_pcm_hw_strategy_simple_t *s = strategy->private_data;
+ snd_pcm_hw_strategy_simple_near_t *data;
+ assert(strategy);
+ assert(var <= SND_PCM_HW_PARAM_LAST_INTERVAL);
+ assert(!s->valid);
+ data = calloc(1, sizeof(*data));
+ if (!data)
+ return -ENOMEM;
+ data->best = best;
+ data->mul = mul;
+ s += var;
+ s->order = order;
+ s->valid = 1;
+ s->next_value = snd_pcm_hw_strategy_simple_near_next_value;
+ s->min_badness = snd_pcm_hw_strategy_simple_near_min_badness;
+ s->private_data = data;
+ s->free = snd_pcm_hw_strategy_simple_near_free;
+ return 0;
+}
+
+int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy,
+ int order,
+ snd_pcm_hw_param_t var,
+ unsigned int count,
+ snd_pcm_hw_strategy_simple_choices_list_t *choices)
+{
+ snd_pcm_hw_strategy_simple_t *s = strategy->private_data;
+ snd_pcm_hw_strategy_simple_choices_t *data;
+ assert(strategy);
+ assert(var <= SND_PCM_HW_PARAM_LAST_INTERVAL);
+ assert(!s->valid);
+ data = calloc(1, sizeof(*data));
+ if (!data)
+ return -ENOMEM;
+ data->count = count;
+ data->choices = choices;
+ s += var;
+ s->valid = 1;
+ s->order = order;
+ s->next_value = snd_pcm_hw_strategy_simple_choices_next_value;
+ s->min_badness = snd_pcm_hw_strategy_simple_choices_min_badness;
+ s->private_data = data;
+ s->free = snd_pcm_hw_strategy_simple_choices_free;
+ return 0;
+}
+
+int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *fail,
+ snd_pcm_hw_params_t *success,
+ unsigned int depth,
+ snd_output_t *out)
+{
+ snd_pcm_hw_param_t var;
+ snd_pcm_hw_params_t i;
+ if (depth < 1)
+ return -ENOENT;
+ for (var = 0; var <= SND_PCM_HW_PARAM_LAST_INTERVAL; var++) {
+ int err;
+ i = *success;
+ _snd_pcm_hw_param_copy(&i, var, fail);
+ err = snd_pcm_hw_refine(pcm, &i);
+ if (err == 0 &&
+ snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0)
+ continue;
+ snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var));
+ snd_pcm_hw_param_dump(fail, var, out);
+ snd_output_putc(out, '\n');
+ return 0;
+ }
+ return -ENOENT;
+}
+
+int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *fail,
+ snd_pcm_hw_params_t *success,
+ unsigned int depth,
+ snd_output_t *out)
+{
+ snd_pcm_hw_params_t i, any;
+ int err;
+ snd_pcm_hw_param_t var;
+ int done = 0;
+ assert(pcm && fail);
+ for (var = 0; var <= SND_PCM_HW_PARAM_LAST_INTERVAL; var++) {
+ if (!snd_pcm_hw_param_empty(fail, var))
+ continue;
+ snd_output_printf(out, "%s is empty\n", snd_pcm_hw_param_name(var));
+ done = 1;
+ }
+ if (done)
+ return 0;
+ i = *fail;
+ err = snd_pcm_hw_refine(pcm, &i);
+ if (err == 0) {
+ snd_output_printf(out, "Configuration is virtually correct\n");
+ return 0;
+ }
+ if (!success) {
+ snd_pcm_hw_params_any(pcm, &any);
+ success = &any;
+ }
+ return snd_pcm_hw_params_try_explain_failure1(pcm, fail, success, depth, out);
+}
+
+#endif
+
+typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t;
+
+typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule);
+
+struct _snd_pcm_hw_rule {
+ int var;
+ snd_pcm_hw_rule_func_t func;
+ int deps[4];
+ void *private_data;
+};
+
+static int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ snd_interval_t t;
+ snd_interval_mul(hw_param_interval_c(params, rule->deps[0]),
+ hw_param_interval_c(params, rule->deps[1]), &t);
+ return snd_interval_refine(hw_param_interval(params, rule->var), &t);
+}
+
+static int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ snd_interval_t t;
+ snd_interval_div(hw_param_interval_c(params, rule->deps[0]),
+ hw_param_interval_c(params, rule->deps[1]), &t);
+ return snd_interval_refine(hw_param_interval(params, rule->var), &t);
+}
+
+static int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ snd_interval_t t;
+ snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
+ hw_param_interval_c(params, rule->deps[1]),
+ (unsigned long) rule->private_data, &t);
+ return snd_interval_refine(hw_param_interval(params, rule->var), &t);
+}
+
+static int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ snd_interval_t t;
+ snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
+ (unsigned long) rule->private_data,
+ hw_param_interval_c(params, rule->deps[1]), &t);
+ return snd_interval_refine(hw_param_interval(params, rule->var), &t);
+}
+
+static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ int changed = 0;
+ snd_pcm_format_t k;
+ snd_mask_t *mask = hw_param_mask(params, rule->var);
+ snd_interval_t *i = hw_param_interval(params, rule->deps[0]);
+ for (k = 0; k <= SND_PCM_FORMAT_LAST; k++) {
+ int bits;
+ if (!snd_pcm_format_mask_test(mask, k))
+ continue;
+ bits = snd_pcm_format_physical_width(k);
+ if (bits < 0)
+ continue;
+ if (!snd_interval_test(i, (unsigned int) bits)) {
+ snd_pcm_format_mask_reset(mask, k);
+ if (snd_mask_empty(mask))
+ return -EINVAL;
+ changed = 1;
+ }
+ }
+ return changed;
+}
+
+
+static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
+ const snd_pcm_hw_rule_t *rule)
+{
+ unsigned int min, max;
+ snd_pcm_format_t k;
+ snd_interval_t *i = hw_param_interval(params, rule->var);
+ snd_mask_t *mask = hw_param_mask(params, rule->deps[0]);
+ int c, changed = 0;
+ min = UINT_MAX;
+ max = 0;
+ for (k = 0; k <= SND_PCM_FORMAT_LAST; k++) {
+ int bits;
+ if (!snd_pcm_format_mask_test(mask, k))
+ continue;
+ bits = snd_pcm_format_physical_width(k);
+ if (bits < 0)
+ continue;
+ if (min > (unsigned)bits)
+ min = bits;
+ if (max < (unsigned)bits)
+ max = bits;
+ }
+ c = snd_interval_refine_min(i, min, 0);
+ if (c < 0)
+ return c;
+ if (c)
+ changed = 1;
+ c = snd_interval_refine_max(i, max, 0);
+ if (c < 0)
+ return c;
+ if (c)
+ changed = 1;
+ return changed;
+}
+
+static const snd_pcm_hw_rule_t refine_rules[] = {
+ {
+ .var = SND_PCM_HW_PARAM_FORMAT,
+ .func = snd_pcm_hw_rule_format,
+ .deps = { SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_SAMPLE_BITS,
+ .func = snd_pcm_hw_rule_sample_bits,
+ .deps = { SND_PCM_HW_PARAM_FORMAT,
+ SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_SAMPLE_BITS,
+ .func = snd_pcm_hw_rule_div,
+ .deps = { SND_PCM_HW_PARAM_FRAME_BITS,
+ SND_PCM_HW_PARAM_CHANNELS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_FRAME_BITS,
+ .func = snd_pcm_hw_rule_mul,
+ .deps = { SND_PCM_HW_PARAM_SAMPLE_BITS,
+ SND_PCM_HW_PARAM_CHANNELS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_FRAME_BITS,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
+ SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_FRAME_BITS,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
+ SND_PCM_HW_PARAM_BUFFER_SIZE, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_CHANNELS,
+ .func = snd_pcm_hw_rule_div,
+ .deps = { SND_PCM_HW_PARAM_FRAME_BITS,
+ SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_RATE,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_PERIOD_TIME, -1 },
+ .private_data = (void*) 1000000,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_RATE,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_BUFFER_TIME, -1 },
+ .private_data = (void*) 1000000,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIODS,
+ .func = snd_pcm_hw_rule_div,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
+ .func = snd_pcm_hw_rule_div,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_PERIODS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
+ SND_PCM_HW_PARAM_FRAME_BITS, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIOD_SIZE,
+ .func = snd_pcm_hw_rule_muldivk,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_TIME,
+ SND_PCM_HW_PARAM_RATE, -1 },
+ .private_data = (void*) 1000000,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
+ .func = snd_pcm_hw_rule_mul,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_PERIODS, -1 },
+ .private_data = 0,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
+ SND_PCM_HW_PARAM_FRAME_BITS, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_BUFFER_SIZE,
+ .func = snd_pcm_hw_rule_muldivk,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_TIME,
+ SND_PCM_HW_PARAM_RATE, -1 },
+ .private_data = (void*) 1000000,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIOD_BYTES,
+ .func = snd_pcm_hw_rule_muldivk,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_FRAME_BITS, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_BUFFER_BYTES,
+ .func = snd_pcm_hw_rule_muldivk,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_FRAME_BITS, -1 },
+ .private_data = (void*) 8,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_PERIOD_TIME,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
+ SND_PCM_HW_PARAM_RATE, -1 },
+ .private_data = (void*) 1000000,
+ },
+ {
+ .var = SND_PCM_HW_PARAM_BUFFER_TIME,
+ .func = snd_pcm_hw_rule_mulkdiv,
+ .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
+ SND_PCM_HW_PARAM_RATE, -1 },
+ .private_data = (void*) 1000000,
+ },
+};
+
+#define RULES (sizeof(refine_rules) / sizeof(refine_rules[0]))
+
+static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PARAM_FIRST_MASK + 1] = {
+ [SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK] = {
+ .bits = { 0x1f },
+ },
+ [SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK] = {
+ .bits = { 0x81ffffff, 0xfff},
+ },
+ [SND_PCM_HW_PARAM_SUBFORMAT - SND_PCM_HW_PARAM_FIRST_MASK] = {
+ .bits = { 0x1 },
+ },
+};
+
+static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = {
+ [SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_FRAME_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_CHANNELS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_RATE - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_PERIOD_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 0, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_PERIOD_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 0, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_PERIOD_BYTES - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 0, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_PERIODS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 0, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_BUFFER_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_BUFFER_SIZE - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_BUFFER_BYTES - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 1, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 1, .empty = 0,
+ },
+ [SND_PCM_HW_PARAM_TICK_TIME - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
+ .min = 0, .max = UINT_MAX,
+ .openmin = 0, .openmax = 0, .integer = 0, .empty = 0,
+ },
+};
+
+#if 0
+#define RULES_DEBUG
+#endif
+
+int snd_pcm_hw_refine_soft(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ unsigned int k;
+ snd_interval_t *i;
+ unsigned int rstamps[RULES];
+ unsigned int vstamps[SND_PCM_HW_PARAM_LAST_INTERVAL + 1];
+ unsigned int stamp = 2;
+ int changed, again;
+#ifdef RULES_DEBUG
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr, 0);
+ snd_output_printf(log, "refine_soft '%s' (begin)\n", pcm->name);
+ snd_pcm_hw_params_dump(params, log);
+#endif
+
+ for (k = SND_PCM_HW_PARAM_FIRST_MASK; k <= SND_PCM_HW_PARAM_LAST_MASK; k++) {
+ if (!(params->rmask & (1 << k)))
+ continue;
+ changed = snd_mask_refine(hw_param_mask(params, k),
+ &refine_masks[k - SND_PCM_HW_PARAM_FIRST_MASK]);
+ if (changed)
+ params->cmask |= 1 << k;
+ if (changed < 0)
+ goto _err;
+ }
+
+ for (k = SND_PCM_HW_PARAM_FIRST_INTERVAL; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; k++) {
+ if (!(params->rmask & (1 << k)))
+ continue;
+ changed = snd_interval_refine(hw_param_interval(params, k),
+ &refine_intervals[k - SND_PCM_HW_PARAM_FIRST_INTERVAL]);
+ if (changed)
+ params->cmask |= 1 << k;
+ if (changed < 0)
+ goto _err;
+ }
+
+ for (k = 0; k < RULES; k++)
+ rstamps[k] = 0;
+ for (k = 0; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; k++)
+ vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0;
+ do {
+ again = 0;
+ for (k = 0; k < RULES; k++) {
+ const snd_pcm_hw_rule_t *r = &refine_rules[k];
+ unsigned int d;
+ int doit = 0;
+ for (d = 0; r->deps[d] >= 0; d++) {
+ if (vstamps[r->deps[d]] > rstamps[k]) {
+ doit = 1;
+ break;
+ }
+ }
+ if (!doit)
+ continue;
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "Rule %d (%p): ", k, r->func);
+ if (r->var >= 0) {
+ snd_output_printf(log, "%s=", snd_pcm_hw_param_name(r->var));
+ snd_pcm_hw_param_dump(params, r->var, log);
+ snd_output_puts(log, " -> ");
+ }
+#endif
+ changed = r->func(params, r);
+#ifdef RULES_DEBUG
+ if (r->var >= 0)
+ snd_pcm_hw_param_dump(params, r->var, log);
+ for (d = 0; r->deps[d] >= 0; d++) {
+ snd_output_printf(log, " %s=", snd_pcm_hw_param_name(r->deps[d]));
+ snd_pcm_hw_param_dump(params, r->deps[d], log);
+ }
+ snd_output_putc(log, '\n');
+#endif
+ rstamps[k] = stamp;
+ if (changed && r->var >= 0) {
+ params->cmask |= 1 << r->var;
+ vstamps[r->var] = stamp;
+ again = 1;
+ }
+ if (changed < 0)
+ goto _err;
+ stamp++;
+ }
+ } while (again);
+ if (!params->msbits) {
+ i = hw_param_interval(params, SND_PCM_HW_PARAM_SAMPLE_BITS);
+ if (snd_interval_single(i))
+ params->msbits = snd_interval_value(i);
+ }
+
+ if (!params->rate_den) {
+ i = hw_param_interval(params, SND_PCM_HW_PARAM_RATE);
+ if (snd_interval_single(i)) {
+ params->rate_num = snd_interval_value(i);
+ params->rate_den = 1;
+ }
+ }
+ params->rmask = 0;
+ return 0;
+ _err:
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "refine_soft '%s' (end-%i)\n", pcm->name, changed);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_close(log);
+#endif
+ return changed;
+}
+
+int _snd_pcm_hw_params_refine(snd_pcm_hw_params_t *params,
+ unsigned int vars,
+ const snd_pcm_hw_params_t *src)
+{
+ int changed, err = 0;
+ unsigned int k;
+ for (k = 0; k <= SND_PCM_HW_PARAM_LAST_INTERVAL; ++k) {
+ if (!(vars & (1 << k)))
+ continue;
+ changed = _snd_pcm_hw_param_refine(params, k, src);
+ if (changed < 0)
+ err = changed;
+ }
+ params->info &= src->info;
+ return err;
+}
+
+int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ int (*cprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*cchange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*schange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*srefine)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *sparams))
+
+{
+#ifdef RULES_DEBUG
+ snd_output_t *log;
+#endif
+ snd_pcm_hw_params_t sparams;
+ int err;
+ unsigned int cmask, changed;
+#ifdef RULES_DEBUG
+ snd_output_stdio_attach(&log, stderr, 0);
+#endif
+ err = cprepare(pcm, params);
+ if (err < 0)
+ return err;
+ err = sprepare(pcm, &sparams);
+ if (err < 0) {
+ SNDERR("Slave PCM not usable");
+ return err;
+ }
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "hw_refine_slave - enter '%s'\n", pcm->name);
+#endif
+ do {
+ cmask = params->cmask;
+ params->cmask = 0;
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "schange '%s' (client)\n", pcm->name);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_printf(log, "schange '%s' (slave)\n", pcm->name);
+ snd_pcm_hw_params_dump(&sparams, log);
+#endif
+ err = schange(pcm, params, &sparams);
+ if (err >= 0) {
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "srefine '%s' (client)\n", pcm->name);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_printf(log, "srefine '%s' (slave)\n", pcm->name);
+ snd_pcm_hw_params_dump(&sparams, log);
+#endif
+ err = srefine(pcm, &sparams);
+ if (err < 0) {
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "srefine '%s', err < 0 (%i) (client)\n", pcm->name, err);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_printf(log, "srefine '%s', err < 0 (%i) (slave)\n", pcm->name, err);
+ snd_pcm_hw_params_dump(&sparams, log);
+#endif
+ cchange(pcm, params, &sparams);
+ return err;
+ }
+ } else {
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "schange '%s', err < 0 (%i) (client)\n", pcm->name, err);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_printf(log, "schange '%s', err < 0 (%i) (slave)\n", pcm->name, err);
+ snd_pcm_hw_params_dump(&sparams, log);
+#endif
+ cchange(pcm, params, &sparams);
+ return err;
+ }
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "cchange '%s'\n", pcm->name);
+#endif
+ err = cchange(pcm, params, &sparams);
+ if (err < 0)
+ return err;
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "refine_soft '%s'\n", pcm->name);
+#endif
+ err = snd_pcm_hw_refine_soft(pcm, params);
+ changed = params->cmask;
+ params->cmask |= cmask;
+ if (err < 0)
+ return err;
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "refine_soft ok '%s'\n", pcm->name);
+#endif
+ } while (changed);
+#ifdef RULES_DEBUG
+ snd_output_printf(log, "refine_slave - leave '%s'\n", pcm->name);
+ snd_output_close(log);
+#endif
+ return 0;
+}
+
+int snd_pcm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ int (*cchange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sprepare)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params),
+ int (*schange)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams),
+ int (*sparams)(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *sparams))
+
+{
+ snd_pcm_hw_params_t slave_params;
+ int err;
+ err = sprepare(pcm, &slave_params);
+ assert(err >= 0);
+ err = schange(pcm, params, &slave_params);
+ assert(err >= 0);
+ err = sparams(pcm, &slave_params);
+ if (err < 0)
+ cchange(pcm, params, &slave_params);
+ return err;
+}
+
+static int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+{
+ assert(pcm && params);
+ assert(pcm->setup);
+ params->tstamp_mode = SND_PCM_TSTAMP_NONE;
+ params->period_step = 1;
+ params->sleep_min = 0;
+ params->avail_min = pcm->period_size;
+ params->xfer_align = 1;
+ params->start_threshold = 1;
+ params->stop_threshold = pcm->buffer_size;
+ params->silence_threshold = 0;
+ params->silence_size = 0;
+ params->boundary = pcm->buffer_size;
+ while (params->boundary * 2 <= LONG_MAX - pcm->buffer_size)
+ params->boundary *= 2;
+ return 0;
+}
+
+#if 0
+#define REFINE_DEBUG
+#endif
+
+int snd_pcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int res;
+#ifdef REFINE_DEBUG
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr, 0);
+#endif
+ assert(pcm && params);
+#ifdef REFINE_DEBUG
+ snd_output_printf(log, "REFINE called:\n");
+ snd_pcm_hw_params_dump(params, log);
+#endif
+ res = pcm->ops->hw_refine(pcm->op_arg, params);
+#ifdef REFINE_DEBUG
+ snd_output_printf(log, "refine done - result = %i\n", res);
+ snd_pcm_hw_params_dump(params, log);
+ snd_output_close(log);
+#endif
+ return res;
+}
+
+/* Install one of the configurations present in configuration
+ space defined by PARAMS.
+ The configuration chosen is that obtained fixing in this order:
+ first access
+ first format
+ first subformat
+ min channels
+ min rate
+ min period_size
+ max periods
+ Return 0 on success otherwise a negative error code
+*/
+int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_sw_params_t sw;
+ int fb, min_align;
+ err = snd_pcm_hw_refine(pcm, params);
+ if (err < 0)
+ return err;
+ snd_pcm_hw_params_choose(pcm, params);
+ if (pcm->setup) {
+ err = snd_pcm_hw_free(pcm);
+ if (err < 0)
+ return err;
+ }
+ err = pcm->ops->hw_params(pcm->op_arg, params);
+ if (err < 0)
+ return err;
+
+ pcm->setup = 1;
+ INTERNAL(snd_pcm_hw_params_get_access)(params, &pcm->access);
+ INTERNAL(snd_pcm_hw_params_get_format)(params, &pcm->format);
+ INTERNAL(snd_pcm_hw_params_get_subformat)(params, &pcm->subformat);
+ INTERNAL(snd_pcm_hw_params_get_channels)(params, &pcm->channels);
+ INTERNAL(snd_pcm_hw_params_get_rate)(params, &pcm->rate, 0);
+ INTERNAL(snd_pcm_hw_params_get_period_time)(params, &pcm->period_time, 0);
+ INTERNAL(snd_pcm_hw_params_get_period_size)(params, &pcm->period_size, 0);
+ INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &pcm->buffer_size);
+ pcm->sample_bits = snd_pcm_format_physical_width(pcm->format);
+ pcm->frame_bits = pcm->sample_bits * pcm->channels;
+ fb = pcm->frame_bits;
+ min_align = 1;
+ while (fb % 8) {
+ fb *= 2;
+ min_align *= 2;
+ }
+ pcm->min_align = min_align;
+
+ pcm->hw_flags = params->flags;
+ pcm->info = params->info;
+ pcm->msbits = params->msbits;
+ pcm->rate_num = params->rate_num;
+ pcm->rate_den = params->rate_den;
+ pcm->fifo_size = params->fifo_size;
+
+ /* Default sw params */
+ memset(&sw, 0, sizeof(sw));
+ snd_pcm_sw_params_default(pcm, &sw);
+ err = snd_pcm_sw_params(pcm, &sw);
+ assert(err >= 0);
+
+ if (pcm->mmap_rw ||
+ pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
+ pcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED ||
+ pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) {
+ err = snd_pcm_mmap(pcm);
+ }
+ if (err < 0)
+ return err;
+ return 0;
+}
+
diff --git a/alsa-lib/src/pcm/pcm_plug.c b/alsa-lib/src/pcm/pcm_plug.c
new file mode 100644
index 0000000..abd3d43
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_plug.c
@@ -0,0 +1,1304 @@
+/*
+ * \file pcm/pcm_plug.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Route & Volume Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Plug
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_plug = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+enum snd_pcm_plug_route_policy {
+ PLUG_ROUTE_POLICY_NONE,
+ PLUG_ROUTE_POLICY_DEFAULT,
+ PLUG_ROUTE_POLICY_COPY,
+ PLUG_ROUTE_POLICY_AVERAGE,
+ PLUG_ROUTE_POLICY_DUP,
+};
+
+typedef struct {
+ snd_pcm_generic_t gen;
+ snd_pcm_t *req_slave;
+ snd_pcm_format_t sformat;
+ int schannels;
+ int srate;
+ const snd_config_t *rate_converter;
+ enum snd_pcm_plug_route_policy route_policy;
+ snd_pcm_route_ttable_entry_t *ttable;
+ int ttable_ok, ttable_last;
+ unsigned int tt_ssize, tt_cused, tt_sused;
+} snd_pcm_plug_t;
+
+#endif
+
+static int snd_pcm_plug_close(snd_pcm_t *pcm)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err, result = 0;
+ free(plug->ttable);
+ assert(plug->gen.slave == plug->req_slave);
+ if (plug->gen.close_slave) {
+ snd_pcm_unlink_hw_ptr(pcm, plug->req_slave);
+ snd_pcm_unlink_appl_ptr(pcm, plug->req_slave);
+ err = snd_pcm_close(plug->req_slave);
+ if (err < 0)
+ result = err;
+ }
+ free(plug);
+ return result;
+}
+
+static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_pcm_t *slave = plug->req_slave;
+ int err;
+
+ if ((err = snd_pcm_info(slave, info)) < 0)
+ return err;
+ return 0;
+}
+
+static const snd_pcm_format_t linear_preferred_formats[] = {
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S16_LE,
+ SND_PCM_FORMAT_U16_LE,
+ SND_PCM_FORMAT_S16_BE,
+ SND_PCM_FORMAT_U16_BE,
+#else
+ SND_PCM_FORMAT_S16_BE,
+ SND_PCM_FORMAT_U16_BE,
+ SND_PCM_FORMAT_S16_LE,
+ SND_PCM_FORMAT_U16_LE,
+#endif
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S32_LE,
+ SND_PCM_FORMAT_U32_LE,
+ SND_PCM_FORMAT_S32_BE,
+ SND_PCM_FORMAT_U32_BE,
+#else
+ SND_PCM_FORMAT_S32_BE,
+ SND_PCM_FORMAT_U32_BE,
+ SND_PCM_FORMAT_S32_LE,
+ SND_PCM_FORMAT_U32_LE,
+#endif
+ SND_PCM_FORMAT_S8,
+ SND_PCM_FORMAT_U8,
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_FLOAT_LE,
+ SND_PCM_FORMAT_FLOAT64_LE,
+ SND_PCM_FORMAT_FLOAT_BE,
+ SND_PCM_FORMAT_FLOAT64_BE,
+#else
+ SND_PCM_FORMAT_FLOAT_BE,
+ SND_PCM_FORMAT_FLOAT64_BE,
+ SND_PCM_FORMAT_FLOAT_LE,
+ SND_PCM_FORMAT_FLOAT64_LE,
+#endif
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S24_LE,
+ SND_PCM_FORMAT_U24_LE,
+ SND_PCM_FORMAT_S24_BE,
+ SND_PCM_FORMAT_U24_BE,
+#else
+ SND_PCM_FORMAT_S24_BE,
+ SND_PCM_FORMAT_U24_BE,
+ SND_PCM_FORMAT_S24_LE,
+ SND_PCM_FORMAT_U24_LE,
+#endif
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S24_3LE,
+ SND_PCM_FORMAT_U24_3LE,
+ SND_PCM_FORMAT_S24_3BE,
+ SND_PCM_FORMAT_U24_3BE,
+#else
+ SND_PCM_FORMAT_S24_3BE,
+ SND_PCM_FORMAT_U24_3BE,
+ SND_PCM_FORMAT_S24_3LE,
+ SND_PCM_FORMAT_U24_3LE,
+#endif
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S20_3LE,
+ SND_PCM_FORMAT_U20_3LE,
+ SND_PCM_FORMAT_S20_3BE,
+ SND_PCM_FORMAT_U20_3BE,
+#else
+ SND_PCM_FORMAT_S20_3BE,
+ SND_PCM_FORMAT_U20_3BE,
+ SND_PCM_FORMAT_S20_3LE,
+ SND_PCM_FORMAT_U20_3LE,
+#endif
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_S18_3LE,
+ SND_PCM_FORMAT_U18_3LE,
+ SND_PCM_FORMAT_S18_3BE,
+ SND_PCM_FORMAT_U18_3BE,
+#else
+ SND_PCM_FORMAT_S18_3BE,
+ SND_PCM_FORMAT_U18_3BE,
+ SND_PCM_FORMAT_S18_3LE,
+ SND_PCM_FORMAT_U18_3LE,
+#endif
+};
+
+#if defined(BUILD_PCM_PLUGIN_MULAW) || \
+ defined(BUILD_PCM_PLUGIN_ALAW) || \
+ defined(BUILD_PCM_PLUGIN_ADPCM)
+#define BUILD_PCM_NONLINEAR
+#endif
+
+#ifdef BUILD_PCM_NONLINEAR
+static const snd_pcm_format_t nonlinear_preferred_formats[] = {
+#ifdef BUILD_PCM_PLUGIN_MULAW
+ SND_PCM_FORMAT_MU_LAW,
+#endif
+#ifdef BUILD_PCM_PLUGIN_ALAW
+ SND_PCM_FORMAT_A_LAW,
+#endif
+#ifdef BUILD_PCM_PLUGIN_ADPCM
+ SND_PCM_FORMAT_IMA_ADPCM,
+#endif
+};
+#endif
+
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+static const snd_pcm_format_t float_preferred_formats[] = {
+#ifdef SND_LITTLE_ENDIAN
+ SND_PCM_FORMAT_FLOAT_LE,
+ SND_PCM_FORMAT_FLOAT64_LE,
+ SND_PCM_FORMAT_FLOAT_BE,
+ SND_PCM_FORMAT_FLOAT64_BE,
+#else
+ SND_PCM_FORMAT_FLOAT_BE,
+ SND_PCM_FORMAT_FLOAT64_BE,
+ SND_PCM_FORMAT_FLOAT_LE,
+ SND_PCM_FORMAT_FLOAT64_LE,
+#endif
+};
+#endif
+
+static const char linear_format_widths[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 1, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1,
+};
+
+static int check_linear_format(const snd_pcm_format_mask_t *format_mask, int wid, int sgn, int ed)
+{
+ int e, s;
+ if (! linear_format_widths[wid - 1])
+ return SND_PCM_FORMAT_UNKNOWN;
+ for (e = 0; e < 2; e++) {
+ for (s = 0; s < 2; s++) {
+ int pw = ((wid + 7) / 8) * 8;
+ for (; pw <= 32; pw += 8) {
+ snd_pcm_format_t f;
+ f = snd_pcm_build_linear_format(wid, pw, sgn, ed);
+ if (f != SND_PCM_FORMAT_UNKNOWN &&
+ snd_pcm_format_mask_test(format_mask, f))
+ return f;
+ }
+ sgn = !sgn;
+ }
+ ed = !ed;
+ }
+ return SND_PCM_FORMAT_UNKNOWN;
+}
+
+static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const snd_pcm_format_mask_t *format_mask)
+{
+ int w, w1, u, e;
+ snd_pcm_format_t f;
+ snd_pcm_format_mask_t lin = { SND_PCM_FMTBIT_LINEAR };
+ snd_pcm_format_mask_t fl = {
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+ SND_PCM_FMTBIT_FLOAT
+#else
+ { 0 }
+#endif
+ };
+ if (snd_pcm_format_mask_test(format_mask, format))
+ return format;
+ if (!snd_pcm_format_mask_test(&lin, format) &&
+ !snd_pcm_format_mask_test(&fl, format)) {
+ unsigned int i;
+ switch (format) {
+#ifdef BUILD_PCM_PLUGIN_MULAW
+ case SND_PCM_FORMAT_MU_LAW:
+#endif
+#ifdef BUILD_PCM_PLUGIN_ALAW
+ case SND_PCM_FORMAT_A_LAW:
+#endif
+#ifdef BUILD_PCM_PLUGIN_ADPCM
+ case SND_PCM_FORMAT_IMA_ADPCM:
+#endif
+ for (i = 0; i < sizeof(linear_preferred_formats) / sizeof(linear_preferred_formats[0]); ++i) {
+ snd_pcm_format_t f = linear_preferred_formats[i];
+ if (snd_pcm_format_mask_test(format_mask, f))
+ return f;
+ }
+ /* Fall through */
+ default:
+ return SND_PCM_FORMAT_UNKNOWN;
+ }
+
+ }
+ snd_mask_intersect(&lin, format_mask);
+ snd_mask_intersect(&fl, format_mask);
+ if (snd_mask_empty(&lin) && snd_mask_empty(&fl)) {
+#ifdef BUILD_PCM_NONLINEAR
+ unsigned int i;
+ for (i = 0; i < sizeof(nonlinear_preferred_formats) / sizeof(nonlinear_preferred_formats[0]); ++i) {
+ snd_pcm_format_t f = nonlinear_preferred_formats[i];
+ if (snd_pcm_format_mask_test(format_mask, f))
+ return f;
+ }
+#endif
+ return SND_PCM_FORMAT_UNKNOWN;
+ }
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+ if (snd_pcm_format_float(format)) {
+ if (snd_pcm_format_mask_test(&fl, format)) {
+ unsigned int i;
+ for (i = 0; i < sizeof(float_preferred_formats) / sizeof(float_preferred_formats[0]); ++i) {
+ snd_pcm_format_t f = float_preferred_formats[i];
+ if (snd_pcm_format_mask_test(format_mask, f))
+ return f;
+ }
+ }
+ w = 32;
+ u = 0;
+ e = snd_pcm_format_big_endian(format);
+ } else
+#endif
+ if (snd_mask_empty(&lin)) {
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+ unsigned int i;
+ for (i = 0; i < sizeof(float_preferred_formats) / sizeof(float_preferred_formats[0]); ++i) {
+ snd_pcm_format_t f = float_preferred_formats[i];
+ if (snd_pcm_format_mask_test(format_mask, f))
+ return f;
+ }
+#endif
+ return SND_PCM_FORMAT_UNKNOWN;
+ } else {
+ w = snd_pcm_format_width(format);
+ u = snd_pcm_format_unsigned(format);
+ e = snd_pcm_format_big_endian(format);
+ }
+ for (w1 = w; w1 <= 32; w1++) {
+ f = check_linear_format(format_mask, w1, u, e);
+ if (f != SND_PCM_FORMAT_UNKNOWN)
+ return f;
+ }
+ for (w1 = w - 1; w1 > 0; w1--) {
+ f = check_linear_format(format_mask, w1, u, e);
+ if (f != SND_PCM_FORMAT_UNKNOWN)
+ return f;
+ }
+ return SND_PCM_FORMAT_UNKNOWN;
+}
+
+static void snd_pcm_plug_clear(snd_pcm_t *pcm)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_pcm_t *slave = plug->req_slave;
+ /* Clear old plugins */
+ if (plug->gen.slave != slave) {
+ snd_pcm_unlink_hw_ptr(pcm, plug->gen.slave);
+ snd_pcm_unlink_appl_ptr(pcm, plug->gen.slave);
+ snd_pcm_close(plug->gen.slave);
+ plug->gen.slave = slave;
+ pcm->fast_ops = slave->fast_ops;
+ pcm->fast_op_arg = slave->fast_op_arg;
+ }
+}
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ snd_pcm_access_t access;
+ snd_pcm_format_t format;
+ unsigned int channels;
+ unsigned int rate;
+} snd_pcm_plug_params_t;
+#endif
+
+#ifdef BUILD_PCM_PLUGIN_RATE
+static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err;
+ if (clt->rate == slv->rate)
+ return 0;
+ assert(snd_pcm_format_linear(slv->format));
+ err = snd_pcm_rate_open(new, NULL, slv->format, slv->rate, plug->rate_converter,
+ plug->gen.slave, plug->gen.slave != plug->req_slave);
+ if (err < 0)
+ return err;
+ slv->access = clt->access;
+ slv->rate = clt->rate;
+ if (snd_pcm_format_linear(clt->format))
+ slv->format = clt->format;
+ return 1;
+}
+#endif
+
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ unsigned int tt_ssize, tt_cused, tt_sused;
+ snd_pcm_route_ttable_entry_t *ttable;
+ int err;
+ if (clt->channels == slv->channels &&
+ (!plug->ttable || !plug->ttable_last))
+ return 0;
+ if (clt->rate != slv->rate &&
+ clt->channels > slv->channels)
+ return 0;
+ assert(snd_pcm_format_linear(slv->format));
+ tt_ssize = slv->channels;
+ tt_cused = clt->channels;
+ tt_sused = slv->channels;
+ ttable = alloca(tt_cused * tt_sused * sizeof(*ttable));
+ if (plug->ttable) { /* expand or shrink table */
+ unsigned int c = 0, s = 0;
+ for (c = 0; c < tt_cused; c++) {
+ for (s = 0; s < tt_sused; s++) {
+ snd_pcm_route_ttable_entry_t v;
+ if (c >= plug->tt_cused)
+ v = 0;
+ else if (s >= plug->tt_sused)
+ v = 0;
+ else
+ v = plug->ttable[c * plug->tt_ssize + s];
+ ttable[c * tt_ssize + s] = v;
+ }
+ }
+ plug->ttable_ok = 1;
+ } else {
+ unsigned int k;
+ unsigned int c = 0, s = 0;
+ enum snd_pcm_plug_route_policy rpolicy = plug->route_policy;
+ int n;
+ for (k = 0; k < tt_cused * tt_sused; ++k)
+ ttable[k] = 0;
+ if (rpolicy == PLUG_ROUTE_POLICY_DEFAULT) {
+ rpolicy = PLUG_ROUTE_POLICY_COPY;
+ /* it's hack for mono conversion */
+ if (clt->channels == 1 || slv->channels == 1)
+ rpolicy = PLUG_ROUTE_POLICY_AVERAGE;
+ }
+ switch (rpolicy) {
+ case PLUG_ROUTE_POLICY_AVERAGE:
+ case PLUG_ROUTE_POLICY_DUP:
+ if (clt->channels > slv->channels) {
+ n = clt->channels;
+ } else {
+ n = slv->channels;
+ }
+ while (n-- > 0) {
+ snd_pcm_route_ttable_entry_t v = SND_PCM_PLUGIN_ROUTE_FULL;
+ if (rpolicy == PLUG_ROUTE_POLICY_AVERAGE) {
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK &&
+ clt->channels > slv->channels) {
+ int srcs = clt->channels / slv->channels;
+ if (s < clt->channels % slv->channels)
+ srcs++;
+ v /= srcs;
+ } else if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
+ slv->channels > clt->channels) {
+ int srcs = slv->channels / clt->channels;
+ if (s < slv->channels % clt->channels)
+ srcs++;
+ v /= srcs;
+ }
+ }
+ ttable[c * tt_ssize + s] = v;
+ if (++c == clt->channels)
+ c = 0;
+ if (++s == slv->channels)
+ s = 0;
+ }
+ break;
+ case PLUG_ROUTE_POLICY_COPY:
+ if (clt->channels < slv->channels) {
+ n = clt->channels;
+ } else {
+ n = slv->channels;
+ }
+ for (c = 0; (int)c < n; c++)
+ ttable[c * tt_ssize + c] = SND_PCM_PLUGIN_ROUTE_FULL;
+ break;
+ default:
+ SNDERR("Invalid route policy");
+ break;
+ }
+ }
+ err = snd_pcm_route_open(new, NULL, slv->format, (int) slv->channels, ttable, tt_ssize, tt_cused, tt_sused, plug->gen.slave, plug->gen.slave != plug->req_slave);
+ if (err < 0)
+ return err;
+ slv->channels = clt->channels;
+ slv->access = clt->access;
+ if (snd_pcm_format_linear(clt->format))
+ slv->format = clt->format;
+ return 1;
+}
+#endif
+
+static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err;
+ snd_pcm_format_t cfmt;
+ int (*f)(snd_pcm_t **_pcm, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
+
+ /* No conversion is needed */
+ if (clt->format == slv->format &&
+ clt->rate == slv->rate &&
+ clt->channels == clt->channels)
+ return 0;
+
+ if (snd_pcm_format_linear(slv->format)) {
+ /* Conversion is done in another plugin */
+ if (clt->rate != slv->rate ||
+ clt->channels != slv->channels)
+ return 0;
+ cfmt = clt->format;
+ switch (clt->format) {
+#ifdef BUILD_PCM_PLUGIN_MULAW
+ case SND_PCM_FORMAT_MU_LAW:
+ f = snd_pcm_mulaw_open;
+ break;
+#endif
+#ifdef BUILD_PCM_PLUGIN_ALAW
+ case SND_PCM_FORMAT_A_LAW:
+ f = snd_pcm_alaw_open;
+ break;
+#endif
+#ifdef BUILD_PCM_PLUGIN_ADPCM
+ case SND_PCM_FORMAT_IMA_ADPCM:
+ f = snd_pcm_adpcm_open;
+ break;
+#endif
+ default:
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+ if (snd_pcm_format_float(clt->format))
+ f = snd_pcm_lfloat_open;
+
+ else
+#endif
+ f = snd_pcm_linear_open;
+ break;
+ }
+#ifdef BUILD_PCM_PLUGIN_LFLOAT
+ } else if (snd_pcm_format_float(slv->format)) {
+ /* Conversion is done in another plugin */
+ if (clt->format == slv->format &&
+ clt->rate == slv->rate &&
+ clt->channels == slv->channels)
+ return 0;
+ cfmt = clt->format;
+ if (snd_pcm_format_linear(clt->format))
+ f = snd_pcm_lfloat_open;
+ else
+ return -EINVAL;
+#endif
+#ifdef BUILD_PCM_NONLINEAR
+ } else {
+ switch (slv->format) {
+#ifdef BUILD_PCM_PLUGIN_MULAW
+ case SND_PCM_FORMAT_MU_LAW:
+ f = snd_pcm_mulaw_open;
+ break;
+#endif
+#ifdef BUILD_PCM_PLUGIN_ALAW
+ case SND_PCM_FORMAT_A_LAW:
+ f = snd_pcm_alaw_open;
+ break;
+#endif
+#ifdef BUILD_PCM_PLUGIN_ADPCM
+ case SND_PCM_FORMAT_IMA_ADPCM:
+ f = snd_pcm_adpcm_open;
+ break;
+#endif
+ default:
+ return -EINVAL;
+ }
+ if (snd_pcm_format_linear(clt->format))
+ cfmt = clt->format;
+ else
+ cfmt = SND_PCM_FORMAT_S16;
+#endif /* NONLINEAR */
+ }
+ err = f(new, NULL, slv->format, plug->gen.slave, plug->gen.slave != plug->req_slave);
+ if (err < 0)
+ return err;
+ slv->format = cfmt;
+ slv->access = clt->access;
+ return 1;
+}
+
+static int snd_pcm_plug_change_access(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err;
+ if (clt->access == slv->access)
+ return 0;
+ err = snd_pcm_copy_open(new, NULL, plug->gen.slave, plug->gen.slave != plug->req_slave);
+ if (err < 0)
+ return err;
+ slv->access = clt->access;
+ return 1;
+}
+
+#ifdef BUILD_PCM_PLUGIN_MMAP_EMUL
+static int snd_pcm_plug_change_mmap(snd_pcm_t *pcm, snd_pcm_t **new,
+ snd_pcm_plug_params_t *clt,
+ snd_pcm_plug_params_t *slv)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err;
+
+ if (clt->access == slv->access)
+ return 0;
+
+ switch (slv->access) {
+ case SND_PCM_ACCESS_MMAP_INTERLEAVED:
+ case SND_PCM_ACCESS_MMAP_NONINTERLEAVED:
+ case SND_PCM_ACCESS_MMAP_COMPLEX:
+ return 0;
+ default:
+ break;
+ }
+
+ err = __snd_pcm_mmap_emul_open(new, NULL, plug->gen.slave,
+ plug->gen.slave != plug->req_slave);
+ if (err < 0)
+ return err;
+ slv->access = clt->access;
+ return 1;
+}
+#endif
+
+static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
+ snd_pcm_plug_params_t *client,
+ snd_pcm_plug_params_t *slave)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ static int (*const funcs[])(snd_pcm_t *_pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
+#ifdef BUILD_PCM_PLUGIN_MMAP_EMUL
+ snd_pcm_plug_change_mmap,
+#endif
+ snd_pcm_plug_change_format,
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+ snd_pcm_plug_change_channels,
+#endif
+#ifdef BUILD_PCM_PLUGIN_RATE
+ snd_pcm_plug_change_rate,
+#endif
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+ snd_pcm_plug_change_channels,
+#endif
+ snd_pcm_plug_change_format,
+ snd_pcm_plug_change_access
+ };
+ snd_pcm_plug_params_t p = *slave;
+ unsigned int k = 0;
+ plug->ttable_ok = plug->ttable_last = 0;
+ while (client->format != p.format ||
+ client->channels != p.channels ||
+ client->rate != p.rate ||
+ client->access != p.access) {
+ snd_pcm_t *new;
+ int err;
+ if (k >= sizeof(funcs)/sizeof(*funcs))
+ return -EINVAL;
+ err = funcs[k](pcm, &new, client, &p);
+ if (err < 0) {
+ snd_pcm_plug_clear(pcm);
+ return err;
+ }
+ if (err) {
+ plug->gen.slave = new;
+ pcm->fast_ops = new->fast_ops;
+ pcm->fast_op_arg = new->fast_op_arg;
+ }
+ k++;
+ }
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+ /* it's exception, user specified ttable, but no reduction/expand */
+ if (plug->ttable && !plug->ttable_ok) {
+ snd_pcm_t *new;
+ int err;
+ plug->ttable_last = 1;
+ err = snd_pcm_plug_change_channels(pcm, &new, client, &p);
+ if (err < 0) {
+ snd_pcm_plug_clear(pcm);
+ return err;
+ }
+ assert(err);
+ assert(plug->ttable_ok);
+ plug->gen.slave = new;
+ pcm->fast_ops = new->fast_ops;
+ pcm->fast_op_arg = new->fast_op_arg;
+ }
+#endif
+ return 0;
+}
+
+static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ unsigned int rate_min, channels_max;
+ int err;
+
+ /* HACK: to avoid overflow in PARTBIT_RATE code */
+ err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, NULL);
+ if (err < 0)
+ return err;
+ if (rate_min < 4000) {
+ _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, 4000, 0);
+ if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_RATE))
+ return -EINVAL;
+ }
+ /* HACK: to avoid overflow in PERIOD_SIZE code */
+ err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, &channels_max, NULL);
+ if (err < 0)
+ return err;
+ if (channels_max > 10000) {
+ _snd_pcm_hw_param_set_max(params, SND_PCM_HW_PARAM_CHANNELS, 10000, 0);
+ if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_CHANNELS))
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ int err;
+
+ _snd_pcm_hw_params_any(sparams);
+ if (plug->sformat >= 0) {
+ _snd_pcm_hw_params_set_format(sparams, plug->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ }
+ if (plug->schannels > 0)
+ _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS,
+ plug->schannels, 0);
+ if (plug->srate > 0)
+ _snd_pcm_hw_param_set_minmax(sparams, SND_PCM_HW_PARAM_RATE,
+ plug->srate, 0, plug->srate + 1, -1);
+ /* reduce the available configurations */
+ err = snd_pcm_hw_refine(plug->req_slave, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int check_access_change(snd_pcm_hw_params_t *cparams,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_access_mask_t *smask;
+#ifdef BUILD_PCM_PLUGIN_MMAP_EMUL
+ const snd_pcm_access_mask_t *cmask;
+ snd_pcm_access_mask_t mask;
+#endif
+
+ smask = (snd_pcm_access_mask_t *)
+ snd_pcm_hw_param_get_mask(sparams,
+ SND_PCM_HW_PARAM_ACCESS);
+ if (snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_MMAP_INTERLEAVED) ||
+ snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED) ||
+ snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_MMAP_COMPLEX))
+ return 0; /* OK, we have mmap support */
+#ifdef BUILD_PCM_PLUGIN_MMAP_EMUL
+ /* no mmap support - we need mmap emulation */
+ cmask = (const snd_pcm_access_mask_t *)
+ snd_pcm_hw_param_get_mask(cparams,
+ SND_PCM_HW_PARAM_ACCESS);
+ snd_mask_none(&mask);
+ if (snd_pcm_access_mask_test(cmask, SND_PCM_ACCESS_RW_INTERLEAVED) ||
+ snd_pcm_access_mask_test(cmask, SND_PCM_ACCESS_MMAP_INTERLEAVED))
+ snd_pcm_access_mask_set(&mask,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (snd_pcm_access_mask_test(cmask, SND_PCM_ACCESS_RW_NONINTERLEAVED) ||
+ snd_pcm_access_mask_test(cmask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED))
+ snd_pcm_access_mask_set(&mask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ *smask = mask;
+ return 0;
+#else
+ return -EINVAL;
+#endif
+}
+
+static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_pcm_t *slave = plug->req_slave;
+ unsigned int links = (SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ const snd_pcm_format_mask_t *format_mask, *sformat_mask;
+ snd_pcm_format_mask_t sfmt_mask;
+ int err;
+ snd_pcm_format_t format;
+ snd_interval_t t, buffer_size;
+ const snd_interval_t *srate, *crate;
+
+ if (plug->srate == -2 ||
+ (pcm->mode & SND_PCM_NO_AUTO_RESAMPLE) ||
+ (params->flags & SND_PCM_HW_PARAMS_NORESAMPLE))
+ links |= SND_PCM_HW_PARBIT_RATE;
+ else {
+ err = snd_pcm_hw_param_refine_multiple(slave, sparams, SND_PCM_HW_PARAM_RATE, params);
+ if (err < 0)
+ return err;
+ }
+
+ if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS))
+ links |= SND_PCM_HW_PARBIT_CHANNELS;
+ else {
+ err = snd_pcm_hw_param_refine_near(slave, sparams, SND_PCM_HW_PARAM_CHANNELS, params);
+ if (err < 0)
+ return err;
+ }
+ if (plug->sformat == -2 || (pcm->mode & SND_PCM_NO_AUTO_FORMAT))
+ links |= SND_PCM_HW_PARBIT_FORMAT;
+ else {
+ format_mask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_FORMAT);
+ sformat_mask = snd_pcm_hw_param_get_mask(sparams, SND_PCM_HW_PARAM_FORMAT);
+ snd_mask_none(&sfmt_mask);
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ snd_pcm_format_t f;
+ if (!snd_pcm_format_mask_test(format_mask, format))
+ continue;
+ if (snd_pcm_format_mask_test(sformat_mask, format))
+ f = format;
+ else {
+ f = snd_pcm_plug_slave_format(format, sformat_mask);
+ if (f == SND_PCM_FORMAT_UNKNOWN)
+ continue;
+ }
+ snd_pcm_format_mask_set(&sfmt_mask, f);
+ }
+
+ if (snd_pcm_format_mask_empty(&sfmt_mask)) {
+ SNDERR("Unable to find an usable slave format for '%s'", pcm->name);
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (!snd_pcm_format_mask_test(format_mask, format))
+ continue;
+ SNDERR("Format: %s", snd_pcm_format_name(format));
+ }
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (!snd_pcm_format_mask_test(sformat_mask, format))
+ continue;
+ SNDERR("Slave format: %s", snd_pcm_format_name(format));
+ }
+ return -EINVAL;
+ }
+ err = snd_pcm_hw_param_set_mask(slave, sparams, SND_CHANGE,
+ SND_PCM_HW_PARAM_FORMAT, &sfmt_mask);
+ if (err < 0)
+ return -EINVAL;
+ }
+
+ if (snd_pcm_hw_param_never_eq(params, SND_PCM_HW_PARAM_ACCESS, sparams)) {
+ err = check_access_change(params, sparams);
+ if (err < 0) {
+ SNDERR("Unable to find an usable access for '%s'",
+ pcm->name);
+ return err;
+ }
+ }
+
+ if ((links & SND_PCM_HW_PARBIT_RATE) ||
+ snd_pcm_hw_param_always_eq(params, SND_PCM_HW_PARAM_RATE, sparams))
+ links |= (SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE);
+ else {
+ snd_interval_copy(&buffer_size, snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE));
+ snd_interval_unfloor(&buffer_size);
+ crate = snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_RATE);
+ srate = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_RATE);
+ snd_interval_muldiv(&buffer_size, srate, crate, &t);
+ err = _snd_pcm_hw_param_set_interval(sparams, SND_PCM_HW_PARAM_BUFFER_SIZE, &t);
+ if (err < 0)
+ return err;
+ }
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ unsigned int links = (SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ const snd_pcm_format_mask_t *format_mask, *sformat_mask;
+ snd_pcm_format_mask_t fmt_mask;
+ int err;
+ snd_pcm_format_t format;
+ snd_interval_t t;
+ const snd_interval_t *sbuffer_size;
+ const snd_interval_t *srate, *crate;
+
+ if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS))
+ links |= SND_PCM_HW_PARBIT_CHANNELS;
+
+ if (plug->sformat == -2 || (pcm->mode & SND_PCM_NO_AUTO_FORMAT))
+ links |= SND_PCM_HW_PARBIT_FORMAT;
+ else {
+ format_mask = snd_pcm_hw_param_get_mask(params,
+ SND_PCM_HW_PARAM_FORMAT);
+ sformat_mask = snd_pcm_hw_param_get_mask(sparams,
+ SND_PCM_HW_PARAM_FORMAT);
+ snd_mask_none(&fmt_mask);
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ snd_pcm_format_t f;
+ if (!snd_pcm_format_mask_test(format_mask, format))
+ continue;
+ if (snd_pcm_format_mask_test(sformat_mask, format))
+ f = format;
+ else {
+ f = snd_pcm_plug_slave_format(format, sformat_mask);
+ if (f == SND_PCM_FORMAT_UNKNOWN)
+ continue;
+ }
+ snd_pcm_format_mask_set(&fmt_mask, format);
+ }
+
+ if (snd_pcm_format_mask_empty(&fmt_mask)) {
+ SNDERR("Unable to find an usable client format");
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (!snd_pcm_format_mask_test(format_mask, format))
+ continue;
+ SNDERR("Format: %s", snd_pcm_format_name(format));
+ }
+ for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
+ if (!snd_pcm_format_mask_test(sformat_mask, format))
+ continue;
+ SNDERR("Slave format: %s", snd_pcm_format_name(format));
+ }
+ return -EINVAL;
+ }
+
+ err = _snd_pcm_hw_param_set_mask(params,
+ SND_PCM_HW_PARAM_FORMAT, &fmt_mask);
+ if (err < 0)
+ return err;
+ }
+
+ if (plug->srate == -2 ||
+ (pcm->mode & SND_PCM_NO_AUTO_RESAMPLE) ||
+ (params->flags & SND_PCM_HW_PARAMS_NORESAMPLE))
+ links |= SND_PCM_HW_PARBIT_RATE;
+ else {
+ unsigned int rate_min, srate_min;
+ int rate_mindir, srate_mindir;
+
+ /* This is a temporary hack, waiting for a better solution */
+ err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_min, &srate_mindir);
+ if (err < 0)
+ return err;
+ if (rate_min == srate_min && srate_mindir > rate_mindir) {
+ err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, srate_min, srate_mindir);
+ if (err < 0)
+ return err;
+ }
+ }
+ if ((links & SND_PCM_HW_PARBIT_RATE) ||
+ snd_pcm_hw_param_always_eq(params, SND_PCM_HW_PARAM_RATE, sparams))
+ links |= (SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE);
+ else {
+ sbuffer_size = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_BUFFER_SIZE);
+ crate = snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_RATE);
+ srate = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_RATE);
+ snd_interval_muldiv(sbuffer_size, crate, srate, &t);
+ snd_interval_floor(&t);
+ if (snd_interval_empty(&t))
+ return -EINVAL;
+ err = _snd_pcm_hw_param_set_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &t);
+ if (err < 0)
+ return err;
+ }
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ /* FIXME */
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_plug_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ return snd_pcm_hw_refine(plug->req_slave, params);
+}
+
+static int snd_pcm_plug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_plug_hw_refine_cprepare,
+ snd_pcm_plug_hw_refine_cchange,
+ snd_pcm_plug_hw_refine_sprepare,
+ snd_pcm_plug_hw_refine_schange,
+ snd_pcm_plug_hw_refine_slave);
+}
+
+static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_pcm_t *slave = plug->req_slave;
+ snd_pcm_plug_params_t clt_params, slv_params;
+ snd_pcm_hw_params_t sparams;
+ int err;
+
+ err = snd_pcm_plug_hw_refine_sprepare(pcm, &sparams);
+ if (err < 0)
+ return err;
+ err = snd_pcm_plug_hw_refine_schange(pcm, params, &sparams);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_refine_soft(slave, &sparams);
+ if (err < 0)
+ return err;
+
+ INTERNAL(snd_pcm_hw_params_get_access)(params, &clt_params.access);
+ INTERNAL(snd_pcm_hw_params_get_format)(params, &clt_params.format);
+ INTERNAL(snd_pcm_hw_params_get_channels)(params, &clt_params.channels);
+ INTERNAL(snd_pcm_hw_params_get_rate)(params, &clt_params.rate, 0);
+
+ INTERNAL(snd_pcm_hw_params_get_format)(&sparams, &slv_params.format);
+ INTERNAL(snd_pcm_hw_params_get_channels)(&sparams, &slv_params.channels);
+ INTERNAL(snd_pcm_hw_params_get_rate)(&sparams, &slv_params.rate, 0);
+ snd_pcm_plug_clear(pcm);
+ if (!(clt_params.format == slv_params.format &&
+ clt_params.channels == slv_params.channels &&
+ clt_params.rate == slv_params.rate &&
+ !plug->ttable &&
+ snd_pcm_hw_params_test_access(slave, &sparams,
+ clt_params.access) >= 0)) {
+ INTERNAL(snd_pcm_hw_params_set_access_first)(slave, &sparams, &slv_params.access);
+ err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params);
+ if (err < 0)
+ return err;
+ }
+ slave = plug->gen.slave;
+ err = _snd_pcm_hw_params(slave, params);
+ if (err < 0) {
+ snd_pcm_plug_clear(pcm);
+ return err;
+ }
+ snd_pcm_unlink_hw_ptr(pcm, plug->req_slave);
+ snd_pcm_unlink_appl_ptr(pcm, plug->req_slave);
+ snd_pcm_link_hw_ptr(pcm, slave);
+ snd_pcm_link_appl_ptr(pcm, slave);
+ return 0;
+}
+
+static int snd_pcm_plug_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_pcm_t *slave = plug->gen.slave;
+ int err = snd_pcm_hw_free(slave);
+ snd_pcm_plug_clear(pcm);
+ return err;
+}
+
+static void snd_pcm_plug_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_plug_t *plug = pcm->private_data;
+ snd_output_printf(out, "Plug PCM: ");
+ snd_pcm_dump(plug->gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_plug_ops = {
+ .close = snd_pcm_plug_close,
+ .info = snd_pcm_plug_info,
+ .hw_refine = snd_pcm_plug_hw_refine,
+ .hw_params = snd_pcm_plug_hw_params,
+ .hw_free = snd_pcm_plug_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_plug_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new Plug PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave (destination) format
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_plug_open(snd_pcm_t **pcmp,
+ const char *name,
+ snd_pcm_format_t sformat, int schannels, int srate,
+ const snd_config_t *rate_converter,
+ enum snd_pcm_plug_route_policy route_policy,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_ssize,
+ unsigned int tt_cused, unsigned int tt_sused,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_plug_t *plug;
+ int err;
+ assert(pcmp && slave);
+
+ plug = calloc(1, sizeof(snd_pcm_plug_t));
+ if (!plug)
+ return -ENOMEM;
+ plug->sformat = sformat;
+ plug->schannels = schannels;
+ plug->srate = srate;
+ plug->rate_converter = rate_converter;
+ plug->gen.slave = plug->req_slave = slave;
+ plug->gen.close_slave = close_slave;
+ plug->route_policy = route_policy;
+ plug->ttable = ttable;
+ plug->tt_ssize = tt_ssize;
+ plug->tt_cused = tt_cused;
+ plug->tt_sused = tt_sused;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(plug);
+ return err;
+ }
+ pcm->ops = &snd_pcm_plug_ops;
+ pcm->fast_ops = slave->fast_ops;
+ pcm->fast_op_arg = slave->fast_op_arg;
+ pcm->private_data = plug;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->mmap_shadow = 1;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_link_hw_ptr(pcm, slave);
+ snd_pcm_link_appl_ptr(pcm, slave);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_plug Automatic conversion plugin
+
+This plugin converts channels, rate and format on request.
+
+\code
+pcm.name {
+ type plug # Automatic conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format (default nearest) or "unchanged"
+ [channels INT] # Slave channels (default nearest) or "unchanged"
+ [rate INT] # Slave rate (default nearest) or "unchanged"
+ }
+ route_policy STR # route policy for automatic ttable generation
+ # STR can be 'default', 'average', 'copy', 'duplicate'
+ # average: result is average of input channels
+ # copy: only first channels are copied to destination
+ # duplicate: duplicate first set of channels
+ # default: copy policy, except for mono capture - sum
+ ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
+ CCHANNEL {
+ SCHANNEL REAL # route value (0.0 - 1.0)
+ }
+ }
+ rate_converter STR # type of rate converter
+ # or
+ rate_converter [ STR1 STR2 ... ]
+ # type of rate converter
+ # default value is taken from defaults.pcm.rate_converter
+}
+\endcode
+
+\subsection pcm_plugins_plug_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_plug_open()
+ <LI>_snd_pcm_plug_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Plug PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Plug PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_t *tt = NULL;
+ enum snd_pcm_plug_route_policy route_policy = PLUG_ROUTE_POLICY_DEFAULT;
+ snd_pcm_route_ttable_entry_t *ttable = NULL;
+ unsigned int csize, ssize;
+ unsigned int cused, sused;
+ snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
+ int schannels = -1, srate = -1;
+ const snd_config_t *rate_converter = NULL;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+ if (strcmp(id, "ttable") == 0) {
+ route_policy = PLUG_ROUTE_POLICY_NONE;
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ tt = n;
+ continue;
+ }
+ if (strcmp(id, "route_policy") == 0) {
+ const char *str;
+ if ((err = snd_config_get_string(n, &str)) < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ if (tt != NULL)
+ SNDERR("Table is defined, route policy is ignored");
+ if (!strcmp(str, "default"))
+ route_policy = PLUG_ROUTE_POLICY_DEFAULT;
+ else if (!strcmp(str, "average"))
+ route_policy = PLUG_ROUTE_POLICY_AVERAGE;
+ else if (!strcmp(str, "copy"))
+ route_policy = PLUG_ROUTE_POLICY_COPY;
+ else if (!strcmp(str, "duplicate"))
+ route_policy = PLUG_ROUTE_POLICY_DUP;
+ continue;
+ }
+#endif
+#ifdef BUILD_PCM_PLUGIN_RATE
+ if (strcmp(id, "rate_converter") == 0) {
+ rate_converter = n;
+ continue;
+ }
+#endif
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 3,
+ SND_PCM_HW_PARAM_FORMAT, SCONF_UNCHANGED, &sformat,
+ SND_PCM_HW_PARAM_CHANNELS, SCONF_UNCHANGED, &schannels,
+ SND_PCM_HW_PARAM_RATE, SCONF_UNCHANGED, &srate);
+ if (err < 0)
+ return err;
+#ifdef BUILD_PCM_PLUGIN_ROUTE
+ if (tt) {
+ err = snd_pcm_route_determine_ttable(tt, &csize, &ssize);
+ if (err < 0) {
+ snd_config_delete(sconf);
+ return err;
+ }
+ ttable = malloc(csize * ssize * sizeof(*ttable));
+ if (ttable == NULL) {
+ snd_config_delete(sconf);
+ return err;
+ }
+ err = snd_pcm_route_load_ttable(tt, ttable, csize, ssize, &cused, &sused, -1);
+ if (err < 0) {
+ snd_config_delete(sconf);
+ return err;
+ }
+ }
+#endif
+
+#ifdef BUILD_PCM_PLUGIN_RATE
+ if (! rate_converter)
+ rate_converter = snd_pcm_rate_get_default_converter(root);
+#endif
+
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_plug_open(pcmp, name, sformat, schannels, srate, rate_converter,
+ route_policy, ttable, ssize, cused, sused, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_plugin.c b/alsa-lib/src/pcm/pcm_plugin.c
new file mode 100644
index 0000000..a751deb
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_plugin.c
@@ -0,0 +1,593 @@
+/**
+ * \file pcm/pcm_plugin.c
+ * \ingroup PCM
+ * \brief PCM Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Common plugin code
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*!
+
+\page pcm_plugins PCM (digital audio) plugins
+
+PCM plugins extends functionality and features of PCM devices.
+The plugins take care about various sample conversions, sample
+copying among channels and so on.
+
+\section pcm_plugins_slave Slave definition
+
+The slave plugin can be specified directly with a string or the definition
+can be entered inside a compound configuration node. Some restrictions can
+be also specified (like static rate or count of channels).
+
+\code
+pcm_slave.NAME {
+ pcm STR # PCM name
+ # or
+ pcm { } # PCM definition
+ format STR # Format or "unchanged"
+ channels INT # Count of channels or "unchanged" string
+ rate INT # Rate in Hz or "unchanged" string
+ period_time INT # Period time in us or "unchanged" string
+ buffer_time INT # Buffer time in us or "unchanged" string
+}
+\endcode
+
+Example:
+
+\code
+pcm_slave.slave_rate44100Hz {
+ pcm "hw:0,0"
+ rate 44100
+}
+
+pcm.rate44100Hz {
+ type plug
+ slave slave_rate44100Hz
+}
+\endcode
+
+The equivalent configuration (in one compound):
+
+\code
+pcm.rate44100Hz {
+ type plug
+ slave {
+ pcm "hw:0,0"
+ rate 44100
+ }
+}
+\endcode
+
+*/
+
+#include <limits.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef DOC_HIDDEN
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_undo_read(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ const snd_pcm_channel_area_t *res_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_size ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t slave_undo_size ATTRIBUTE_UNUSED)
+{
+ return -EIO;
+}
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_undo_write(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ const snd_pcm_channel_area_t *res_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_size ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t slave_undo_size ATTRIBUTE_UNUSED)
+{
+ return -EIO;
+}
+
+snd_pcm_sframes_t
+snd_pcm_plugin_undo_read_generic(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ const snd_pcm_channel_area_t *res_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_size ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t slave_undo_size)
+{
+ return slave_undo_size;
+}
+
+snd_pcm_sframes_t
+snd_pcm_plugin_undo_write_generic(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ const snd_pcm_channel_area_t *res_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t res_size ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t slave_undo_size)
+{
+ return slave_undo_size;
+}
+
+void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin)
+{
+ memset(plugin, 0, sizeof(snd_pcm_plugin_t));
+ plugin->undo_read = snd_pcm_plugin_undo_read;
+ plugin->undo_write = snd_pcm_plugin_undo_write;
+ snd_atomic_write_init(&plugin->watom);
+}
+
+static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_sframes_t sd;
+ int err = snd_pcm_delay(plugin->gen.slave, &sd);
+ if (err < 0)
+ return err;
+ if (plugin->client_frames)
+ sd = plugin->client_frames(pcm, sd);
+ *delayp = sd;
+ return 0;
+}
+
+static int snd_pcm_plugin_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ int err;
+ snd_atomic_write_begin(&plugin->watom);
+ err = snd_pcm_prepare(plugin->gen.slave);
+ if (err < 0) {
+ snd_atomic_write_end(&plugin->watom);
+ return err;
+ }
+ *pcm->hw.ptr = 0;
+ *pcm->appl.ptr = 0;
+ snd_atomic_write_end(&plugin->watom);
+ if (plugin->init) {
+ err = plugin->init(pcm);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static int snd_pcm_plugin_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ int err;
+ snd_atomic_write_begin(&plugin->watom);
+ err = snd_pcm_reset(plugin->gen.slave);
+ if (err < 0) {
+ snd_atomic_write_end(&plugin->watom);
+ return err;
+ }
+ *pcm->hw.ptr = 0;
+ *pcm->appl.ptr = 0;
+ snd_atomic_write_end(&plugin->watom);
+ if (plugin->init) {
+ err = plugin->init(pcm);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_rewindable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_hw_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm);
+ snd_pcm_sframes_t sframes;
+
+ if ((snd_pcm_uframes_t)n < frames)
+ frames = n;
+ if (frames == 0)
+ return 0;
+
+ if (plugin->slave_frames)
+ sframes = plugin->slave_frames(pcm, (snd_pcm_sframes_t) frames);
+ else
+ sframes = frames;
+ snd_atomic_write_begin(&plugin->watom);
+ sframes = snd_pcm_rewind(plugin->gen.slave, sframes);
+ if (sframes < 0) {
+ snd_atomic_write_end(&plugin->watom);
+ return sframes;
+ }
+ if (plugin->client_frames)
+ frames = plugin->client_frames(pcm, sframes);
+ snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
+ snd_atomic_write_end(&plugin->watom);
+ return (snd_pcm_sframes_t) frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)
+{
+ return snd_pcm_mmap_avail(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm);
+ snd_pcm_sframes_t sframes;
+
+ if ((snd_pcm_uframes_t)n < frames)
+ frames = n;
+ if (frames == 0)
+ return 0;
+
+ if (plugin->slave_frames)
+ sframes = plugin->slave_frames(pcm, (snd_pcm_sframes_t) frames);
+ else
+ sframes = frames;
+ snd_atomic_write_begin(&plugin->watom);
+ sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
+ if (sframes < 0) {
+ snd_atomic_write_end(&plugin->watom);
+ return sframes;
+ }
+ if (plugin->client_frames)
+ frames = plugin->client_frames(pcm, sframes);
+ snd_pcm_mmap_appl_forward(pcm, (snd_pcm_uframes_t) frames);
+ snd_atomic_write_end(&plugin->watom);
+ return (snd_pcm_sframes_t) frames;
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_t *slave = plugin->gen.slave;
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t result;
+ int err;
+
+ while (size > 0) {
+ snd_pcm_uframes_t frames = size;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+
+ err = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
+ if (err < 0 || slave_frames == 0)
+ break;
+ frames = plugin->write(pcm, areas, offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ if (CHECK_SANITY(slave_frames > snd_pcm_mmap_playback_avail(slave))) {
+ SNDMSG("write overflow %ld > %ld", slave_frames,
+ snd_pcm_mmap_playback_avail(slave));
+ return -EPIPE;
+ }
+ snd_atomic_write_begin(&plugin->watom);
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+ res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
+ if (res < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ frames -= res;
+ }
+ snd_atomic_write_end(&plugin->watom);
+ if (result <= 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ offset += frames;
+ xfer += frames;
+ size -= frames;
+ }
+ return (snd_pcm_sframes_t)xfer;
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_t *slave = plugin->gen.slave;
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_sframes_t result;
+
+ while (size > 0) {
+ snd_pcm_uframes_t frames = size;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+
+ snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
+ if (slave_frames == 0)
+ break;
+ frames = (plugin->read)(pcm, areas, offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ if (CHECK_SANITY(slave_frames > snd_pcm_mmap_capture_avail(slave))) {
+ SNDMSG("read overflow %ld > %ld", slave_frames,
+ snd_pcm_mmap_playback_avail(slave));
+ return -EPIPE;
+ }
+ snd_atomic_write_begin(&plugin->watom);
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result);
+ if (res < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ frames -= res;
+ }
+ snd_atomic_write_end(&plugin->watom);
+ if (result <= 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ offset += frames;
+ xfer += frames;
+ size -= frames;
+ }
+ return (snd_pcm_sframes_t)xfer;
+}
+
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ snd_pcm_plugin_write_areas);
+}
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_write_areas(pcm, areas, 0, size,
+ snd_pcm_plugin_write_areas);
+}
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_buf(pcm, areas, buffer);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ snd_pcm_plugin_read_areas);
+}
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+{
+ snd_pcm_channel_area_t areas[pcm->channels];
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
+ return snd_pcm_read_areas(pcm, areas, 0, size,
+ snd_pcm_plugin_read_areas);
+}
+
+static snd_pcm_sframes_t
+snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_t *slave = plugin->gen.slave;
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_uframes_t appl_offset;
+ snd_pcm_sframes_t slave_size;
+ snd_pcm_sframes_t xfer;
+
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
+ snd_atomic_write_begin(&plugin->watom);
+ snd_pcm_mmap_appl_forward(pcm, size);
+ snd_atomic_write_end(&plugin->watom);
+ return size;
+ }
+ slave_size = snd_pcm_avail_update(slave);
+ if (slave_size < 0)
+ return slave_size;
+ areas = snd_pcm_mmap_areas(pcm);
+ appl_offset = snd_pcm_mmap_offset(pcm);
+ xfer = 0;
+ while (size > 0 && slave_size > 0) {
+ snd_pcm_uframes_t frames = size;
+ snd_pcm_uframes_t cont = pcm->buffer_size - appl_offset;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+ snd_pcm_sframes_t result;
+ int err;
+
+ err = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
+ if (err < 0)
+ return xfer > 0 ? xfer : err;
+ if (frames > cont)
+ frames = cont;
+ frames = plugin->write(pcm, areas, appl_offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ snd_atomic_write_begin(&plugin->watom);
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ snd_atomic_write_end(&plugin->watom);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
+ if (res < 0)
+ return xfer > 0 ? xfer : res;
+ frames -= res;
+ }
+ if (result <= 0)
+ return xfer > 0 ? xfer : result;
+ if (frames == cont)
+ appl_offset = 0;
+ else
+ appl_offset += result;
+ size -= frames;
+ slave_size -= frames;
+ xfer += frames;
+ }
+ if (CHECK_SANITY(size)) {
+ SNDMSG("short commit: %ld", size);
+ return -EPIPE;
+ }
+ return xfer;
+}
+
+static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_t *slave = plugin->gen.slave;
+ snd_pcm_sframes_t slave_size;
+
+ slave_size = snd_pcm_avail_update(slave);
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
+ pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
+ pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
+ goto _capture;
+ if (plugin->client_frames) {
+ *pcm->hw.ptr = plugin->client_frames(pcm, *slave->hw.ptr);
+ if (slave_size <= 0)
+ return slave_size;
+ return plugin->client_frames(pcm, slave_size);
+ } else {
+ *pcm->hw.ptr = *slave->hw.ptr;
+ return slave_size;
+ }
+ _capture:
+ {
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_uframes_t xfer, hw_offset, size;
+
+ xfer = snd_pcm_mmap_capture_avail(pcm);
+ size = pcm->buffer_size - xfer;
+ areas = snd_pcm_mmap_areas(pcm);
+ hw_offset = snd_pcm_mmap_hw_offset(pcm);
+ while (size > 0 && slave_size > 0) {
+ snd_pcm_uframes_t frames = size;
+ snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+ snd_pcm_sframes_t result;
+ int err;
+
+ err = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
+ if (err < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
+ if (frames > cont)
+ frames = cont;
+ frames = (plugin->read)(pcm, areas, hw_offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ snd_atomic_write_begin(&plugin->watom);
+ snd_pcm_mmap_hw_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ snd_atomic_write_end(&plugin->watom);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result);
+ if (res < 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
+ frames -= res;
+ }
+ if (result <= 0)
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
+ if (frames == cont)
+ hw_offset = 0;
+ else
+ hw_offset += frames;
+ size -= frames;
+ slave_size -= slave_frames;
+ xfer += frames;
+ }
+ return (snd_pcm_sframes_t)xfer;
+ }
+}
+
+static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_plugin_t *plugin = pcm->private_data;
+ snd_pcm_sframes_t err;
+ snd_atomic_read_t ratom;
+ snd_atomic_read_init(&ratom, &plugin->watom);
+ _again:
+ snd_atomic_read_begin(&ratom);
+ /* sync with the latest hw and appl ptrs */
+ snd_pcm_plugin_avail_update(pcm);
+
+ err = snd_pcm_status(plugin->gen.slave, status);
+ if (err < 0) {
+ snd_atomic_read_ok(&ratom);
+ return err;
+ }
+ status->appl_ptr = *pcm->appl.ptr;
+ status->hw_ptr = *pcm->hw.ptr;
+ if (plugin->client_frames) {
+ status->delay = plugin->client_frames(pcm, status->delay);
+ status->avail = plugin->client_frames(pcm, status->avail);
+ }
+ if (!snd_atomic_read_ok(&ratom)) {
+ snd_atomic_read_wait(&ratom);
+ goto _again;
+ }
+ if (plugin->client_frames)
+ status->avail_max = plugin->client_frames(pcm, (snd_pcm_sframes_t) status->avail_max);
+ return 0;
+}
+
+const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops = {
+ .status = snd_pcm_plugin_status,
+ .state = snd_pcm_generic_state,
+ .hwsync = snd_pcm_generic_hwsync,
+ .delay = snd_pcm_plugin_delay,
+ .prepare = snd_pcm_plugin_prepare,
+ .reset = snd_pcm_plugin_reset,
+ .start = snd_pcm_generic_start,
+ .drop = snd_pcm_generic_drop,
+ .drain = snd_pcm_generic_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewindable = snd_pcm_plugin_rewindable,
+ .rewind = snd_pcm_plugin_rewind,
+ .forwardable = snd_pcm_plugin_forwardable,
+ .forward = snd_pcm_plugin_forward,
+ .resume = snd_pcm_generic_resume,
+ .link = snd_pcm_generic_link,
+ .link_slaves = snd_pcm_generic_link_slaves,
+ .unlink = snd_pcm_generic_unlink,
+ .writei = snd_pcm_plugin_writei,
+ .writen = snd_pcm_plugin_writen,
+ .readi = snd_pcm_plugin_readi,
+ .readn = snd_pcm_plugin_readn,
+ .avail_update = snd_pcm_plugin_avail_update,
+ .mmap_commit = snd_pcm_plugin_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_revents = snd_pcm_generic_poll_revents,
+};
+
+#endif
diff --git a/alsa-lib/src/pcm/pcm_plugin.h b/alsa-lib/src/pcm/pcm_plugin.h
new file mode 100644
index 0000000..dfcf6de
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_plugin.h
@@ -0,0 +1,154 @@
+/*
+ * PCM - Common plugin code
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "iatomic.h"
+#include "pcm_generic.h"
+
+typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
+ (snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep);
+
+typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
+ (snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *res_areas, /* result areas */
+ snd_pcm_uframes_t res_offset, /* offset of result areas */
+ snd_pcm_uframes_t res_size, /* size of result areas */
+ snd_pcm_uframes_t slave_undo_size);
+
+typedef struct {
+ snd_pcm_generic_t gen;
+ snd_pcm_slave_xfer_areas_func_t read;
+ snd_pcm_slave_xfer_areas_func_t write;
+ snd_pcm_slave_xfer_areas_undo_func_t undo_read;
+ snd_pcm_slave_xfer_areas_undo_func_t undo_write;
+ snd_pcm_sframes_t (*client_frames)(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
+ snd_pcm_sframes_t (*slave_frames)(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
+ int (*init)(snd_pcm_t *pcm);
+ snd_pcm_uframes_t appl_ptr, hw_ptr;
+ snd_atomic_write_t watom;
+} snd_pcm_plugin_t;
+
+/* make local functions really local */
+#define snd_pcm_plugin_init \
+ snd1_pcm_plugin_init
+#define snd_pcm_plugin_fast_ops \
+ snd1_pcm_plugin_fast_ops
+#define snd_pcm_plugin_undo_read_generic \
+ snd1_pcm_plugin_undo_read_generic
+#define snd_pcm_plugin_undo_write_generic \
+ snd1_pcm_plugin_undo_write_generic
+
+void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
+
+extern const snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
+
+snd_pcm_sframes_t snd_pcm_plugin_undo_read_generic
+ (snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *res_areas, /* result areas */
+ snd_pcm_uframes_t res_offset, /* offset of result areas */
+ snd_pcm_uframes_t res_size, /* size of result areas */
+ snd_pcm_uframes_t slave_undo_size);
+
+snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
+ (snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *res_areas, /* result areas */
+ snd_pcm_uframes_t res_offset, /* offset of result areas */
+ snd_pcm_uframes_t res_size, /* size of result areas */
+ snd_pcm_uframes_t slave_undo_size);
+
+/* make local functions really local */
+#define snd_pcm_linear_get_index snd1_pcm_linear_get_index
+#define snd_pcm_linear_put_index snd1_pcm_linear_put_index
+#define snd_pcm_linear_get32_index snd1_pcm_linear_get32_index
+#define snd_pcm_linear_put32_index snd1_pcm_linear_put32_index
+#define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index
+#define snd_pcm_linear_convert snd1_pcm_linear_convert
+#define snd_pcm_linear_getput snd1_pcm_linear_getput
+#define snd_pcm_alaw_decode snd1_pcm_alaw_decode
+#define snd_pcm_alaw_encode snd1_pcm_alaw_encode
+#define snd_pcm_mulaw_decode snd1_pcm_mulaw_decode
+#define snd_pcm_mulaw_encode snd1_pcm_mulaw_encode
+#define snd_pcm_adpcm_decode snd1_pcm_adpcm_decode
+#define snd_pcm_adpcm_encode snd1_pcm_adpcm_encode
+
+int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
+int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
+int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
+int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
+int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
+
+void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int convidx);
+void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int get_idx, unsigned int put_idx);
+void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx);
+void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx);
+void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx);
+void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx);
+
+typedef struct _snd_pcm_adpcm_state {
+ int pred_val; /* Calculated predicted value */
+ int step_idx; /* Previous StepSize lookup index */
+} snd_pcm_adpcm_state_t;
+
+void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx,
+ snd_pcm_adpcm_state_t *states);
+void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx,
+ snd_pcm_adpcm_state_t *states);
diff --git a/alsa-lib/src/pcm/pcm_rate.c b/alsa-lib/src/pcm/pcm_rate.c
new file mode 100644
index 0000000..a97a5de
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_rate.c
@@ -0,0 +1,1510 @@
+/**
+ * \file pcm/pcm_rate.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Rate Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2004
+ */
+/*
+ * PCM - Rate conversion
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ * 2004 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#include <inttypes.h>
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+#include "pcm_rate.h"
+#include "iatomic.h"
+
+#include "plugin_ops.h"
+
+#if 0
+#define DEBUG_REFINE
+#endif
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_rate = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef struct _snd_pcm_rate snd_pcm_rate_t;
+
+struct _snd_pcm_rate {
+ snd_pcm_generic_t gen;
+ snd_atomic_write_t watom;
+ snd_pcm_uframes_t appl_ptr, hw_ptr;
+ snd_pcm_uframes_t last_commit_ptr;
+ snd_pcm_uframes_t orig_avail_min;
+ snd_pcm_sw_params_t sw_params;
+ snd_pcm_format_t sformat;
+ unsigned int srate;
+ snd_pcm_channel_area_t *pareas; /* areas for splitted period (rate pcm) */
+ snd_pcm_channel_area_t *sareas; /* areas for splitted period (slave pcm) */
+ snd_pcm_rate_info_t info;
+ void *obj;
+ snd_pcm_rate_ops_t ops;
+ unsigned int get_idx;
+ unsigned int put_idx;
+ int16_t *src_buf;
+ int16_t *dst_buf;
+ int start_pending; /* start is triggered but not commited to slave */
+ snd_htimestamp_t trigger_tstamp;
+};
+
+#endif /* DOC_HIDDEN */
+
+static int snd_pcm_rate_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_min(params,
+ SND_PCM_HW_PARAM_RATE, SND_PCM_PLUGIN_RATE_MIN, 0);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_max(params,
+ SND_PCM_HW_PARAM_RATE, SND_PCM_PLUGIN_RATE_MAX, 0);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_rate_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ if (rate->sformat != SND_PCM_FORMAT_UNKNOWN) {
+ _snd_pcm_hw_params_set_format(sparams, rate->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ }
+ _snd_pcm_hw_param_set_minmax(sparams, SND_PCM_HW_PARAM_RATE,
+ rate->srate, 0, rate->srate + 1, -1);
+ return 0;
+}
+
+static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_interval_t t, buffer_size;
+ const snd_interval_t *srate, *crate;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS |
+ SND_PCM_HW_PARBIT_FRAME_BITS);
+ snd_interval_copy(&buffer_size, snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE));
+ snd_interval_unfloor(&buffer_size);
+ crate = snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_RATE);
+ srate = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_RATE);
+ snd_interval_muldiv(&buffer_size, srate, crate, &t);
+ err = _snd_pcm_hw_param_set_interval(sparams, SND_PCM_HW_PARAM_BUFFER_SIZE, &t);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_interval_t t;
+#ifdef DEBUG_REFINE
+ snd_output_t *out;
+#endif
+ const snd_interval_t *sbuffer_size, *buffer_size;
+ const snd_interval_t *srate, *crate;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS |
+ SND_PCM_HW_PARBIT_FRAME_BITS);
+ sbuffer_size = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_BUFFER_SIZE);
+ crate = snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_RATE);
+ srate = snd_pcm_hw_param_get_interval(sparams, SND_PCM_HW_PARAM_RATE);
+ snd_interval_muldiv(sbuffer_size, crate, srate, &t);
+ snd_interval_floor(&t);
+ err = _snd_pcm_hw_param_set_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &t);
+ if (err < 0)
+ return err;
+ buffer_size = snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_BUFFER_SIZE);
+ /*
+ * this condition probably needs more work:
+ * in case when the buffer_size is known and we are looking
+ * for best period_size, we should prefer situation when
+ * (buffer_size / period_size) * period_size == buffer_size
+ */
+ if (snd_interval_single(buffer_size) && buffer_size->integer) {
+ snd_interval_t *period_size;
+ period_size = (snd_interval_t *)snd_pcm_hw_param_get_interval(params, SND_PCM_HW_PARAM_PERIOD_SIZE);
+ if (!snd_interval_checkempty(period_size) &&
+ period_size->openmin && period_size->openmax &&
+ period_size->min + 1 == period_size->max) {
+ if ((buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
+ snd_interval_set_value(period_size, period_size->min);
+ } else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
+ snd_interval_set_value(period_size, period_size->max);
+ }
+ }
+ }
+#ifdef DEBUG_REFINE
+ snd_output_stdio_attach(&out, stderr, 0);
+ snd_output_printf(out, "REFINE (params):\n");
+ snd_pcm_hw_params_dump(params, out);
+ snd_output_printf(out, "REFINE (slave params):\n");
+ snd_pcm_hw_params_dump(sparams, out);
+ snd_output_close(out);
+#endif
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+#ifdef DEBUG_REFINE
+ snd_output_stdio_attach(&out, stderr, 0);
+ snd_output_printf(out, "********************\n");
+ snd_output_printf(out, "REFINE (params) (%i):\n", err);
+ snd_pcm_hw_params_dump(params, out);
+ snd_output_printf(out, "REFINE (slave params):\n");
+ snd_pcm_hw_params_dump(sparams, out);
+ snd_output_close(out);
+#endif
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_rate_hw_refine_cprepare,
+ snd_pcm_rate_hw_refine_cchange,
+ snd_pcm_rate_hw_refine_sprepare,
+ snd_pcm_rate_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_t *slave = rate->gen.slave;
+ snd_pcm_rate_side_info_t *sinfo, *cinfo;
+ unsigned int channels, cwidth, swidth, chn;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_rate_hw_refine_cchange,
+ snd_pcm_rate_hw_refine_sprepare,
+ snd_pcm_rate_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ cinfo = &rate->info.in;
+ sinfo = &rate->info.out;
+ } else {
+ sinfo = &rate->info.in;
+ cinfo = &rate->info.out;
+ }
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &cinfo->format);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_rate)(params, &cinfo->rate, 0);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_period_size)(params, &cinfo->period_size, 0);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &cinfo->buffer_size);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_get_channels)(params, &channels);
+ if (err < 0)
+ return err;
+
+ rate->info.channels = channels;
+ sinfo->format = slave->format;
+ sinfo->rate = slave->rate;
+ sinfo->buffer_size = slave->buffer_size;
+ sinfo->period_size = slave->period_size;
+
+ if (CHECK_SANITY(rate->pareas)) {
+ SNDMSG("rate plugin already in use");
+ return -EBUSY;
+ }
+ err = rate->ops.init(rate->obj, &rate->info);
+ if (err < 0)
+ return err;
+
+ rate->pareas = malloc(2 * channels * sizeof(*rate->pareas));
+ if (rate->pareas == NULL)
+ goto error;
+
+ cwidth = snd_pcm_format_physical_width(cinfo->format);
+ swidth = snd_pcm_format_physical_width(sinfo->format);
+ rate->pareas[0].addr = malloc(((cwidth * channels * cinfo->period_size) / 8) +
+ ((swidth * channels * sinfo->period_size) / 8));
+ if (rate->pareas[0].addr == NULL)
+ goto error;
+
+ rate->sareas = rate->pareas + channels;
+ rate->sareas[0].addr = (char *)rate->pareas[0].addr + ((cwidth * channels * cinfo->period_size) / 8);
+ for (chn = 0; chn < channels; chn++) {
+ rate->pareas[chn].addr = rate->pareas[0].addr + (cwidth * chn * cinfo->period_size) / 8;
+ rate->pareas[chn].first = 0;
+ rate->pareas[chn].step = cwidth;
+ rate->sareas[chn].addr = rate->sareas[0].addr + (swidth * chn * sinfo->period_size) / 8;
+ rate->sareas[chn].first = 0;
+ rate->sareas[chn].step = swidth;
+ }
+
+ if (rate->ops.convert_s16) {
+ rate->get_idx = snd_pcm_linear_get_index(rate->info.in.format, SND_PCM_FORMAT_S16);
+ rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, rate->info.out.format);
+ free(rate->src_buf);
+ rate->src_buf = malloc(channels * rate->info.in.period_size * 2);
+ free(rate->dst_buf);
+ rate->dst_buf = malloc(channels * rate->info.out.period_size * 2);
+ if (! rate->src_buf || ! rate->dst_buf)
+ goto error;
+ }
+
+ return 0;
+
+ error:
+ if (rate->pareas) {
+ free(rate->pareas[0].addr);
+ free(rate->pareas);
+ rate->pareas = NULL;
+ }
+ if (rate->ops.free)
+ rate->ops.free(rate->obj);
+ return -ENOMEM;
+}
+
+static int snd_pcm_rate_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ if (rate->pareas) {
+ free(rate->pareas[0].addr);
+ free(rate->pareas);
+ rate->pareas = NULL;
+ rate->sareas = NULL;
+ }
+ if (rate->ops.free)
+ rate->ops.free(rate->obj);
+ free(rate->src_buf);
+ free(rate->dst_buf);
+ rate->src_buf = rate->dst_buf = NULL;
+ return snd_pcm_hw_free(rate->gen.slave);
+}
+
+static void recalc(snd_pcm_t *pcm, snd_pcm_uframes_t *val)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_t *slave = rate->gen.slave;
+ unsigned long div;
+
+ if (*val == pcm->buffer_size) {
+ *val = slave->buffer_size;
+ } else {
+ div = *val / pcm->period_size;
+ if (div * pcm->period_size == *val)
+ *val = div * slave->period_size;
+ else
+ *val = muldiv_near(*val, slave->period_size, pcm->period_size);
+ }
+}
+
+static int snd_pcm_rate_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_t *slave = rate->gen.slave;
+ snd_pcm_sw_params_t *sparams;
+ snd_pcm_uframes_t boundary1, boundary2, sboundary;
+ int err;
+
+ sparams = &rate->sw_params;
+ err = snd_pcm_sw_params_current(slave, sparams);
+ if (err < 0)
+ return err;
+ sboundary = sparams->boundary;
+ *sparams = *params;
+ boundary1 = pcm->buffer_size;
+ boundary2 = slave->buffer_size;
+ while (boundary1 * 2 <= LONG_MAX - pcm->buffer_size &&
+ boundary2 * 2 <= LONG_MAX - slave->buffer_size) {
+ boundary1 *= 2;
+ boundary2 *= 2;
+ }
+ params->boundary = boundary1;
+ sparams->boundary = sboundary;
+
+ if (rate->ops.adjust_pitch)
+ rate->ops.adjust_pitch(rate->obj, &rate->info);
+
+ recalc(pcm, &sparams->avail_min);
+ rate->orig_avail_min = sparams->avail_min;
+ recalc(pcm, &sparams->start_threshold);
+ if (sparams->avail_min < 1) sparams->avail_min = 1;
+ if (sparams->start_threshold <= slave->buffer_size) {
+ if (sparams->start_threshold > (slave->buffer_size / sparams->avail_min) * sparams->avail_min)
+ sparams->start_threshold = (slave->buffer_size / sparams->avail_min) * sparams->avail_min;
+ }
+ if (sparams->stop_threshold >= params->boundary) {
+ sparams->stop_threshold = sparams->boundary;
+ } else {
+ recalc(pcm, &sparams->stop_threshold);
+ }
+ recalc(pcm, &sparams->silence_threshold);
+ if (sparams->silence_size >= params->boundary) {
+ sparams->silence_size = sparams->boundary;
+ } else {
+ recalc(pcm, &sparams->silence_size);
+ }
+ return snd_pcm_sw_params(slave, sparams);
+}
+
+static int snd_pcm_rate_init(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+
+ if (rate->ops.reset)
+ rate->ops.reset(rate->obj);
+ rate->last_commit_ptr = 0;
+ rate->start_pending = 0;
+ return 0;
+}
+
+static void convert_to_s16(snd_pcm_rate_t *rate, int16_t *buf,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, unsigned int frames,
+ unsigned int channels)
+{
+#ifndef DOC_HIDDEN
+#define GET16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+#endif /* DOC_HIDDEN */
+ void *get = get16_labels[rate->get_idx];
+ const char *src;
+ int16_t sample;
+ const char *srcs[channels];
+ int src_step[channels];
+ unsigned int c;
+
+ for (c = 0; c < channels; c++) {
+ srcs[c] = snd_pcm_channel_area_addr(areas + c, offset);
+ src_step[c] = snd_pcm_channel_area_step(areas + c);
+ }
+
+ while (frames--) {
+ for (c = 0; c < channels; c++) {
+ src = srcs[c];
+ goto *get;
+#ifndef DOC_HIDDEN
+#define GET16_END after_get
+#include "plugin_ops.h"
+#undef GET16_END
+#endif /* DOC_HIDDEN */
+ after_get:
+ *buf++ = sample;
+ srcs[c] += src_step[c];
+ }
+ }
+}
+
+static void convert_from_s16(snd_pcm_rate_t *rate, const int16_t *buf,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset, unsigned int frames,
+ unsigned int channels)
+{
+#ifndef DOC_HIDDEN
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef PUT16_LABELS
+#endif /* DOC_HIDDEN */
+ void *put = put16_labels[rate->put_idx];
+ char *dst;
+ int16_t sample;
+ char *dsts[channels];
+ int dst_step[channels];
+ unsigned int c;
+
+ for (c = 0; c < channels; c++) {
+ dsts[c] = snd_pcm_channel_area_addr(areas + c, offset);
+ dst_step[c] = snd_pcm_channel_area_step(areas + c);
+ }
+
+ while (frames--) {
+ for (c = 0; c < channels; c++) {
+ dst = dsts[c];
+ sample = *buf++;
+ goto *put;
+#ifndef DOC_HIDDEN
+#define PUT16_END after_put
+#include "plugin_ops.h"
+#undef PUT16_END
+#endif /* DOC_HIDDEN */
+ after_put:
+ dsts[c] += dst_step[c];
+ }
+ }
+}
+
+static void do_convert(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames,
+ unsigned int channels,
+ snd_pcm_rate_t *rate)
+{
+ if (rate->ops.convert_s16) {
+ const int16_t *src;
+ int16_t *dst;
+ if (! rate->src_buf)
+ src = src_areas->addr + src_offset * 2 * channels;
+ else {
+ convert_to_s16(rate, rate->src_buf, src_areas, src_offset,
+ src_frames, channels);
+ src = rate->src_buf;
+ }
+ if (! rate->dst_buf)
+ dst = dst_areas->addr + dst_offset * 2 * channels;
+ else
+ dst = rate->dst_buf;
+ rate->ops.convert_s16(rate->obj, dst, dst_frames, src, src_frames);
+ if (dst == rate->dst_buf)
+ convert_from_s16(rate, rate->dst_buf, dst_areas, dst_offset,
+ dst_frames, channels);
+ } else {
+ rate->ops.convert(rate->obj, dst_areas, dst_offset, dst_frames,
+ src_areas, src_offset, src_frames);
+ }
+}
+
+static inline void
+snd_pcm_rate_write_areas1(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ do_convert(slave_areas, slave_offset, rate->gen.slave->period_size,
+ areas, offset, pcm->period_size,
+ pcm->channels, rate);
+}
+
+static inline void
+snd_pcm_rate_read_areas1(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ do_convert(areas, offset, pcm->period_size,
+ slave_areas, slave_offset, rate->gen.slave->period_size,
+ pcm->channels, rate);
+}
+
+static inline snd_pcm_sframes_t snd_pcm_rate_move_applptr(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_uframes_t orig_appl_ptr, appl_ptr = rate->appl_ptr, slave_appl_ptr;
+ snd_pcm_sframes_t diff, ndiff;
+ snd_pcm_t *slave = rate->gen.slave;
+
+ orig_appl_ptr = rate->appl_ptr;
+ if (frames > 0)
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ else
+ snd_pcm_mmap_appl_backward(pcm, -frames);
+ slave_appl_ptr =
+ (appl_ptr / pcm->period_size) * rate->gen.slave->period_size;
+ diff = slave_appl_ptr - *slave->appl.ptr;
+ if (diff < -(snd_pcm_sframes_t)(slave->boundary / 2)) {
+ diff = (slave->boundary - *slave->appl.ptr) + slave_appl_ptr;
+ } else if (diff > (snd_pcm_sframes_t)(slave->boundary / 2)) {
+ diff = -((slave->boundary - slave_appl_ptr) + *slave->appl.ptr);
+ }
+ if (diff == 0)
+ return frames;
+ if (diff > 0) {
+ ndiff = snd_pcm_forward(rate->gen.slave, diff);
+ } else {
+ ndiff = snd_pcm_rewind(rate->gen.slave, diff);
+ }
+ if (ndiff < 0)
+ return diff;
+ slave_appl_ptr = *slave->appl.ptr;
+ rate->appl_ptr =
+ (slave_appl_ptr / rate->gen.slave->period_size) * pcm->period_size +
+ orig_appl_ptr % pcm->period_size;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ rate->appl_ptr += rate->ops.input_frames(rate->obj, slave_appl_ptr % rate->gen.slave->period_size);
+ else
+ rate->appl_ptr += rate->ops.output_frames(rate->obj, slave_appl_ptr % rate->gen.slave->period_size);
+
+ diff = orig_appl_ptr - rate->appl_ptr;
+ if (diff < -(snd_pcm_sframes_t)(slave->boundary / 2)) {
+ diff = (slave->boundary - rate->appl_ptr) + orig_appl_ptr;
+ } else if (diff > (snd_pcm_sframes_t)(slave->boundary / 2)) {
+ diff = -((slave->boundary - orig_appl_ptr) + rate->appl_ptr);
+ }
+ if (frames < 0)
+ diff = -diff;
+
+ rate->last_commit_ptr = rate->appl_ptr - rate->appl_ptr % pcm->period_size;
+
+ return diff;
+}
+
+static inline void snd_pcm_rate_sync_hwptr(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_uframes_t slave_hw_ptr = *rate->gen.slave->hw.ptr;
+
+ if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
+ return;
+ /* FIXME: boundary overlap of slave hw_ptr isn't evaluated here!
+ * e.g. if slave rate is small...
+ */
+ rate->hw_ptr =
+ (slave_hw_ptr / rate->gen.slave->period_size) * pcm->period_size +
+ rate->ops.input_frames(rate->obj, slave_hw_ptr % rate->gen.slave->period_size);
+}
+
+static int snd_pcm_rate_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ int err = snd_pcm_hwsync(rate->gen.slave);
+ if (err < 0)
+ return err;
+ snd_atomic_write_begin(&rate->watom);
+ snd_pcm_rate_sync_hwptr(pcm);
+ snd_atomic_write_end(&rate->watom);
+ return 0;
+}
+
+static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_rate_hwsync(pcm);
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
+ else
+ *delayp = snd_pcm_mmap_capture_hw_avail(pcm);
+ return 0;
+}
+
+static int snd_pcm_rate_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ int err;
+
+ snd_atomic_write_begin(&rate->watom);
+ err = snd_pcm_prepare(rate->gen.slave);
+ if (err < 0) {
+ snd_atomic_write_end(&rate->watom);
+ return err;
+ }
+ *pcm->hw.ptr = 0;
+ *pcm->appl.ptr = 0;
+ snd_atomic_write_end(&rate->watom);
+ err = snd_pcm_rate_init(pcm);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_rate_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ int err;
+ snd_atomic_write_begin(&rate->watom);
+ err = snd_pcm_reset(rate->gen.slave);
+ if (err < 0) {
+ snd_atomic_write_end(&rate->watom);
+ return err;
+ }
+ *pcm->hw.ptr = 0;
+ *pcm->appl.ptr = 0;
+ snd_atomic_write_end(&rate->watom);
+ err = snd_pcm_rate_init(pcm);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm);
+
+ if ((snd_pcm_uframes_t)n > frames)
+ frames = n;
+ if (frames == 0)
+ return 0;
+
+ snd_atomic_write_begin(&rate->watom);
+ n = snd_pcm_rate_move_applptr(pcm, -frames);
+ snd_atomic_write_end(&rate->watom);
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm);
+
+ if ((snd_pcm_uframes_t)n > frames)
+ frames = n;
+ if (frames == 0)
+ return 0;
+
+ snd_atomic_write_begin(&rate->watom);
+ n = snd_pcm_rate_move_applptr(pcm, frames);
+ snd_atomic_write_end(&rate->watom);
+ return n;
+}
+
+static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
+ snd_pcm_uframes_t appl_offset,
+ snd_pcm_uframes_t size,
+ snd_pcm_uframes_t slave_size)
+{
+ snd_pcm_uframes_t cont = pcm->buffer_size - appl_offset;
+ const snd_pcm_channel_area_t *areas;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset, xfer;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+ snd_pcm_sframes_t result;
+
+ areas = snd_pcm_mmap_areas(pcm);
+ if (cont >= size) {
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+ if (slave_frames < slave_size) {
+ snd_pcm_rate_write_areas1(pcm, areas, appl_offset, rate->sareas, 0);
+ goto __partial;
+ }
+ snd_pcm_rate_write_areas1(pcm, areas, appl_offset,
+ slave_areas, slave_offset);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, slave_size);
+ if (result < (snd_pcm_sframes_t)slave_size) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+ } else {
+ snd_pcm_areas_copy(rate->pareas, 0,
+ areas, appl_offset,
+ pcm->channels, cont,
+ pcm->format);
+ snd_pcm_areas_copy(rate->pareas, cont,
+ areas, 0,
+ pcm->channels, size - cont,
+ pcm->format);
+
+ snd_pcm_rate_write_areas1(pcm, rate->pareas, 0, rate->sareas, 0);
+
+ /* ok, commit first fragment */
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+ __partial:
+ xfer = 0;
+ cont = slave_frames;
+ if (cont > slave_size)
+ cont = slave_size;
+ snd_pcm_areas_copy(slave_areas, slave_offset,
+ rate->sareas, 0,
+ pcm->channels, cont,
+ rate->gen.slave->format);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
+ if (result < (snd_pcm_sframes_t)cont) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+ xfer = cont;
+
+ if (xfer == slave_size)
+ goto commit_done;
+
+ /* commit second fragment */
+ cont = slave_size - cont;
+ slave_frames = cont;
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+#if 0
+ if (slave_offset) {
+ SNDERR("non-zero slave_offset %ld", slave_offset);
+ return -EIO;
+ }
+#endif
+ snd_pcm_areas_copy(slave_areas, slave_offset,
+ rate->sareas, xfer,
+ pcm->channels, cont,
+ rate->gen.slave->format);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
+ if (result < (snd_pcm_sframes_t)cont) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result + xfer);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+ }
+
+ commit_done:
+ if (rate->start_pending) {
+ /* we have pending start-trigger. let's issue it now */
+ snd_pcm_start(rate->gen.slave);
+ rate->start_pending = 0;
+ }
+ return 1;
+}
+
+static int snd_pcm_rate_commit_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t appl_offset)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+
+ return snd_pcm_rate_commit_area(pcm, rate, appl_offset, pcm->period_size,
+ rate->gen.slave->period_size);
+}
+
+static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_offset)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset;
+ const snd_pcm_channel_area_t *areas;
+ const snd_pcm_channel_area_t *slave_areas;
+ snd_pcm_uframes_t slave_offset, xfer;
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
+ snd_pcm_sframes_t result;
+
+ areas = snd_pcm_mmap_areas(pcm);
+ if (cont >= pcm->period_size) {
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+ if (slave_frames < rate->gen.slave->period_size)
+ goto __partial;
+ snd_pcm_rate_read_areas1(pcm, areas, hw_offset,
+ slave_areas, slave_offset);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, rate->gen.slave->period_size);
+ if (result < (snd_pcm_sframes_t)rate->gen.slave->period_size) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+ } else {
+ /* ok, grab first fragment */
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+ __partial:
+ xfer = 0;
+ cont = slave_frames;
+ if (cont > rate->gen.slave->period_size)
+ cont = rate->gen.slave->period_size;
+ snd_pcm_areas_copy(rate->sareas, 0,
+ slave_areas, slave_offset,
+ pcm->channels, cont,
+ rate->gen.slave->format);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
+ if (result < (snd_pcm_sframes_t)cont) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+ xfer = cont;
+
+ if (xfer == rate->gen.slave->period_size)
+ goto __transfer;
+
+ /* grab second fragment */
+ cont = rate->gen.slave->period_size - cont;
+ slave_frames = cont;
+ result = snd_pcm_mmap_begin(rate->gen.slave, &slave_areas, &slave_offset, &slave_frames);
+ if (result < 0)
+ return result;
+#if 0
+ if (slave_offset) {
+ SNDERR("non-zero slave_offset %ld", slave_offset);
+ return -EIO;
+ }
+#endif
+ snd_pcm_areas_copy(rate->sareas, xfer,
+ slave_areas, slave_offset,
+ pcm->channels, cont,
+ rate->gen.slave->format);
+ result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
+ if (result < (snd_pcm_sframes_t)cont) {
+ if (result < 0)
+ return result;
+ result = snd_pcm_rewind(rate->gen.slave, result + xfer);
+ if (result < 0)
+ return result;
+ return 0;
+ }
+
+ __transfer:
+ cont = pcm->buffer_size - hw_offset;
+ if (cont >= pcm->period_size) {
+ snd_pcm_rate_read_areas1(pcm, areas, hw_offset,
+ rate->sareas, 0);
+ } else {
+ snd_pcm_rate_read_areas1(pcm,
+ rate->pareas, 0,
+ rate->sareas, 0);
+ snd_pcm_areas_copy(areas, hw_offset,
+ rate->pareas, 0,
+ pcm->channels, cont,
+ pcm->format);
+ snd_pcm_areas_copy(areas, 0,
+ rate->pareas, cont,
+ pcm->channels, pcm->period_size - cont,
+ pcm->format);
+ }
+ }
+ return 1;
+}
+
+static int snd_pcm_rate_sync_playback_area(snd_pcm_t *pcm, snd_pcm_uframes_t appl_ptr)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_t *slave = rate->gen.slave;
+ snd_pcm_uframes_t xfer;
+ snd_pcm_sframes_t slave_size;
+ int err;
+
+ slave_size = snd_pcm_avail_update(slave);
+ if (slave_size < 0)
+ return slave_size;
+
+ if (appl_ptr < rate->last_commit_ptr)
+ xfer = appl_ptr - rate->last_commit_ptr + pcm->boundary;
+ else
+ xfer = appl_ptr - rate->last_commit_ptr;
+ while (xfer >= pcm->period_size &&
+ (snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) {
+ err = snd_pcm_rate_commit_next_period(pcm, rate->last_commit_ptr % pcm->buffer_size);
+ if (err == 0)
+ break;
+ if (err < 0)
+ return err;
+ xfer -= pcm->period_size;
+ slave_size -= rate->gen.slave->period_size;
+ rate->last_commit_ptr += pcm->period_size;
+ if (rate->last_commit_ptr >= pcm->boundary)
+ rate->last_commit_ptr = 0;
+ }
+ return 0;
+}
+
+static snd_pcm_sframes_t snd_pcm_rate_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ int err;
+
+ if (size == 0)
+ return 0;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ err = snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr + size);
+ if (err < 0)
+ return err;
+ }
+ snd_atomic_write_begin(&rate->watom);
+ snd_pcm_mmap_appl_forward(pcm, size);
+ snd_atomic_write_end(&rate->watom);
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_t *slave = rate->gen.slave;
+ snd_pcm_uframes_t slave_size;
+
+ slave_size = snd_pcm_avail_update(slave);
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
+ goto _capture;
+ snd_atomic_write_begin(&rate->watom);
+ snd_pcm_rate_sync_hwptr(pcm);
+ snd_atomic_write_end(&rate->watom);
+ snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr);
+ return snd_pcm_mmap_avail(pcm);
+ _capture: {
+ snd_pcm_uframes_t xfer, hw_offset, size;
+
+ xfer = snd_pcm_mmap_capture_avail(pcm);
+ size = pcm->buffer_size - xfer;
+ hw_offset = snd_pcm_mmap_hw_offset(pcm);
+ while (size >= pcm->period_size &&
+ slave_size >= rate->gen.slave->period_size) {
+ int err = snd_pcm_rate_grab_next_period(pcm, hw_offset);
+ if (err < 0)
+ return err;
+ if (err == 0)
+ return (snd_pcm_sframes_t)xfer;
+ xfer += pcm->period_size;
+ size -= pcm->period_size;
+ slave_size -= rate->gen.slave->period_size;
+ hw_offset += pcm->period_size;
+ hw_offset %= pcm->buffer_size;
+ snd_pcm_mmap_hw_forward(pcm, pcm->period_size);
+ }
+ return (snd_pcm_sframes_t)xfer;
+ }
+}
+
+static int snd_pcm_rate_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_sframes_t avail1;
+ snd_pcm_uframes_t tmp;
+ int ok = 0, err;
+
+ while (1) {
+ /* the position is from this plugin itself */
+ avail1 = snd_pcm_avail_update(pcm);
+ if (avail1 < 0)
+ return avail1;
+ if (ok && (snd_pcm_uframes_t)avail1 == *avail)
+ break;
+ *avail = avail1;
+ /* timestamp is taken from the slave PCM */
+ err = snd_pcm_htimestamp(rate->gen.slave, &tmp, tstamp);
+ if (err < 0)
+ return err;
+ ok = 1;
+ }
+ return 0;
+}
+
+static int snd_pcm_rate_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ /* Try to sync as much as possible */
+ snd_pcm_rate_hwsync(pcm);
+ snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr);
+ }
+ return snd_pcm_poll_descriptors_revents(rate->gen.slave, pfds, nfds, revents);
+}
+
+static int snd_pcm_rate_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ /* commit the remaining fraction (if any) */
+ snd_pcm_uframes_t size, ofs, saved_avail_min;
+ snd_pcm_sw_params_t sw_params;
+
+ /* temporarily set avail_min to one */
+ sw_params = rate->sw_params;
+ saved_avail_min = sw_params.avail_min;
+ sw_params.avail_min = 1;
+ snd_pcm_sw_params(rate->gen.slave, &sw_params);
+
+ size = rate->appl_ptr - rate->last_commit_ptr;
+ ofs = rate->last_commit_ptr % pcm->buffer_size;
+ while (size > 0) {
+ snd_pcm_uframes_t psize, spsize;
+
+ if (snd_pcm_wait(rate->gen.slave, -1) < 0)
+ break;
+ if (size > pcm->period_size) {
+ psize = pcm->period_size;
+ spsize = rate->gen.slave->period_size;
+ } else {
+ psize = size;
+ spsize = rate->ops.output_frames(rate->obj, size);
+ if (! spsize)
+ break;
+ }
+ snd_pcm_rate_commit_area(pcm, rate, ofs,
+ psize, spsize);
+ ofs = (ofs + psize) % pcm->buffer_size;
+ size -= psize;
+ }
+ sw_params.avail_min = saved_avail_min;
+ snd_pcm_sw_params(rate->gen.slave, &sw_params);
+ }
+ return snd_pcm_drain(rate->gen.slave);
+}
+
+static snd_pcm_state_t snd_pcm_rate_state(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ if (rate->start_pending) /* pseudo-state */
+ return SND_PCM_STATE_RUNNING;
+ return snd_pcm_state(rate->gen.slave);
+}
+
+
+static int snd_pcm_rate_start(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_uframes_t avail;
+
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
+ return snd_pcm_start(rate->gen.slave);
+
+ if (snd_pcm_state(rate->gen.slave) != SND_PCM_STATE_PREPARED)
+ return -EBADFD;
+
+ gettimestamp(&rate->trigger_tstamp, pcm->monotonic);
+
+ avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave);
+ if (avail == 0) {
+ /* postpone the trigger since we have no data committed yet */
+ rate->start_pending = 1;
+ return 0;
+ }
+ rate->start_pending = 0;
+ return snd_pcm_start(rate->gen.slave);
+}
+
+static int snd_pcm_rate_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ snd_pcm_sframes_t err;
+ snd_atomic_read_t ratom;
+ snd_atomic_read_init(&ratom, &rate->watom);
+ _again:
+ snd_atomic_read_begin(&ratom);
+ err = snd_pcm_status(rate->gen.slave, status);
+ if (err < 0) {
+ snd_atomic_read_ok(&ratom);
+ return err;
+ }
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (rate->start_pending)
+ status->state = SND_PCM_STATE_RUNNING;
+ status->trigger_tstamp = rate->trigger_tstamp;
+ }
+ snd_pcm_rate_sync_hwptr(pcm);
+ status->appl_ptr = *pcm->appl.ptr;
+ status->hw_ptr = *pcm->hw.ptr;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ status->delay = snd_pcm_mmap_playback_hw_avail(pcm);
+ status->avail = snd_pcm_mmap_playback_avail(pcm);
+ status->avail_max = rate->ops.input_frames(rate->obj, status->avail_max);
+ } else {
+ status->delay = snd_pcm_mmap_capture_hw_avail(pcm);
+ status->avail = snd_pcm_mmap_capture_avail(pcm);
+ status->avail_max = rate->ops.output_frames(rate->obj, status->avail_max);
+ }
+ if (!snd_atomic_read_ok(&ratom)) {
+ snd_atomic_read_wait(&ratom);
+ goto _again;
+ }
+ return 0;
+}
+
+static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+ if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
+ snd_output_printf(out, "Rate conversion PCM (%d)\n",
+ rate->srate);
+ else
+ snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n",
+ rate->srate,
+ snd_pcm_format_name(rate->sformat));
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(rate->gen.slave, out);
+}
+
+static int snd_pcm_rate_close(snd_pcm_t *pcm)
+{
+ snd_pcm_rate_t *rate = pcm->private_data;
+
+ if (rate->ops.close)
+ rate->ops.close(rate->obj);
+ return snd_pcm_generic_close(pcm);
+}
+
+static const snd_pcm_fast_ops_t snd_pcm_rate_fast_ops = {
+ .status = snd_pcm_rate_status,
+ .state = snd_pcm_rate_state,
+ .hwsync = snd_pcm_rate_hwsync,
+ .delay = snd_pcm_rate_delay,
+ .prepare = snd_pcm_rate_prepare,
+ .reset = snd_pcm_rate_reset,
+ .start = snd_pcm_rate_start,
+ .drop = snd_pcm_generic_drop,
+ .drain = snd_pcm_rate_drain,
+ .pause = snd_pcm_generic_pause,
+ .rewind = snd_pcm_rate_rewind,
+ .forward = snd_pcm_rate_forward,
+ .resume = snd_pcm_generic_resume,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .avail_update = snd_pcm_rate_avail_update,
+ .mmap_commit = snd_pcm_rate_mmap_commit,
+ .htimestamp = snd_pcm_rate_htimestamp,
+ .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
+ .poll_revents = snd_pcm_rate_poll_revents,
+};
+
+static const snd_pcm_ops_t snd_pcm_rate_ops = {
+ .close = snd_pcm_rate_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_rate_hw_refine,
+ .hw_params = snd_pcm_rate_hw_params,
+ .hw_free = snd_pcm_rate_hw_free,
+ .sw_params = snd_pcm_rate_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_rate_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Get a default converter string
+ * \param root Root configuration node
+ * \retval A const config item if found, or NULL
+ */
+const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root)
+{
+ snd_config_t *n;
+ /* look for default definition */
+ if (snd_config_search(root, "defaults.pcm.rate_converter", &n) >= 0)
+ return n;
+ return NULL;
+}
+
+#ifdef PIC
+static int is_builtin_plugin(const char *type)
+{
+ return strcmp(type, "linear") == 0;
+}
+
+static const char *const default_rate_plugins[] = {
+ "speexrate", "linear", NULL
+};
+
+static int rate_open_func(snd_pcm_rate_t *rate, const char *type)
+{
+ char open_name[64];
+ snd_pcm_rate_open_func_t open_func;
+
+ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type);
+ open_func = snd_dlobj_cache_lookup(open_name);
+ if (!open_func) {
+ void *h;
+ char lib_name[128], *lib = NULL;
+ if (!is_builtin_plugin(type)) {
+ snprintf(lib_name, sizeof(lib_name),
+ "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type);
+ lib = lib_name;
+ }
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (!h)
+ return -ENOENT;
+ open_func = snd_dlsym(h, open_name, NULL);
+ if (!open_func) {
+ snd_dlclose(h);
+ return -ENOENT;
+ }
+ snd_dlobj_cache_add(open_name, h, open_func);
+ }
+ return open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
+}
+#endif
+
+/**
+ * \brief Creates a new rate PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave format
+ * \param srate Slave rate
+ * \param type SRC type string
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, unsigned int srate,
+ const snd_config_t *converter,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_rate_t *rate;
+ const char *type = NULL;
+ int err;
+#ifndef PIC
+ snd_pcm_rate_open_func_t open_func;
+ extern int SND_PCM_RATE_PLUGIN_ENTRY(linear) (unsigned int version, void **objp, snd_pcm_rate_ops_t *ops);
+#endif
+
+ assert(pcmp && slave);
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ snd_pcm_format_linear(sformat) != 1)
+ return -EINVAL;
+ rate = calloc(1, sizeof(snd_pcm_rate_t));
+ if (!rate) {
+ return -ENOMEM;
+ }
+ rate->gen.slave = slave;
+ rate->gen.close_slave = close_slave;
+ rate->srate = srate;
+ rate->sformat = sformat;
+ snd_atomic_write_init(&rate->watom);
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_RATE, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(rate);
+ return err;
+ }
+
+#ifdef PIC
+ err = -ENOENT;
+ if (!converter) {
+ const char *const *types;
+ for (types = default_rate_plugins; *types; types++) {
+ err = rate_open_func(rate, *types);
+ if (!err) {
+ type = *types;
+ break;
+ }
+ }
+ } else if (!snd_config_get_string(converter, &type))
+ err = rate_open_func(rate, type);
+ else if (snd_config_get_type(converter) == SND_CONFIG_TYPE_COMPOUND) {
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, converter) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ if (snd_config_get_string(n, &type) < 0)
+ break;
+ err = rate_open_func(rate, type);
+ if (!err)
+ break;
+ }
+ } else {
+ SNDERR("Invalid type for rate converter");
+ snd_pcm_close(pcm);
+ return -EINVAL;
+ }
+ if (err < 0) {
+ SNDERR("Cannot find rate converter");
+ snd_pcm_close(pcm);
+ return -ENOENT;
+ }
+#else
+ type = "linear";
+ open_func = SND_PCM_RATE_PLUGIN_ENTRY(linear);
+ err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
+ if (err < 0) {
+ snd_pcm_close(pcm);
+ return err;
+ }
+#endif
+
+ if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
+ ! rate->ops.input_frames || ! rate->ops.output_frames) {
+ SNDERR("Inproper rate plugin %s initialization", type);
+ snd_pcm_close(pcm);
+ return err;
+ }
+
+ pcm->ops = &snd_pcm_rate_ops;
+ pcm->fast_ops = &snd_pcm_rate_fast_ops;
+ pcm->private_data = rate;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->mmap_rw = 1;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &rate->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &rate->appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_rate Plugin: Rate
+
+This plugin converts a stream rate. The input and output formats must be linear.
+
+\code
+pcm.name {
+ type rate # Rate PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ rate INT # Slave rate
+ [format STR] # Slave format
+ }
+ converter STR # optional
+ # or
+ converter [ STR1 STR2 ... ] # optional
+ # Converter type, default is taken from
+ # defaults.pcm.rate_converter
+}
+\endcode
+
+\subsection pcm_plugins_rate_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_rate_open()
+ <LI>_snd_pcm_rate_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new rate PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with rate PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
+ int srate = -1;
+ const snd_config_t *converter = NULL;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "converter") == 0) {
+ converter = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+
+ err = snd_pcm_slave_conf(root, slave, &sconf, 2,
+ SND_PCM_HW_PARAM_FORMAT, 0, &sformat,
+ SND_PCM_HW_PARAM_RATE, SCONF_MANDATORY, &srate);
+ if (err < 0)
+ return err;
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ snd_pcm_format_linear(sformat) != 1) {
+ snd_config_delete(sconf);
+ SNDERR("slave format is not linear");
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ err = snd_pcm_rate_open(pcmp, name, sformat, (unsigned int) srate,
+ converter, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_rate_linear.c b/alsa-lib/src/pcm/pcm_rate_linear.c
new file mode 100644
index 0000000..20e119b
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_rate_linear.c
@@ -0,0 +1,435 @@
+/*
+ * Linear rate converter plugin
+ *
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ * 2004 by Jaroslav Kysela <perex@perex.cz>
+ * 2006 by Takashi Iwai <tiwai@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <inttypes.h>
+#include <byteswap.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+#include "pcm_rate.h"
+
+#include "plugin_ops.h"
+
+
+/* LINEAR_DIV needs to be large enough to handle resampling from 192000 -> 8000 */
+#define LINEAR_DIV_SHIFT 19
+#define LINEAR_DIV (1<<LINEAR_DIV_SHIFT)
+
+struct rate_linear {
+ unsigned int get_idx;
+ unsigned int put_idx;
+ unsigned int pitch;
+ unsigned int pitch_shift; /* for expand interpolation */
+ unsigned int channels;
+ int16_t *old_sample;
+ void (*func)(struct rate_linear *rate,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames);
+};
+
+static snd_pcm_uframes_t input_frames(void *obj, snd_pcm_uframes_t frames)
+{
+ struct rate_linear *rate = obj;
+ if (frames == 0)
+ return 0;
+ /* Round toward zero */
+ return muldiv_near(frames, LINEAR_DIV, rate->pitch);
+}
+
+static snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames)
+{
+ struct rate_linear *rate = obj;
+ if (frames == 0)
+ return 0;
+ /* Round toward zero */
+ return muldiv_near(frames, rate->pitch, LINEAR_DIV);
+}
+
+static void linear_expand(struct rate_linear *rate,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames)
+{
+#define GET16_LABELS
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+#undef PUT16_LABELS
+ void *get = get16_labels[rate->get_idx];
+ void *put = put16_labels[rate->put_idx];
+ unsigned int get_threshold = rate->pitch;
+ unsigned int channel;
+ unsigned int src_frames1;
+ unsigned int dst_frames1;
+ int16_t sample = 0;
+ unsigned int pos;
+
+ for (channel = 0; channel < rate->channels; ++channel) {
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ int16_t old_sample = 0;
+ int16_t new_sample;
+ int old_weight, new_weight;
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ src_frames1 = 0;
+ dst_frames1 = 0;
+ new_sample = rate->old_sample[channel];
+ pos = get_threshold;
+ while (dst_frames1 < dst_frames) {
+ if (pos >= get_threshold) {
+ pos -= get_threshold;
+ old_sample = new_sample;
+ if (src_frames1 < src_frames) {
+ goto *get;
+#define GET16_END after_get
+#include "plugin_ops.h"
+#undef GET16_END
+ after_get:
+ new_sample = sample;
+ }
+ }
+ new_weight = (pos << (16 - rate->pitch_shift)) / (get_threshold >> rate->pitch_shift);
+ old_weight = 0x10000 - new_weight;
+ sample = (old_sample * old_weight + new_sample * new_weight) >> 16;
+ goto *put;
+#define PUT16_END after_put
+#include "plugin_ops.h"
+#undef PUT16_END
+ after_put:
+ dst += dst_step;
+ dst_frames1++;
+ pos += LINEAR_DIV;
+ if (pos >= get_threshold) {
+ src += src_step;
+ src_frames1++;
+ }
+ }
+ rate->old_sample[channel] = new_sample;
+ }
+}
+
+/* optimized version for S16 format */
+static void linear_expand_s16(struct rate_linear *rate,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames)
+{
+ unsigned int channel;
+ unsigned int src_frames1;
+ unsigned int dst_frames1;
+ unsigned int get_threshold = rate->pitch;
+ unsigned int pos;
+
+ for (channel = 0; channel < rate->channels; ++channel) {
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ const int16_t *src;
+ int16_t *dst;
+ int src_step, dst_step;
+ int16_t old_sample = 0;
+ int16_t new_sample;
+ int old_weight, new_weight;
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area) >> 1;
+ dst_step = snd_pcm_channel_area_step(dst_area) >> 1;
+ src_frames1 = 0;
+ dst_frames1 = 0;
+ new_sample = rate->old_sample[channel];
+ pos = get_threshold;
+ while (dst_frames1 < dst_frames) {
+ if (pos >= get_threshold) {
+ pos -= get_threshold;
+ old_sample = new_sample;
+ if (src_frames1 < src_frames)
+ new_sample = *src;
+ }
+ new_weight = (pos << (16 - rate->pitch_shift)) / (get_threshold >> rate->pitch_shift);
+ old_weight = 0x10000 - new_weight;
+ *dst = (old_sample * old_weight + new_sample * new_weight) >> 16;
+ dst += dst_step;
+ dst_frames1++;
+ pos += LINEAR_DIV;
+ if (pos >= get_threshold) {
+ src += src_step;
+ src_frames1++;
+ }
+ }
+ rate->old_sample[channel] = new_sample;
+ }
+}
+
+static void linear_shrink(struct rate_linear *rate,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames)
+{
+#define GET16_LABELS
+#define PUT16_LABELS
+#include "plugin_ops.h"
+#undef GET16_LABELS
+#undef PUT16_LABELS
+ void *get = get16_labels[rate->get_idx];
+ void *put = put16_labels[rate->put_idx];
+ unsigned int get_increment = rate->pitch;
+ unsigned int channel;
+ unsigned int src_frames1;
+ unsigned int dst_frames1;
+ int16_t sample = 0;
+ unsigned int pos;
+
+ for (channel = 0; channel < rate->channels; ++channel) {
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ int16_t old_sample = 0;
+ int16_t new_sample = 0;
+ int old_weight, new_weight;
+ pos = LINEAR_DIV - get_increment; /* Force first sample to be copied */
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ src_frames1 = 0;
+ dst_frames1 = 0;
+ while (src_frames1 < src_frames) {
+
+ goto *get;
+#define GET16_END after_get
+#include "plugin_ops.h"
+#undef GET16_END
+ after_get:
+ new_sample = sample;
+ src += src_step;
+ src_frames1++;
+ pos += get_increment;
+ if (pos >= LINEAR_DIV) {
+ pos -= LINEAR_DIV;
+ old_weight = (pos << (32 - LINEAR_DIV_SHIFT)) / (get_increment >> (LINEAR_DIV_SHIFT - 16));
+ new_weight = 0x10000 - old_weight;
+ sample = (old_sample * old_weight + new_sample * new_weight) >> 16;
+ goto *put;
+#define PUT16_END after_put
+#include "plugin_ops.h"
+#undef PUT16_END
+ after_put:
+ dst += dst_step;
+ dst_frames1++;
+ if (CHECK_SANITY(dst_frames1 > dst_frames)) {
+ SNDERR("dst_frames overflow");
+ break;
+ }
+ }
+ old_sample = new_sample;
+ }
+ }
+}
+
+/* optimized version for S16 format */
+static void linear_shrink_s16(struct rate_linear *rate,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames)
+{
+ unsigned int get_increment = rate->pitch;
+ unsigned int channel;
+ unsigned int src_frames1;
+ unsigned int dst_frames1;
+ unsigned int pos = 0;
+
+ for (channel = 0; channel < rate->channels; ++channel) {
+ const snd_pcm_channel_area_t *src_area = &src_areas[channel];
+ const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
+ const int16_t *src;
+ int16_t *dst;
+ int src_step, dst_step;
+ int16_t old_sample = 0;
+ int16_t new_sample = 0;
+ int old_weight, new_weight;
+ pos = LINEAR_DIV - get_increment; /* Force first sample to be copied */
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area) >> 1;
+ dst_step = snd_pcm_channel_area_step(dst_area) >> 1 ;
+ src_frames1 = 0;
+ dst_frames1 = 0;
+ while (src_frames1 < src_frames) {
+
+ new_sample = *src;
+ src += src_step;
+ src_frames1++;
+ pos += get_increment;
+ if (pos >= LINEAR_DIV) {
+ pos -= LINEAR_DIV;
+ old_weight = (pos << (32 - LINEAR_DIV_SHIFT)) / (get_increment >> (LINEAR_DIV_SHIFT - 16));
+ new_weight = 0x10000 - old_weight;
+ *dst = (old_sample * old_weight + new_sample * new_weight) >> 16;
+ dst += dst_step;
+ dst_frames1++;
+ if (CHECK_SANITY(dst_frames1 > dst_frames)) {
+ SNDERR("dst_frames overflow");
+ break;
+ }
+ }
+ old_sample = new_sample;
+ }
+ }
+}
+
+static void linear_convert(void *obj,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, unsigned int src_frames)
+{
+ struct rate_linear *rate = obj;
+ rate->func(rate, dst_areas, dst_offset, dst_frames,
+ src_areas, src_offset, src_frames);
+}
+
+static void linear_free(void *obj)
+{
+ struct rate_linear *rate = obj;
+
+ free(rate->old_sample);
+ rate->old_sample = NULL;
+}
+
+static int linear_init(void *obj, snd_pcm_rate_info_t *info)
+{
+ struct rate_linear *rate = obj;
+
+ rate->get_idx = snd_pcm_linear_get_index(info->in.format, SND_PCM_FORMAT_S16);
+ rate->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, info->out.format);
+ if (info->in.rate < info->out.rate) {
+ if (info->in.format == info->out.format && info->in.format == SND_PCM_FORMAT_S16)
+ rate->func = linear_expand_s16;
+ else
+ rate->func = linear_expand;
+ /* pitch is get_threshold */
+ } else {
+ if (info->in.format == info->out.format && info->in.format == SND_PCM_FORMAT_S16)
+ rate->func = linear_shrink_s16;
+ else
+ rate->func = linear_shrink;
+ /* pitch is get_increment */
+ }
+ rate->pitch = (((u_int64_t)info->out.rate * LINEAR_DIV) +
+ (info->in.rate / 2)) / info->in.rate;
+ rate->channels = info->channels;
+
+ free(rate->old_sample);
+ rate->old_sample = malloc(sizeof(*rate->old_sample) * rate->channels);
+ if (! rate->old_sample)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
+{
+ struct rate_linear *rate = obj;
+ snd_pcm_uframes_t cframes;
+
+ rate->pitch = (((u_int64_t)info->out.period_size * LINEAR_DIV) +
+ (info->in.period_size/2) ) / info->in.period_size;
+
+ cframes = input_frames(rate, info->out.period_size);
+ while (cframes != info->in.period_size) {
+ snd_pcm_uframes_t cframes_new;
+ if (cframes > info->in.period_size)
+ rate->pitch++;
+ else
+ rate->pitch--;
+ cframes_new = input_frames(rate, info->out.period_size);
+ if ((cframes > info->in.period_size && cframes_new < info->in.period_size) ||
+ (cframes < info->in.period_size && cframes_new > info->in.period_size)) {
+ SNDERR("invalid pcm period_size %ld -> %ld",
+ info->in.period_size, info->out.period_size);
+ return -EIO;
+ }
+ cframes = cframes_new;
+ }
+ if (rate->pitch >= LINEAR_DIV) {
+ /* shift for expand linear interpolation */
+ rate->pitch_shift = 0;
+ while ((rate->pitch >> rate->pitch_shift) >= (1 << 16))
+ rate->pitch_shift++;
+ }
+ return 0;
+}
+
+static void linear_reset(void *obj)
+{
+ struct rate_linear *rate = obj;
+
+ /* for expand */
+ if (rate->old_sample)
+ memset(rate->old_sample, 0, sizeof(*rate->old_sample) * rate->channels);
+}
+
+static void linear_close(void *obj)
+{
+ free(obj);
+}
+
+static const snd_pcm_rate_ops_t linear_ops = {
+ .close = linear_close,
+ .init = linear_init,
+ .free = linear_free,
+ .reset = linear_reset,
+ .adjust_pitch = linear_adjust_pitch,
+ .convert = linear_convert,
+ .input_frames = input_frames,
+ .output_frames = output_frames,
+};
+
+int SND_PCM_RATE_PLUGIN_ENTRY(linear) (unsigned int version, void **objp, snd_pcm_rate_ops_t *ops)
+{
+ struct rate_linear *rate;
+
+ if (version != SND_PCM_RATE_PLUGIN_VERSION) {
+ SNDERR("Invalid plugin version %x\n", version);
+ return -EINVAL;
+ }
+
+ rate = calloc(1, sizeof(*rate));
+ if (! rate)
+ return -ENOMEM;
+
+ *objp = rate;
+ *ops = linear_ops;
+ return 0;
+}
diff --git a/alsa-lib/src/pcm/pcm_route.c b/alsa-lib/src/pcm/pcm_route.c
new file mode 100644
index 0000000..4da623f
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_route.c
@@ -0,0 +1,1172 @@
+/**
+ * \file pcm/pcm_route.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Route & Volume Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Route & Volume Plugin
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include <math.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#include "plugin_ops.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_route = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+/* The best possible hack to support missing optimization in gcc 2.7.2.3 */
+#if SND_PCM_PLUGIN_ROUTE_RESOLUTION & (SND_PCM_PLUGIN_ROUTE_RESOLUTION - 1) != 0
+#define div(a) a /= SND_PCM_PLUGIN_ROUTE_RESOLUTION
+#elif SND_PCM_PLUGIN_ROUTE_RESOLUTION == 16
+#define div(a) a >>= 4
+#else
+#error "Add some code here"
+#endif
+
+typedef struct {
+ int channel;
+ int as_int;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ float as_float;
+#endif
+} snd_pcm_route_ttable_src_t;
+
+typedef struct snd_pcm_route_ttable_dst snd_pcm_route_ttable_dst_t;
+
+typedef struct {
+ enum {UINT32=0, UINT64=1, FLOAT=2} sum_idx;
+ unsigned int get_idx;
+ unsigned int put_idx;
+ unsigned int conv_idx;
+ int use_getput;
+ unsigned int src_size;
+ snd_pcm_format_t dst_sfmt;
+ unsigned int ndsts;
+ snd_pcm_route_ttable_dst_t *dsts;
+} snd_pcm_route_params_t;
+
+
+typedef void (*route_f)(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int src_channels,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t *ttable,
+ const snd_pcm_route_params_t *params);
+
+struct snd_pcm_route_ttable_dst {
+ int att; /* Attenuated */
+ unsigned int nsrcs;
+ snd_pcm_route_ttable_src_t* srcs;
+ route_f func;
+};
+
+typedef union {
+ int32_t as_sint32;
+ int64_t as_sint64;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ float as_float;
+#endif
+} sum_t;
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ snd_pcm_format_t sformat;
+ int schannels;
+ snd_pcm_route_params_t params;
+} snd_pcm_route_t;
+
+#endif /* DOC_HIDDEN */
+
+static void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t src_offset ATTRIBUTE_UNUSED,
+ unsigned int src_channels ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable ATTRIBUTE_UNUSED,
+ const snd_pcm_route_params_t *params)
+{
+ snd_pcm_area_silence(dst_area, dst_offset, frames, params->dst_sfmt);
+}
+
+#ifndef DOC_HIDDEN
+
+static void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int src_channels,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable,
+ const snd_pcm_route_params_t *params)
+{
+#define CONV_LABELS
+#include "plugin_ops.h"
+#undef CONV_LABELS
+ void *conv;
+ const snd_pcm_channel_area_t *src_area = 0;
+ unsigned int srcidx;
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ for (srcidx = 0; srcidx < ttable->nsrcs && srcidx < src_channels; ++srcidx) {
+ unsigned int channel = ttable->srcs[srcidx].channel;
+ if (channel >= src_channels)
+ continue;
+ src_area = &src_areas[channel];
+ if (src_area->addr != NULL)
+ break;
+ }
+ if (srcidx == ttable->nsrcs || srcidx == src_channels) {
+ snd_pcm_route_convert1_zero(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, ttable, params);
+ return;
+ }
+
+ conv = conv_labels[params->conv_idx];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ while (frames-- > 0) {
+ goto *conv;
+#define CONV_END after
+#include "plugin_ops.h"
+#undef CONV_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+}
+
+static void snd_pcm_route_convert1_one_getput(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int src_channels,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable,
+ const snd_pcm_route_params_t *params)
+{
+#define CONV24_LABELS
+#include "plugin_ops.h"
+#undef CONV24_LABELS
+ void *get, *put;
+ const snd_pcm_channel_area_t *src_area = 0;
+ unsigned int srcidx;
+ const char *src;
+ char *dst;
+ int src_step, dst_step;
+ u_int32_t sample = 0;
+ for (srcidx = 0; srcidx < ttable->nsrcs && srcidx < src_channels; ++srcidx) {
+ unsigned int channel = ttable->srcs[srcidx].channel;
+ if (channel >= src_channels)
+ continue;
+ src_area = &src_areas[channel];
+ if (src_area->addr != NULL)
+ break;
+ }
+ if (srcidx == ttable->nsrcs || srcidx == src_channels) {
+ snd_pcm_route_convert1_zero(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, ttable, params);
+ return;
+ }
+
+ get = get32_labels[params->get_idx];
+ put = put32_labels[params->put_idx];
+ src = snd_pcm_channel_area_addr(src_area, src_offset);
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ src_step = snd_pcm_channel_area_step(src_area);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+ while (frames-- > 0) {
+ goto *get;
+#define CONV24_END after
+#include "plugin_ops.h"
+#undef CONV24_END
+ after:
+ src += src_step;
+ dst += dst_step;
+ }
+}
+
+static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int src_channels,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable,
+ const snd_pcm_route_params_t *params)
+{
+#define GETS_LABELS
+#define PUT32_LABELS
+#include "plugin_ops.h"
+#undef GETS_LABELS
+#undef PUT32_LABELS
+ static void *const zero_labels[3] = {
+ &&zero_int32, &&zero_int64,
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ &&zero_float
+#endif
+ };
+ /* sum_type att */
+ static void *const add_labels[3 * 2] = {
+ &&add_int32_noatt, &&add_int32_att,
+ &&add_int64_noatt, &&add_int64_att,
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ &&add_float_noatt, &&add_float_att
+#endif
+ };
+ /* sum_type att shift */
+ static void *const norm_labels[3 * 2 * 4] = {
+ 0,
+ &&norm_int32_8_noatt,
+ &&norm_int32_16_noatt,
+ &&norm_int32_24_noatt,
+ 0,
+ &&norm_int32_8_att,
+ &&norm_int32_16_att,
+ &&norm_int32_24_att,
+ &&norm_int64_0_noatt,
+ &&norm_int64_8_noatt,
+ &&norm_int64_16_noatt,
+ &&norm_int64_24_noatt,
+ &&norm_int64_0_att,
+ &&norm_int64_8_att,
+ &&norm_int64_16_att,
+ &&norm_int64_24_att,
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ &&norm_float_0,
+ &&norm_float_8,
+ &&norm_float_16,
+ &&norm_float_24,
+ &&norm_float_0,
+ &&norm_float_8,
+ &&norm_float_16,
+ &&norm_float_24,
+#endif
+ };
+ void *zero, *get, *add, *norm, *put32;
+ int nsrcs = ttable->nsrcs;
+ char *dst;
+ int dst_step;
+ const char *srcs[nsrcs];
+ int src_steps[nsrcs];
+ snd_pcm_route_ttable_src_t src_tt[nsrcs];
+ int32_t sample = 0;
+ int srcidx, srcidx1 = 0;
+ for (srcidx = 0; srcidx < nsrcs && (unsigned)srcidx < src_channels; ++srcidx) {
+ const snd_pcm_channel_area_t *src_area;
+ unsigned int channel = ttable->srcs[srcidx].channel;
+ if (channel >= src_channels)
+ continue;
+ src_area = &src_areas[channel];
+ srcs[srcidx1] = snd_pcm_channel_area_addr(src_area, src_offset);
+ src_steps[srcidx1] = snd_pcm_channel_area_step(src_area);
+ src_tt[srcidx1] = ttable->srcs[srcidx];
+ srcidx1++;
+ }
+ nsrcs = srcidx1;
+ if (nsrcs == 0) {
+ snd_pcm_route_convert1_zero(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, ttable, params);
+ return;
+ } else if (nsrcs == 1 && src_tt[0].as_int == SND_PCM_PLUGIN_ROUTE_RESOLUTION) {
+ if (params->use_getput)
+ snd_pcm_route_convert1_one_getput(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, ttable, params);
+ else
+ snd_pcm_route_convert1_one(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, ttable, params);
+ return;
+ }
+
+ zero = zero_labels[params->sum_idx];
+ get = gets_labels[params->get_idx];
+ add = add_labels[params->sum_idx * 2 + ttable->att];
+ norm = norm_labels[params->sum_idx * 8 + ttable->att * 4 + 4 - params->src_size];
+ put32 = put32_labels[params->put_idx];
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
+ dst_step = snd_pcm_channel_area_step(dst_area);
+
+ while (frames-- > 0) {
+ snd_pcm_route_ttable_src_t *ttp = src_tt;
+ sum_t sum;
+
+ /* Zero sum */
+ goto *zero;
+ zero_int32:
+ sum.as_sint32 = 0;
+ goto zero_end;
+ zero_int64:
+ sum.as_sint64 = 0;
+ goto zero_end;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ zero_float:
+ sum.as_float = 0.0;
+ goto zero_end;
+#endif
+ zero_end:
+ for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
+ const char *src = srcs[srcidx];
+
+ /* Get sample */
+ goto *get;
+#define GETS_END after_get
+#include "plugin_ops.h"
+#undef GETS_END
+ after_get:
+
+ /* Sum */
+ goto *add;
+ add_int32_att:
+ sum.as_sint32 += sample * ttp->as_int;
+ goto after_sum;
+ add_int32_noatt:
+ if (ttp->as_int)
+ sum.as_sint32 += sample;
+ goto after_sum;
+ add_int64_att:
+ sum.as_sint64 += (int64_t) sample * ttp->as_int;
+ goto after_sum;
+ add_int64_noatt:
+ if (ttp->as_int)
+ sum.as_sint64 += sample;
+ goto after_sum;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ add_float_att:
+ sum.as_float += sample * ttp->as_float;
+ goto after_sum;
+ add_float_noatt:
+ if (ttp->as_int)
+ sum.as_float += sample;
+ goto after_sum;
+#endif
+ after_sum:
+ srcs[srcidx] += src_steps[srcidx];
+ ttp++;
+ }
+
+ /* Normalization */
+ goto *norm;
+ norm_int32_8_att:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_8_att:
+ sum.as_sint64 <<= 8;
+ norm_int64_0_att:
+ div(sum.as_sint64);
+ goto norm_int;
+
+ norm_int32_16_att:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_16_att:
+ sum.as_sint64 <<= 16;
+ div(sum.as_sint64);
+ goto norm_int;
+
+ norm_int32_24_att:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_24_att:
+ sum.as_sint64 <<= 24;
+ div(sum.as_sint64);
+ goto norm_int;
+
+ norm_int32_8_noatt:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_8_noatt:
+ sum.as_sint64 <<= 8;
+ goto norm_int;
+
+ norm_int32_16_noatt:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_16_noatt:
+ sum.as_sint64 <<= 16;
+ goto norm_int;
+
+ norm_int32_24_noatt:
+ sum.as_sint64 = sum.as_sint32;
+ norm_int64_24_noatt:
+ sum.as_sint64 <<= 24;
+ goto norm_int;
+
+ norm_int64_0_noatt:
+ norm_int:
+ if (sum.as_sint64 > (int64_t)0x7fffffff)
+ sample = 0x7fffffff; /* maximum positive value */
+ else if (sum.as_sint64 < -(int64_t)0x80000000)
+ sample = 0x80000000; /* maximum negative value */
+ else
+ sample = sum.as_sint64;
+ goto after_norm;
+
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ norm_float_8:
+ sum.as_float *= 1 << 8;
+ goto norm_float;
+ norm_float_16:
+ sum.as_float *= 1 << 16;
+ goto norm_float;
+ norm_float_24:
+ sum.as_float *= 1 << 24;
+ goto norm_float;
+ norm_float_0:
+ norm_float:
+ sum.as_float = rint(sum.as_float);
+ if (sum.as_float > (int64_t)0x7fffffff)
+ sample = 0x7fffffff; /* maximum positive value */
+ else if (sum.as_float < -(int64_t)0x80000000)
+ sample = 0x80000000; /* maximum negative value */
+ else
+ sample = sum.as_float;
+ goto after_norm;
+#endif
+ after_norm:
+
+ /* Put sample */
+ goto *put32;
+#define PUT32_END after_put32
+#include "plugin_ops.h"
+#undef PUT32_END
+ after_put32:
+
+ dst += dst_step;
+ }
+}
+
+#endif /* DOC_HIDDEN */
+
+static void snd_pcm_route_convert(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int src_channels,
+ unsigned int dst_channels,
+ snd_pcm_uframes_t frames,
+ snd_pcm_route_params_t *params)
+{
+ unsigned int dst_channel;
+ snd_pcm_route_ttable_dst_t *dstp;
+ const snd_pcm_channel_area_t *dst_area;
+
+ dstp = params->dsts;
+ dst_area = dst_areas;
+ for (dst_channel = 0; dst_channel < dst_channels; ++dst_channel) {
+ if (dst_channel >= params->ndsts)
+ snd_pcm_route_convert1_zero(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, dstp, params);
+ else
+ dstp->func(dst_area, dst_offset,
+ src_areas, src_offset,
+ src_channels,
+ frames, dstp, params);
+ dstp++;
+ dst_area++;
+ }
+}
+
+static int snd_pcm_route_close(snd_pcm_t *pcm)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ snd_pcm_route_params_t *params = &route->params;
+ unsigned int dst_channel;
+
+ if (params->dsts) {
+ for (dst_channel = 0; dst_channel < params->ndsts; ++dst_channel) {
+ free(params->dsts[dst_channel].srcs);
+ }
+ free(params->dsts);
+ }
+ return snd_pcm_generic_close(pcm);
+}
+
+static int snd_pcm_route_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ snd_pcm_format_mask_t format_mask = { SND_PCM_FMTBIT_LINEAR };
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_CHANNELS, 1, 0);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_route_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ if (route->sformat != SND_PCM_FORMAT_UNKNOWN) {
+ _snd_pcm_hw_params_set_format(sparams, route->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ }
+ if (route->schannels >= 0) {
+ _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS,
+ (unsigned int) route->schannels, 0);
+ }
+ return 0;
+}
+
+static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS);
+ if (route->schannels < 0)
+ links |= SND_PCM_HW_PARBIT_CHANNELS;
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS);
+ if (route->schannels < 0)
+ links |= SND_PCM_HW_PARBIT_CHANNELS;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_route_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_route_hw_refine_cprepare,
+ snd_pcm_route_hw_refine_cchange,
+ snd_pcm_route_hw_refine_sprepare,
+ snd_pcm_route_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ snd_pcm_t *slave = route->plug.gen.slave;
+ snd_pcm_format_t src_format, dst_format;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_route_hw_refine_cchange,
+ snd_pcm_route_hw_refine_sprepare,
+ snd_pcm_route_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format);
+ dst_format = slave->format;
+ } else {
+ src_format = slave->format;
+ err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
+ }
+ if (err < 0)
+ return err;
+ route->params.use_getput = snd_pcm_format_physical_width(src_format) == 24 ||
+ snd_pcm_format_physical_width(dst_format) == 24;
+ route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S16);
+ route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
+ route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);
+ route->params.src_size = snd_pcm_format_width(src_format) / 8;
+ route->params.dst_sfmt = dst_format;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ route->params.sum_idx = FLOAT;
+#else
+ if (snd_pcm_format_width(src_format) == 32)
+ route->params.sum_idx = UINT64;
+ else
+ route->params.sum_idx = UINT32;
+#endif
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_route_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ snd_pcm_t *slave = route->plug.gen.slave;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ snd_pcm_route_convert(slave_areas, slave_offset,
+ areas, offset,
+ pcm->channels,
+ slave->channels,
+ size, &route->params);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_route_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ snd_pcm_t *slave = route->plug.gen.slave;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ snd_pcm_route_convert(areas, offset,
+ slave_areas, slave_offset,
+ slave->channels,
+ pcm->channels,
+ size, &route->params);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_route_t *route = pcm->private_data;
+ unsigned int dst;
+ if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
+ snd_output_printf(out, "Route conversion PCM\n");
+ else
+ snd_output_printf(out, "Route conversion PCM (sformat=%s)\n",
+ snd_pcm_format_name(route->sformat));
+ snd_output_puts(out, " Transformation table:\n");
+ for (dst = 0; dst < route->params.ndsts; dst++) {
+ snd_pcm_route_ttable_dst_t *d = &route->params.dsts[dst];
+ unsigned int src;
+ snd_output_printf(out, " %d <- ", dst);
+ if (d->nsrcs == 0) {
+ snd_output_printf(out, "none\n");
+ continue;
+ }
+ src = 0;
+ while (1) {
+ snd_pcm_route_ttable_src_t *s = &d->srcs[src];
+ if (d->att)
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ snd_output_printf(out, "%d*%g", s->channel, s->as_float);
+#else
+ snd_output_printf(out, "%d*%g", s->channel, (double)s->as_int / (double)SND_PCM_PLUGIN_ROUTE_RESOLUTION);
+#endif
+ else
+ snd_output_printf(out, "%d", s->channel);
+ src++;
+ if (src == d->nsrcs)
+ break;
+ snd_output_puts(out, " + ");
+ }
+ snd_output_putc(out, '\n');
+ }
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(route->plug.gen.slave, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_route_ops = {
+ .close = snd_pcm_route_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_route_hw_refine,
+ .hw_params = snd_pcm_route_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_route_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+static int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
+ unsigned int tt_ssize,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_cused, unsigned int tt_sused)
+{
+ unsigned int src_channel, dst_channel;
+ snd_pcm_route_ttable_dst_t *dptr;
+ unsigned int sused, dused, smul, dmul;
+ if (stream == SND_PCM_STREAM_PLAYBACK) {
+ sused = tt_cused;
+ dused = tt_sused;
+ smul = tt_ssize;
+ dmul = 1;
+ } else {
+ sused = tt_sused;
+ dused = tt_cused;
+ smul = 1;
+ dmul = tt_ssize;
+ }
+ params->ndsts = dused;
+ dptr = calloc(dused, sizeof(*params->dsts));
+ if (!dptr)
+ return -ENOMEM;
+ params->dsts = dptr;
+ for (dst_channel = 0; dst_channel < dused; ++dst_channel) {
+ snd_pcm_route_ttable_entry_t t = 0;
+ int att = 0;
+ int nsrcs = 0;
+ snd_pcm_route_ttable_src_t srcs[sused];
+ for (src_channel = 0; src_channel < sused; ++src_channel) {
+ snd_pcm_route_ttable_entry_t v;
+ v = ttable[src_channel * smul + dst_channel * dmul];
+ if (v != 0) {
+ srcs[nsrcs].channel = src_channel;
+#if SND_PCM_PLUGIN_ROUTE_FLOAT
+ /* Also in user space for non attenuated */
+ srcs[nsrcs].as_int = (v == SND_PCM_PLUGIN_ROUTE_FULL ? SND_PCM_PLUGIN_ROUTE_RESOLUTION : 0);
+ srcs[nsrcs].as_float = v;
+#else
+ assert(v >= 0 && v <= SND_PCM_PLUGIN_ROUTE_FULL);
+ srcs[nsrcs].as_int = v;
+#endif
+ if (v != SND_PCM_PLUGIN_ROUTE_FULL)
+ att = 1;
+ t += v;
+ nsrcs++;
+ }
+ }
+#if 0
+ assert(t <= SND_PCM_PLUGIN_ROUTE_FULL);
+#endif
+ dptr->att = att;
+ dptr->nsrcs = nsrcs;
+ if (nsrcs == 0)
+ dptr->func = snd_pcm_route_convert1_zero;
+ else
+ dptr->func = snd_pcm_route_convert1_many;
+ if (nsrcs > 0) {
+ dptr->srcs = calloc((unsigned int) nsrcs, sizeof(*srcs));
+ if (!dptr->srcs)
+ return -ENOMEM;
+ memcpy(dptr->srcs, srcs, sizeof(*srcs) * nsrcs);
+ } else
+ dptr->srcs = 0;
+ dptr++;
+ }
+ return 0;
+}
+
+/**
+ * \brief Creates a new Route & Volume PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave format
+ * \param schannels Slave channels
+ * \param ttable Attenuation table
+ * \param tt_ssize Attenuation table - slave size
+ * \param tt_cused Attenuation table - client used count
+ * \param tt_sused Attenuation table - slave used count
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat, int schannels,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_ssize,
+ unsigned int tt_cused, unsigned int tt_sused,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_route_t *route;
+ int err;
+ assert(pcmp && slave && ttable);
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ snd_pcm_format_linear(sformat) != 1)
+ return -EINVAL;
+ route = calloc(1, sizeof(snd_pcm_route_t));
+ if (!route) {
+ return -ENOMEM;
+ }
+ snd_pcm_plugin_init(&route->plug);
+ route->sformat = sformat;
+ route->schannels = schannels;
+ route->plug.read = snd_pcm_route_read_areas;
+ route->plug.write = snd_pcm_route_write_areas;
+ route->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ route->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ route->plug.gen.slave = slave;
+ route->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_ROUTE, name, slave->stream, slave->mode);
+ if (err < 0) {
+ free(route);
+ return err;
+ }
+ pcm->ops = &snd_pcm_route_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = route;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &route->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &route->plug.appl_ptr, -1, 0);
+ err = route_load_ttable(&route->params, pcm->stream, tt_ssize, ttable, tt_cused, tt_sused);
+ if (err < 0) {
+ snd_pcm_close(pcm);
+ return err;
+ }
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/**
+ * \brief Determine route matrix sizes
+ * \param tt Configuration root describing route matrix
+ * \param tt_csize Returned client size in elements
+ * \param tt_ssize Returned slave size in elements
+ * \retval zero on success otherwise a negative error code
+ */
+int snd_pcm_route_determine_ttable(snd_config_t *tt,
+ unsigned int *tt_csize,
+ unsigned int *tt_ssize)
+{
+ snd_config_iterator_t i, inext;
+ long csize = 0, ssize = 0;
+ int err;
+
+ assert(tt && tt_csize && tt_ssize);
+ snd_config_for_each(i, inext, tt) {
+ snd_config_t *in = snd_config_iterator_entry(i);
+ snd_config_iterator_t j, jnext;
+ long cchannel;
+ const char *id;
+ if (!snd_config_get_id(in, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0) {
+ SNDERR("Invalid client channel: %s", id);
+ return -EINVAL;
+ }
+ if (cchannel + 1 > csize)
+ csize = cchannel + 1;
+ if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
+ return -EINVAL;
+ snd_config_for_each(j, jnext, in) {
+ snd_config_t *jnode = snd_config_iterator_entry(j);
+ long schannel;
+ const char *id;
+ if (snd_config_get_id(jnode, &id) < 0)
+ continue;
+ err = safe_strtol(id, &schannel);
+ if (err < 0) {
+ SNDERR("Invalid slave channel: %s", id);
+ return -EINVAL;
+ }
+ if (schannel + 1 > ssize)
+ ssize = schannel + 1;
+ }
+ }
+ if (csize == 0 || ssize == 0) {
+ SNDERR("Invalid null ttable configuration");
+ return -EINVAL;
+ }
+ *tt_csize = csize;
+ *tt_ssize = ssize;
+ return 0;
+}
+
+/**
+ * \brief Load route matrix
+ * \param tt Configuration root describing route matrix
+ * \param ttable Returned route matrix
+ * \param tt_csize Client size in elements
+ * \param tt_ssize Slave size in elements
+ * \param tt_cused Used client elements
+ * \param tt_sused Used slave elements
+ * \param schannels Slave channels
+ * \retval zero on success otherwise a negative error code
+ */
+int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_csize, unsigned int tt_ssize,
+ unsigned int *tt_cused, unsigned int *tt_sused,
+ int schannels)
+{
+ int cused = -1;
+ int sused = -1;
+ snd_config_iterator_t i, inext;
+ unsigned int k;
+ int err;
+ for (k = 0; k < tt_csize * tt_ssize; ++k)
+ ttable[k] = 0.0;
+ snd_config_for_each(i, inext, tt) {
+ snd_config_t *in = snd_config_iterator_entry(i);
+ snd_config_iterator_t j, jnext;
+ long cchannel;
+ const char *id;
+ if (!snd_config_get_id(in, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0 ||
+ cchannel < 0 || (unsigned int) cchannel > tt_csize) {
+ SNDERR("Invalid client channel: %s", id);
+ return -EINVAL;
+ }
+ if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
+ return -EINVAL;
+ snd_config_for_each(j, jnext, in) {
+ snd_config_t *jnode = snd_config_iterator_entry(j);
+ double value;
+ long schannel;
+ const char *id;
+ if (snd_config_get_id(jnode, &id) < 0)
+ continue;
+ err = safe_strtol(id, &schannel);
+ if (err < 0 ||
+ schannel < 0 || (unsigned int) schannel > tt_ssize ||
+ (schannels > 0 && schannel >= schannels)) {
+ SNDERR("Invalid slave channel: %s", id);
+ return -EINVAL;
+ }
+ err = snd_config_get_real(jnode, &value);
+ if (err < 0) {
+ long v;
+ err = snd_config_get_integer(jnode, &v);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ value = v;
+ }
+ ttable[cchannel * tt_ssize + schannel] = value;
+ if (schannel > sused)
+ sused = schannel;
+ }
+ if (cchannel > cused)
+ cused = cchannel;
+ }
+ *tt_sused = sused + 1;
+ *tt_cused = cused + 1;
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_route Plugin: Route & Volume
+
+This plugin converts channels and applies volume during the conversion.
+The format and rate must match for both of them.
+
+\code
+pcm.name {
+ type route # Route & Volume conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format
+ [channels INT] # Slave channels
+ }
+ ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
+ CCHANNEL {
+ SCHANNEL REAL # route value (0.0 - 1.0)
+ }
+ }
+}
+\endcode
+
+\subsection pcm_plugins_route_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_route_open()
+ <LI>_snd_pcm_route_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Route & Volume PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Route & Volume PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
+ int schannels = -1;
+ snd_config_t *tt = NULL;
+ snd_pcm_route_ttable_entry_t *ttable = NULL;
+ unsigned int csize, ssize;
+ unsigned int cused, sused;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "ttable") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ tt = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ if (!tt) {
+ SNDERR("ttable is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 2,
+ SND_PCM_HW_PARAM_FORMAT, 0, &sformat,
+ SND_PCM_HW_PARAM_CHANNELS, 0, &schannels);
+ if (err < 0)
+ return err;
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ snd_pcm_format_linear(sformat) != 1) {
+ snd_config_delete(sconf);
+ SNDERR("slave format is not linear");
+ return -EINVAL;
+ }
+
+ err = snd_pcm_route_determine_ttable(tt, &csize, &ssize);
+ if (err < 0) {
+ snd_config_delete(sconf);
+ return err;
+ }
+ ttable = malloc(csize * ssize * sizeof(snd_pcm_route_ttable_entry_t));
+ if (ttable == NULL) {
+ snd_config_delete(sconf);
+ return -ENOMEM;
+ }
+ err = snd_pcm_route_load_ttable(tt, ttable, csize, ssize,
+ &cused, &sused, schannels);
+ if (err < 0) {
+ free(ttable);
+ snd_config_delete(sconf);
+ return err;
+ }
+
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0) {
+ free(ttable);
+ return err;
+ }
+ err = snd_pcm_route_open(pcmp, name, sformat, schannels,
+ ttable, ssize,
+ cused, sused,
+ spcm, 1);
+ free(ttable);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_share.c b/alsa-lib/src/pcm/pcm_share.c
new file mode 100644
index 0000000..3f8a0ac
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_share.c
@@ -0,0 +1,1722 @@
+/**
+ * \file pcm/pcm_share.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Share Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Share
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include <signal.h>
+#include <math.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <pthread.h>
+#include "pcm_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_share = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+static LIST_HEAD(snd_pcm_share_slaves);
+static pthread_mutex_t snd_pcm_share_slaves_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#ifdef MUTEX_DEBUG
+#define Pthread_mutex_lock(mutex) \
+char *snd_pcm_share_slaves_mutex_holder;
+do { \
+ int err = pthread_mutex_trylock(mutex); \
+ if (err < 0) { \
+ fprintf(stderr, "lock " #mutex " is busy (%s): waiting in " __FUNCTION__ "\n", *(mutex##_holder)); \
+ pthread_mutex_lock(mutex); \
+ fprintf(stderr, "... got\n"); \
+ } \
+ *(mutex##_holder) = __FUNCTION__; \
+} while (0)
+
+#define Pthread_mutex_unlock(mutex) \
+do { \
+ *(mutex##_holder) = 0; \
+ pthread_mutex_unlock(mutex); \
+} while (0)
+#else
+#define Pthread_mutex_lock(mutex) pthread_mutex_lock(mutex)
+#define Pthread_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
+#endif
+
+typedef struct {
+ struct list_head clients;
+ struct list_head list;
+ snd_pcm_t *pcm;
+ snd_pcm_format_t format;
+ int rate;
+ unsigned int channels;
+ snd_pcm_sframes_t period_time;
+ snd_pcm_sframes_t buffer_time;
+ unsigned int open_count;
+ unsigned int setup_count;
+ unsigned int prepared_count;
+ unsigned int running_count;
+ snd_pcm_uframes_t safety_threshold;
+ snd_pcm_uframes_t silence_frames;
+ snd_pcm_sw_params_t sw_params;
+ snd_pcm_uframes_t hw_ptr;
+ int poll[2];
+ int polling;
+ pthread_t thread;
+ pthread_mutex_t mutex;
+#ifdef MUTEX_DEBUG
+ char *mutex_holder;
+#endif
+ pthread_cond_t poll_cond;
+} snd_pcm_share_slave_t;
+
+typedef struct {
+ struct list_head list;
+ snd_pcm_t *pcm;
+ snd_pcm_share_slave_t *slave;
+ unsigned int channels;
+ unsigned int *slave_channels;
+ int drain_silenced;
+ snd_htimestamp_t trigger_tstamp;
+ snd_pcm_state_t state;
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_uframes_t appl_ptr;
+ int ready;
+ int client_socket;
+ int slave_socket;
+} snd_pcm_share_t;
+
+#endif /* DOC_HIDDEN */
+
+static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state);
+
+static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave)
+{
+ snd_pcm_sframes_t avail;
+ snd_pcm_t *pcm = slave->pcm;
+ avail = slave->hw_ptr - *pcm->appl.ptr;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ avail += pcm->buffer_size;
+ if (avail < 0)
+ avail += pcm->boundary;
+ return avail;
+}
+
+/* Warning: take the mutex before to call this */
+/* Return number of frames to mmap_commit the slave */
+static snd_pcm_uframes_t _snd_pcm_share_slave_forward(snd_pcm_share_slave_t *slave)
+{
+ struct list_head *i;
+ snd_pcm_uframes_t buffer_size, boundary;
+ snd_pcm_uframes_t slave_appl_ptr;
+ snd_pcm_sframes_t frames, safety_frames;
+ snd_pcm_sframes_t min_frames, max_frames;
+ snd_pcm_uframes_t avail, slave_avail;
+ snd_pcm_uframes_t slave_hw_avail;
+ slave_avail = snd_pcm_share_slave_avail(slave);
+ boundary = slave->pcm->boundary;
+ buffer_size = slave->pcm->buffer_size;
+ min_frames = slave_avail;
+ max_frames = 0;
+ slave_appl_ptr = *slave->pcm->appl.ptr;
+ list_for_each(i, &slave->clients) {
+ snd_pcm_share_t *share = list_entry(i, snd_pcm_share_t, list);
+ snd_pcm_t *pcm = share->pcm;
+ switch (share->state) {
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
+ continue;
+ break;
+ default:
+ continue;
+ }
+ avail = snd_pcm_mmap_avail(pcm);
+ frames = slave_avail - avail;
+ if (frames > max_frames)
+ max_frames = frames;
+ if (share->state != SND_PCM_STATE_RUNNING)
+ continue;
+ if (frames < min_frames)
+ min_frames = frames;
+ }
+ if (max_frames == 0)
+ return 0;
+ frames = min_frames;
+ /* Slave xrun prevention */
+ slave_hw_avail = buffer_size - slave_avail;
+ safety_frames = slave->safety_threshold - slave_hw_avail;
+ if (safety_frames > 0 &&
+ frames < safety_frames) {
+ /* Avoid to pass over the last */
+ if (max_frames < safety_frames)
+ frames = max_frames;
+ else
+ frames = safety_frames;
+ }
+ if (frames < 0)
+ return 0;
+ return frames;
+}
+
+
+/*
+ - stop PCM on xrun
+ - update poll status
+ - draining silencing
+ - return distance in frames to next event
+*/
+static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_t *spcm = slave->pcm;
+ snd_pcm_uframes_t buffer_size = spcm->buffer_size;
+ int ready = 1, running = 0;
+ snd_pcm_uframes_t avail = 0, slave_avail;
+ snd_pcm_sframes_t hw_avail;
+ snd_pcm_uframes_t missing = INT_MAX;
+ snd_pcm_sframes_t ready_missing;
+ // printf("state=%s hw_ptr=%ld appl_ptr=%ld slave appl_ptr=%ld safety=%ld silence=%ld\n", snd_pcm_state_name(share->state), slave->hw_ptr, share->appl_ptr, *slave->pcm->appl_ptr, slave->safety_threshold, slave->silence_frames);
+ switch (share->state) {
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ break;
+ /* Fall through */
+ default:
+ return INT_MAX;
+ }
+ share->hw_ptr = slave->hw_ptr;
+ avail = snd_pcm_mmap_avail(pcm);
+ if (avail >= pcm->stop_threshold) {
+ _snd_pcm_share_stop(pcm, share->state == SND_PCM_STATE_DRAINING ? SND_PCM_STATE_SETUP : SND_PCM_STATE_XRUN);
+ goto update_poll;
+ }
+ hw_avail = buffer_size - avail;
+ slave_avail = snd_pcm_share_slave_avail(slave);
+ if (avail < slave_avail) {
+ /* Some frames need still to be transferred */
+ snd_pcm_sframes_t slave_hw_avail = buffer_size - slave_avail;
+ snd_pcm_sframes_t safety_missing = slave_hw_avail - slave->safety_threshold;
+ if (safety_missing < 0) {
+ snd_pcm_sframes_t err;
+ snd_pcm_sframes_t frames = slave_avail - avail;
+ if (-safety_missing <= frames) {
+ frames = -safety_missing;
+ missing = 1;
+ }
+ err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
+ if (err < 0) {
+ SYSMSG("snd_pcm_mmap_commit error");
+ return INT_MAX;
+ }
+ if (err != frames)
+ SYSMSG("commit returns %ld for size %ld", err, frames);
+ slave_avail -= err;
+ } else {
+ if (safety_missing == 0)
+ missing = 1;
+ else
+ missing = safety_missing;
+ }
+ }
+ switch (share->state) {
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (hw_avail <= 0) {
+ _snd_pcm_share_stop(pcm, SND_PCM_STATE_SETUP);
+ break;
+ }
+ if ((snd_pcm_uframes_t)hw_avail < missing)
+ missing = hw_avail;
+ running = 1;
+ ready = 0;
+ }
+ break;
+ case SND_PCM_STATE_RUNNING:
+ if (avail >= pcm->stop_threshold) {
+ _snd_pcm_share_stop(pcm, SND_PCM_STATE_XRUN);
+ break;
+ } else {
+ snd_pcm_uframes_t xrun_missing = pcm->stop_threshold - avail;
+ if (missing > xrun_missing)
+ missing = xrun_missing;
+ }
+ ready_missing = pcm->avail_min - avail;
+ if (ready_missing > 0) {
+ ready = 0;
+ if (missing > (snd_pcm_uframes_t)ready_missing)
+ missing = ready_missing;
+ }
+ running = 1;
+ break;
+ default:
+ SNDERR("invalid shared PCM state %d", share->state);
+ return INT_MAX;
+ }
+
+ update_poll:
+ if (ready != share->ready) {
+ char buf[1];
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ if (ready)
+ read(share->slave_socket, buf, 1);
+ else
+ write(share->client_socket, buf, 1);
+ } else {
+ if (ready)
+ write(share->slave_socket, buf, 1);
+ else
+ read(share->client_socket, buf, 1);
+ }
+ share->ready = ready;
+ }
+ if (!running)
+ return INT_MAX;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK &&
+ share->state == SND_PCM_STATE_DRAINING &&
+ !share->drain_silenced) {
+ /* drain silencing */
+ if (avail >= slave->silence_frames) {
+ snd_pcm_uframes_t offset = share->appl_ptr % buffer_size;
+ snd_pcm_uframes_t xfer = 0;
+ snd_pcm_uframes_t size = slave->silence_frames;
+ while (xfer < size) {
+ snd_pcm_uframes_t frames = size - xfer;
+ snd_pcm_uframes_t cont = buffer_size - offset;
+ if (cont < frames)
+ frames = cont;
+ snd_pcm_areas_silence(pcm->running_areas, offset, pcm->channels, frames, pcm->format);
+ offset += frames;
+ if (offset >= buffer_size)
+ offset = 0;
+ xfer += frames;
+ }
+ share->drain_silenced = 1;
+ } else {
+ snd_pcm_uframes_t silence_missing;
+ silence_missing = slave->silence_frames - avail;
+ if (silence_missing < missing)
+ missing = silence_missing;
+ }
+ }
+ // printf("missing=%d\n", missing);
+ return missing;
+}
+
+static snd_pcm_uframes_t _snd_pcm_share_slave_missing(snd_pcm_share_slave_t *slave)
+{
+ snd_pcm_uframes_t missing = INT_MAX;
+ struct list_head *i;
+ /* snd_pcm_sframes_t avail = */ snd_pcm_avail_update(slave->pcm);
+ slave->hw_ptr = *slave->pcm->hw.ptr;
+ list_for_each(i, &slave->clients) {
+ snd_pcm_share_t *share = list_entry(i, snd_pcm_share_t, list);
+ snd_pcm_t *pcm = share->pcm;
+ snd_pcm_uframes_t m = _snd_pcm_share_missing(pcm);
+ if (m < missing)
+ missing = m;
+ }
+ return missing;
+}
+
+static void *snd_pcm_share_thread(void *data)
+{
+ snd_pcm_share_slave_t *slave = data;
+ snd_pcm_t *spcm = slave->pcm;
+ struct pollfd pfd[2];
+ int err;
+
+ pfd[0].fd = slave->poll[0];
+ pfd[0].events = POLLIN;
+ err = snd_pcm_poll_descriptors(spcm, &pfd[1], 1);
+ if (err != 1) {
+ SNDERR("invalid poll descriptors %d", err);
+ return NULL;
+ }
+ Pthread_mutex_lock(&slave->mutex);
+ err = pipe(slave->poll);
+ if (err < 0) {
+ SYSERR("can't create a pipe");
+ return NULL;
+ }
+ while (slave->open_count > 0) {
+ snd_pcm_uframes_t missing;
+ // printf("begin min_missing\n");
+ missing = _snd_pcm_share_slave_missing(slave);
+ // printf("min_missing=%ld\n", missing);
+ if (missing < INT_MAX) {
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_sframes_t avail_min;
+ hw_ptr = slave->hw_ptr + missing;
+ hw_ptr += spcm->period_size - 1;
+ if (hw_ptr >= spcm->boundary)
+ hw_ptr -= spcm->boundary;
+ hw_ptr -= hw_ptr % spcm->period_size;
+ avail_min = hw_ptr - *spcm->appl.ptr;
+ if (spcm->stream == SND_PCM_STREAM_PLAYBACK)
+ avail_min += spcm->buffer_size;
+ if (avail_min < 0)
+ avail_min += spcm->boundary;
+ // printf("avail_min=%d\n", avail_min);
+ if ((snd_pcm_uframes_t)avail_min != spcm->avail_min) {
+ snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
+ err = snd_pcm_sw_params(spcm, &slave->sw_params);
+ if (err < 0) {
+ SYSERR("snd_pcm_sw_params error");
+ return NULL;
+ }
+ }
+ slave->polling = 1;
+ Pthread_mutex_unlock(&slave->mutex);
+ err = poll(pfd, 2, -1);
+ Pthread_mutex_lock(&slave->mutex);
+ if (pfd[0].revents & POLLIN) {
+ char buf[1];
+ read(pfd[0].fd, buf, 1);
+ }
+ } else {
+ slave->polling = 0;
+ pthread_cond_wait(&slave->poll_cond, &slave->mutex);
+ }
+ }
+ Pthread_mutex_unlock(&slave->mutex);
+ return NULL;
+}
+
+static void _snd_pcm_share_update(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_t *spcm = slave->pcm;
+ snd_pcm_uframes_t missing;
+ /* snd_pcm_sframes_t avail = */ snd_pcm_avail_update(spcm);
+ slave->hw_ptr = *slave->pcm->hw.ptr;
+ missing = _snd_pcm_share_missing(pcm);
+ // printf("missing %ld\n", missing);
+ if (!slave->polling) {
+ pthread_cond_signal(&slave->poll_cond);
+ return;
+ }
+ if (missing < INT_MAX) {
+ snd_pcm_uframes_t hw_ptr;
+ snd_pcm_sframes_t avail_min;
+ hw_ptr = slave->hw_ptr + missing;
+ hw_ptr += spcm->period_size - 1;
+ if (hw_ptr >= spcm->boundary)
+ hw_ptr -= spcm->boundary;
+ hw_ptr -= hw_ptr % spcm->period_size;
+ avail_min = hw_ptr - *spcm->appl.ptr;
+ if (spcm->stream == SND_PCM_STREAM_PLAYBACK)
+ avail_min += spcm->buffer_size;
+ if (avail_min < 0)
+ avail_min += spcm->boundary;
+ if ((snd_pcm_uframes_t)avail_min < spcm->avail_min) {
+ int err;
+ snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
+ err = snd_pcm_sw_params(spcm, &slave->sw_params);
+ if (err < 0) {
+ SYSERR("snd_pcm_sw_params error");
+ return;
+ }
+ }
+ }
+}
+
+static int snd_pcm_share_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_share_async(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int sig ATTRIBUTE_UNUSED, pid_t pid ATTRIBUTE_UNUSED)
+{
+ return -ENOSYS;
+}
+
+static int snd_pcm_share_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ return snd_pcm_info(share->slave->pcm, info);
+}
+
+static int snd_pcm_share_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_access_mask_t access_mask;
+ int err;
+ snd_pcm_access_mask_any(&access_mask);
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS,
+ share->channels, 0);
+ if (err < 0)
+ return err;
+ if (slave->format != SND_PCM_FORMAT_UNKNOWN) {
+ err = _snd_pcm_hw_params_set_format(params, slave->format);
+ if (err < 0)
+ return err;
+ }
+
+ if (slave->rate >= 0) {
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_RATE,
+ slave->rate, 0);
+ if (err < 0)
+ return err;
+ }
+ if (slave->period_time >= 0) {
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ slave->period_time, 0);
+ if (err < 0)
+ return err;
+ }
+ if (slave->buffer_time >= 0) {
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_BUFFER_TIME,
+ slave->buffer_time, 0);
+ if (err < 0)
+ return err;
+ }
+ params->info |= SND_PCM_INFO_DOUBLE;
+ return 0;
+}
+
+static int snd_pcm_share_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS,
+ slave->channels, 0);
+ return 0;
+}
+
+static int snd_pcm_share_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_PERIODS);
+ const snd_pcm_access_mask_t *access_mask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ if (!snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
+ !snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED) &&
+ !snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) {
+ snd_pcm_access_mask_t saccess_mask;
+ snd_pcm_access_mask_any(&saccess_mask);
+ snd_pcm_access_mask_reset(&saccess_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ err = _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ if (err < 0)
+ return err;
+ }
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_share_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_PERIODS);
+ snd_pcm_access_mask_t access_mask;
+ const snd_pcm_access_mask_t *saccess_mask = snd_pcm_hw_param_get_mask(sparams, SND_PCM_HW_PARAM_ACCESS);
+ snd_pcm_access_mask_any(&access_mask);
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ if (!snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED))
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ if (!snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_COMPLEX) &&
+ !snd_pcm_access_mask_test(saccess_mask, SND_PCM_ACCESS_MMAP_INTERLEAVED))
+ snd_pcm_access_mask_reset(&access_mask, SND_PCM_ACCESS_MMAP_COMPLEX);
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_share_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ return snd_pcm_hw_refine(share->slave->pcm, params);
+}
+
+static int snd_pcm_share_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ return _snd_pcm_hw_params(share->slave->pcm, params);
+}
+
+static int snd_pcm_share_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_share_hw_refine_cprepare,
+ snd_pcm_share_hw_refine_cchange,
+ snd_pcm_share_hw_refine_sprepare,
+ snd_pcm_share_hw_refine_schange,
+ snd_pcm_share_hw_refine_slave);
+}
+
+static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_t *spcm = slave->pcm;
+ int err = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ if (slave->setup_count) {
+ err = _snd_pcm_hw_params_set_format(params, spcm->format);
+ if (err < 0)
+ goto _err;
+ err = _snd_pcm_hw_params_set_subformat(params, spcm->subformat);
+ if (err < 0)
+ goto _err;
+ err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_RATE,
+ spcm->rate, 0,
+ spcm->rate, 1);
+ if (err < 0)
+ goto _err;
+ err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_PERIOD_TIME,
+ spcm->period_time, 0,
+ spcm->period_time, 1);
+ if (err < 0)
+ goto _err;
+ err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_BUFFER_SIZE,
+ spcm->buffer_size, 0);
+ _err:
+ if (err < 0) {
+ SNDERR("slave is already running with incompatible setup");
+ err = -EBUSY;
+ goto _end;
+ }
+ } else {
+ err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_share_hw_refine_cchange,
+ snd_pcm_share_hw_refine_sprepare,
+ snd_pcm_share_hw_refine_schange,
+ snd_pcm_share_hw_params_slave);
+ if (err < 0)
+ goto _end;
+ snd_pcm_sw_params_current(slave->pcm, &slave->sw_params);
+ /* >= 30 ms */
+ slave->safety_threshold = slave->pcm->rate * 30 / 1000;
+ slave->safety_threshold += slave->pcm->period_size - 1;
+ slave->safety_threshold -= slave->safety_threshold % slave->pcm->period_size;
+ slave->silence_frames = slave->safety_threshold;
+ if (slave->pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ snd_pcm_areas_silence(slave->pcm->running_areas, 0, slave->pcm->channels, slave->pcm->buffer_size, slave->pcm->format);
+ }
+ share->state = SND_PCM_STATE_SETUP;
+ slave->setup_count++;
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ slave->setup_count--;
+ if (slave->setup_count == 0)
+ err = snd_pcm_hw_free(slave->pcm);
+ share->state = SND_PCM_STATE_OPEN;
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_sw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_params_t *params ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_share_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ snd_pcm_sframes_t sd = 0, d = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ status->avail = snd_pcm_mmap_playback_avail(pcm);
+ if (share->state != SND_PCM_STATE_RUNNING &&
+ share->state != SND_PCM_STATE_DRAINING)
+ goto _notrunning;
+ d = pcm->buffer_size - status->avail;
+ } else {
+ status->avail = snd_pcm_mmap_capture_avail(pcm);
+ if (share->state != SND_PCM_STATE_RUNNING)
+ goto _notrunning;
+ d = status->avail;
+ }
+ err = snd_pcm_delay(slave->pcm, &sd);
+ if (err < 0)
+ goto _end;
+ _notrunning:
+ status->delay = sd + d;
+ status->state = share->state;
+ status->trigger_tstamp = share->trigger_tstamp;
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static snd_pcm_state_t snd_pcm_share_state(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ return share->state;
+}
+
+static int _snd_pcm_share_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ switch (share->state) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ break;
+ }
+ return snd_pcm_hwsync(slave->pcm);
+}
+
+static int snd_pcm_share_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err;
+ Pthread_mutex_lock(&slave->mutex);
+ err = _snd_pcm_share_hwsync(pcm);
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int _snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ switch (share->state) {
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
+ break;
+ /* Fall through */
+ default:
+ return -EBADFD;
+ }
+ return snd_pcm_delay(slave->pcm, delayp);
+}
+
+static int snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err;
+ Pthread_mutex_lock(&slave->mutex);
+ err = _snd_pcm_share_delay(pcm, delayp);
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t avail;
+ Pthread_mutex_lock(&slave->mutex);
+ if (share->state == SND_PCM_STATE_RUNNING) {
+ avail = snd_pcm_avail_update(slave->pcm);
+ if (avail < 0) {
+ Pthread_mutex_unlock(&slave->mutex);
+ return avail;
+ }
+ share->hw_ptr = *slave->pcm->hw.ptr;
+ }
+ Pthread_mutex_unlock(&slave->mutex);
+ avail = snd_pcm_mmap_avail(pcm);
+ if ((snd_pcm_uframes_t)avail > pcm->buffer_size)
+ return -EPIPE;
+ return avail;
+}
+
+static int snd_pcm_share_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err;
+ Pthread_mutex_lock(&slave->mutex);
+ err = snd_pcm_htimestamp(slave->pcm, avail, tstamp);
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+/* Call it with mutex held */
+static snd_pcm_sframes_t _snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_t *spcm = slave->pcm;
+ snd_pcm_sframes_t ret;
+ snd_pcm_sframes_t frames;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK &&
+ share->state == SND_PCM_STATE_RUNNING) {
+ frames = *spcm->appl.ptr - share->appl_ptr;
+ if (frames > (snd_pcm_sframes_t)pcm->buffer_size)
+ frames -= pcm->boundary;
+ else if (frames < -(snd_pcm_sframes_t)pcm->buffer_size)
+ frames += pcm->boundary;
+ if (frames > 0) {
+ /* Latecomer PCM */
+ ret = snd_pcm_rewind(spcm, frames);
+ if (ret < 0)
+ return ret;
+ }
+ }
+ snd_pcm_mmap_appl_forward(pcm, size);
+ if (share->state == SND_PCM_STATE_RUNNING) {
+ frames = _snd_pcm_share_slave_forward(slave);
+ if (frames > 0) {
+ snd_pcm_sframes_t err;
+ err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
+ if (err < 0) {
+ SYSMSG("snd_pcm_mmap_commit error");
+ return err;
+ }
+ if (err != frames) {
+ SYSMSG("commit returns %ld for size %ld", err, frames);
+ return err;
+ }
+ }
+ _snd_pcm_share_update(pcm);
+ }
+ return size;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t ret;
+ Pthread_mutex_lock(&slave->mutex);
+ ret = _snd_pcm_share_mmap_commit(pcm, offset, size);
+ Pthread_mutex_unlock(&slave->mutex);
+ return ret;
+}
+
+static int snd_pcm_share_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ switch (share->state) {
+ case SND_PCM_STATE_OPEN:
+ err = -EBADFD;
+ goto _end;
+ case SND_PCM_STATE_RUNNING:
+ err = -EBUSY;
+ goto _end;
+ case SND_PCM_STATE_PREPARED:
+ err = 0;
+ goto _end;
+ default: /* nothing todo */
+ break;
+ }
+ if (slave->prepared_count == 0) {
+ err = snd_pcm_prepare(slave->pcm);
+ if (err < 0)
+ goto _end;
+ }
+ slave->prepared_count++;
+ share->hw_ptr = 0;
+ share->appl_ptr = 0;
+ share->state = SND_PCM_STATE_PREPARED;
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ /* FIXME? */
+ Pthread_mutex_lock(&slave->mutex);
+ snd_pcm_areas_silence(pcm->running_areas, 0, pcm->channels, pcm->buffer_size, pcm->format);
+ share->hw_ptr = *slave->pcm->hw.ptr;
+ share->appl_ptr = share->hw_ptr;
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_start(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_t *spcm = slave->pcm;
+ int err = 0;
+ if (share->state != SND_PCM_STATE_PREPARED)
+ return -EBADFD;
+ Pthread_mutex_lock(&slave->mutex);
+ share->state = SND_PCM_STATE_RUNNING;
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ snd_pcm_uframes_t hw_avail = snd_pcm_mmap_playback_hw_avail(pcm);
+ snd_pcm_uframes_t xfer = 0;
+ if (hw_avail == 0) {
+ err = -EPIPE;
+ goto _end;
+ }
+ if (slave->running_count) {
+ snd_pcm_sframes_t sd;
+ err = snd_pcm_delay(spcm, &sd);
+ if (err < 0)
+ goto _end;
+ err = snd_pcm_rewind(spcm, sd);
+ if (err < 0)
+ goto _end;
+ }
+ assert(share->hw_ptr == 0);
+ share->hw_ptr = *spcm->hw.ptr;
+ share->appl_ptr = *spcm->appl.ptr;
+ while (xfer < hw_avail) {
+ snd_pcm_uframes_t frames = hw_avail - xfer;
+ snd_pcm_uframes_t offset = snd_pcm_mmap_offset(pcm);
+ snd_pcm_uframes_t cont = pcm->buffer_size - offset;
+ if (cont < frames)
+ frames = cont;
+ if (pcm->stopped_areas != NULL)
+ snd_pcm_areas_copy(pcm->running_areas, offset,
+ pcm->stopped_areas, xfer,
+ pcm->channels, frames,
+ pcm->format);
+ xfer += frames;
+ }
+ snd_pcm_mmap_appl_forward(pcm, hw_avail);
+ if (slave->running_count == 0) {
+ snd_pcm_sframes_t res;
+ res = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), hw_avail);
+ if (res < 0) {
+ err = res;
+ goto _end;
+ }
+ assert((snd_pcm_uframes_t)res == hw_avail);
+ }
+ }
+ if (slave->running_count == 0) {
+ err = snd_pcm_start(spcm);
+ if (err < 0)
+ goto _end;
+ }
+ slave->running_count++;
+ _snd_pcm_share_update(pcm);
+ gettimestamp(&share->trigger_tstamp, pcm->monotonic);
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIBUTE_UNUSED)
+{
+ return -ENOSYS;
+}
+
+static int snd_pcm_share_resume(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+static int snd_pcm_share_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ unsigned int channel = info->channel;
+ int c = share->slave_channels[channel];
+ int err;
+ info->channel = c;
+ err = snd_pcm_channel_info(slave->pcm, info);
+ info->channel = channel;
+ return err;
+}
+
+static snd_pcm_sframes_t _snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t n;
+ switch (share->state) {
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_PREPARED:
+ if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
+ return -EBADFD;
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream != SND_PCM_STREAM_CAPTURE)
+ return -EBADFD;
+ break;
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ return -EBADFD;
+ }
+ n = snd_pcm_mmap_hw_avail(pcm);
+ assert(n >= 0);
+ if ((snd_pcm_uframes_t)n > frames)
+ frames = n;
+ if (share->state == SND_PCM_STATE_RUNNING && frames > 0) {
+ snd_pcm_sframes_t ret = snd_pcm_rewind(slave->pcm, frames);
+ if (ret < 0)
+ return ret;
+ frames = ret;
+ }
+ snd_pcm_mmap_appl_backward(pcm, frames);
+ _snd_pcm_share_update(pcm);
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_rewindable(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t ret;
+ Pthread_mutex_lock(&slave->mutex);
+ ret = snd_pcm_rewindable(slave->pcm);
+ Pthread_mutex_unlock(&slave->mutex);
+ return ret;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t ret;
+ Pthread_mutex_lock(&slave->mutex);
+ ret = _snd_pcm_share_rewind(pcm, frames);
+ Pthread_mutex_unlock(&slave->mutex);
+ return ret;
+}
+
+static snd_pcm_sframes_t _snd_pcm_share_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t n;
+ switch (share->state) {
+ case SND_PCM_STATE_RUNNING:
+ break;
+ case SND_PCM_STATE_PREPARED:
+ if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
+ return -EBADFD;
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream != SND_PCM_STREAM_CAPTURE)
+ return -EBADFD;
+ break;
+ case SND_PCM_STATE_XRUN:
+ return -EPIPE;
+ default:
+ return -EBADFD;
+ }
+ n = snd_pcm_mmap_avail(pcm);
+ if ((snd_pcm_uframes_t)n > frames)
+ frames = n;
+ if (share->state == SND_PCM_STATE_RUNNING && frames > 0) {
+ snd_pcm_sframes_t ret = INTERNAL(snd_pcm_forward)(slave->pcm, frames);
+ if (ret < 0)
+ return ret;
+ frames = ret;
+ }
+ snd_pcm_mmap_appl_forward(pcm, frames);
+ _snd_pcm_share_update(pcm);
+ return n;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_forwardable(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t ret;
+ Pthread_mutex_lock(&slave->mutex);
+ ret = snd_pcm_forwardable(slave->pcm);
+ Pthread_mutex_unlock(&slave->mutex);
+ return ret;
+}
+
+static snd_pcm_sframes_t snd_pcm_share_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ snd_pcm_sframes_t ret;
+ Pthread_mutex_lock(&slave->mutex);
+ ret = _snd_pcm_share_forward(pcm, frames);
+ Pthread_mutex_unlock(&slave->mutex);
+ return ret;
+}
+
+/* Warning: take the mutex before to call this */
+static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+#if 0
+ if (!pcm->mmap_channels) {
+ /* PCM closing already begun in the main thread */
+ return;
+ }
+#endif
+ gettimestamp(&share->trigger_tstamp, pcm->monotonic);
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
+ snd_pcm_areas_copy(pcm->stopped_areas, 0,
+ pcm->running_areas, 0,
+ pcm->channels, pcm->buffer_size,
+ pcm->format);
+ } else if (slave->running_count > 1) {
+ int err;
+ snd_pcm_sframes_t delay;
+ snd_pcm_areas_silence(pcm->running_areas, 0, pcm->channels,
+ pcm->buffer_size, pcm->format);
+ err = snd_pcm_delay(slave->pcm, &delay);
+ if (err >= 0 && delay > 0)
+ snd_pcm_rewind(slave->pcm, delay);
+ share->drain_silenced = 0;
+ }
+ share->state = state;
+ slave->prepared_count--;
+ slave->running_count--;
+ if (slave->running_count == 0) {
+ int err = snd_pcm_drop(slave->pcm);
+ assert(err >= 0);
+ }
+}
+
+static int snd_pcm_share_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ switch (share->state) {
+ case SND_PCM_STATE_OPEN:
+ err = -EBADFD;
+ goto _end;
+ case SND_PCM_STATE_PREPARED:
+ share->state = SND_PCM_STATE_SETUP;
+ goto _end;
+ case SND_PCM_STATE_SETUP:
+ goto _end;
+ default:
+ break;
+ }
+ if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
+ switch (share->state) {
+ case SND_PCM_STATE_XRUN:
+ share->state = SND_PCM_STATE_SETUP;
+ goto _end;
+ case SND_PCM_STATE_DRAINING:
+ case SND_PCM_STATE_RUNNING:
+ share->state = SND_PCM_STATE_DRAINING;
+ _snd_pcm_share_update(pcm);
+ Pthread_mutex_unlock(&slave->mutex);
+ if (!(pcm->mode & SND_PCM_NONBLOCK))
+ snd_pcm_wait(pcm, -1);
+ return 0;
+ default:
+ assert(0);
+ break;
+ }
+ } else {
+ switch (share->state) {
+ case SND_PCM_STATE_RUNNING:
+ _snd_pcm_share_stop(pcm, SND_PCM_STATE_DRAINING);
+ _snd_pcm_share_update(pcm);
+ /* Fall through */
+ case SND_PCM_STATE_XRUN:
+ case SND_PCM_STATE_DRAINING:
+ if (snd_pcm_mmap_capture_avail(pcm) <= 0)
+ share->state = SND_PCM_STATE_SETUP;
+ else
+ share->state = SND_PCM_STATE_DRAINING;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ }
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+ Pthread_mutex_lock(&slave->mutex);
+ switch (share->state) {
+ case SND_PCM_STATE_OPEN:
+ err = -EBADFD;
+ goto _end;
+ case SND_PCM_STATE_SETUP:
+ break;
+ case SND_PCM_STATE_DRAINING:
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
+ share->state = SND_PCM_STATE_SETUP;
+ break;
+ }
+ /* Fall through */
+ case SND_PCM_STATE_RUNNING:
+ _snd_pcm_share_stop(pcm, SND_PCM_STATE_SETUP);
+ _snd_pcm_share_update(pcm);
+ break;
+ case SND_PCM_STATE_PREPARED:
+ case SND_PCM_STATE_XRUN:
+ share->state = SND_PCM_STATE_SETUP;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ share->appl_ptr = share->hw_ptr = 0;
+ _end:
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
+static int snd_pcm_share_close(snd_pcm_t *pcm)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err = 0;
+
+ Pthread_mutex_lock(&snd_pcm_share_slaves_mutex);
+ Pthread_mutex_lock(&slave->mutex);
+ slave->open_count--;
+ if (slave->open_count == 0) {
+ pthread_cond_signal(&slave->poll_cond);
+ Pthread_mutex_unlock(&slave->mutex);
+ err = pthread_join(slave->thread, 0);
+ assert(err == 0);
+ err = snd_pcm_close(slave->pcm);
+ pthread_mutex_destroy(&slave->mutex);
+ pthread_cond_destroy(&slave->poll_cond);
+ list_del(&slave->list);
+ free(slave);
+ list_del(&share->list);
+ } else {
+ list_del(&share->list);
+ Pthread_mutex_unlock(&slave->mutex);
+ }
+ Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
+ close(share->client_socket);
+ close(share->slave_socket);
+ free(share->slave_channels);
+ free(share);
+ return err;
+}
+
+static int snd_pcm_share_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_share_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static void snd_pcm_share_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ unsigned int k;
+ snd_output_printf(out, "Share PCM\n");
+ snd_output_printf(out, " Channel bindings:\n");
+ for (k = 0; k < share->channels; ++k)
+ snd_output_printf(out, " %d: %d\n", k, share->slave_channels[k]);
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(slave->pcm, out);
+}
+
+static const snd_pcm_ops_t snd_pcm_share_ops = {
+ .close = snd_pcm_share_close,
+ .info = snd_pcm_share_info,
+ .hw_refine = snd_pcm_share_hw_refine,
+ .hw_params = snd_pcm_share_hw_params,
+ .hw_free = snd_pcm_share_hw_free,
+ .sw_params = snd_pcm_share_sw_params,
+ .channel_info = snd_pcm_share_channel_info,
+ .dump = snd_pcm_share_dump,
+ .nonblock = snd_pcm_share_nonblock,
+ .async = snd_pcm_share_async,
+ .mmap = snd_pcm_share_mmap,
+ .munmap = snd_pcm_share_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_share_fast_ops = {
+ .status = snd_pcm_share_status,
+ .state = snd_pcm_share_state,
+ .hwsync = snd_pcm_share_hwsync,
+ .delay = snd_pcm_share_delay,
+ .prepare = snd_pcm_share_prepare,
+ .reset = snd_pcm_share_reset,
+ .start = snd_pcm_share_start,
+ .drop = snd_pcm_share_drop,
+ .drain = snd_pcm_share_drain,
+ .pause = snd_pcm_share_pause,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .rewindable = snd_pcm_share_rewindable,
+ .rewind = snd_pcm_share_rewind,
+ .forwardable = snd_pcm_share_forwardable,
+ .forward = snd_pcm_share_forward,
+ .resume = snd_pcm_share_resume,
+ .avail_update = snd_pcm_share_avail_update,
+ .htimestamp = snd_pcm_share_htimestamp,
+ .mmap_commit = snd_pcm_share_mmap_commit,
+};
+
+/**
+ * \brief Creates a new Share PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sname Slave name
+ * \param sformat Slave format
+ * \param srate Slave rate
+ * \param schannels Slave channels
+ * \param speriod_time Slave period time
+ * \param sbuffer_time Slave buffer time
+ * \param channels Count of channels
+ * \param channels_map Map of channels
+ * \param stream Direction
+ * \param mode PCM mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
+ snd_pcm_format_t sformat, int srate,
+ unsigned int schannels,
+ int speriod_time, int sbuffer_time,
+ unsigned int channels, unsigned int *channels_map,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_share_t *share;
+ int err;
+ struct list_head *i;
+ char slave_map[32] = { 0 };
+ unsigned int k;
+ snd_pcm_share_slave_t *slave = NULL;
+ int sd[2];
+
+ assert(pcmp);
+ assert(channels > 0 && sname && channels_map);
+
+ for (k = 0; k < channels; ++k) {
+ if (channels_map[k] >= sizeof(slave_map) / sizeof(slave_map[0])) {
+ SNDERR("Invalid slave channel (%d) in binding", channels_map[k]);
+ return -EINVAL;
+ }
+ if (slave_map[channels_map[k]]) {
+ SNDERR("Repeated slave channel (%d) in binding", channels_map[k]);
+ return -EINVAL;
+ }
+ slave_map[channels_map[k]] = 1;
+ assert((unsigned)channels_map[k] < schannels);
+ }
+
+ share = calloc(1, sizeof(snd_pcm_share_t));
+ if (!share)
+ return -ENOMEM;
+
+ share->channels = channels;
+ share->slave_channels = calloc(channels, sizeof(*share->slave_channels));
+ if (!share->slave_channels) {
+ free(share);
+ return -ENOMEM;
+ }
+ memcpy(share->slave_channels, channels_map, channels * sizeof(*share->slave_channels));
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_SHARE, name, stream, mode);
+ if (err < 0) {
+ free(share->slave_channels);
+ free(share);
+ return err;
+ }
+ err = socketpair(AF_LOCAL, SOCK_STREAM, 0, sd);
+ if (err < 0) {
+ snd_pcm_free(pcm);
+ free(share->slave_channels);
+ free(share);
+ return -errno;
+ }
+
+ if (stream == SND_PCM_STREAM_PLAYBACK) {
+ int bufsize = 1;
+ err = setsockopt(sd[0], SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));
+ if (err >= 0) {
+ struct pollfd pfd;
+ pfd.fd = sd[0];
+ pfd.events = POLLOUT;
+ while ((err = poll(&pfd, 1, 0)) == 1) {
+ char buf[1];
+ err = write(sd[0], buf, 1);
+ assert(err != 0);
+ if (err != 1)
+ break;
+ }
+ }
+ }
+ if (err < 0) {
+ err = -errno;
+ close(sd[0]);
+ close(sd[1]);
+ snd_pcm_free(pcm);
+ free(share->slave_channels);
+ free(share);
+ return err;
+ }
+
+ Pthread_mutex_lock(&snd_pcm_share_slaves_mutex);
+ list_for_each(i, &snd_pcm_share_slaves) {
+ snd_pcm_share_slave_t *s = list_entry(i, snd_pcm_share_slave_t, list);
+ if (s->pcm->name && strcmp(s->pcm->name, sname) == 0) {
+ slave = s;
+ break;
+ }
+ }
+ if (!slave) {
+ snd_pcm_t *spcm;
+ err = snd_pcm_open(&spcm, sname, stream, mode);
+ if (err < 0) {
+ Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
+ close(sd[0]);
+ close(sd[1]);
+ snd_pcm_free(pcm);
+ free(share->slave_channels);
+ free(share);
+ return err;
+ }
+ /* FIXME: bellow is a real ugly hack to get things working */
+ /* there is a memory leak somewhere, but I'm unable to trace it --jk */
+ slave = calloc(1, sizeof(snd_pcm_share_slave_t) * 8);
+ if (!slave) {
+ Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
+ snd_pcm_close(spcm);
+ close(sd[0]);
+ close(sd[1]);
+ snd_pcm_free(pcm);
+ free(share->slave_channels);
+ free(share);
+ return err;
+ }
+ INIT_LIST_HEAD(&slave->clients);
+ slave->pcm = spcm;
+ slave->channels = schannels;
+ slave->format = sformat;
+ slave->rate = srate;
+ slave->period_time = speriod_time;
+ slave->buffer_time = sbuffer_time;
+ pthread_mutex_init(&slave->mutex, NULL);
+ pthread_cond_init(&slave->poll_cond, NULL);
+ list_add_tail(&slave->list, &snd_pcm_share_slaves);
+ Pthread_mutex_lock(&slave->mutex);
+ err = pthread_create(&slave->thread, NULL, snd_pcm_share_thread, slave);
+ assert(err == 0);
+ Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
+ } else {
+ Pthread_mutex_lock(&slave->mutex);
+ Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
+ list_for_each(i, &slave->clients) {
+ snd_pcm_share_t *sh = list_entry(i, snd_pcm_share_t, list);
+ for (k = 0; k < sh->channels; ++k) {
+ if (slave_map[sh->slave_channels[k]]) {
+ SNDERR("Slave channel %d is already in use", sh->slave_channels[k]);
+ Pthread_mutex_unlock(&slave->mutex);
+ close(sd[0]);
+ close(sd[1]);
+ snd_pcm_free(pcm);
+ free(share->slave_channels);
+ free(share);
+ return -EBUSY;
+ }
+ }
+ }
+ }
+
+ share->slave = slave;
+ share->pcm = pcm;
+ share->client_socket = sd[0];
+ share->slave_socket = sd[1];
+
+ pcm->mmap_rw = 1;
+ pcm->ops = &snd_pcm_share_ops;
+ pcm->fast_ops = &snd_pcm_share_fast_ops;
+ pcm->private_data = share;
+ pcm->poll_fd = share->client_socket;
+ pcm->poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
+ pcm->monotonic = pcm->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &share->hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &share->appl_ptr, -1, 0);
+
+ slave->open_count++;
+ list_add_tail(&share->list, &slave->clients);
+
+ Pthread_mutex_unlock(&slave->mutex);
+
+ *pcmp = pcm;
+ return 0;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_share Plugin: Share
+
+This plugin allows sharing of multiple channels with more clients. The access
+to each channel is exlusive (samples are not mixed together). It means, if
+the channel zero is used with first client, the channel cannot be used with
+second one. If you are looking for a mixing plugin, use the
+\ref pcm_plugins_dmix "dmix plugin".
+
+The difference from \ref pcm_plugins_dshare "dshare plugin" is that
+share plugin requires the server program "aserver", while dshare plugin
+doesn't need the explicit server but access to the shared buffer.
+
+\code
+pcm.name {
+ type share # Share PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ [format STR] # Slave format
+ [channels INT] # Slave channels
+ [rate INT] # Slave rate
+ [period_time INT] # Slave period time in us
+ [buffer_time INT] # Slave buffer time in us
+ }
+ bindings {
+ N INT # Slave channel INT for client channel N
+ }
+}
+\endcode
+
+\subsection pcm_plugins_share_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_share_open()
+ <LI>_snd_pcm_share_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Share PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Share PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ const char *sname = NULL;
+ snd_config_t *bindings = NULL;
+ int err;
+ snd_config_t *slave = NULL, *sconf;
+ unsigned int *channels_map = NULL;
+ unsigned int channels = 0;
+ snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
+ int schannels = -1;
+ int srate = -1;
+ int speriod_time= -1, sbuffer_time = -1;
+ unsigned int schannel_max = 0;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "bindings") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ bindings = n;
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ err = snd_pcm_slave_conf(root, slave, &sconf, 5,
+ SND_PCM_HW_PARAM_FORMAT, 0, &sformat,
+ SND_PCM_HW_PARAM_CHANNELS, 0, &schannels,
+ SND_PCM_HW_PARAM_RATE, 0, &srate,
+ SND_PCM_HW_PARAM_PERIOD_TIME, 0, &speriod_time,
+ SND_PCM_HW_PARAM_BUFFER_TIME, 0, &sbuffer_time);
+ if (err < 0)
+ return err;
+
+ /* FIXME: nothing strictly forces to have named definition */
+ err = snd_config_get_string(sconf, &sname);
+ sname = err >= 0 && sname ? strdup(sname) : NULL;
+ snd_config_delete(sconf);
+ if (sname == NULL) {
+ SNDERR("slave.pcm is not a string");
+ return err;
+ }
+
+ if (!bindings) {
+ SNDERR("bindings is not defined");
+ err = -EINVAL;
+ goto _free;
+ }
+ snd_config_for_each(i, next, bindings) {
+ long cchannel = -1;
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ err = safe_strtol(id, &cchannel);
+ if (err < 0 || cchannel < 0) {
+ SNDERR("Invalid client channel in binding: %s", id);
+ err = -EINVAL;
+ goto _free;
+ }
+ if ((unsigned)cchannel >= channels)
+ channels = cchannel + 1;
+ }
+ if (channels == 0) {
+ SNDERR("No bindings defined");
+ err = -EINVAL;
+ goto _free;
+ }
+ channels_map = calloc(channels, sizeof(*channels_map));
+ if (! channels_map) {
+ err = -ENOMEM;
+ goto _free;
+ }
+
+ snd_config_for_each(i, next, bindings) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ long cchannel;
+ long schannel = -1;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ cchannel = atoi(id);
+ err = snd_config_get_integer(n, &schannel);
+ if (err < 0) {
+ goto _free;
+ }
+ assert(schannel >= 0);
+ assert(schannels <= 0 || schannel < schannels);
+ channels_map[cchannel] = schannel;
+ if ((unsigned)schannel > schannel_max)
+ schannel_max = schannel;
+ }
+ if (schannels <= 0)
+ schannels = schannel_max + 1;
+ err = snd_pcm_share_open(pcmp, name, sname, sformat, srate,
+ (unsigned int) schannels,
+ speriod_time, sbuffer_time,
+ channels, channels_map, stream, mode);
+_free:
+ free(channels_map);
+ free((char *)sname);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_shm.c b/alsa-lib/src/pcm/pcm_shm.c
new file mode 100644
index 0000000..69d0524
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_shm.c
@@ -0,0 +1,956 @@
+/**
+ * \file pcm/pcm_shm.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Shared Memory Plugin Interface
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ */
+/*
+ * PCM - Shared Memory Client
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/shm.h>
+#include <sys/socket.h>
+#include <sys/poll.h>
+#include <sys/un.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <netdb.h>
+#include "aserver.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_shm = "";
+#endif
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ int socket;
+ volatile snd_pcm_shm_ctrl_t *ctrl;
+} snd_pcm_shm_t;
+#endif
+
+static long snd_pcm_shm_action_fd0(snd_pcm_t *pcm, int *fd)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ int err;
+ char buf[1];
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+
+ err = write(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ err = snd_receive_fd(shm->socket, buf, 1, fd);
+ if (err != 1)
+ return -EBADFD;
+ if (ctrl->cmd) {
+ SNDERR("Server has not done the cmd");
+ return -EBADFD;
+ }
+ return ctrl->result;
+}
+
+static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm,
+ snd_pcm_rbptr_t *rbptr, volatile snd_pcm_shm_rbptr_t *shm_rbptr)
+{
+ if (!shm_rbptr->use_mmap) {
+ if (&pcm->hw == rbptr)
+ snd_pcm_set_hw_ptr(pcm, &shm_rbptr->ptr, -1, 0);
+ else
+ snd_pcm_set_appl_ptr(pcm, &shm_rbptr->ptr, -1, 0);
+ } else {
+ void *ptr;
+ size_t mmap_size, mmap_offset, offset;
+ int fd;
+ long result;
+
+ shm->ctrl->cmd = &pcm->hw == rbptr ? SND_PCM_IOCTL_HW_PTR_FD : SND_PCM_IOCTL_APPL_PTR_FD;
+ result = snd_pcm_shm_action_fd0(pcm, &fd);
+ if (result < 0)
+ return result;
+ mmap_size = page_ptr(shm_rbptr->offset, sizeof(snd_pcm_uframes_t), &offset, &mmap_offset);
+ ptr = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, mmap_offset);
+ if (ptr == MAP_FAILED || ptr == NULL) {
+ SYSERR("shm rbptr mmap failed");
+ return -errno;
+ }
+ if (&pcm->hw == rbptr)
+ snd_pcm_set_hw_ptr(pcm, (snd_pcm_uframes_t *)((char *)ptr + offset), fd, shm_rbptr->offset);
+ else
+ snd_pcm_set_appl_ptr(pcm, (snd_pcm_uframes_t *)((char *)ptr + offset), fd, shm_rbptr->offset);
+ }
+ return 0;
+}
+
+static long snd_pcm_shm_action(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ int err, result;
+ char buf[1];
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+
+ if (ctrl->hw.changed || ctrl->appl.changed)
+ return -EBADFD;
+ err = write(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ err = read(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ if (ctrl->cmd) {
+ SNDERR("Server has not done the cmd");
+ return -EBADFD;
+ }
+ result = ctrl->result;
+ if (ctrl->hw.changed) {
+ err = snd_pcm_shm_new_rbptr(pcm, shm, &pcm->hw, &ctrl->hw);
+ if (err < 0)
+ return err;
+ ctrl->hw.changed = 0;
+ }
+ if (ctrl->appl.changed) {
+ err = snd_pcm_shm_new_rbptr(pcm, shm, &pcm->appl, &ctrl->appl);
+ if (err < 0)
+ return err;
+ ctrl->appl.changed = 0;
+ }
+ return result;
+}
+
+static long snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ int err;
+ char buf[1];
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+
+ if (ctrl->hw.changed || ctrl->appl.changed)
+ return -EBADFD;
+ err = write(shm->socket, buf, 1);
+ if (err != 1)
+ return -EBADFD;
+ err = snd_receive_fd(shm->socket, buf, 1, fd);
+ if (err != 1)
+ return -EBADFD;
+ if (ctrl->cmd) {
+ SNDERR("Server has not done the cmd");
+ return -EBADFD;
+ }
+ if (ctrl->hw.changed) {
+ err = snd_pcm_shm_new_rbptr(pcm, shm, &pcm->hw, &ctrl->hw);
+ if (err < 0)
+ return err;
+ ctrl->hw.changed = 0;
+ }
+ if (ctrl->appl.changed) {
+ err = snd_pcm_shm_new_rbptr(pcm, shm, &pcm->appl, &ctrl->appl);
+ if (err < 0)
+ return err;
+ ctrl->appl.changed = 0;
+ }
+ return ctrl->result;
+}
+
+static int snd_pcm_shm_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_shm_async(snd_pcm_t *pcm, int sig, pid_t pid)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_PCM_IOCTL_ASYNC;
+ ctrl->u.async.sig = sig;
+ ctrl->u.async.pid = pid;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+// ctrl->u.info = *info;
+ ctrl->cmd = SNDRV_PCM_IOCTL_INFO;
+ err = snd_pcm_shm_action(pcm);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.info;
+ return err;
+}
+
+static int snd_pcm_shm_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_shm_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ return 0;
+}
+
+static int snd_pcm_shm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ const snd_pcm_access_mask_t *access_mask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS);
+ if (!snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
+ !snd_pcm_access_mask_test(access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED)) {
+ err = _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ access_mask);
+ if (err < 0)
+ return err;
+ }
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_shm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ int err;
+ unsigned int links = ~SND_PCM_HW_PARBIT_ACCESS;
+ snd_pcm_access_mask_t access_mask;
+ snd_mask_copy(&access_mask, snd_pcm_hw_param_get_mask(sparams, SND_PCM_HW_PARAM_ACCESS));
+ snd_pcm_access_mask_set(&access_mask, SND_PCM_ACCESS_RW_INTERLEAVED);
+ snd_pcm_access_mask_set(&access_mask, SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ err = _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int snd_pcm_shm_hw_refine_slave(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->u.hw_refine = *params;
+ ctrl->cmd = SNDRV_PCM_IOCTL_HW_REFINE;
+ err = snd_pcm_shm_action(pcm);
+ *params = ctrl->u.hw_refine;
+ return err;
+}
+
+static int snd_pcm_shm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_shm_hw_refine_cprepare,
+ snd_pcm_shm_hw_refine_cchange,
+ snd_pcm_shm_hw_refine_sprepare,
+ snd_pcm_shm_hw_refine_schange,
+ snd_pcm_shm_hw_refine_slave);
+}
+
+static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ params->flags |= SND_PCM_HW_PARAMS_EXPORT_BUFFER;
+ ctrl->cmd = SNDRV_PCM_IOCTL_HW_PARAMS;
+ ctrl->u.hw_params = *params;
+ err = snd_pcm_shm_action(pcm);
+ *params = ctrl->u.hw_params;
+ return err;
+}
+
+static int snd_pcm_shm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ return snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_shm_hw_refine_cchange,
+ snd_pcm_shm_hw_refine_sprepare,
+ snd_pcm_shm_hw_refine_schange,
+ snd_pcm_shm_hw_params_slave);
+}
+
+static int snd_pcm_shm_hw_free(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_HW_FREE;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->cmd = SNDRV_PCM_IOCTL_SW_PARAMS;
+ ctrl->u.sw_params = *params;
+ err = snd_pcm_shm_action(pcm);
+ *params = ctrl->u.sw_params;
+ if (err < 0)
+ return err;
+ return err;
+}
+
+static int snd_pcm_shm_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static int snd_pcm_shm_munmap(snd_pcm_t *pcm)
+{
+ unsigned int c;
+ for (c = 0; c < pcm->channels; ++c) {
+ snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
+ unsigned int c1;
+ int err;
+ if (i->type != SND_PCM_AREA_MMAP)
+ continue;
+ if (i->u.mmap.fd < 0)
+ continue;
+ for (c1 = c + 1; c1 < pcm->channels; ++c1) {
+ snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
+ if (i1->type != SND_PCM_AREA_MMAP)
+ continue;
+ if (i1->u.mmap.fd != i->u.mmap.fd)
+ continue;
+ i1->u.mmap.fd = -1;
+ }
+ err = close(i->u.mmap.fd);
+ if (err < 0) {
+ SYSERR("close failed");
+ return -errno;
+ }
+ }
+ return 0;
+}
+
+static int snd_pcm_shm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ int fd;
+ ctrl->cmd = SNDRV_PCM_IOCTL_CHANNEL_INFO;
+ ctrl->u.channel_info = *info;
+ err = snd_pcm_shm_action_fd(pcm, &fd);
+ if (err < 0)
+ return err;
+ *info = ctrl->u.channel_info;
+ info->addr = 0;
+ switch (info->type) {
+ case SND_PCM_AREA_MMAP:
+ info->u.mmap.fd = fd;
+ break;
+ case SND_PCM_AREA_SHM:
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return err;
+}
+
+static int snd_pcm_shm_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->cmd = SNDRV_PCM_IOCTL_STATUS;
+ // ctrl->u.status = *status;
+ err = snd_pcm_shm_action(pcm);
+ if (err < 0)
+ return err;
+ *status = ctrl->u.status;
+ return err;
+}
+
+static snd_pcm_state_t snd_pcm_shm_state(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_PCM_IOCTL_STATE;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_hwsync(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_PCM_IOCTL_HWSYNC;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->cmd = SNDRV_PCM_IOCTL_DELAY;
+ err = snd_pcm_shm_action(pcm);
+ if (err < 0)
+ return err;
+ *delayp = ctrl->u.delay.frames;
+ return err;
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_avail_update(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ ctrl->cmd = SND_PCM_IOCTL_AVAIL_UPDATE;
+ err = snd_pcm_shm_action(pcm);
+ if (err < 0)
+ return err;
+ return err;
+}
+
+static int snd_pcm_shm_htimestamp(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t *avail ATTRIBUTE_UNUSED,
+ snd_htimestamp_t *tstamp ATTRIBUTE_UNUSED)
+{
+ return -EIO; /* not implemented yet */
+}
+
+static int snd_pcm_shm_prepare(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_PREPARE;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_reset(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_RESET;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_start(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_START;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_drop(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_DROP;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_drain(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int err;
+ do {
+ ctrl->cmd = SNDRV_PCM_IOCTL_DRAIN;
+ err = snd_pcm_shm_action(pcm);
+ if (err != -EAGAIN)
+ break;
+ usleep(10000);
+ } while (1);
+ if (err < 0)
+ return err;
+ if (!(pcm->mode & SND_PCM_NONBLOCK))
+ snd_pcm_wait(pcm, -1);
+ return err;
+}
+
+static int snd_pcm_shm_pause(snd_pcm_t *pcm, int enable)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_PAUSE;
+ ctrl->u.pause.enable = enable;
+ return snd_pcm_shm_action(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_rewindable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0; /* FIX ME */
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_REWIND;
+ ctrl->u.rewind.frames = frames;
+ return snd_pcm_shm_action(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+ return 0; /* FIX ME */
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_PCM_IOCTL_FORWARD;
+ ctrl->u.forward.frames = frames;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_resume(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SNDRV_PCM_IOCTL_RESUME;
+ return snd_pcm_shm_action(pcm);
+}
+
+static snd_pcm_sframes_t snd_pcm_shm_mmap_commit(snd_pcm_t *pcm,
+ snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t size)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ ctrl->cmd = SND_PCM_IOCTL_MMAP_COMMIT;
+ ctrl->u.mmap_commit.offset = offset;
+ ctrl->u.mmap_commit.frames = size;
+ return snd_pcm_shm_action(pcm);
+}
+
+static int snd_pcm_shm_poll_descriptor(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int fd, err;
+ ctrl->cmd = SND_PCM_IOCTL_POLL_DESCRIPTOR;
+ err = snd_pcm_shm_action_fd(pcm, &fd);
+ if (err < 0)
+ return err;
+ return fd;
+}
+
+static int snd_pcm_shm_close(snd_pcm_t *pcm)
+{
+ snd_pcm_shm_t *shm = pcm->private_data;
+ volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+ int result;
+ ctrl->cmd = SND_PCM_IOCTL_CLOSE;
+ result = snd_pcm_shm_action(pcm);
+ shmdt((void *)ctrl);
+ close(shm->socket);
+ close(pcm->poll_fd);
+ free(shm);
+ return result;
+}
+
+static void snd_pcm_shm_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_output_printf(out, "Shm PCM\n");
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+}
+
+static const snd_pcm_ops_t snd_pcm_shm_ops = {
+ .close = snd_pcm_shm_close,
+ .info = snd_pcm_shm_info,
+ .hw_refine = snd_pcm_shm_hw_refine,
+ .hw_params = snd_pcm_shm_hw_params,
+ .hw_free = snd_pcm_shm_hw_free,
+ .sw_params = snd_pcm_shm_sw_params,
+ .channel_info = snd_pcm_shm_channel_info,
+ .dump = snd_pcm_shm_dump,
+ .nonblock = snd_pcm_shm_nonblock,
+ .async = snd_pcm_shm_async,
+ .mmap = snd_pcm_shm_mmap,
+ .munmap = snd_pcm_shm_munmap,
+};
+
+static const snd_pcm_fast_ops_t snd_pcm_shm_fast_ops = {
+ .status = snd_pcm_shm_status,
+ .state = snd_pcm_shm_state,
+ .hwsync = snd_pcm_shm_hwsync,
+ .delay = snd_pcm_shm_delay,
+ .prepare = snd_pcm_shm_prepare,
+ .reset = snd_pcm_shm_reset,
+ .start = snd_pcm_shm_start,
+ .drop = snd_pcm_shm_drop,
+ .drain = snd_pcm_shm_drain,
+ .pause = snd_pcm_shm_pause,
+ .rewindable = snd_pcm_shm_rewindable,
+ .rewind = snd_pcm_shm_rewind,
+ .forwardable = snd_pcm_shm_forwardable,
+ .forward = snd_pcm_shm_forward,
+ .resume = snd_pcm_shm_resume,
+ .writei = snd_pcm_mmap_writei,
+ .writen = snd_pcm_mmap_writen,
+ .readi = snd_pcm_mmap_readi,
+ .readn = snd_pcm_mmap_readn,
+ .avail_update = snd_pcm_shm_avail_update,
+ .mmap_commit = snd_pcm_shm_mmap_commit,
+ .htimestamp = snd_pcm_shm_htimestamp,
+};
+
+static int make_local_socket(const char *filename)
+{
+ size_t l = strlen(filename);
+ size_t size = offsetof(struct sockaddr_un, sun_path) + l;
+ struct sockaddr_un *addr = alloca(size);
+ int sock;
+
+ sock = socket(PF_LOCAL, SOCK_STREAM, 0);
+ if (sock < 0) {
+ SYSERR("socket failed");
+ return -errno;
+ }
+
+ addr->sun_family = AF_LOCAL;
+ memcpy(addr->sun_path, filename, l);
+
+ if (connect(sock, (struct sockaddr *) addr, size) < 0) {
+ SYSERR("connect failed");
+ return -errno;
+ }
+ return sock;
+}
+
+#if 0
+static int make_inet_socket(const char *host, int port)
+{
+ struct sockaddr_in addr;
+ int sock;
+ struct hostent *h = gethostbyname(host);
+ if (!h)
+ return -ENOENT;
+
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock < 0) {
+ SYSERR("socket failed");
+ return -errno;
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(port);
+ memcpy(&addr.sin_addr, h->h_addr_list[0], sizeof(struct in_addr));
+
+ if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ SYSERR("connect failed");
+ return -errno;
+ }
+ return sock;
+}
+#endif
+
+/**
+ * \brief Creates a new shared memory PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sockname Unix socket name
+ * \param sname Server name
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
+ const char *sockname, const char *sname,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_shm_t *shm = NULL;
+ snd_client_open_request_t *req;
+ snd_client_open_answer_t ans;
+ size_t snamelen, reqlen;
+ int err;
+ int result;
+ snd_pcm_shm_ctrl_t *ctrl = NULL;
+ int sock = -1;
+ snamelen = strlen(sname);
+ if (snamelen > 255)
+ return -EINVAL;
+
+ result = make_local_socket(sockname);
+ if (result < 0) {
+ SNDERR("server for socket %s is not running", sockname);
+ goto _err;
+ }
+ sock = result;
+
+ reqlen = sizeof(*req) + snamelen;
+ req = alloca(reqlen);
+ memcpy(req->name, sname, snamelen);
+ req->dev_type = SND_DEV_TYPE_PCM;
+ req->transport_type = SND_TRANSPORT_TYPE_SHM;
+ req->stream = stream;
+ req->mode = mode;
+ req->namelen = snamelen;
+ err = write(sock, req, reqlen);
+ if (err < 0) {
+ SYSERR("write error");
+ result = -errno;
+ goto _err;
+ }
+ if ((size_t) err != reqlen) {
+ SNDERR("write size error");
+ result = -EINVAL;
+ goto _err;
+ }
+ err = read(sock, &ans, sizeof(ans));
+ if (err < 0) {
+ SYSERR("read error");
+ result = -errno;
+ goto _err;
+ }
+ if (err != sizeof(ans)) {
+ SNDERR("read size error");
+ result = -EINVAL;
+ goto _err;
+ }
+ result = ans.result;
+ if (result < 0)
+ goto _err;
+
+ ctrl = shmat(ans.cookie, 0, 0);
+ if (!ctrl) {
+ SYSERR("shmat error");
+ result = -errno;
+ goto _err;
+ }
+
+ shm = calloc(1, sizeof(snd_pcm_shm_t));
+ if (!shm) {
+ result = -ENOMEM;
+ goto _err;
+ }
+
+ shm->socket = sock;
+ shm->ctrl = ctrl;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_SHM, name, stream, mode);
+ if (err < 0) {
+ result = err;
+ goto _err;
+ }
+ pcm->mmap_rw = 1;
+ pcm->ops = &snd_pcm_shm_ops;
+ pcm->fast_ops = &snd_pcm_shm_fast_ops;
+ pcm->private_data = shm;
+ err = snd_pcm_shm_poll_descriptor(pcm);
+ if (err < 0) {
+ snd_pcm_close(pcm);
+ return err;
+ }
+ pcm->poll_fd = err;
+ pcm->poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
+ snd_pcm_set_hw_ptr(pcm, &ctrl->hw.ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &ctrl->appl.ptr, -1, 0);
+ *pcmp = pcm;
+ return 0;
+
+ _err:
+ close(sock);
+ if (ctrl)
+ shmdt(ctrl);
+ free(shm);
+ return result;
+}
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_shm Plugin: shm
+
+This plugin communicates with aserver via shared memory. It is a raw
+communication without any conversions, but it can be expected worse
+performance.
+
+\code
+pcm.name {
+ type shm # Shared memory PCM
+ server STR # Server name
+ pcm STR # PCM name
+}
+\endcode
+
+\subsection pcm_plugins_shm_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_shm_open()
+ <LI>_snd_pcm_shm_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new shm PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with hw PCM description
+ * \param stream PCM Stream
+ * \param mode PCM Mode
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ const char *server = NULL;
+ const char *pcm_name = NULL;
+ snd_config_t *sconfig;
+ const char *host = NULL;
+ const char *sockname = NULL;
+ long port = -1;
+ int err;
+ int local;
+ struct hostent *h;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "server") == 0) {
+ err = snd_config_get_string(n, &server);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "pcm") == 0) {
+ err = snd_config_get_string(n, &pcm_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!pcm_name) {
+ SNDERR("pcm is not defined");
+ return -EINVAL;
+ }
+ if (!server) {
+ SNDERR("server is not defined");
+ return -EINVAL;
+ }
+ err = snd_config_search_definition(root, "server", server, &sconfig);
+ if (err < 0) {
+ SNDERR("Unknown server %s", server);
+ return -EINVAL;
+ }
+ if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for server %s definition", server);
+ goto _err;
+ }
+ snd_config_for_each(i, next, sconfig) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "host") == 0) {
+ err = snd_config_get_string(n, &host);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "socket") == 0) {
+ err = snd_config_get_string(n, &sockname);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "port") == 0) {
+ err = snd_config_get_integer(n, &port);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ _err:
+ err = -EINVAL;
+ goto __error;
+ }
+
+ if (!host) {
+ SNDERR("host is not defined");
+ goto _err;
+ }
+ if (!sockname) {
+ SNDERR("socket is not defined");
+ goto _err;
+ }
+ h = gethostbyname(host);
+ if (!h) {
+ SNDERR("Cannot resolve %s", host);
+ goto _err;
+ }
+ local = snd_is_local(h);
+ if (!local) {
+ SNDERR("%s is not the local host", host);
+ goto _err;
+ }
+ err = snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode);
+ __error:
+ snd_config_delete(sconfig);
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_simple.c b/alsa-lib/src/pcm/pcm_simple.c
new file mode 100644
index 0000000..975f699
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_simple.c
@@ -0,0 +1,305 @@
+/**
+ * \file pcm/pcm_simple.c
+ * \ingroup PCM_Simple
+ * \brief PCM Simple Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2004
+ */
+/*
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "pcm_local.h"
+
+static int set_buffer_time(snd_spcm_latency_t latency,
+ unsigned int *buffer_time)
+{
+ switch (latency) {
+ case SND_SPCM_LATENCY_STANDARD:
+ *buffer_time = 350000;
+ break;
+ case SND_SPCM_LATENCY_MEDIUM:
+ *buffer_time = 25000;
+ break;
+ case SND_SPCM_LATENCY_REALTIME:
+ *buffer_time = 2500;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int set_hw_params(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *hw_params,
+ unsigned int *rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ unsigned int *buffer_time,
+ unsigned int *period_time,
+ snd_pcm_access_t access)
+{
+ int err;
+
+ /*
+ * hardware parameters
+ */
+ err = snd_pcm_hw_params_any(pcm, hw_params);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_params_set_access(pcm, hw_params, access);
+ if (err < 0)
+ return err;
+ err = snd_pcm_hw_params_set_format(pcm, hw_params, format);
+ if (err < 0)
+ return err;
+ if (subformat != SND_PCM_SUBFORMAT_STD) {
+ err = snd_pcm_hw_params_set_subformat(pcm, hw_params, subformat);
+ if (err < 0)
+ return err;
+ }
+ err = snd_pcm_hw_params_set_channels(pcm, hw_params, channels);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_set_rate_near)(pcm, hw_params, rate, 0);
+ if (err < 0)
+ return err;
+ err = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(pcm, hw_params, buffer_time, NULL);
+ if (err < 0)
+ return err;
+ if (period_time == NULL || *period_time == 0) {
+ unsigned int periods = 3;
+ err = INTERNAL(snd_pcm_hw_params_set_periods_near)(pcm, hw_params, &periods, NULL);
+ if (err < 0)
+ return err;
+ if (periods == 1)
+ return -EINVAL;
+ if (*period_time == 0) {
+ err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
+ if (err < 0)
+ return err;
+ }
+ } else {
+ err = snd_pcm_hw_params_set_period_time(pcm, hw_params, *period_time, 0);
+ if (err < 0)
+ return err;
+ if (*buffer_time == *period_time)
+ return -EINVAL;
+ }
+ err = snd_pcm_hw_params(pcm, hw_params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+static int set_sw_params(snd_pcm_t *pcm,
+ snd_pcm_sw_params_t *sw_params,
+ snd_spcm_xrun_type_t xrun_type)
+{
+ int err;
+
+ err = snd_pcm_sw_params_current(pcm, sw_params);
+ if (err < 0)
+ return err;
+ err = snd_pcm_sw_params_set_start_threshold(pcm, sw_params, (pcm->buffer_size / pcm->period_size) * pcm->period_size);
+ if (err < 0)
+ return err;
+ err = snd_pcm_sw_params_set_avail_min(pcm, sw_params, pcm->period_size);
+ if (err < 0)
+ return err;
+ switch (xrun_type) {
+ case SND_SPCM_XRUN_STOP:
+ err = snd_pcm_sw_params_set_stop_threshold(pcm, sw_params, pcm->buffer_size);
+ break;
+ case SND_SPCM_XRUN_IGNORE:
+ err = snd_pcm_sw_params_set_stop_threshold(pcm, sw_params, pcm->boundary);
+ break;
+ default:
+ return -EINVAL;
+ }
+ if (err < 0)
+ return err;
+ err = snd_pcm_sw_params(pcm, sw_params);
+ if (err < 0)
+ return err;
+ return 0;
+}
+
+/**
+ * \brief Set up a simple PCM
+ * \param pcm PCM handle
+ * \param rate Sample rate
+ * \param channels Number of channels
+ * \param format PCM format
+ * \param subformat PCM subformat
+ * \param latency Latency type
+ * \param access PCM acceess type
+ * \param xrun_type XRUN type
+ * \return 0 if successful, or a negative error code
+ *
+ * \warning The simple PCM API may be broken in the current release.
+ */
+int snd_spcm_init(snd_pcm_t *pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t access,
+ snd_spcm_xrun_type_t xrun_type)
+{
+ int err;
+ snd_pcm_hw_params_t *hw_params;
+ snd_pcm_sw_params_t *sw_params;
+ unsigned int rrate;
+ unsigned int buffer_time;
+
+ snd_pcm_hw_params_alloca(&hw_params);
+ snd_pcm_sw_params_alloca(&sw_params);
+
+ assert(pcm);
+ assert(rate > 5000 && rate < 192000);
+ assert(channels > 1 && channels < 512);
+
+ rrate = rate;
+ err = set_buffer_time(latency, &buffer_time);
+ if (err < 0)
+ return err;
+ err = set_hw_params(pcm, hw_params,
+ &rrate, channels, format, subformat,
+ &buffer_time, NULL, access);
+ if (err < 0)
+ return err;
+
+ err = set_sw_params(pcm, sw_params, xrun_type);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+/**
+ * \brief Initialize simple PCMs in the duplex mode
+ * \param playback_pcm PCM handle for playback
+ * \param capture_pcm PCM handle for capture
+ * \param rate Sample rate
+ * \param channels Number of channels
+ * \param format PCM format
+ * \param subformat PCM subformat
+ * \param latency Latency type
+ * \param access PCM acceess type
+ * \param xrun_type XRUN type
+ * \param duplex_type Duplex mode
+ * \return 0 if successful, or a negative error code
+ *
+ * \warning The simple PCM API may be broken in the current release.
+ */
+int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
+ snd_pcm_t *capture_pcm,
+ unsigned int rate,
+ unsigned int channels,
+ snd_pcm_format_t format,
+ snd_pcm_subformat_t subformat,
+ snd_spcm_latency_t latency,
+ snd_pcm_access_t access,
+ snd_spcm_xrun_type_t xrun_type,
+ snd_spcm_duplex_type_t duplex_type)
+{
+ int err, i;
+ snd_pcm_hw_params_t *hw_params;
+ snd_pcm_sw_params_t *sw_params;
+ unsigned int rrate;
+ unsigned int xbuffer_time, buffer_time[2];
+ unsigned int period_time[2];
+ snd_pcm_t *pcms[2];
+
+ snd_pcm_hw_params_alloca(&hw_params);
+ snd_pcm_sw_params_alloca(&sw_params);
+
+ assert(playback_pcm);
+ assert(capture_pcm);
+ assert(rate > 5000 && rate < 192000);
+ assert(channels > 1 && channels < 512);
+
+ pcms[0] = playback_pcm;
+ pcms[1] = capture_pcm;
+
+ /*
+ * hardware parameters
+ */
+ err = set_buffer_time(latency, &xbuffer_time);
+ if (err < 0)
+ return err;
+
+ for (i = 0; i < 2; i++) {
+ buffer_time[i] = xbuffer_time;
+ period_time[i] = i > 0 ? period_time[0] : 0;
+ rrate = rate;
+ err = set_hw_params(pcms[i], hw_params,
+ &rrate, channels, format, subformat,
+ &buffer_time[i], &period_time[i], access);
+ if (err < 0)
+ return err;
+ }
+ if (buffer_time[0] == buffer_time[1] &&
+ period_time[0] == period_time[1])
+ goto __sw_params;
+ if (duplex_type == SND_SPCM_DUPLEX_LIBERAL)
+ goto __sw_params;
+ /* FIXME: */
+ return -EINVAL;
+
+ /*
+ * software parameters
+ */
+ __sw_params:
+ for (i = 0; i < 2; i++) {
+ err = set_sw_params(pcms[i], sw_params, xrun_type);
+ if (err < 0)
+ return err;
+ }
+
+ return 0;
+}
+
+/**
+ * \brief Get the set up of simple PCM
+ * \param pcm PCM handle
+ * \param rate Pointer to store the current sample rate
+ * \param buffer_size Pointer to store the current buffer size
+ * \param period_size Pointer to store the current period size
+ * \return 0 if successful, or a negative error code
+ *
+ * \warning The simple PCM API may be broken in the current release.
+ */
+int snd_spcm_init_get_params(snd_pcm_t *pcm,
+ unsigned int *rate,
+ snd_pcm_uframes_t *buffer_size,
+ snd_pcm_uframes_t *period_size)
+{
+ assert(pcm);
+ if (!pcm->setup)
+ return -EBADFD;
+ if (rate)
+ *rate = pcm->rate;
+ if (buffer_size)
+ *buffer_size = pcm->buffer_size;
+ if (period_size)
+ *period_size = pcm->period_size;
+ return 0;
+}
diff --git a/alsa-lib/src/pcm/pcm_softvol.c b/alsa-lib/src/pcm/pcm_softvol.c
new file mode 100644
index 0000000..637e5cb
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_softvol.c
@@ -0,0 +1,1082 @@
+/**
+ * \file pcm/pcm_softvol.c
+ * \ingroup PCM_Plugins
+ * \brief PCM Soft Volume Plugin Interface
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2004
+ */
+/*
+ * PCM - Soft Volume Plugin
+ * Copyright (c) 2004 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <byteswap.h>
+#include <math.h>
+#include "pcm_local.h"
+#include "pcm_plugin.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_pcm_softvol = "";
+#endif
+
+#ifndef DOC_HIDDEN
+
+typedef struct {
+ /* This field need to be the first */
+ snd_pcm_plugin_t plug;
+ snd_pcm_format_t sformat;
+ unsigned int cchannels;
+ snd_ctl_t *ctl;
+ snd_ctl_elem_value_t elem;
+ unsigned int cur_vol[2];
+ unsigned int max_val; /* max index */
+ unsigned int zero_dB_val; /* index at 0 dB */
+ double min_dB;
+ double max_dB;
+ unsigned int *dB_value;
+} snd_pcm_softvol_t;
+
+#define VOL_SCALE_SHIFT 16
+#define VOL_SCALE_MASK ((1 << VOL_SCALE_SHIFT) - 1)
+
+#define PRESET_RESOLUTION 256
+#define PRESET_MIN_DB -51.0
+#define ZERO_DB 0.0
+#define MAX_DB_UPPER_LIMIT 50
+
+static const unsigned int preset_dB_value[PRESET_RESOLUTION] = {
+ 0x00b8, 0x00bd, 0x00c1, 0x00c5, 0x00ca, 0x00cf, 0x00d4, 0x00d9,
+ 0x00de, 0x00e3, 0x00e8, 0x00ed, 0x00f3, 0x00f9, 0x00fe, 0x0104,
+ 0x010a, 0x0111, 0x0117, 0x011e, 0x0124, 0x012b, 0x0132, 0x0139,
+ 0x0140, 0x0148, 0x0150, 0x0157, 0x015f, 0x0168, 0x0170, 0x0179,
+ 0x0181, 0x018a, 0x0194, 0x019d, 0x01a7, 0x01b0, 0x01bb, 0x01c5,
+ 0x01cf, 0x01da, 0x01e5, 0x01f1, 0x01fc, 0x0208, 0x0214, 0x0221,
+ 0x022d, 0x023a, 0x0248, 0x0255, 0x0263, 0x0271, 0x0280, 0x028f,
+ 0x029e, 0x02ae, 0x02be, 0x02ce, 0x02df, 0x02f0, 0x0301, 0x0313,
+ 0x0326, 0x0339, 0x034c, 0x035f, 0x0374, 0x0388, 0x039d, 0x03b3,
+ 0x03c9, 0x03df, 0x03f7, 0x040e, 0x0426, 0x043f, 0x0458, 0x0472,
+ 0x048d, 0x04a8, 0x04c4, 0x04e0, 0x04fd, 0x051b, 0x053a, 0x0559,
+ 0x0579, 0x0599, 0x05bb, 0x05dd, 0x0600, 0x0624, 0x0648, 0x066e,
+ 0x0694, 0x06bb, 0x06e3, 0x070c, 0x0737, 0x0762, 0x078e, 0x07bb,
+ 0x07e9, 0x0818, 0x0848, 0x087a, 0x08ac, 0x08e0, 0x0915, 0x094b,
+ 0x0982, 0x09bb, 0x09f5, 0x0a30, 0x0a6d, 0x0aab, 0x0aeb, 0x0b2c,
+ 0x0b6f, 0x0bb3, 0x0bf9, 0x0c40, 0x0c89, 0x0cd4, 0x0d21, 0x0d6f,
+ 0x0dbf, 0x0e11, 0x0e65, 0x0ebb, 0x0f12, 0x0f6c, 0x0fc8, 0x1026,
+ 0x1087, 0x10e9, 0x114e, 0x11b5, 0x121f, 0x128b, 0x12fa, 0x136b,
+ 0x13df, 0x1455, 0x14ce, 0x154a, 0x15c9, 0x164b, 0x16d0, 0x1758,
+ 0x17e4, 0x1872, 0x1904, 0x1999, 0x1a32, 0x1ace, 0x1b6e, 0x1c11,
+ 0x1cb9, 0x1d64, 0x1e13, 0x1ec7, 0x1f7e, 0x203a, 0x20fa, 0x21bf,
+ 0x2288, 0x2356, 0x2429, 0x2500, 0x25dd, 0x26bf, 0x27a6, 0x2892,
+ 0x2984, 0x2a7c, 0x2b79, 0x2c7c, 0x2d85, 0x2e95, 0x2fab, 0x30c7,
+ 0x31ea, 0x3313, 0x3444, 0x357c, 0x36bb, 0x3801, 0x394f, 0x3aa5,
+ 0x3c02, 0x3d68, 0x3ed6, 0x404d, 0x41cd, 0x4355, 0x44e6, 0x4681,
+ 0x4826, 0x49d4, 0x4b8c, 0x4d4f, 0x4f1c, 0x50f3, 0x52d6, 0x54c4,
+ 0x56be, 0x58c3, 0x5ad4, 0x5cf2, 0x5f1c, 0x6153, 0x6398, 0x65e9,
+ 0x6849, 0x6ab7, 0x6d33, 0x6fbf, 0x7259, 0x7503, 0x77bd, 0x7a87,
+ 0x7d61, 0x804d, 0x834a, 0x8659, 0x897a, 0x8cae, 0x8ff5, 0x934f,
+ 0x96bd, 0x9a40, 0x9dd8, 0xa185, 0xa548, 0xa922, 0xad13, 0xb11b,
+ 0xb53b, 0xb973, 0xbdc5, 0xc231, 0xc6b7, 0xcb58, 0xd014, 0xd4ed,
+ 0xd9e3, 0xdef6, 0xe428, 0xe978, 0xeee8, 0xf479, 0xfa2b, 0xffff,
+};
+
+/* (32bit x 16bit) >> 16 */
+typedef union {
+ int i;
+ short s[2];
+} val_t;
+static inline int MULTI_DIV_32x16(int a, unsigned short b)
+{
+ val_t v, x, y;
+ v.i = a;
+ y.i = 0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ x.i = (unsigned int)v.s[0] * b;
+ y.s[0] = x.s[1];
+ y.i += (int)v.s[1] * b;
+#else
+ x.i = (unsigned int)v.s[1] * b;
+ y.s[1] = x.s[0];
+ y.i += (int)v.s[0] * b;
+#endif
+ return y.i;
+}
+
+static inline int MULTI_DIV_int(int a, unsigned int b, int swap)
+{
+ unsigned int gain = (b >> VOL_SCALE_SHIFT);
+ int fraction;
+ a = swap ? (int)bswap_32(a) : a;
+ fraction = MULTI_DIV_32x16(a, b & VOL_SCALE_MASK);
+ if (gain) {
+ long long amp = (long long)a * gain + fraction;
+ if (amp > (int)0x7fffffff)
+ amp = (int)0x7fffffff;
+ else if (amp < (int)0x80000000)
+ amp = (int)0x80000000;
+ return swap ? (int)bswap_32((int)amp) : (int)amp;
+ }
+ return swap ? (int)bswap_32(fraction) : fraction;
+}
+
+static inline short MULTI_DIV_short(short a, unsigned int b, int swap)
+{
+ unsigned int gain = b >> VOL_SCALE_SHIFT;
+ int fraction;
+ a = swap ? (short)bswap_16(a) : a;
+ fraction = (int)(a * (b & VOL_SCALE_MASK)) >> VOL_SCALE_SHIFT;
+ if (gain) {
+ int amp = a * gain + fraction;
+ if (abs(amp) > 0x7fff)
+ amp = (a<0) ? (short)0x8000 : (short)0x7fff;
+ return swap ? (short)bswap_16((short)amp) : (short)amp;
+ }
+ return swap ? (short)bswap_16((short)fraction) : (short)fraction;
+}
+
+#endif /* DOC_HIDDEN */
+
+/*
+ * apply volumue attenuation
+ *
+ * TODO: use SIMD operations
+ */
+
+#ifndef DOC_HIDDEN
+#define CONVERT_AREA(TYPE, swap) do { \
+ unsigned int ch, fr; \
+ TYPE *src, *dst; \
+ for (ch = 0; ch < channels; ch++) { \
+ src_area = &src_areas[ch]; \
+ dst_area = &dst_areas[ch]; \
+ src = snd_pcm_channel_area_addr(src_area, src_offset); \
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset); \
+ src_step = snd_pcm_channel_area_step(src_area) / sizeof(TYPE); \
+ dst_step = snd_pcm_channel_area_step(dst_area) / sizeof(TYPE); \
+ GET_VOL_SCALE; \
+ fr = frames; \
+ if (! vol_scale) { \
+ while (fr--) { \
+ *dst = 0; \
+ dst += dst_step; \
+ } \
+ } else if (vol_scale == 0xffff) { \
+ while (fr--) { \
+ *dst = *src; \
+ src += src_step; \
+ dst += dst_step; \
+ } \
+ } else { \
+ while (fr--) { \
+ *dst = (TYPE) MULTI_DIV_##TYPE(*src, vol_scale, swap); \
+ src += src_step; \
+ dst += dst_step; \
+ } \
+ } \
+ } \
+} while (0)
+
+#define CONVERT_AREA_S24_3LE() do { \
+ unsigned int ch, fr; \
+ unsigned char *src, *dst; \
+ int tmp; \
+ for (ch = 0; ch < channels; ch++) { \
+ src_area = &src_areas[ch]; \
+ dst_area = &dst_areas[ch]; \
+ src = snd_pcm_channel_area_addr(src_area, src_offset); \
+ dst = snd_pcm_channel_area_addr(dst_area, dst_offset); \
+ src_step = snd_pcm_channel_area_step(src_area); \
+ dst_step = snd_pcm_channel_area_step(dst_area); \
+ GET_VOL_SCALE; \
+ fr = frames; \
+ if (! vol_scale) { \
+ while (fr--) { \
+ dst[0] = dst[1] = dst[2] = 0; \
+ dst += dst_step; \
+ } \
+ } else if (vol_scale == 0xffff) { \
+ while (fr--) { \
+ dst[0] = src[0]; \
+ dst[1] = src[1]; \
+ dst[2] = src[2]; \
+ src += dst_step; \
+ dst += src_step; \
+ } \
+ } else { \
+ while (fr--) { \
+ tmp = src[0] | \
+ (src[1] << 8) | \
+ (((signed char *) src)[2] << 16); \
+ tmp = MULTI_DIV_int(tmp, vol_scale, 0); \
+ dst[0] = tmp; \
+ dst[1] = tmp >> 8; \
+ dst[2] = tmp >> 16; \
+ src += dst_step; \
+ dst += src_step; \
+ } \
+ } \
+ } \
+} while (0)
+
+#define GET_VOL_SCALE \
+ switch (ch) { \
+ case 0: \
+ case 2: \
+ vol_scale = (channels == ch + 1) ? vol_c : vol[0]; \
+ break; \
+ case 4: \
+ case 5: \
+ vol_scale = vol_c; \
+ break; \
+ default: \
+ vol_scale = vol[ch & 1]; \
+ break; \
+ }
+
+#endif /* DOC_HIDDEN */
+
+/* 2-channel stereo control */
+static void softvol_convert_stereo_vol(snd_pcm_softvol_t *svol,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels,
+ snd_pcm_uframes_t frames)
+{
+ const snd_pcm_channel_area_t *dst_area, *src_area;
+ unsigned int src_step, dst_step;
+ unsigned int vol_scale, vol[2], vol_c;
+
+ if (svol->cur_vol[0] == 0 && svol->cur_vol[1] == 0) {
+ snd_pcm_areas_silence(dst_areas, dst_offset, channels, frames,
+ svol->sformat);
+ return;
+ } else if (svol->zero_dB_val && svol->cur_vol[0] == svol->zero_dB_val &&
+ svol->cur_vol[1] == svol->zero_dB_val) {
+ snd_pcm_areas_copy(dst_areas, dst_offset, src_areas, src_offset,
+ channels, frames, svol->sformat);
+ return;
+ }
+
+ if (svol->max_val == 1) {
+ vol[0] = svol->cur_vol[0] ? 0xffff : 0;
+ vol[1] = svol->cur_vol[1] ? 0xffff : 0;
+ vol_c = vol[0] | vol[1];
+ } else {
+ vol[0] = svol->dB_value[svol->cur_vol[0]];
+ vol[1] = svol->dB_value[svol->cur_vol[1]];
+ vol_c = svol->dB_value[(svol->cur_vol[0] + svol->cur_vol[1]) / 2];
+ }
+ switch (svol->sformat) {
+ case SND_PCM_FORMAT_S16_LE:
+ case SND_PCM_FORMAT_S16_BE:
+ /* 16bit samples */
+ CONVERT_AREA(short,
+ !snd_pcm_format_cpu_endian(svol->sformat));
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_S32_BE:
+ /* 32bit samples */
+ CONVERT_AREA(int,
+ !snd_pcm_format_cpu_endian(svol->sformat));
+ break;
+ case SND_PCM_FORMAT_S24_3LE:
+ CONVERT_AREA_S24_3LE();
+ break;
+ default:
+ break;
+ }
+}
+
+#undef GET_VOL_SCALE
+#define GET_VOL_SCALE
+
+/* mono control */
+static void softvol_convert_mono_vol(snd_pcm_softvol_t *svol,
+ const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ unsigned int channels,
+ snd_pcm_uframes_t frames)
+{
+ const snd_pcm_channel_area_t *dst_area, *src_area;
+ unsigned int src_step, dst_step;
+ unsigned int vol_scale;
+
+ if (svol->cur_vol[0] == 0) {
+ snd_pcm_areas_silence(dst_areas, dst_offset, channels, frames,
+ svol->sformat);
+ return;
+ } else if (svol->zero_dB_val && svol->cur_vol[0] == svol->zero_dB_val) {
+ snd_pcm_areas_copy(dst_areas, dst_offset, src_areas, src_offset,
+ channels, frames, svol->sformat);
+ return;
+ }
+
+ if (svol->max_val == 1)
+ vol_scale = svol->cur_vol[0] ? 0xffff : 0;
+ else
+ vol_scale = svol->dB_value[svol->cur_vol[0]];
+ switch (svol->sformat) {
+ case SND_PCM_FORMAT_S16_LE:
+ case SND_PCM_FORMAT_S16_BE:
+ /* 16bit samples */
+ CONVERT_AREA(short,
+ !snd_pcm_format_cpu_endian(svol->sformat));
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_S32_BE:
+ /* 32bit samples */
+ CONVERT_AREA(int,
+ !snd_pcm_format_cpu_endian(svol->sformat));
+ break;
+ case SND_PCM_FORMAT_S24_3LE:
+ CONVERT_AREA_S24_3LE();
+ break;
+ default:
+ break;
+ }
+}
+
+/*
+ * get the current volume value from driver
+ *
+ * TODO: mmap support?
+ */
+static void get_current_volume(snd_pcm_softvol_t *svol)
+{
+ unsigned int val;
+ unsigned int i;
+
+ if (snd_ctl_elem_read(svol->ctl, &svol->elem) < 0)
+ return;
+ for (i = 0; i < svol->cchannels; i++) {
+ val = svol->elem.value.integer.value[i];
+ if (val > svol->max_val)
+ val = svol->max_val;
+ svol->cur_vol[i] = val;
+ }
+}
+
+static void softvol_free(snd_pcm_softvol_t *svol)
+{
+ if (svol->plug.gen.close_slave)
+ snd_pcm_close(svol->plug.gen.slave);
+ if (svol->ctl)
+ snd_ctl_close(svol->ctl);
+ if (svol->dB_value && svol->dB_value != preset_dB_value)
+ free(svol->dB_value);
+ free(svol);
+}
+
+static int snd_pcm_softvol_close(snd_pcm_t *pcm)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ softvol_free(svol);
+ return 0;
+}
+
+static int snd_pcm_softvol_hw_refine_cprepare(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params)
+{
+ int err;
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_SHM };
+ snd_pcm_format_mask_t format_mask = {
+ {
+ (1ULL << SND_PCM_FORMAT_S16_LE) |
+ (1ULL << SND_PCM_FORMAT_S16_BE) |
+ (1ULL << SND_PCM_FORMAT_S32_LE) |
+ (1ULL << SND_PCM_FORMAT_S32_BE),
+ (1ULL << (SND_PCM_FORMAT_S24_3LE - 32))
+ }
+ };
+ if (svol->sformat != SND_PCM_FORMAT_UNKNOWN) {
+ snd_pcm_format_mask_none(&format_mask);
+ snd_pcm_format_mask_set(&format_mask, svol->sformat);
+ }
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
+ &access_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
+ &format_mask);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD);
+ if (err < 0)
+ return err;
+ err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_CHANNELS, 1, 0);
+ if (err < 0)
+ return err;
+ params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID);
+ return 0;
+}
+
+static int snd_pcm_softvol_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
+ _snd_pcm_hw_params_any(sparams);
+ _snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
+ &saccess_mask);
+ if (svol->sformat != SND_PCM_FORMAT_UNKNOWN) {
+ _snd_pcm_hw_params_set_format(sparams, svol->sformat);
+ _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
+ }
+ return 0;
+}
+
+/*
+ * refine the access mask
+ */
+static int check_access_mask(snd_pcm_hw_params_t *src,
+ snd_pcm_hw_params_t *dst)
+{
+ const snd_pcm_access_mask_t *mask;
+ snd_pcm_access_mask_t smask;
+
+ mask = snd_pcm_hw_param_get_mask(src, SND_PCM_HW_PARAM_ACCESS);
+ snd_mask_none(&smask);
+ if (snd_pcm_access_mask_test(mask, SND_PCM_ACCESS_RW_INTERLEAVED) ||
+ snd_pcm_access_mask_test(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED)) {
+ snd_pcm_access_mask_set(&smask,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ snd_pcm_access_mask_set(&smask,
+ SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ }
+ if (snd_pcm_access_mask_test(mask, SND_PCM_ACCESS_RW_NONINTERLEAVED) ||
+ snd_pcm_access_mask_test(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED)) {
+ snd_pcm_access_mask_set(&smask,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ snd_pcm_access_mask_set(&smask,
+ SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ }
+ if (snd_pcm_access_mask_test(mask, SND_PCM_ACCESS_MMAP_COMPLEX))
+ snd_pcm_access_mask_set(&smask,
+ SND_PCM_ACCESS_MMAP_COMPLEX);
+
+ return _snd_pcm_hw_param_set_mask(dst, SND_PCM_HW_PARAM_ACCESS, &smask);
+}
+
+static int snd_pcm_softvol_hw_refine_schange(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (svol->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS);
+ err = _snd_pcm_hw_params_refine(sparams, links, params);
+ if (err < 0)
+ return err;
+
+ err = check_access_mask(params, sparams);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static int snd_pcm_softvol_hw_refine_cchange(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *sparams)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ int err;
+ unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
+ SND_PCM_HW_PARBIT_RATE |
+ SND_PCM_HW_PARBIT_PERIODS |
+ SND_PCM_HW_PARBIT_PERIOD_SIZE |
+ SND_PCM_HW_PARBIT_PERIOD_TIME |
+ SND_PCM_HW_PARBIT_BUFFER_SIZE |
+ SND_PCM_HW_PARBIT_BUFFER_TIME |
+ SND_PCM_HW_PARBIT_TICK_TIME);
+ if (svol->sformat == SND_PCM_FORMAT_UNKNOWN)
+ links |= (SND_PCM_HW_PARBIT_FORMAT |
+ SND_PCM_HW_PARBIT_SUBFORMAT |
+ SND_PCM_HW_PARBIT_SAMPLE_BITS);
+ err = _snd_pcm_hw_params_refine(params, links, sparams);
+ if (err < 0)
+ return err;
+
+ err = check_access_mask(sparams, params);
+ if (err < 0)
+ return err;
+
+ return 0;
+}
+
+static int snd_pcm_softvol_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+{
+ return snd_pcm_hw_refine_slave(pcm, params,
+ snd_pcm_softvol_hw_refine_cprepare,
+ snd_pcm_softvol_hw_refine_cchange,
+ snd_pcm_softvol_hw_refine_sprepare,
+ snd_pcm_softvol_hw_refine_schange,
+ snd_pcm_generic_hw_refine);
+}
+
+static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ snd_pcm_t *slave = svol->plug.gen.slave;
+ int err = snd_pcm_hw_params_slave(pcm, params,
+ snd_pcm_softvol_hw_refine_cchange,
+ snd_pcm_softvol_hw_refine_sprepare,
+ snd_pcm_softvol_hw_refine_schange,
+ snd_pcm_generic_hw_params);
+ if (err < 0)
+ return err;
+ if (slave->format != SND_PCM_FORMAT_S16_LE &&
+ slave->format != SND_PCM_FORMAT_S16_BE &&
+ slave->format != SND_PCM_FORMAT_S24_3LE &&
+ slave->format != SND_PCM_FORMAT_S32_LE &&
+ slave->format != SND_PCM_FORMAT_S32_BE) {
+ SNDERR("softvol supports only S16_LE, S16_BE, S24_3LE, S32_LE "
+ " or S32_BE");
+ return -EINVAL;
+ }
+ svol->sformat = slave->format;
+ return 0;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_softvol_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ get_current_volume(svol);
+ if (svol->cchannels == 1)
+ softvol_convert_mono_vol(svol, slave_areas, slave_offset,
+ areas, offset, pcm->channels, size);
+ else
+ softvol_convert_stereo_vol(svol, slave_areas, slave_offset,
+ areas, offset, pcm->channels, size);
+ *slave_sizep = size;
+ return size;
+}
+
+static snd_pcm_uframes_t
+snd_pcm_softvol_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size,
+ const snd_pcm_channel_area_t *slave_areas,
+ snd_pcm_uframes_t slave_offset,
+ snd_pcm_uframes_t *slave_sizep)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ if (size > *slave_sizep)
+ size = *slave_sizep;
+ get_current_volume(svol);
+ if (svol->cchannels == 1)
+ softvol_convert_mono_vol(svol, areas, offset, slave_areas,
+ slave_offset, pcm->channels, size);
+ else
+ softvol_convert_stereo_vol(svol, areas, offset, slave_areas,
+ slave_offset, pcm->channels, size);
+ *slave_sizep = size;
+ return size;
+}
+
+static void snd_pcm_softvol_dump(snd_pcm_t *pcm, snd_output_t *out)
+{
+ snd_pcm_softvol_t *svol = pcm->private_data;
+ snd_output_printf(out, "Soft volume PCM\n");
+ snd_output_printf(out, "Control: %s\n", svol->elem.id.name);
+ if (svol->max_val == 1)
+ snd_output_printf(out, "boolean\n");
+ else {
+ snd_output_printf(out, "min_dB: %g\n", svol->min_dB);
+ snd_output_printf(out, "max_dB: %g\n", svol->max_dB);
+ snd_output_printf(out, "resolution: %d\n", svol->max_val + 1);
+ }
+ if (pcm->setup) {
+ snd_output_printf(out, "Its setup is:\n");
+ snd_pcm_dump_setup(pcm, out);
+ }
+ snd_output_printf(out, "Slave: ");
+ snd_pcm_dump(svol->plug.gen.slave, out);
+}
+
+static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo)
+{
+ unsigned int tlv[4];
+ tlv[0] = SND_CTL_TLVT_DB_SCALE;
+ tlv[1] = 2 * sizeof(int);
+ tlv[2] = svol->min_dB * 100;
+ tlv[3] = (svol->max_dB - svol->min_dB) * 100 / svol->max_val;
+ return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv);
+}
+
+static int add_user_ctl(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, int count)
+{
+ int err;
+ int i;
+ unsigned int def_val;
+
+ if (svol->max_val == 1)
+ err = snd_ctl_elem_add_boolean(svol->ctl, &cinfo->id, count);
+ else
+ err = snd_ctl_elem_add_integer(svol->ctl, &cinfo->id, count,
+ 0, svol->max_val, 0);
+ if (err < 0)
+ return err;
+ if (svol->max_val == 1)
+ def_val = 1;
+ else {
+ add_tlv_info(svol, cinfo);
+ /* set zero dB value as default, or max_val if
+ there is no 0 dB setting */
+ def_val = svol->zero_dB_val ? svol->zero_dB_val : svol->max_val;
+ }
+ for (i = 0; i < count; i++)
+ svol->elem.value.integer.value[i] = def_val;
+ return snd_ctl_elem_write(svol->ctl, &svol->elem);
+}
+
+/*
+ * load and set up user-control
+ * returns 0 if the user-control is found or created,
+ * returns 1 if the control is a hw control,
+ * or a negative error code
+ */
+static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
+ int ctl_card, snd_ctl_elem_id_t *ctl_id,
+ int cchannels, double min_dB, double max_dB,
+ int resolution)
+{
+ char tmp_name[32];
+ snd_pcm_info_t *info;
+ snd_ctl_elem_info_t *cinfo;
+ int err;
+ unsigned int i;
+
+ if (ctl_card < 0) {
+ snd_pcm_info_alloca(&info);
+ err = snd_pcm_info(pcm, info);
+ if (err < 0)
+ return err;
+ ctl_card = snd_pcm_info_get_card(info);
+ if (ctl_card < 0) {
+ SNDERR("No card defined for softvol control");
+ return -EINVAL;
+ }
+ }
+ sprintf(tmp_name, "hw:%d", ctl_card);
+ err = snd_ctl_open(&svol->ctl, tmp_name, 0);
+ if (err < 0) {
+ SNDERR("Cannot open CTL %s", tmp_name);
+ return err;
+ }
+
+ svol->elem.id = *ctl_id;
+ svol->max_val = resolution - 1;
+ svol->min_dB = min_dB;
+ svol->max_dB = max_dB;
+ if (svol->max_val == 1 || svol->max_dB == ZERO_DB)
+ svol->zero_dB_val = svol->max_val;
+ else if (svol->max_dB < 0)
+ svol->zero_dB_val = 0; /* there is no 0 dB setting */
+ else
+ svol->zero_dB_val = (min_dB / (min_dB - max_dB)) * svol->max_val;
+
+ snd_ctl_elem_info_alloca(&cinfo);
+ snd_ctl_elem_info_set_id(cinfo, ctl_id);
+ if ((err = snd_ctl_elem_info(svol->ctl, cinfo)) < 0) {
+ if (err != -ENOENT) {
+ SNDERR("Cannot get info for CTL %s", tmp_name);
+ return err;
+ }
+ err = add_user_ctl(svol, cinfo, cchannels);
+ if (err < 0) {
+ SNDERR("Cannot add a control");
+ return err;
+ }
+ } else {
+ if (! (cinfo->access & SNDRV_CTL_ELEM_ACCESS_USER)) {
+ /* hardware control exists */
+ return 1; /* notify */
+
+ } else if ((cinfo->type != SND_CTL_ELEM_TYPE_INTEGER &&
+ cinfo->type != SND_CTL_ELEM_TYPE_BOOLEAN) ||
+ cinfo->count != (unsigned int)cchannels ||
+ cinfo->value.integer.min != 0 ||
+ cinfo->value.integer.max != resolution - 1) {
+ if ((err = snd_ctl_elem_remove(svol->ctl, &cinfo->id)) < 0) {
+ SNDERR("Control %s mismatch", tmp_name);
+ return err;
+ }
+ snd_ctl_elem_info_set_id(cinfo, ctl_id); /* reset numid */
+ if ((err = add_user_ctl(svol, cinfo, cchannels)) < 0) {
+ SNDERR("Cannot add a control");
+ return err;
+ }
+ } else if (svol->max_val > 1) {
+ /* check TLV availability */
+ unsigned int tlv[4];
+ err = snd_ctl_elem_tlv_read(svol->ctl, &cinfo->id, tlv, sizeof(tlv));
+ if (err < 0)
+ add_tlv_info(svol, cinfo);
+ }
+ }
+
+ if (svol->max_val == 1)
+ return 0;
+
+ /* set up dB table */
+ if (min_dB == PRESET_MIN_DB && max_dB == ZERO_DB && resolution == PRESET_RESOLUTION)
+ svol->dB_value = (unsigned int*)preset_dB_value;
+ else {
+#ifndef HAVE_SOFT_FLOAT
+ svol->dB_value = calloc(resolution, sizeof(unsigned int));
+ if (! svol->dB_value) {
+ SNDERR("cannot allocate dB table");
+ return -ENOMEM;
+ }
+ svol->min_dB = min_dB;
+ svol->max_dB = max_dB;
+ for (i = 0; i <= svol->max_val; i++) {
+ double db = svol->min_dB + (i * (svol->max_dB - svol->min_dB)) / svol->max_val;
+ double v = (pow(10.0, db / 20.0) * (double)(1 << VOL_SCALE_SHIFT));
+ svol->dB_value[i] = (unsigned int)v;
+ }
+ if (svol->zero_dB_val)
+ svol->dB_value[svol->zero_dB_val] = 65535;
+#else
+ SNDERR("Cannot handle the given dB range and resolution");
+ return -EINVAL;
+#endif
+ }
+ return 0;
+}
+
+static const snd_pcm_ops_t snd_pcm_softvol_ops = {
+ .close = snd_pcm_softvol_close,
+ .info = snd_pcm_generic_info,
+ .hw_refine = snd_pcm_softvol_hw_refine,
+ .hw_params = snd_pcm_softvol_hw_params,
+ .hw_free = snd_pcm_generic_hw_free,
+ .sw_params = snd_pcm_generic_sw_params,
+ .channel_info = snd_pcm_generic_channel_info,
+ .dump = snd_pcm_softvol_dump,
+ .nonblock = snd_pcm_generic_nonblock,
+ .async = snd_pcm_generic_async,
+ .mmap = snd_pcm_generic_mmap,
+ .munmap = snd_pcm_generic_munmap,
+};
+
+/**
+ * \brief Creates a new SoftVolume PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param sformat Slave format
+ * \param ctl_card card index of the control
+ * \param ctl_id The control element
+ * \param cchannels PCM channels
+ * \param min_dB minimal dB value
+ * \param max_dB maximal dB value
+ * \param resolution resolution of control
+ * \param slave Slave PCM handle
+ * \param close_slave When set, the slave PCM handle is closed with copy PCM
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
+ snd_pcm_format_t sformat,
+ int ctl_card, snd_ctl_elem_id_t *ctl_id,
+ int cchannels,
+ double min_dB, double max_dB, int resolution,
+ snd_pcm_t *slave, int close_slave)
+{
+ snd_pcm_t *pcm;
+ snd_pcm_softvol_t *svol;
+ int err;
+ assert(pcmp && slave);
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ sformat != SND_PCM_FORMAT_S16_LE &&
+ sformat != SND_PCM_FORMAT_S16_BE &&
+ sformat != SND_PCM_FORMAT_S24_3LE &&
+ sformat != SND_PCM_FORMAT_S32_LE &&
+ sformat != SND_PCM_FORMAT_S32_BE)
+ return -EINVAL;
+ svol = calloc(1, sizeof(*svol));
+ if (! svol)
+ return -ENOMEM;
+ err = softvol_load_control(slave, svol, ctl_card, ctl_id, cchannels,
+ min_dB, max_dB, resolution);
+ if (err < 0) {
+ softvol_free(svol);
+ return err;
+ }
+ if (err > 0) { /* hardware control - no need for softvol! */
+ softvol_free(svol);
+ *pcmp = slave; /* just pass the slave */
+ if (!slave->name && name)
+ slave->name = strdup(name);
+ return 0;
+ }
+
+ /* do softvol */
+ snd_pcm_plugin_init(&svol->plug);
+ svol->sformat = sformat;
+ svol->cchannels = cchannels;
+ svol->plug.read = snd_pcm_softvol_read_areas;
+ svol->plug.write = snd_pcm_softvol_write_areas;
+ svol->plug.undo_read = snd_pcm_plugin_undo_read_generic;
+ svol->plug.undo_write = snd_pcm_plugin_undo_write_generic;
+ svol->plug.gen.slave = slave;
+ svol->plug.gen.close_slave = close_slave;
+
+ err = snd_pcm_new(&pcm, SND_PCM_TYPE_SOFTVOL, name, slave->stream, slave->mode);
+ if (err < 0) {
+ softvol_free(svol);
+ return err;
+ }
+ pcm->ops = &snd_pcm_softvol_ops;
+ pcm->fast_ops = &snd_pcm_plugin_fast_ops;
+ pcm->private_data = svol;
+ pcm->poll_fd = slave->poll_fd;
+ pcm->poll_events = slave->poll_events;
+ /*
+ * Since the softvol converts on the place, and the format/channels
+ * must be identical between source and destination, we don't need
+ * an extra buffer.
+ */
+ pcm->mmap_shadow = 1;
+ pcm->monotonic = slave->monotonic;
+ snd_pcm_set_hw_ptr(pcm, &svol->plug.hw_ptr, -1, 0);
+ snd_pcm_set_appl_ptr(pcm, &svol->plug.appl_ptr, -1, 0);
+ *pcmp = pcm;
+
+ return 0;
+}
+
+/* in pcm_misc.c */
+int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
+ int *cchannelsp, int *hwctlp);
+
+/*! \page pcm_plugins
+
+\section pcm_plugins_softvol Plugin: Soft Volume
+
+This plugin applies the software volume attenuation.
+The format, rate and channels must match for both of source and destination.
+
+When the control is stereo (count=2), the channels are assumed to be either
+mono, 2.0, 2.1, 4.0, 4.1, 5.1 or 7.1.
+
+If the control already exists and it's a system control (i.e. no
+user-defined control), the plugin simply passes its slave without
+any changes.
+
+\code
+pcm.name {
+ type softvol # Soft Volume conversion PCM
+ slave STR # Slave name
+ # or
+ slave { # Slave definition
+ pcm STR # Slave PCM name
+ # or
+ pcm { } # Slave PCM definition
+ [format STR] # Slave format
+ }
+ control {
+ name STR # control element id string
+ [card STR] # control card index
+ [iface STR] # interface of the element
+ [index INT] # index of the element
+ [device INT] # device number of the element
+ [subdevice INT] # subdevice number of the element
+ [count INT] # control channels 1 or 2 (default: 2)
+ }
+ [min_dB REAL] # minimal dB value (default: -51.0)
+ [max_dB REAL] # maximal dB value (default: 0.0)
+ [resolution INT] # resolution (default: 256)
+ # resolution = 2 means a mute switch
+}
+\endcode
+
+\subsection pcm_plugins_softvol_funcref Function reference
+
+<UL>
+ <LI>snd_pcm_softvol_open()
+ <LI>_snd_pcm_softvol_open()
+</UL>
+
+*/
+
+/**
+ * \brief Creates a new Soft Volume PCM
+ * \param pcmp Returns created PCM handle
+ * \param name Name of PCM
+ * \param root Root configuration node
+ * \param conf Configuration node with Soft Volume PCM description
+ * \param stream Stream type
+ * \param mode Stream mode
+ * \retval zero on success otherwise a negative error code
+ * \warning Using of this function might be dangerous in the sense
+ * of compatibility reasons. The prototype might be freely
+ * changed in future.
+ */
+int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
+ snd_config_t *root, snd_config_t *conf,
+ snd_pcm_stream_t stream, int mode)
+{
+ snd_config_iterator_t i, next;
+ int err;
+ snd_pcm_t *spcm;
+ snd_config_t *slave = NULL, *sconf;
+ snd_config_t *control = NULL;
+ snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
+ snd_ctl_elem_id_t *ctl_id;
+ int resolution = PRESET_RESOLUTION;
+ double min_dB = PRESET_MIN_DB;
+ double max_dB = ZERO_DB;
+ int card = -1, cchannels = 2;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_pcm_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ slave = n;
+ continue;
+ }
+ if (strcmp(id, "control") == 0) {
+ control = n;
+ continue;
+ }
+ if (strcmp(id, "resolution") == 0) {
+ long v;
+ err = snd_config_get_integer(n, &v);
+ if (err < 0) {
+ SNDERR("Invalid resolution value");
+ return err;
+ }
+ resolution = v;
+ continue;
+ }
+ if (strcmp(id, "min_dB") == 0) {
+ err = snd_config_get_real(n, &min_dB);
+ if (err < 0) {
+ SNDERR("Invalid min_dB value");
+ return err;
+ }
+ continue;
+ }
+ if (strcmp(id, "max_dB") == 0) {
+ err = snd_config_get_real(n, &max_dB);
+ if (err < 0) {
+ SNDERR("Invalid max_dB value");
+ return err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ SNDERR("slave is not defined");
+ return -EINVAL;
+ }
+ if (!control) {
+ SNDERR("control is not defined");
+ return -EINVAL;
+ }
+ if (min_dB >= 0) {
+ SNDERR("min_dB must be a negative value");
+ return -EINVAL;
+ }
+ if (max_dB <= min_dB || max_dB > MAX_DB_UPPER_LIMIT) {
+ SNDERR("max_dB must be larger than min_dB and less than %d dB",
+ MAX_DB_UPPER_LIMIT);
+ return -EINVAL;
+ }
+ if (resolution <= 1 || resolution > 1024) {
+ SNDERR("Invalid resolution value %d", resolution);
+ return -EINVAL;
+ }
+ if (mode & SND_PCM_NO_SOFTVOL) {
+ err = snd_pcm_slave_conf(root, slave, &sconf, 0);
+ if (err < 0)
+ return err;
+ err = snd_pcm_open_named_slave(pcmp, name, root, sconf, stream,
+ mode, conf);
+ snd_config_delete(sconf);
+ } else {
+ snd_ctl_elem_id_alloca(&ctl_id);
+ err = snd_pcm_slave_conf(root, slave, &sconf, 1,
+ SND_PCM_HW_PARAM_FORMAT, 0, &sformat);
+ if (err < 0)
+ return err;
+ if (sformat != SND_PCM_FORMAT_UNKNOWN &&
+ sformat != SND_PCM_FORMAT_S16_LE &&
+ sformat != SND_PCM_FORMAT_S16_BE &&
+ sformat != SND_PCM_FORMAT_S24_3LE &&
+ sformat != SND_PCM_FORMAT_S32_LE &&
+ sformat != SND_PCM_FORMAT_S32_BE) {
+ SNDERR("only S16_LE, S16_BE, S24_3LE, S32_LE or S32_BE format "
+ "is supported");
+ snd_config_delete(sconf);
+ return -EINVAL;
+ }
+ err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
+ snd_config_delete(sconf);
+ if (err < 0)
+ return err;
+ if ((err = snd_pcm_parse_control_id(control, ctl_id, &card, &cchannels, NULL)) < 0) {
+ snd_pcm_close(spcm);
+ return err;
+ }
+ err = snd_pcm_softvol_open(pcmp, name, sformat, card, ctl_id, cchannels,
+ min_dB, max_dB, resolution, spcm, 1);
+ if (err < 0)
+ snd_pcm_close(spcm);
+ }
+ return err;
+}
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_pcm_softvol_open, SND_PCM_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/pcm/pcm_symbols.c b/alsa-lib/src/pcm/pcm_symbols.c
new file mode 100644
index 0000000..91982df
--- /dev/null
+++ b/alsa-lib/src/pcm/pcm_symbols.c
@@ -0,0 +1,64 @@
+/*
+ * PCM Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+#include "config.h"
+
+extern const char *_snd_module_pcm_adpcm;
+extern const char *_snd_module_pcm_alaw;
+extern const char *_snd_module_pcm_copy;
+extern const char *_snd_module_pcm_file;
+extern const char *_snd_module_pcm_hooks;
+extern const char *_snd_module_pcm_hw;
+extern const char *_snd_module_pcm_linear;
+extern const char *_snd_module_pcm_meter;
+extern const char *_snd_module_pcm_mulaw;
+extern const char *_snd_module_pcm_multi;
+extern const char *_snd_module_pcm_null;
+extern const char *_snd_module_pcm_empty;
+extern const char *_snd_module_pcm_plug;
+extern const char *_snd_module_pcm_rate;
+extern const char *_snd_module_pcm_route;
+extern const char *_snd_module_pcm_share;
+extern const char *_snd_module_pcm_shm;
+extern const char *_snd_module_pcm_lfloat;
+extern const char *_snd_module_pcm_ladspa;
+extern const char *_snd_module_pcm_dmix;
+extern const char *_snd_module_pcm_dsnoop;
+extern const char *_snd_module_pcm_dshare;
+extern const char *_snd_module_pcm_asym;
+extern const char *_snd_module_pcm_iec958;
+extern const char *_snd_module_pcm_softvol;
+extern const char *_snd_module_pcm_extplug;
+extern const char *_snd_module_pcm_ioplug;
+extern const char *_snd_module_pcm_mmap_emul;
+
+static const char **snd_pcm_open_objects[] = {
+ &_snd_module_pcm_hw,
+#include "pcm_symbols_list.c"
+};
+
+void *snd_pcm_open_symbols(void)
+{
+ return snd_pcm_open_objects;
+}
+
+#endif /* !PIC */
diff --git a/alsa-lib/src/pcm/plugin_ops.h b/alsa-lib/src/pcm/plugin_ops.h
new file mode 100644
index 0000000..04220d6
--- /dev/null
+++ b/alsa-lib/src/pcm/plugin_ops.h
@@ -0,0 +1,1081 @@
+/*
+ * Plugin sample operators with fast switch
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef SX_INLINES
+#define SX_INLINES
+static inline u_int32_t sx24(u_int32_t x)
+{
+ if(x&0x00800000)
+ return x|0xFF000000;
+ return x&0x00FFFFFF;
+}
+static inline u_int32_t sx24s(u_int32_t x)
+{
+ if(x&0x00008000)
+ return x|0x000000FF;
+ return x&0xFFFFFF00;
+}
+#endif
+
+#define as_u8(ptr) (*(u_int8_t*)(ptr))
+#define as_u16(ptr) (*(u_int16_t*)(ptr))
+#define as_u32(ptr) (*(u_int32_t*)(ptr))
+#define as_u64(ptr) (*(u_int64_t*)(ptr))
+#define as_s8(ptr) (*(int8_t*)(ptr))
+#define as_s16(ptr) (*(int16_t*)(ptr))
+#define as_s32(ptr) (*(int32_t*)(ptr))
+#define as_s64(ptr) (*(int64_t*)(ptr))
+#define as_float(ptr) (*(float_t*)(ptr))
+#define as_double(ptr) (*(double_t*)(ptr))
+
+#define as_u8c(ptr) (*(const u_int8_t*)(ptr))
+#define as_u16c(ptr) (*(const u_int16_t*)(ptr))
+#define as_u32c(ptr) (*(const u_int32_t*)(ptr))
+#define as_u64c(ptr) (*(const u_int64_t*)(ptr))
+#define as_s8c(ptr) (*(const int8_t*)(ptr))
+#define as_s16c(ptr) (*(const int16_t*)(ptr))
+#define as_s32c(ptr) (*(const int32_t*)(ptr))
+#define as_s64c(ptr) (*(const int64_t*)(ptr))
+#define as_floatc(ptr) (*(const float_t*)(ptr))
+#define as_doublec(ptr) (*(const double_t*)(ptr))
+
+#define _get_triple_le(ptr) (*(u_int8_t*)(ptr) | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | (u_int32_t)*((u_int8_t*)(ptr) + 2) << 16)
+#define _get_triple_be(ptr) ((u_int32_t)*(u_int8_t*)(ptr) << 16 | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | *((u_int8_t*)(ptr) + 2))
+#define _put_triple_le(ptr,val) do { \
+ u_int8_t *_tmp = (u_int8_t *)(ptr); \
+ u_int32_t _val = (val); \
+ _tmp[0] = _val; \
+ _tmp[1] = _val >> 8; \
+ _tmp[2] = _val >> 16; \
+} while(0)
+#define _put_triple_be(ptr,val) do { \
+ u_int8_t *_tmp = (u_int8_t *)(ptr); \
+ u_int32_t _val = (val); \
+ _tmp[0] = _val >> 16; \
+ _tmp[1] = _val >> 8; \
+ _tmp[2] = _val; \
+} while(0)
+
+#ifdef SNDRV_LITTLE_ENDIAN
+#define _get_triple(ptr) _get_triple_le(ptr)
+#define _get_triple_s(ptr) _get_triple_be(ptr)
+#define _put_triple(ptr,val) _put_triple_le(ptr,val)
+#define _put_triple_s(ptr,val) _put_triple_be(ptr,val)
+#else
+#define _get_triple(ptr) _get_triple_be(ptr)
+#define _get_triple_s(ptr) _get_triple_le(ptr)
+#define _put_triple(ptr,val) _put_triple_be(ptr,val)
+#define _put_triple_s(ptr,val) _put_triple_le(ptr,val)
+#endif
+
+#ifdef COPY_LABELS
+static void *copy_labels[5] = {
+ &&copy_8,
+ &&copy_16,
+ &&copy_24
+ &&copy_32,
+ &&copy_64
+};
+#endif
+
+#ifdef COPY_END
+while(0) {
+copy_8: as_s8(dst) = as_s8c(src); goto COPY_END;
+copy_16: as_s16(dst) = as_s16c(src); goto COPY_END;
+copy_24: memcpy(dst,src,3); goto COPY_END;
+copy_32: as_s32(dst) = as_s32c(src); goto COPY_END;
+copy_64: as_s64(dst) = as_s64c(src); goto COPY_END;
+}
+#endif
+
+#ifdef CONV_LABELS
+/* src_wid src_endswap sign_toggle dst_wid dst_endswap */
+static void *const conv_labels[4 * 2 * 2 * 4 * 2] = {
+ &&conv_xxx1_xxx1, /* 8h -> 8h */
+ &&conv_xxx1_xxx1, /* 8h -> 8s */
+ &&conv_xxx1_xx10, /* 8h -> 16h */
+ &&conv_xxx1_xx01, /* 8h -> 16s */
+ &&conv_xxx1_x100, /* 8h -> 24h */
+ &&conv_xxx1_001x, /* 8h -> 24s */
+ &&conv_xxx1_1000, /* 8h -> 32h */
+ &&conv_xxx1_0001, /* 8h -> 32s */
+ &&conv_xxx1_xxx9, /* 8h ^> 8h */
+ &&conv_xxx1_xxx9, /* 8h ^> 8s */
+ &&conv_xxx1_xx90, /* 8h ^> 16h */
+ &&conv_xxx1_xx09, /* 8h ^> 16s */
+ &&conv_xxx1_x900, /* 8h ^> 24h */
+ &&conv_xxx1_009x, /* 8h ^> 24s */
+ &&conv_xxx1_9000, /* 8h ^> 32h */
+ &&conv_xxx1_0009, /* 8h ^> 32s */
+ &&conv_xxx1_xxx1, /* 8s -> 8h */
+ &&conv_xxx1_xxx1, /* 8s -> 8s */
+ &&conv_xxx1_xx10, /* 8s -> 16h */
+ &&conv_xxx1_xx01, /* 8s -> 16s */
+ &&conv_xxx1_x100, /* 8s -> 24h */
+ &&conv_xxx1_001x, /* 8s -> 24s */
+ &&conv_xxx1_1000, /* 8s -> 32h */
+ &&conv_xxx1_0001, /* 8s -> 32s */
+ &&conv_xxx1_xxx9, /* 8s ^> 8h */
+ &&conv_xxx1_xxx9, /* 8s ^> 8s */
+ &&conv_xxx1_xx90, /* 8s ^> 16h */
+ &&conv_xxx1_xx09, /* 8s ^> 16s */
+ &&conv_xxx1_x900, /* 8s ^> 24h */
+ &&conv_xxx1_009x, /* 8s ^> 24s */
+ &&conv_xxx1_9000, /* 8s ^> 32h */
+ &&conv_xxx1_0009, /* 8s ^> 32s */
+ &&conv_xx12_xxx1, /* 16h -> 8h */
+ &&conv_xx12_xxx1, /* 16h -> 8s */
+ &&conv_xx12_xx12, /* 16h -> 16h */
+ &&conv_xx12_xx21, /* 16h -> 16s */
+ &&conv_xx12_x120, /* 16h -> 24h */
+ &&conv_xx12_021x, /* 16h -> 24s */
+ &&conv_xx12_1200, /* 16h -> 32h */
+ &&conv_xx12_0021, /* 16h -> 32s */
+ &&conv_xx12_xxx9, /* 16h ^> 8h */
+ &&conv_xx12_xxx9, /* 16h ^> 8s */
+ &&conv_xx12_xx92, /* 16h ^> 16h */
+ &&conv_xx12_xx29, /* 16h ^> 16s */
+ &&conv_xx12_x920, /* 16h ^> 24h */
+ &&conv_xx12_029x, /* 16h ^> 24s */
+ &&conv_xx12_9200, /* 16h ^> 32h */
+ &&conv_xx12_0029, /* 16h ^> 32s */
+ &&conv_xx12_xxx2, /* 16s -> 8h */
+ &&conv_xx12_xxx2, /* 16s -> 8s */
+ &&conv_xx12_xx21, /* 16s -> 16h */
+ &&conv_xx12_xx12, /* 16s -> 16s */
+ &&conv_xx12_x210, /* 16s -> 24h */
+ &&conv_xx12_012x, /* 16s -> 24s */
+ &&conv_xx12_2100, /* 16s -> 32h */
+ &&conv_xx12_0012, /* 16s -> 32s */
+ &&conv_xx12_xxxA, /* 16s ^> 8h */
+ &&conv_xx12_xxxA, /* 16s ^> 8s */
+ &&conv_xx12_xxA1, /* 16s ^> 16h */
+ &&conv_xx12_xx1A, /* 16s ^> 16s */
+ &&conv_xx12_xA10, /* 16s ^> 24h */
+ &&conv_xx12_01Ax, /* 16s ^> 24s */
+ &&conv_xx12_A100, /* 16s ^> 32h */
+ &&conv_xx12_001A, /* 16s ^> 32s */
+ &&conv_x123_xxx1, /* 24h -> 8h */
+ &&conv_x123_xxx1, /* 24h -> 8s */
+ &&conv_x123_xx12, /* 24h -> 16h */
+ &&conv_x123_xx21, /* 24h -> 16s */
+ &&conv_x123_x123, /* 24h -> 24h */
+ &&conv_x123_321x, /* 24h -> 24s */
+ &&conv_x123_1230, /* 24h -> 32h */
+ &&conv_x123_0321, /* 24h -> 32s */
+ &&conv_x123_xxx9, /* 24h ^> 8h */
+ &&conv_x123_xxx9, /* 24h ^> 8s */
+ &&conv_x123_xx92, /* 24h ^> 16h */
+ &&conv_x123_xx29, /* 24h ^> 16s */
+ &&conv_x123_x923, /* 24h ^> 24h */
+ &&conv_x123_329x, /* 24h ^> 24s */
+ &&conv_x123_9230, /* 24h ^> 32h */
+ &&conv_x123_0329, /* 24h ^> 32s */
+ &&conv_123x_xxx3, /* 24s -> 8h */
+ &&conv_123x_xxx3, /* 24s -> 8s */
+ &&conv_123x_xx32, /* 24s -> 16h */
+ &&conv_123x_xx23, /* 24s -> 16s */
+ &&conv_123x_x321, /* 24s -> 24h */
+ &&conv_123x_123x, /* 24s -> 24s */
+ &&conv_123x_3210, /* 24s -> 32h */
+ &&conv_123x_0123, /* 24s -> 32s */
+ &&conv_123x_xxxB, /* 24s ^> 8h */
+ &&conv_123x_xxxB, /* 24s ^> 8s */
+ &&conv_123x_xxB2, /* 24s ^> 16h */
+ &&conv_123x_xx2B, /* 24s ^> 16s */
+ &&conv_123x_xB21, /* 24s ^> 24h */
+ &&conv_123x_12Bx, /* 24s ^> 24s */
+ &&conv_123x_B210, /* 24s ^> 32h */
+ &&conv_123x_012B, /* 24s ^> 32s */
+ &&conv_1234_xxx1, /* 32h -> 8h */
+ &&conv_1234_xxx1, /* 32h -> 8s */
+ &&conv_1234_xx12, /* 32h -> 16h */
+ &&conv_1234_xx21, /* 32h -> 16s */
+ &&conv_1234_x123, /* 32h -> 24h */
+ &&conv_1234_321x, /* 32h -> 24s */
+ &&conv_1234_1234, /* 32h -> 32h */
+ &&conv_1234_4321, /* 32h -> 32s */
+ &&conv_1234_xxx9, /* 32h ^> 8h */
+ &&conv_1234_xxx9, /* 32h ^> 8s */
+ &&conv_1234_xx92, /* 32h ^> 16h */
+ &&conv_1234_xx29, /* 32h ^> 16s */
+ &&conv_1234_x923, /* 32h ^> 24h */
+ &&conv_1234_329x, /* 32h ^> 24s */
+ &&conv_1234_9234, /* 32h ^> 32h */
+ &&conv_1234_4329, /* 32h ^> 32s */
+ &&conv_1234_xxx4, /* 32s -> 8h */
+ &&conv_1234_xxx4, /* 32s -> 8s */
+ &&conv_1234_xx43, /* 32s -> 16h */
+ &&conv_1234_xx34, /* 32s -> 16s */
+ &&conv_1234_x432, /* 32s -> 24h */
+ &&conv_1234_234x, /* 32s -> 24s */
+ &&conv_1234_4321, /* 32s -> 32h */
+ &&conv_1234_1234, /* 32s -> 32s */
+ &&conv_1234_xxxC, /* 32s ^> 8h */
+ &&conv_1234_xxxC, /* 32s ^> 8s */
+ &&conv_1234_xxC3, /* 32s ^> 16h */
+ &&conv_1234_xx3C, /* 32s ^> 16s */
+ &&conv_1234_xC32, /* 32s ^> 24h */
+ &&conv_1234_23Cx, /* 32s ^> 24s */
+ &&conv_1234_C321, /* 32s ^> 32h */
+ &&conv_1234_123C, /* 32s ^> 32s */
+};
+#endif
+
+#ifdef CONV_END
+while(0) {
+conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
+conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END;
+conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END;
+conv_xxx1_x100: as_u32(dst) = sx24((u_int32_t)as_u8c(src) << 16); goto CONV_END;
+conv_xxx1_001x: as_u32(dst) = sx24s((u_int32_t)as_u8c(src) << 8); goto CONV_END;
+conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END;
+conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END;
+conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
+conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
+conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
+conv_xxx1_x900: as_u32(dst) = sx24((u_int32_t)(as_u8c(src) ^ 0x80) << 16); goto CONV_END;
+conv_xxx1_009x: as_u32(dst) = sx24s((u_int32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END;
+conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
+conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
+conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
+conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
+conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
+conv_xx12_x120: as_u32(dst) = sx24((u_int32_t)as_u16c(src) << 8); goto CONV_END;
+conv_xx12_021x: as_u32(dst) = sx24s((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
+conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
+conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
+conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
+conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
+conv_xx12_x920: as_u32(dst) = sx24((u_int32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END;
+conv_xx12_029x: as_u32(dst) = sx24s((u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8); goto CONV_END;
+conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
+conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
+conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
+conv_xx12_x210: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
+conv_xx12_012x: as_u32(dst) = sx24s((u_int32_t)as_u16c(src) << 8); goto CONV_END;
+conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
+conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END;
+conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
+conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
+conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
+conv_xx12_xA10: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
+conv_xx12_01Ax: as_u32(dst) = sx24s((u_int32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
+conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
+conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
+conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
+conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
+conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
+conv_x123_x123: as_u32(dst) = sx24(as_u32c(src)); goto CONV_END;
+conv_x123_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src))); goto CONV_END;
+conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
+conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
+conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
+conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
+conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_x123_x923: as_u32(dst) = sx24(as_u32c(src) ^ 0x800000); goto CONV_END;
+conv_x123_329x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) ^ 0x8000); goto CONV_END;
+conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
+conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
+conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
+conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
+conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
+conv_123x_x321: as_u32(dst) = sx24(bswap_32(as_u32c(src))); goto CONV_END;
+conv_123x_123x: as_u32(dst) = sx24s(as_u32c(src)); goto CONV_END;
+conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
+conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
+conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
+conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
+conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
+conv_123x_xB21: as_u32(dst) = sx24(bswap_32(as_u32c(src)) ^ 0x800000); goto CONV_END;
+conv_123x_12Bx: as_u32(dst) = sx24s(as_u32c(src) ^ 0x8000); goto CONV_END;
+conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
+conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
+conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
+conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
+conv_1234_x123: as_u32(dst) = sx24(as_u32c(src) >> 8); goto CONV_END;
+conv_1234_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) << 8); goto CONV_END;
+conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
+conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
+conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
+conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
+conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
+conv_1234_x923: as_u32(dst) = sx24((as_u32c(src) >> 8) ^ 0x800000); goto CONV_END;
+conv_1234_329x: as_u32(dst) = sx24s((bswap_32(as_u32c(src)) ^ 0x80) << 8); goto CONV_END;
+conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
+conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
+conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
+conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
+conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
+conv_1234_x432: as_u32(dst) = sx24(bswap_32(as_u32c(src)) >> 8); goto CONV_END;
+conv_1234_234x: as_u32(dst) = sx24s(as_u32c(src) << 8); goto CONV_END;
+conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
+conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
+conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
+conv_1234_xC32: as_u32(dst) = sx24((bswap_32(as_u32c(src)) >> 8) ^ 0x800000); goto CONV_END;
+conv_1234_23Cx: as_u32(dst) = sx24s((as_u32c(src) ^ 0x80) << 8); goto CONV_END;
+conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
+conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
+}
+#endif
+
+#ifdef GET16_LABELS
+/* src_wid src_endswap sign_toggle */
+static void *const get16_labels[4 * 2 * 2 + 4 * 3] = {
+ &&get16_1_10, /* 8h -> 16h */
+ &&get16_1_90, /* 8h ^> 16h */
+ &&get16_1_10, /* 8s -> 16h */
+ &&get16_1_90, /* 8s ^> 16h */
+ &&get16_12_12, /* 16h -> 16h */
+ &&get16_12_92, /* 16h ^> 16h */
+ &&get16_12_21, /* 16s -> 16h */
+ &&get16_12_A1, /* 16s ^> 16h */
+ &&get16_0123_12, /* 24h -> 16h */
+ &&get16_0123_92, /* 24h ^> 16h */
+ &&get16_1230_32, /* 24s -> 16h */
+ &&get16_1230_B2, /* 24s ^> 16h */
+ &&get16_1234_12, /* 32h -> 16h */
+ &&get16_1234_92, /* 32h ^> 16h */
+ &&get16_1234_43, /* 32s -> 16h */
+ &&get16_1234_C3, /* 32s ^> 16h */
+ /* 3bytes format */
+ &&get16_123_12, /* 24h -> 16h */
+ &&get16_123_92, /* 24h ^> 16h */
+ &&get16_123_32, /* 24s -> 16h */
+ &&get16_123_B2, /* 24s ^> 16h */
+ &&get16_123_12_20, /* 20h -> 16h */
+ &&get16_123_92_20, /* 20h ^> 16h */
+ &&get16_123_32_20, /* 20s -> 16h */
+ &&get16_123_B2_20, /* 20s ^> 16h */
+ &&get16_123_12_18, /* 18h -> 16h */
+ &&get16_123_92_18, /* 18h ^> 16h */
+ &&get16_123_32_18, /* 18s -> 16h */
+ &&get16_123_B2_18, /* 18s ^> 16h */
+};
+#endif
+
+#ifdef GET16_END
+while(0) {
+get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END;
+get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
+get16_12_12: sample = as_u16c(src); goto GET16_END;
+get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
+get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
+get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
+get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
+get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
+get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
+get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto GET16_END;
+get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
+get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
+get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
+get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
+get16_123_12: sample = _get_triple(src) >> 8; goto GET16_END;
+get16_123_92: sample = (_get_triple(src) >> 8) ^ 0x8000; goto GET16_END;
+get16_123_32: sample = _get_triple_s(src) >> 8; goto GET16_END;
+get16_123_B2: sample = (_get_triple_s(src) >> 8) ^ 0x8000; goto GET16_END;
+get16_123_12_20: sample = _get_triple(src) >> 4; goto GET16_END;
+get16_123_92_20: sample = (_get_triple(src) >> 4) ^ 0x8000; goto GET16_END;
+get16_123_32_20: sample = _get_triple_s(src) >> 4; goto GET16_END;
+get16_123_B2_20: sample = (_get_triple_s(src) >> 4) ^ 0x8000; goto GET16_END;
+get16_123_12_18: sample = _get_triple(src) >> 2; goto GET16_END;
+get16_123_92_18: sample = (_get_triple(src) >> 2) ^ 0x8000; goto GET16_END;
+get16_123_32_18: sample = _get_triple_s(src) >> 2; goto GET16_END;
+get16_123_B2_18: sample = (_get_triple_s(src) >> 2) ^ 0x8000; goto GET16_END;
+}
+#endif
+
+#ifdef PUT16_LABELS
+/* dst_wid dst_endswap sign_toggle */
+static void *const put16_labels[4 * 2 * 2] = {
+ &&put16_12_1, /* 16h -> 8h */
+ &&put16_12_9, /* 16h ^> 8h */
+ &&put16_12_1, /* 16h -> 8s */
+ &&put16_12_9, /* 16h ^> 8s */
+ &&put16_12_12, /* 16h -> 16h */
+ &&put16_12_92, /* 16h ^> 16h */
+ &&put16_12_21, /* 16h -> 16s */
+ &&put16_12_29, /* 16h ^> 16s */
+ &&put16_12_0120, /* 16h -> 24h */
+ &&put16_12_0920, /* 16h ^> 24h */
+ &&put16_12_0210, /* 16h -> 24s */
+ &&put16_12_0290, /* 16h ^> 24s */
+ &&put16_12_1200, /* 16h -> 32h */
+ &&put16_12_9200, /* 16h ^> 32h */
+ &&put16_12_0021, /* 16h -> 32s */
+ &&put16_12_0029, /* 16h ^> 32s */
+};
+#endif
+
+#ifdef PUT16_END
+while (0) {
+put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
+put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
+put16_12_12: as_u16(dst) = sample; goto PUT16_END;
+put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
+put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
+put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END;
+put16_12_0120: as_u32(dst) = sx24((u_int32_t)sample << 8); goto PUT16_END;
+put16_12_0920: as_u32(dst) = sx24((u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
+put16_12_0210: as_u32(dst) = sx24s((u_int32_t)bswap_16(sample) << 8); goto PUT16_END;
+put16_12_0290: as_u32(dst) = sx24s((u_int32_t)(bswap_16(sample) ^ 0x80) << 8); goto PUT16_END;
+put16_12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT16_END;
+put16_12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT16_END;
+put16_12_0021: as_u32(dst) = (u_int32_t)bswap_16(sample); goto PUT16_END;
+put16_12_0029: as_u32(dst) = (u_int32_t)bswap_16(sample) ^ 0x80; goto PUT16_END;
+}
+#endif
+
+#ifdef CONV24_LABELS
+#define GET32_LABELS
+#define PUT32_LABELS
+#endif
+
+#ifdef GET32_LABELS
+/* src_wid src_endswap sign_toggle */
+static void *const get32_labels[4 * 2 * 2 + 4 * 3] = {
+ &&get32_1_1000, /* 8h -> 32h */
+ &&get32_1_9000, /* 8h ^> 32h */
+ &&get32_1_1000, /* 8s -> 32h */
+ &&get32_1_9000, /* 8s ^> 32h */
+ &&get32_12_1200, /* 16h -> 32h */
+ &&get32_12_9200, /* 16h ^> 32h */
+ &&get32_12_2100, /* 16s -> 32h */
+ &&get32_12_A100, /* 16s ^> 32h */
+ &&get32_0123_1230, /* 24h -> 32h */
+ &&get32_0123_9230, /* 24h ^> 32h */
+ &&get32_1230_3210, /* 24s -> 32h */
+ &&get32_1230_B210, /* 24s ^> 32h */
+ &&get32_1234_1234, /* 32h -> 32h */
+ &&get32_1234_9234, /* 32h ^> 32h */
+ &&get32_1234_4321, /* 32s -> 32h */
+ &&get32_1234_C321, /* 32s ^> 32h */
+ /* 3bytes format */
+ &&get32_123_1230, /* 24h -> 32h */
+ &&get32_123_9230, /* 24h ^> 32h */
+ &&get32_123_3210, /* 24s -> 32h */
+ &&get32_123_B210, /* 24s ^> 32h */
+ &&get32_123_1230_20, /* 20h -> 32h */
+ &&get32_123_9230_20, /* 20h ^> 32h */
+ &&get32_123_3210_20, /* 20s -> 32h */
+ &&get32_123_B210_20, /* 20s ^> 32h */
+ &&get32_123_1230_18, /* 18h -> 32h */
+ &&get32_123_9230_18, /* 18h ^> 32h */
+ &&get32_123_3210_18, /* 18s -> 32h */
+ &&get32_123_B210_18, /* 18s ^> 32h */
+};
+#endif
+
+#ifdef CONV24_END
+#define GET32_END __conv24_get
+#endif
+
+#ifdef GET32_END
+while (0) {
+get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END;
+get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
+get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END;
+get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
+get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
+get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
+get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
+get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
+get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
+get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
+get32_1234_1234: sample = as_u32c(src); goto GET32_END;
+get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
+get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
+get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
+get32_123_1230: sample = _get_triple(src) << 8; goto GET32_END;
+get32_123_9230: sample = (_get_triple(src) << 8) ^ 0x80000000; goto GET32_END;
+get32_123_3210: sample = _get_triple_s(src) << 8; goto GET32_END;
+get32_123_B210: sample = (_get_triple_s(src) << 8) ^ 0x80000000; goto GET32_END;
+get32_123_1230_20: sample = _get_triple(src) << 12; goto GET32_END;
+get32_123_9230_20: sample = (_get_triple(src) << 12) ^ 0x80000000; goto GET32_END;
+get32_123_3210_20: sample = _get_triple_s(src) << 12; goto GET32_END;
+get32_123_B210_20: sample = (_get_triple_s(src) << 12) ^ 0x80000000; goto GET32_END;
+get32_123_1230_18: sample = _get_triple(src) << 14; goto GET32_END;
+get32_123_9230_18: sample = (_get_triple(src) << 14) ^ 0x80000000; goto GET32_END;
+get32_123_3210_18: sample = _get_triple_s(src) << 14; goto GET32_END;
+get32_123_B210_18: sample = (_get_triple_s(src) << 14) ^ 0x80000000; goto GET32_END;
+}
+#endif
+
+#ifdef CONV24_END
+__conv24_get: goto *put;
+#define PUT32_END CONV24_END
+#endif
+
+#ifdef PUT32_LABELS
+/* dst_wid dst_endswap sign_toggle */
+static void *const put32_labels[4 * 2 * 2 + 4 * 3] = {
+ &&put32_1234_1, /* 32h -> 8h */
+ &&put32_1234_9, /* 32h ^> 8h */
+ &&put32_1234_1, /* 32h -> 8s */
+ &&put32_1234_9, /* 32h ^> 8s */
+ &&put32_1234_12, /* 32h -> 16h */
+ &&put32_1234_92, /* 32h ^> 16h */
+ &&put32_1234_21, /* 32h -> 16s */
+ &&put32_1234_29, /* 32h ^> 16s */
+ &&put32_1234_0123, /* 32h -> 24h */
+ &&put32_1234_0923, /* 32h ^> 24h */
+ &&put32_1234_3210, /* 32h -> 24s */
+ &&put32_1234_3290, /* 32h ^> 24s */
+ &&put32_1234_1234, /* 32h -> 32h */
+ &&put32_1234_9234, /* 32h ^> 32h */
+ &&put32_1234_4321, /* 32h -> 32s */
+ &&put32_1234_4329, /* 32h ^> 32s */
+ /* 3bytes format */
+ &&put32_1234_123, /* 32h -> 24h */
+ &&put32_1234_923, /* 32h ^> 24h */
+ &&put32_1234_321, /* 32h -> 24s */
+ &&put32_1234_329, /* 32h ^> 24s */
+ &&put32_1234_123_20, /* 32h -> 24h */
+ &&put32_1234_923_20, /* 32h ^> 24h */
+ &&put32_1234_321_20, /* 32h -> 24s */
+ &&put32_1234_329_20, /* 32h ^> 24s */
+ &&put32_1234_123_18, /* 32h -> 24h */
+ &&put32_1234_923_18, /* 32h ^> 24h */
+ &&put32_1234_321_18, /* 32h -> 24s */
+ &&put32_1234_329_18, /* 32h ^> 24s */
+};
+#endif
+
+#ifdef CONV24_LABELS
+#undef GET32_LABELS
+#undef PUT32_LABELS
+#endif
+
+#ifdef PUT32_END
+while (0) {
+put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
+put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
+put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
+put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
+put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
+put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
+put32_1234_0123: as_u32(dst) = sx24(sample >> 8); goto PUT32_END;
+put32_1234_0923: as_u32(dst) = sx24((sample >> 8) ^ 0x800000); goto PUT32_END;
+put32_1234_3210: as_u32(dst) = sx24s(bswap_32(sample) << 8); goto PUT32_END;
+put32_1234_3290: as_u32(dst) = sx24s((bswap_32(sample) ^ 0x80) << 8); goto PUT32_END;
+put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
+put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
+put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
+put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
+put32_1234_123: _put_triple(dst, sample >> 8); goto PUT32_END;
+put32_1234_923: _put_triple(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
+put32_1234_321: _put_triple_s(dst, sample >> 8); goto PUT32_END;
+put32_1234_329: _put_triple_s(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
+put32_1234_123_20: _put_triple(dst, sample >> 12); goto PUT32_END;
+put32_1234_923_20: _put_triple(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
+put32_1234_321_20: _put_triple_s(dst, sample >> 12); goto PUT32_END;
+put32_1234_329_20: _put_triple_s(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
+put32_1234_123_18: _put_triple(dst, sample >> 14); goto PUT32_END;
+put32_1234_923_18: _put_triple(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
+put32_1234_321_18: _put_triple_s(dst, sample >> 14); goto PUT32_END;
+put32_1234_329_18: _put_triple_s(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
+}
+#endif
+
+#ifdef CONV24_END
+#undef GET32_END
+#undef PUT32_END
+#endif
+
+#ifdef GETU_LABELS
+/* width endswap sign_toggle */
+static void *const getu_labels[4 * 2 * 2] = {
+ &&getu_1_1, /* 8h -> 8h */
+ &&getu_1_9, /* 8h ^> 8h */
+ &&getu_1_1, /* 8s -> 8h */
+ &&getu_1_9, /* 8s ^> 8h */
+ &&getu_12_12, /* 16h -> 16h */
+ &&getu_12_92, /* 16h ^> 16h */
+ &&getu_12_21, /* 16s -> 16h */
+ &&getu_12_A1, /* 16s ^> 16h */
+ &&getu_0123_0123, /* 24h -> 24h */
+ &&getu_0123_0923, /* 24h ^> 24h */
+ &&getu_1230_0321, /* 24s -> 24h */
+ &&getu_1230_0B21, /* 24s ^> 24h */
+ &&getu_1234_1234, /* 32h -> 32h */
+ &&getu_1234_9234, /* 32h ^> 32h */
+ &&getu_1234_4321, /* 32s -> 32h */
+ &&getu_1234_C321, /* 32s ^> 32h */
+};
+#endif
+
+#ifdef GETU_END
+while (0) {
+getu_1_1: sample = as_u8c(src); goto GETU_END;
+getu_1_9: sample = as_u8c(src) ^ 0x80; goto GETU_END;
+getu_12_12: sample = as_u16c(src); goto GETU_END;
+getu_12_92: sample = as_u16c(src) ^ 0x8000; goto GETU_END;
+getu_12_21: sample = bswap_16(as_u16c(src)); goto GETU_END;
+getu_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GETU_END;
+getu_0123_0123: sample = sx24(as_u32c(src)); goto GETU_END;
+getu_0123_0923: sample = sx24(as_u32c(src) ^ 0x800000); goto GETU_END;
+getu_1230_0321: sample = sx24(bswap_32(as_u32c(src))); goto GETU_END;
+getu_1230_0B21: sample = sx24(bswap_32(as_u32c(src) ^ 0x8000)); goto GETU_END;
+getu_1234_1234: sample = as_u32c(src); goto GETU_END;
+getu_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GETU_END;
+getu_1234_4321: sample = bswap_32(as_u32c(src)); goto GETU_END;
+getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
+}
+#endif
+
+#ifdef GETS_LABELS
+/* width endswap sign_toggle */
+static void *const gets_labels[4 * 2 * 2] = {
+ &&gets_1_1, /* 8h -> 8h */
+ &&gets_1_9, /* 8h ^> 8h */
+ &&gets_1_1, /* 8s -> 8h */
+ &&gets_1_9, /* 8s ^> 8h */
+ &&gets_12_12, /* 16h -> 16h */
+ &&gets_12_92, /* 16h ^> 16h */
+ &&gets_12_21, /* 16s -> 16h */
+ &&gets_12_A1, /* 16s ^> 16h */
+ &&gets_0123_0123, /* 24h -> 24h */
+ &&gets_0123_0923, /* 24h ^> 24h */
+ &&gets_1230_0321, /* 24s -> 24h */
+ &&gets_1230_0B21, /* 24s ^> 24h */
+ &&gets_1234_1234, /* 32h -> 32h */
+ &&gets_1234_9234, /* 32h ^> 32h */
+ &&gets_1234_4321, /* 32s -> 32h */
+ &&gets_1234_C321, /* 32s ^> 32h */
+};
+#endif
+
+#ifdef GETS_END
+while (0) {
+gets_1_1: sample = as_s8c(src); goto GETS_END;
+gets_1_9: sample = (int8_t)(as_s8c(src) ^ 0x80); goto GETS_END;
+gets_12_12: sample = as_s16c(src); goto GETS_END;
+gets_12_92: sample = (int16_t)(as_s16c(src) ^ 0x8000); goto GETS_END;
+gets_12_21: sample = (int16_t)bswap_16(as_s16c(src)); goto GETS_END;
+gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END;
+gets_0123_0123: sample = sx24((int32_t)(as_s32c(src) << 8) >> 8); goto GETS_END;
+gets_0123_0923: sample = sx24((int32_t)((as_s32c(src) ^ 0x800000) << 8) >> 8); goto GETS_END;
+gets_1230_0321: sample = sx24((int32_t)(bswap_32(as_s32c(src)) << 8) >> 8); goto GETS_END;
+gets_1230_0B21: sample = sx24((int32_t)(bswap_32(as_s32c(src) ^ 0x8000) << 8) >> 8); goto GETS_END;
+gets_1234_1234: sample = as_s32c(src); goto GETS_END;
+gets_1234_9234: sample = (int32_t)(as_s32c(src) ^ 0x80000000); goto GETS_END;
+gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
+gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END;
+}
+#endif
+
+#ifdef PUT_LABELS
+/* width endswap sign_toggle */
+static void *const put_labels[4 * 2 * 2] = {
+ &&put_1_1, /* 8h -> 8h */
+ &&put_1_9, /* 8h ^> 8h */
+ &&put_1_1, /* 8h -> 8s */
+ &&put_1_9, /* 8h ^> 8s */
+ &&put_12_12, /* 16h -> 16h */
+ &&put_12_92, /* 16h ^> 16h */
+ &&put_12_21, /* 16h -> 16s */
+ &&put_12_29, /* 16h ^> 16s */
+ &&put_0123_0123, /* 24h -> 24h */
+ &&put_0123_0923, /* 24h ^> 24h */
+ &&put_0123_3210, /* 24h -> 24s */
+ &&put_0123_3290, /* 24h ^> 24s */
+ &&put_1234_1234, /* 32h -> 32h */
+ &&put_1234_9234, /* 32h ^> 32h */
+ &&put_1234_4321, /* 32h -> 32s */
+ &&put_1234_4329, /* 32h ^> 32s */
+};
+#endif
+
+#ifdef PUT_END
+put_1_1: as_s8(dst) = sample; goto PUT_END;
+put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END;
+put_12_12: as_s16(dst) = sample; goto PUT_END;
+put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
+put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END;
+put_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT_END;
+/* this always writes the unused byte in 24-bit formats as 0x00 */
+put_0123_0123: as_s32(dst) = sx24(sample & 0x00ffffff); goto PUT_END;
+put_0123_0923: as_u32(dst) = sx24((sample & 0x00ffffff) ^ 0x800000); goto PUT_END;
+put_0123_3210: as_s32(dst) = sx24s(bswap_32(sample) & 0xffffff00); goto PUT_END;
+put_0123_3290: as_u32(dst) = sx24s((bswap_32(sample) & 0xffffff00) ^ 0x8000); goto PUT_END;
+put_1234_1234: as_s32(dst) = sample; goto PUT_END;
+put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
+put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END;
+put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END;
+#endif
+
+#ifdef PUT32F_LABELS
+/* type (0 = float, 1 = float64), endswap */
+static void *const put32float_labels[2 * 2] = {
+ &&put32f_1234_1234F, /* 32h -> (float)h */
+ &&put32f_1234_4321F, /* 32h -> (float)s */
+ &&put32f_1234_1234D, /* 32h -> (float64)h */
+ &&put32f_1234_4321D, /* 32h -> (float64)s */
+};
+#endif
+
+#ifdef PUT32F_END
+put32f_1234_1234F: as_float(dst) = (float_t)((int32_t)sample) / (float_t)0x80000000UL; goto PUT32F_END;
+put32f_1234_4321F: tmp_float.f = (float_t)((int32_t)sample) / (float_t)0x80000000UL;
+ as_u32(dst) = bswap_32(tmp_float.i); goto PUT32F_END;
+put32f_1234_1234D: as_double(dst) = (double_t)((int32_t)sample) / (double_t)0x80000000UL; goto PUT32F_END;
+put32f_1234_4321D: tmp_double.d = (double_t)((int32_t)sample) / (double_t)0x80000000UL;
+ as_u64(dst) = bswap_64(tmp_double.l); goto PUT32F_END;
+#endif
+
+#ifdef GET32F_LABELS
+/* type (0 = float, 1 = float64), endswap */
+static void *const get32float_labels[2 * 2] = {
+ &&get32f_1234F_1234, /* (float)h -> 32h */
+ &&get32f_4321F_1234, /* (float)s -> 32h */
+ &&get32f_1234D_1234, /* (float64)h -> 32h */
+ &&get32f_4321D_1234, /* (float64)s -> 32h */
+};
+#endif
+
+#ifdef GET32F_END
+get32f_1234F_1234: tmp_float.f = as_floatc(src);
+ if (tmp_float.f >= 1.0)
+ sample = 0x7fffffff;
+ else if (tmp_float.f <= -1.0)
+ sample = 0x80000000;
+ else
+ sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
+ goto GET32F_END;
+get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
+ if (tmp_float.f >= 1.0)
+ sample = 0x7fffffff;
+ else if (tmp_float.f <= -1.0)
+ sample = 0x80000000;
+ else
+ sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
+ goto GET32F_END;
+get32f_1234D_1234: tmp_double.d = as_doublec(src);
+ if (tmp_double.d >= 1.0)
+ sample = 0x7fffffff;
+ else if (tmp_double.d <= -1.0)
+ sample = 0x80000000;
+ else
+ sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
+ goto GET32F_END;
+get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
+ if (tmp_double.d >= 1.0)
+ sample = 0x7fffffff;
+ else if (tmp_double.d <= -1.0)
+ sample = 0x80000000;
+ else
+ sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
+ goto GET32F_END;
+#endif
+
+#ifdef NORMS_LABELS
+static inline void _norms(const void *src, void *dst,
+ int src_wid,
+ int dst_sign, int dst_wid, int dst_end)
+{
+ int32_t s;
+ switch (src_wid) {
+ case 8:
+ s = *(int32_t*)src;
+ if (s >= 0x7f)
+ goto _max;
+ else if (s <= -0x80)
+ goto _min;
+ break;
+ case 16:
+ s = *(int32_t*)src;
+ if (s >= 0x7fff)
+ goto _max;
+ else if (s <= -0x8000)
+ goto _min;
+ break;
+ case 24:
+ s = *(int32_t*)src;
+ if (s >= 0x7fffff)
+ goto _max;
+ else if (s <= -0x800000)
+ goto _min;
+ break;
+ case 32:
+ {
+ int64_t s64;
+ s64 = *(int64_t*)src;
+ if (s64 >= 0x7fffffff)
+ goto _max;
+ else if (s64 <= -0x80000000)
+ goto _min;
+ s = s64;
+ break;
+ }
+ default:
+ assert(0);
+ return;
+ }
+ if (src_wid < dst_wid) {
+ unsigned int bits = dst_wid - src_wid;
+ s *= 1 << bits;
+ } else if (src_wid > dst_wid) {
+ unsigned int bits = src_wid - dst_wid;
+ s = (s + (1 << (bits - 1))) / (1 << bits);
+ }
+ if (!dst_sign)
+ s += (1U << (dst_wid - 1));
+ switch (dst_wid) {
+ case 8:
+ *(u_int8_t*)dst = s;
+ break;
+ case 16:
+ if (dst_end)
+ s = bswap_16(s);
+ *(u_int16_t*)dst = s;
+ break;
+ case 24:
+ case 32:
+ if (dst_end)
+ s = bswap_32(s);
+ *(u_int32_t*)dst = s;
+ break;
+ }
+ return;
+
+ _min:
+ switch (dst_wid) {
+ case 8:
+ if (dst_sign)
+ *(u_int8_t*)dst = 0x80;
+ else
+ *(u_int8_t*)dst = 0;
+ break;
+ case 16:
+ if (dst_sign)
+ *(u_int16_t*)dst = dst_end ? 0x0080 : 0x8000;
+ else
+ *(u_int16_t*)dst = 0;
+ break;
+ case 24:
+ if (dst_sign)
+ *(u_int32_t*)dst = dst_end ? 0x00008000 : 0x00800000;
+ else
+ *(u_int32_t*)dst = 0;
+ break;
+ case 32:
+ if (dst_sign)
+ *(u_int32_t*)dst = dst_end ? 0x00000080 : 0x80000000;
+ else
+ *(u_int32_t*)dst = 0;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
+
+ _max:
+ switch (dst_wid) {
+ case 8:
+ if (dst_sign)
+ *(u_int8_t*)dst = 0x7f;
+ else
+ *(u_int8_t*)dst = 0xff;
+ break;
+ case 16:
+ if (dst_sign)
+ *(u_int16_t*)dst = dst_end ? 0xff7f : 0x7fff;
+ else
+ *(u_int16_t*)dst = 0;
+ break;
+ case 24:
+ if (dst_sign)
+ *(u_int32_t*)dst = dst_end ? 0xffff7f00 : 0x007fffff;
+ else
+ *(u_int32_t*)dst = 0;
+ break;
+ case 32:
+ if (dst_sign)
+ *(u_int32_t*)dst = dst_end ? 0xffffff7f : 0x7fffffff;
+ else
+ *(u_int32_t*)dst = 0;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ return;
+}
+
+/* src_wid dst_sign dst_wid dst_end */
+static void *const norms_labels[4 * 2 * 4 * 2] = {
+ &&norms_8_u8, /* s8 -> u8 */
+ &&norms_8_u8, /* s8 -> u8 */
+ &&norms_8_u16h, /* s8 -> u16h */
+ &&norms_8_u16s, /* s8 -> u16s */
+ &&norms_8_u24h, /* s8 -> u24h */
+ &&norms_8_u24s, /* s8 -> u24s */
+ &&norms_8_u32h, /* s8 -> u32h */
+ &&norms_8_u32s, /* s8 -> u32s */
+ &&norms_8_s8, /* s8 -> s8 */
+ &&norms_8_s8, /* s8 -> s8 */
+ &&norms_8_s16h, /* s8 -> s16h */
+ &&norms_8_s16s, /* s8 -> s16s */
+ &&norms_8_s24h, /* s8 -> s24h */
+ &&norms_8_s24s, /* s8 -> s24s */
+ &&norms_8_s32h, /* s8 -> s32h */
+ &&norms_8_s32s, /* s8 -> s32s */
+ &&norms_16_u8, /* s16 -> u8 */
+ &&norms_16_u8, /* s16 -> u8 */
+ &&norms_16_u16h, /* s16 -> u16h */
+ &&norms_16_u16s, /* s16 -> u16s */
+ &&norms_16_u24h, /* s16 -> u24h */
+ &&norms_16_u24s, /* s16 -> u24s */
+ &&norms_16_u32h, /* s16 -> u32h */
+ &&norms_16_u32s, /* s16 -> u32s */
+ &&norms_16_s8, /* s16 -> s8 h*/
+ &&norms_16_s8, /* s16 -> s8 */
+ &&norms_16_s16h, /* s16 -> s16h */
+ &&norms_16_s16s, /* s16 -> s16s */
+ &&norms_16_s24h, /* s16 -> s24h */
+ &&norms_16_s24s, /* s16 -> s24s */
+ &&norms_16_s32h, /* s16 -> s32h */
+ &&norms_16_s32s, /* s16 -> s32s */
+ &&norms_24_u8, /* s24 -> u8 */
+ &&norms_24_u8, /* s24 -> u8 */
+ &&norms_24_u16h, /* s24 -> u16h */
+ &&norms_24_u16s, /* s24 -> u16s */
+ &&norms_24_u24h, /* s24 -> u24h */
+ &&norms_24_u24s, /* s24 -> u24s */
+ &&norms_24_u32h, /* s24 -> u32h */
+ &&norms_24_u32s, /* s24 -> u32s */
+ &&norms_24_s8, /* s24 -> s8 */
+ &&norms_24_s8, /* s24 -> s8 */
+ &&norms_24_s16h, /* s24 -> s16h */
+ &&norms_24_s16s, /* s24 -> s16s */
+ &&norms_24_s24h, /* s24 -> s24h */
+ &&norms_24_s24s, /* s24 -> s24s */
+ &&norms_24_s32h, /* s24 -> s32h */
+ &&norms_24_s32s, /* s24 -> s32s */
+ &&norms_32_u8, /* s32 -> u8 */
+ &&norms_32_u8, /* s32 -> u8 */
+ &&norms_32_u16h, /* s32 -> u16h */
+ &&norms_32_u16s, /* s32 -> u16s */
+ &&norms_32_u24h, /* s32 -> u24h */
+ &&norms_32_u24s, /* s32 -> u24s */
+ &&norms_32_u32h, /* s32 -> u32h */
+ &&norms_32_u32s, /* s32 -> u32s */
+ &&norms_32_s8, /* s32 -> s8 */
+ &&norms_32_s8, /* s32 -> s8 */
+ &&norms_32_s16h, /* s32 -> s16h */
+ &&norms_32_s16s, /* s32 -> s16s */
+ &&norms_32_s24h, /* s32 -> s24h */
+ &&norms_32_s24s, /* s32 -> s24s */
+ &&norms_32_s32h, /* s32 -> s32h */
+ &&norms_32_s32s, /* s32 -> s32s */
+};
+#endif
+
+#ifdef NORMS_END
+norms_8_u8: _norms(src, dst, 8, 0, 8, 0); goto NORMS_END;
+norms_8_u16h: _norms(src, dst, 8, 0, 16, 0); goto NORMS_END;
+norms_8_u16s: _norms(src, dst, 8, 0, 16, 1); goto NORMS_END;
+norms_8_u24h: _norms(src, dst, 8, 0, 24, 0); goto NORMS_END;
+norms_8_u24s: _norms(src, dst, 8, 0, 24, 1); goto NORMS_END;
+norms_8_u32h: _norms(src, dst, 8, 0, 32, 0); goto NORMS_END;
+norms_8_u32s: _norms(src, dst, 8, 0, 32, 1); goto NORMS_END;
+norms_8_s8: _norms(src, dst, 8, 1, 8, 0); goto NORMS_END;
+norms_8_s16h: _norms(src, dst, 8, 1, 16, 0); goto NORMS_END;
+norms_8_s16s: _norms(src, dst, 8, 1, 16, 1); goto NORMS_END;
+norms_8_s24h: _norms(src, dst, 8, 1, 24, 0); goto NORMS_END;
+norms_8_s24s: _norms(src, dst, 8, 1, 24, 1); goto NORMS_END;
+norms_8_s32h: _norms(src, dst, 8, 1, 32, 0); goto NORMS_END;
+norms_8_s32s: _norms(src, dst, 8, 1, 32, 1); goto NORMS_END;
+norms_16_u8: _norms(src, dst, 16, 0, 8, 0); goto NORMS_END;
+norms_16_u16h: _norms(src, dst, 16, 0, 16, 0); goto NORMS_END;
+norms_16_u16s: _norms(src, dst, 16, 0, 16, 1); goto NORMS_END;
+norms_16_u24h: _norms(src, dst, 16, 0, 24, 0); goto NORMS_END;
+norms_16_u24s: _norms(src, dst, 16, 0, 24, 1); goto NORMS_END;
+norms_16_u32h: _norms(src, dst, 16, 0, 32, 0); goto NORMS_END;
+norms_16_u32s: _norms(src, dst, 16, 0, 32, 1); goto NORMS_END;
+norms_16_s8: _norms(src, dst, 16, 1, 8, 0); goto NORMS_END;
+norms_16_s16h: _norms(src, dst, 16, 1, 16, 0); goto NORMS_END;
+norms_16_s16s: _norms(src, dst, 16, 1, 16, 1); goto NORMS_END;
+norms_16_s24h: _norms(src, dst, 16, 1, 24, 0); goto NORMS_END;
+norms_16_s24s: _norms(src, dst, 16, 1, 24, 1); goto NORMS_END;
+norms_16_s32h: _norms(src, dst, 16, 1, 32, 0); goto NORMS_END;
+norms_16_s32s: _norms(src, dst, 16, 1, 32, 1); goto NORMS_END;
+norms_24_u8: _norms(src, dst, 24, 0, 8, 0); goto NORMS_END;
+norms_24_u16h: _norms(src, dst, 24, 0, 16, 0); goto NORMS_END;
+norms_24_u16s: _norms(src, dst, 24, 0, 16, 1); goto NORMS_END;
+norms_24_u24h: _norms(src, dst, 24, 0, 24, 0); goto NORMS_END;
+norms_24_u24s: _norms(src, dst, 24, 0, 24, 1); goto NORMS_END;
+norms_24_u32h: _norms(src, dst, 24, 0, 32, 0); goto NORMS_END;
+norms_24_u32s: _norms(src, dst, 24, 0, 32, 1); goto NORMS_END;
+norms_24_s8: _norms(src, dst, 24, 1, 8, 0); goto NORMS_END;
+norms_24_s16h: _norms(src, dst, 24, 1, 16, 0); goto NORMS_END;
+norms_24_s16s: _norms(src, dst, 24, 1, 16, 1); goto NORMS_END;
+norms_24_s24h: _norms(src, dst, 24, 1, 24, 0); goto NORMS_END;
+norms_24_s24s: _norms(src, dst, 24, 1, 24, 1); goto NORMS_END;
+norms_24_s32h: _norms(src, dst, 24, 1, 32, 0); goto NORMS_END;
+norms_24_s32s: _norms(src, dst, 24, 1, 32, 1); goto NORMS_END;
+norms_32_u8: _norms(src, dst, 32, 0, 8, 0); goto NORMS_END;
+norms_32_u16h: _norms(src, dst, 32, 0, 16, 0); goto NORMS_END;
+norms_32_u16s: _norms(src, dst, 32, 0, 16, 1); goto NORMS_END;
+norms_32_u24h: _norms(src, dst, 32, 0, 24, 0); goto NORMS_END;
+norms_32_u24s: _norms(src, dst, 32, 0, 24, 1); goto NORMS_END;
+norms_32_u32h: _norms(src, dst, 32, 0, 32, 0); goto NORMS_END;
+norms_32_u32s: _norms(src, dst, 32, 0, 32, 1); goto NORMS_END;
+norms_32_s8: _norms(src, dst, 32, 1, 8, 0); goto NORMS_END;
+norms_32_s16h: _norms(src, dst, 32, 1, 16, 0); goto NORMS_END;
+norms_32_s16s: _norms(src, dst, 32, 1, 16, 1); goto NORMS_END;
+norms_32_s24h: _norms(src, dst, 32, 1, 24, 0); goto NORMS_END;
+norms_32_s24s: _norms(src, dst, 32, 1, 24, 1); goto NORMS_END;
+norms_32_s32h: _norms(src, dst, 32, 1, 32, 0); goto NORMS_END;
+norms_32_s32s: _norms(src, dst, 32, 1, 32, 1); goto NORMS_END;
+#endif
+
+
+#undef as_u8
+#undef as_u16
+#undef as_u32
+#undef as_s8
+#undef as_s16
+#undef as_s32
+#undef as_float
+#undef as_double
+
+#undef as_u8c
+#undef as_u16c
+#undef as_u32c
+#undef as_s8c
+#undef as_s16c
+#undef as_s32c
+#undef as_floatc
+#undef as_doublec
+
+#undef _get_triple
+#undef _get_triple_s
+#undef _get_triple_le
+#undef _get_triple_be
+#undef _put_triple
+#undef _put_triple_s
+#undef _put_triple_le
+#undef _put_triple_be
+
diff --git a/alsa-lib/src/pcm/scopes/Makefile.am b/alsa-lib/src/pcm/scopes/Makefile.am
new file mode 100644
index 0000000..0ce845d
--- /dev/null
+++ b/alsa-lib/src/pcm/scopes/Makefile.am
@@ -0,0 +1,9 @@
+pkglibdir = $(libdir)/@PACKAGE@/scopes
+
+AM_CFLAGS = -g -O2 -W -Wall
+
+pkglib_LTLIBRARIES = scope-level.la
+
+scope_level_la_SOURCES = level.c
+scope_level_la_LDFLAGS = -module
+scope_level_la_LIBADD = -lncurses
diff --git a/alsa-lib/src/pcm/scopes/Makefile.in b/alsa-lib/src/pcm/scopes/Makefile.in
new file mode 100644
index 0000000..b0fd144
--- /dev/null
+++ b/alsa-lib/src/pcm/scopes/Makefile.in
@@ -0,0 +1,557 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/pcm/scopes
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(pkglibdir)"
+pkglibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(pkglib_LTLIBRARIES)
+scope_level_la_DEPENDENCIES =
+am_scope_level_la_OBJECTS = level.lo
+scope_level_la_OBJECTS = $(am_scope_level_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(scope_level_la_SOURCES)
+DIST_SOURCES = $(scope_level_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkglibdir = $(libdir)/@PACKAGE@/scopes
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CFLAGS = -g -O2 -W -Wall
+pkglib_LTLIBRARIES = scope-level.la
+scope_level_la_SOURCES = level.c
+scope_level_la_LDFLAGS = -module
+scope_level_la_LIBADD = -lncurses
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/pcm/scopes/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/pcm/scopes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-pkglibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ done
+
+clean-pkglibLTLIBRARIES:
+ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+ @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+scope-level.la: $(scope_level_la_OBJECTS) $(scope_level_la_DEPENDENCIES)
+ $(LINK) -rpath $(pkglibdir) $(scope_level_la_LDFLAGS) $(scope_level_la_OBJECTS) $(scope_level_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/level.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-pkglibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-pkglibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-pkglibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/pcm/scopes/level.c b/alsa-lib/src/pcm/scopes/level.c
new file mode 100644
index 0000000..eea9eac
--- /dev/null
+++ b/alsa-lib/src/pcm/scopes/level.c
@@ -0,0 +1,271 @@
+/*
+ * PCM - Meter level plugin (ncurses)
+ * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <curses.h>
+#include <errno.h>
+#include <alsa/asoundlib.h>
+
+#define BAR_WIDTH 70
+/* milliseconds to go from 32767 to 0 */
+#define DECAY_MS 400
+/* milliseconds for peak to disappear */
+#define PEAK_MS 800
+
+typedef struct _snd_pcm_scope_level_channel {
+ int16_t level;
+ int16_t peak;
+ unsigned int peak_age;
+} snd_pcm_scope_level_channel_t;
+
+typedef struct _snd_pcm_scope_level {
+ snd_pcm_t *pcm;
+ snd_pcm_scope_t *s16;
+ snd_pcm_scope_level_channel_t *channels;
+ snd_pcm_uframes_t old;
+ int top;
+ WINDOW *win;
+ unsigned int bar_width;
+ unsigned int decay_ms;
+ unsigned int peak_ms;
+} snd_pcm_scope_level_t;
+
+static int level_enable(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ int y, x;
+ level->channels = calloc(snd_pcm_meter_get_channels(level->pcm), sizeof(*level->channels));
+ if (!level->channels) {
+ free(level);
+ return -ENOMEM;
+ }
+ snd_pcm_scope_set_callback_private(scope, level);
+ level->win = initscr();
+ winsdelln(level->win, snd_pcm_meter_get_channels(level->pcm));
+ getyx(level->win, y, x);
+ level->top = y;
+ return 0;
+}
+
+static void level_disable(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ endwin();
+ free(level->channels);
+}
+
+static void level_close(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ free(level);
+}
+
+static void level_start(snd_pcm_scope_t *scope ATTRIBUTE_UNUSED)
+{
+}
+
+static void level_stop(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ unsigned int c;
+ for (c = 0; c < snd_pcm_meter_get_channels(level->pcm); c++) {
+ move(level->top + c, 0);
+ clrtoeol();
+ }
+ move(level->top, 0);
+ refresh();
+}
+
+static void level_update(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ snd_pcm_t *pcm = level->pcm;
+ snd_pcm_sframes_t size;
+ snd_pcm_uframes_t size1, size2;
+ snd_pcm_uframes_t offset, cont;
+ unsigned int c, channels;
+ unsigned int ms;
+ static char bar[256] = { [0 ... 255] = '#' };
+ int max_decay;
+ size = snd_pcm_meter_get_now(pcm) - level->old;
+ if (size < 0)
+ size += snd_pcm_meter_get_boundary(pcm);
+ offset = level->old % snd_pcm_meter_get_bufsize(pcm);
+ cont = snd_pcm_meter_get_bufsize(pcm) - offset;
+ size1 = size;
+ if (size1 > cont)
+ size1 = cont;
+ size2 = size - size1;
+ ms = size * 1000 / snd_pcm_meter_get_rate(pcm);
+ max_decay = 32768 * ms / level->decay_ms;
+ channels = snd_pcm_meter_get_channels(pcm);
+ for (c = 0; c < channels; c++) {
+ int16_t *ptr;
+ int s, lev = 0;
+ snd_pcm_uframes_t n;
+ snd_pcm_scope_level_channel_t *l;
+ unsigned int lev_pos, peak_pos;
+ l = &level->channels[c];
+ ptr = snd_pcm_scope_s16_get_channel_buffer(level->s16, c) + offset;
+ for (n = size1; n > 0; n--) {
+ s = *ptr;
+ if (s < 0)
+ s = -s;
+ if (s > lev)
+ lev = s;
+ ptr++;
+ }
+ ptr = snd_pcm_scope_s16_get_channel_buffer(level->s16, c);
+ for (n = size2; n > 0; n--) {
+ s = *ptr;
+ if (s < 0)
+ s = -s;
+ if (s > lev)
+ lev = s;
+ ptr++;
+ }
+ l->level = lev;
+ l->peak_age += ms;
+ if (l->peak_age >= level->peak_ms ||
+ lev >= l->peak) {
+ l->peak = lev;
+ l->peak_age = 0;
+ }
+ if (lev < l->level - max_decay)
+ lev = l->level - max_decay;
+ move(level->top + c, 0);
+ lev_pos = lev * level->bar_width / 32768;
+ peak_pos = l->peak * level->bar_width / 32768;
+ addnstr(bar, lev_pos);
+ clrtoeol();
+ mvaddch(level->top + c, peak_pos - 1, '#');
+ }
+ move(level->top, 0);
+ refresh();
+ level->old = snd_pcm_meter_get_now(pcm);
+}
+
+static void level_reset(snd_pcm_scope_t *scope)
+{
+ snd_pcm_scope_level_t *level = snd_pcm_scope_get_callback_private(scope);
+ snd_pcm_t *pcm = level->pcm;
+ memset(level->channels, 0, snd_pcm_meter_get_channels(pcm) * sizeof(*level->channels));
+ level->old = snd_pcm_meter_get_now(pcm);
+}
+
+snd_pcm_scope_ops_t level_ops = {
+ .enable = level_enable,
+ .disable = level_disable,
+ .close = level_close,
+ .start = level_start,
+ .stop = level_stop,
+ .update = level_update,
+ .reset = level_reset,
+};
+
+int snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
+ unsigned int bar_width, unsigned int decay_ms,
+ unsigned int peak_ms,
+ snd_pcm_scope_t **scopep)
+{
+ snd_pcm_scope_t *scope, *s16;
+ snd_pcm_scope_level_t *level;
+ int err = snd_pcm_scope_malloc(&scope);
+ if (err < 0)
+ return err;
+ level = calloc(1, sizeof(*level));
+ if (!level) {
+ free(scope);
+ return -ENOMEM;
+ }
+ level->pcm = pcm;
+ level->bar_width = bar_width;
+ level->decay_ms = decay_ms;
+ level->peak_ms = peak_ms;
+ s16 = snd_pcm_meter_search_scope(pcm, "s16");
+ if (!s16) {
+ err = snd_pcm_scope_s16_open(pcm, "s16", &s16);
+ if (err < 0) {
+ free(scope);
+ free(level);
+ return err;
+ }
+ }
+ level->s16 = s16;
+ snd_pcm_scope_set_ops(scope, &level_ops);
+ snd_pcm_scope_set_callback_private(scope, level);
+ if (name)
+ snd_pcm_scope_set_name(scope, strdup(name));
+ snd_pcm_meter_add_scope(pcm, scope);
+ *scopep = scope;
+ return 0;
+}
+
+int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
+ snd_config_t *root, snd_config_t *conf)
+{
+ snd_config_iterator_t i, next;
+ snd_pcm_scope_t *scope;
+ long bar_width = -1, decay_ms = -1, peak_ms = -1;
+ int err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "bar_width") == 0) {
+ err = snd_config_get_integer(n, &bar_width);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "decay_ms") == 0) {
+ err = snd_config_get_integer(n, &decay_ms);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ if (strcmp(id, "peak_ms") == 0) {
+ err = snd_config_get_integer(n, &peak_ms);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ return -EINVAL;
+ }
+ if (bar_width < 0)
+ bar_width = BAR_WIDTH;
+ if (decay_ms < 0)
+ decay_ms = DECAY_MS;
+ if (peak_ms < 0)
+ peak_ms = PEAK_MS;
+ return snd_pcm_scope_level_open(pcm, name, bar_width, decay_ms, peak_ms,
+ &scope);
+}
diff --git a/alsa-lib/src/rawmidi/Makefile.am b/alsa-lib/src/rawmidi/Makefile.am
new file mode 100644
index 0000000..2470c7a
--- /dev/null
+++ b/alsa-lib/src/rawmidi/Makefile.am
@@ -0,0 +1,12 @@
+EXTRA_LTLIBRARIES=librawmidi.la
+
+librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c
+if BUILD_SEQ
+librawmidi_la_SOURCES += rawmidi_virt.c
+endif
+noinst_HEADERS = rawmidi_local.h
+
+all: librawmidi.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/rawmidi/Makefile.in b/alsa-lib/src/rawmidi/Makefile.in
new file mode 100644
index 0000000..282fb8a
--- /dev/null
+++ b/alsa-lib/src/rawmidi/Makefile.in
@@ -0,0 +1,527 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_SEQ_TRUE@am__append_1 = rawmidi_virt.c
+subdir = src/rawmidi
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+librawmidi_la_LIBADD =
+am__librawmidi_la_SOURCES_DIST = rawmidi.c rawmidi_hw.c \
+ rawmidi_symbols.c rawmidi_virt.c
+@BUILD_SEQ_TRUE@am__objects_1 = rawmidi_virt.lo
+am_librawmidi_la_OBJECTS = rawmidi.lo rawmidi_hw.lo rawmidi_symbols.lo \
+ $(am__objects_1)
+librawmidi_la_OBJECTS = $(am_librawmidi_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(librawmidi_la_SOURCES)
+DIST_SOURCES = $(am__librawmidi_la_SOURCES_DIST)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = librawmidi.la
+librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c \
+ $(am__append_1)
+noinst_HEADERS = rawmidi_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/rawmidi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/rawmidi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+librawmidi.la: $(librawmidi_la_OBJECTS) $(librawmidi_la_DEPENDENCIES)
+ $(LINK) $(librawmidi_la_LDFLAGS) $(librawmidi_la_OBJECTS) $(librawmidi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmidi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmidi_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmidi_symbols.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmidi_virt.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+all: librawmidi.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/rawmidi/rawmidi.c b/alsa-lib/src/rawmidi/rawmidi.c
new file mode 100644
index 0000000..f50cc05
--- /dev/null
+++ b/alsa-lib/src/rawmidi/rawmidi.c
@@ -0,0 +1,1004 @@
+/**
+ * \file rawmidi/rawmidi.c
+ * \brief RawMidi Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2000-2001
+ *
+ * See the \ref rawmidi page for more details.
+ */
+/*
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page rawmidi RawMidi interface
+
+<P>RawMidi Interface is designed to write or read raw (unchanged) MIDI
+data over the MIDI line without any timestamps defined in interface. MIDI
+stands Musical Instrument Digital Interface and more information about
+this standard can be found at http://www.midi.org.
+
+\section rawmidi_general_overview General overview
+
+The rawmidi implementation uses ring buffers to store outgoing and incoming
+MIDI stream. The buffer size is tunable and drivers report underruns for incoming
+stream as well.
+
+\section rawmidi_open Open handling
+
+RawMidi devices are opened exclusively for a selected direction.
+While more than one process may not open a given MIDI device in the same
+direction simultaneously, separate processes may open a single MIDI device
+in different directions (i.e. process one opens a MIDI device in write
+direction and process two opens the same device in read direction).
+
+\subsection rawmidi_open_nonblock Nonblocking open (flag)
+
+Using #SND_RAWMIDI_NONBLOCK flag for snd_rawmidi_open() or snd_rawmidi_open_lconf()
+instruct device driver to return the -EBUSY error when device is already occupied
+with another application. This flag also changes behaviour of snd_rawmidi_write()
+and snd_rawmidi_read() returning -EAGAIN when no more bytes can be processed.
+
+Note: In opposite (default) behaviour, application is blocked until device resources
+are free.
+
+\subsection rawmidi_open_append Append open (flag)
+
+Using #SND_RAWMIDI_APPEND flag (output only) instruct device driver to append
+contents of written buffer - passed by snd_rawmidi_write() - atomically
+to output ring buffer in the kernel space. This flag also means that device
+is not opened exclusively, so more applications can share given rawmidi device.
+Note that applications must send the whole MIDI message including the running status,
+because another writting application might break the MIDI message in the output
+buffer.
+
+\subsection rawmidi_open_sync Sync open (flag)
+
+Using #SND_RAWMIDI_SYNC flag (output only) assures that the contents of output
+buffer specified using snd_rawmidi_write() is always drained before the function
+exits. This behaviour is same like 'snd_rawmidi_write() followed by
+snd_rawmidi_drain() immediately'.
+
+\subsection rawmidi_io I/O handling
+
+There is only standard read/write access to device internal ring buffer. Use
+snd_rawmidi_read() and snd_rawmidi_write() functions to obtain / write MIDI bytes.
+
+\subsection rawmidi_dev_names RawMidi naming conventions
+
+The ALSA library uses a generic string representation for names of devices.
+The devices might be virtual, physical or a mix of both. The generic string
+is passed to \link ::snd_rawmidi_open() \endlink or \link ::snd_rawmidi_open_lconf() \endlink.
+It contains two parts: device name and arguments. Devices and arguments are described
+in configuration files. The usual place for default definitions is at /usr/share/alsa/alsa.conf.
+
+\subsection rawmidi_dev_names_default
+
+The default device is equal to hw device. The defaults are used:
+
+defaults.rawmidi.card 0
+defaults.rawmidi.device 0
+defaults.rawmidi.subdevice -1
+
+These defaults can be freely overwritten in local configuration files.
+
+Example:
+
+\code
+default
+\endcode
+
+\subsection rawmidi_dev_names_hw HW device
+
+The hw device description uses the hw plugin. The three arguments (in order: CARD,DEV,SUBDEV)
+specify card number or identifier, device number and subdevice number (-1 means any).
+
+Example:
+
+\code
+hw
+hw:0
+hw:0,0
+hw:supersonic,1
+hw:soundwave,1,2
+hw:DEV=1,CARD=soundwave,SUBDEV=2
+\endcode
+
+\section rawmidi_examples Examples
+
+The full featured examples with cross-links:
+
+\par Simple input/output test program
+\ref example_test_rawmidi "example code"
+\par
+This example shows open and read/write rawmidi operations.
+
+*/
+
+/**
+ * \example ../test/rawmidi.c
+ * \anchor example_test_rawmidi
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <string.h>
+#include "rawmidi_local.h"
+
+/**
+ * \brief setup the default parameters
+ * \param rawmidi RawMidi handle
+ * \param params pointer to a snd_rawmidi_params_t structure
+ * \return 0 on success otherwise a negative error code
+ */
+static int snd_rawmidi_params_default(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params)
+{
+ assert(rawmidi);
+ assert(params);
+ params->buffer_size = page_size();
+ params->avail_min = 1;
+ params->no_active_sensing = 0;
+ return 0;
+}
+
+static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, snd_config_t *rawmidi_root,
+ snd_config_t *rawmidi_conf, int mode)
+{
+ const char *str;
+ char buf[256];
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ snd_rawmidi_params_t params;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **,
+ const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_rawmidi_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for RAWMIDI %s definition", name);
+ else
+ SNDERR("Invalid type for RAWMIDI definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(rawmidi_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(rawmidi_root, "rawmidi_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for RAWMIDI type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str);
+ }
+#ifndef PIC
+ snd_rawmidi_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (err >= 0)
+ err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode);
+ if (err < 0)
+ return err;
+ if (inputp) {
+ (*inputp)->dl_handle = h; h = NULL;
+ snd_rawmidi_params_default(*inputp, &params);
+ err = snd_rawmidi_params(*inputp, &params);
+ assert(err >= 0);
+ }
+ if (outputp) {
+ (*outputp)->dl_handle = h;
+ snd_rawmidi_params_default(*outputp, &params);
+ err = snd_rawmidi_params(*outputp, &params);
+ assert(err >= 0);
+ }
+ return 0;
+}
+
+static int snd_rawmidi_open_noupdate(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ snd_config_t *root, const char *name, int mode)
+{
+ int err;
+ snd_config_t *rawmidi_conf;
+ err = snd_config_search_definition(root, "rawmidi", name, &rawmidi_conf);
+ if (err < 0) {
+ SNDERR("Unknown RawMidi %s", name);
+ return err;
+ }
+ err = snd_rawmidi_open_conf(inputp, outputp, name, root, rawmidi_conf, mode);
+ snd_config_delete(rawmidi_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a new connection to the RawMidi interface.
+ * \param inputp Returned input handle (NULL if not wanted)
+ * \param outputp Returned output handle (NULL if not wanted)
+ * \param name ASCII identifier of the RawMidi handle
+ * \param mode Open mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the RawMidi interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, int mode)
+{
+ int err;
+ assert((inputp || outputp) && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_rawmidi_open_noupdate(inputp, outputp, snd_config, name, mode);
+}
+
+/**
+ * \brief Opens a new connection to the RawMidi interface using local configuration
+ * \param inputp Returned input handle (NULL if not wanted)
+ * \param outputp Returned output handle (NULL if not wanted)
+ * \param name ASCII identifier of the RawMidi handle
+ * \param mode Open mode
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the RawMidi interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_rawmidi_open_lconf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, int mode, snd_config_t *lconf)
+{
+ assert((inputp || outputp) && name && lconf);
+ return snd_rawmidi_open_noupdate(inputp, outputp, lconf, name, mode);
+}
+
+/**
+ * \brief close RawMidi handle
+ * \param rawmidi RawMidi handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified RawMidi handle and frees all associated
+ * resources.
+ */
+int snd_rawmidi_close(snd_rawmidi_t *rawmidi)
+{
+ int err;
+ assert(rawmidi);
+ err = rawmidi->ops->close(rawmidi);
+ free(rawmidi->name);
+ if (rawmidi->dl_handle)
+ snd_dlclose(rawmidi->dl_handle);
+ free(rawmidi);
+ return err;
+}
+
+/**
+ * \brief get identifier of RawMidi handle
+ * \param rawmidi a RawMidi handle
+ * \return ascii identifier of RawMidi handle
+ *
+ * Returns the ASCII identifier of given RawMidi handle. It's the same
+ * identifier specified in snd_rawmidi_open().
+ */
+const char *snd_rawmidi_name(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return rawmidi->name;
+}
+
+/**
+ * \brief get type of RawMidi handle
+ * \param rawmidi a RawMidi handle
+ * \return type of RawMidi handle
+ *
+ * Returns the type #snd_rawmidi_type_t of given RawMidi handle.
+ */
+snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return rawmidi->type;
+}
+
+/**
+ * \brief get stream (direction) of RawMidi handle
+ * \param rawmidi a RawMidi handle
+ * \return stream of RawMidi handle
+ *
+ * Returns the stream #snd_rawmidi_stream_t of given RawMidi handle.
+ */
+snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return rawmidi->stream;
+}
+
+/**
+ * \brief get count of poll descriptors for RawMidi handle
+ * \param rawmidi RawMidi handle
+ * \return count of poll descriptors
+ */
+int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return 1;
+}
+
+/**
+ * \brief get poll descriptors
+ * \param rawmidi RawMidi handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int space)
+{
+ assert(rawmidi);
+ if (space >= 1) {
+ pfds->fd = rawmidi->poll_fd;
+ pfds->events = rawmidi->stream == SND_RAWMIDI_STREAM_OUTPUT ? (POLLOUT|POLLERR|POLLNVAL) : (POLLIN|POLLERR|POLLNVAL);
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param rawmidi rawmidi RawMidi handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(rawmidi && pfds && revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief set nonblock mode
+ * \param rawmidi RawMidi handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * The nonblock mode cannot be used when the stream is in
+ * #SND_RAWMIDI_APPEND state.
+ */
+int snd_rawmidi_nonblock(snd_rawmidi_t *rawmidi, int nonblock)
+{
+ int err;
+ assert(rawmidi);
+ assert(!(rawmidi->mode & SND_RAWMIDI_APPEND));
+ if ((err = rawmidi->ops->nonblock(rawmidi, nonblock)) < 0)
+ return err;
+ if (nonblock)
+ rawmidi->mode |= SND_RAWMIDI_NONBLOCK;
+ else
+ rawmidi->mode &= ~SND_RAWMIDI_NONBLOCK;
+ return 0;
+}
+
+/**
+ * \brief get size of the snd_rawmidi_info_t structure in bytes
+ * \return size of the snd_rawmidi_info_t structure in bytes
+ */
+size_t snd_rawmidi_info_sizeof()
+{
+ return sizeof(snd_rawmidi_info_t);
+}
+
+/**
+ * \brief allocate a new snd_rawmidi_info_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_rawmidi_params_t structure using the standard
+ * malloc C library function.
+ */
+int snd_rawmidi_info_malloc(snd_rawmidi_info_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_rawmidi_info_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_rawmidi_info_t structure
+ * \param info pointer to the snd_rawmidi_info_t structure to free
+ *
+ * Frees the given snd_rawmidi_params_t structure using the standard
+ * free C library function.
+ */
+void snd_rawmidi_info_free(snd_rawmidi_info_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_rawmidi_info_t structure to another
+ * \param dst destination snd_rawmidi_info_t structure
+ * \param src source snd_rawmidi_info_t structure
+ */
+void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief get rawmidi device number
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi device number
+ */
+unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->device;
+}
+
+/**
+ * \brief get rawmidi subdevice number
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi subdevice number
+ */
+unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->subdevice;
+}
+
+/**
+ * \brief get rawmidi stream identification
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi stream identification
+ */
+snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->stream;
+}
+
+/**
+ * \brief get rawmidi card number
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi card number
+ */
+int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->card;
+}
+
+/**
+ * \brief get rawmidi flags
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi flags
+ */
+unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->flags;
+}
+
+/**
+ * \brief get rawmidi hardware driver identifier
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi hardware driver identifier
+ */
+const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return (const char *)info->id;
+}
+
+/**
+ * \brief get rawmidi hardware driver name
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi hardware driver name
+ */
+const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return (const char *)info->name;
+}
+
+/**
+ * \brief get rawmidi subdevice name
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi subdevice name
+ */
+const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return (const char *)info->subname;
+}
+
+/**
+ * \brief get rawmidi count of subdevices
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi count of subdevices
+ */
+unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->subdevices_count;
+}
+
+/**
+ * \brief get rawmidi available count of subdevices
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \return rawmidi available count of subdevices
+ */
+unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *info)
+{
+ assert(info);
+ return info->subdevices_avail;
+}
+
+/**
+ * \brief set rawmidi device number
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \param val device number
+ */
+void snd_rawmidi_info_set_device(snd_rawmidi_info_t *info, unsigned int val)
+{
+ assert(info);
+ info->device = val;
+}
+
+/**
+ * \brief set rawmidi subdevice number
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \param val subdevice number
+ */
+void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *info, unsigned int val)
+{
+ assert(info);
+ info->subdevice = val;
+}
+
+/**
+ * \brief set rawmidi stream identifier
+ * \param info pointer to a snd_rawmidi_info_t structure
+ * \param val rawmidi stream identifier
+ */
+void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *info, snd_rawmidi_stream_t val)
+{
+ assert(info);
+ info->stream = val;
+}
+
+/**
+ * \brief get information about RawMidi handle
+ * \param rawmidi RawMidi handle
+ * \param info pointer to a snd_rawmidi_info_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_rawmidi_info(snd_rawmidi_t *rawmidi, snd_rawmidi_info_t * info)
+{
+ assert(rawmidi);
+ assert(info);
+ return rawmidi->ops->info(rawmidi, info);
+}
+
+/**
+ * \brief get size of the snd_rawmidi_params_t structure in bytes
+ * \return size of the snd_rawmidi_params_t structure in bytes
+ */
+size_t snd_rawmidi_params_sizeof()
+{
+ return sizeof(snd_rawmidi_params_t);
+}
+
+/**
+ * \brief allocate the snd_rawmidi_params_t structure
+ * \param params returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_rawmidi_params_t structure using the standard
+ * malloc C library function.
+ */
+int snd_rawmidi_params_malloc(snd_rawmidi_params_t **params)
+{
+ assert(params);
+ *params = calloc(1, sizeof(snd_rawmidi_params_t));
+ if (!*params)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_rawmidi_params_t structure
+ * \param params pointer to the #snd_rawmidi_params_t structure to free
+ *
+ * Frees the given snd_rawmidi_params_t structure using the standard
+ * free C library function.
+ */
+void snd_rawmidi_params_free(snd_rawmidi_params_t *params)
+{
+ assert(params);
+ free(params);
+}
+
+/**
+ * \brief copy one snd_rawmidi_params_t structure to another
+ * \param dst destination snd_rawmidi_params_t structure
+ * \param src source snd_rawmidi_params_t structure
+ */
+void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief set rawmidi I/O ring buffer size
+ * \param rawmidi RawMidi handle
+ * \param params pointer to a snd_rawmidi_params_t structure
+ * \param val size in bytes
+ * \return 0 on success otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rawmidi ATTRIBUTE_UNUSED, snd_rawmidi_params_t *params, size_t val)
+#else
+int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, size_t val)
+#endif
+{
+ assert(rawmidi && params);
+ assert(val > params->avail_min);
+ params->buffer_size = val;
+ return 0;
+}
+
+/**
+ * \brief get rawmidi I/O ring buffer size
+ * \param params pointer to a snd_rawmidi_params_t structure
+ * \return size of rawmidi I/O ring buffer in bytes
+ */
+size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params)
+{
+ assert(params);
+ return params->buffer_size;
+}
+
+/**
+ * \brief set minimum available bytes in rawmidi I/O ring buffer for wakeup
+ * \param rawmidi RawMidi handle
+ * \param params pointer to a snd_rawmidi_params_t structure
+ * \param val desired value
+ */
+#ifndef DOXYGEN
+int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rawmidi ATTRIBUTE_UNUSED, snd_rawmidi_params_t *params, size_t val)
+#else
+int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, size_t val)
+#endif
+{
+ assert(rawmidi && params);
+ assert(val < params->buffer_size);
+ params->avail_min = val;
+ return 0;
+}
+
+/**
+ * \brief get minimum available bytes in rawmidi I/O ring buffer for wakeup
+ * \param params pointer to snd_rawmidi_params_t structure
+ * \return minimum available bytes
+ */
+size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params)
+{
+ assert(params);
+ return params->avail_min;
+}
+
+/**
+ * \brief set no-active-sensing action on snd_rawmidi_close()
+ * \param rawmidi RawMidi handle
+ * \param params pointer to snd_rawmidi_params_t structure
+ * \param val value: 0 = enable to send the active sensing message, 1 = disable
+ * \return 0 on success otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rawmidi ATTRIBUTE_UNUSED, snd_rawmidi_params_t *params, int val)
+#else
+int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, int val)
+#endif
+{
+ assert(rawmidi && params);
+ params->no_active_sensing = val;
+ return 0;
+}
+
+/**
+ * \brief get no-active-sensing action status
+ * \param params pointer to snd_rawmidi_params_t structure
+ * \return the current status (0 = enable, 1 = disable the active sensing message)
+ */
+int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params)
+{
+ assert(params);
+ return params->no_active_sensing;
+}
+
+/**
+ * \brief set parameters about rawmidi stream
+ * \param rawmidi RawMidi handle
+ * \param params pointer to a snd_rawmidi_params_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_rawmidi_params(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t * params)
+{
+ int err;
+ assert(rawmidi);
+ assert(params);
+ err = rawmidi->ops->params(rawmidi, params);
+ if (err < 0)
+ return err;
+ rawmidi->buffer_size = params->buffer_size;
+ rawmidi->avail_min = params->avail_min;
+ rawmidi->no_active_sensing = params->no_active_sensing;
+ return 0;
+}
+
+/**
+ * \brief get current parameters about rawmidi stream
+ * \param rawmidi RawMidi handle
+ * \param params pointer to a snd_rawmidi_params_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_rawmidi_params_current(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params)
+{
+ assert(rawmidi);
+ assert(params);
+ params->buffer_size = rawmidi->buffer_size;
+ params->avail_min = rawmidi->avail_min;
+ params->no_active_sensing = rawmidi->no_active_sensing;
+ return 0;
+}
+
+/**
+ * \brief get size of the snd_rawmidi_status_t structure in bytes
+ * \return size of the snd_rawmidi_status_t structure in bytes
+ */
+size_t snd_rawmidi_status_sizeof()
+{
+ return sizeof(snd_rawmidi_status_t);
+}
+
+/**
+ * \brief allocate the snd_rawmidi_status_t structure
+ * \param ptr returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_rawmidi_status_t structure using the standard
+ * malloc C library function.
+ */
+int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_rawmidi_status_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_rawmidi_status_t structure
+ * \param status pointer to the snd_rawmidi_status_t structure to free
+ *
+ * Frees the given snd_rawmidi_status_t structure using the standard
+ * free C library function.
+ */
+void snd_rawmidi_status_free(snd_rawmidi_status_t *status)
+{
+ assert(status);
+ free(status);
+}
+
+/**
+ * \brief copy one snd_rawmidi_status_t structure to another
+ * \param dst destination snd_rawmidi_status_t structure
+ * \param src source snd_rawmidi_status_t structure
+ */
+void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief get the start timestamp
+ * \param status pointer to a snd_rawmidi_status_t structure
+ * \param tstamp returned timestamp value
+ */
+void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *status, snd_htimestamp_t *tstamp)
+{
+ assert(status && tstamp);
+ *tstamp = status->tstamp;
+}
+
+/**
+ * \brief get current available bytes in the rawmidi I/O ring buffer
+ * \param status pointer to a snd_rawmidi_status_t structure
+ * \return current available bytes in the rawmidi I/O ring buffer
+ */
+size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *status)
+{
+ assert(status);
+ return status->avail;
+}
+
+/**
+ * \brief get count of xruns
+ * \param status pointer to a snd_rawmidi_status_t structure
+ * \return count of xruns
+ */
+size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *status)
+{
+ assert(status);
+ return status->xruns;
+}
+
+/**
+ * \brief get status of rawmidi stream
+ * \param rawmidi RawMidi handle
+ * \param status pointer to a snd_rawmidi_status_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_rawmidi_status(snd_rawmidi_t *rawmidi, snd_rawmidi_status_t * status)
+{
+ assert(rawmidi);
+ assert(status);
+ return rawmidi->ops->status(rawmidi, status);
+}
+
+/**
+ * \brief drop all bytes in the rawmidi I/O ring buffer immediately
+ * \param rawmidi RawMidi handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_rawmidi_drop(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return rawmidi->ops->drop(rawmidi);
+}
+
+/**
+ * \brief drain all bytes in the rawmidi I/O ring buffer
+ * \param rawmidi RawMidi handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Waits until all MIDI bytes are not drained (sent) to the
+ * hardware device.
+ */
+int snd_rawmidi_drain(snd_rawmidi_t *rawmidi)
+{
+ assert(rawmidi);
+ return rawmidi->ops->drain(rawmidi);
+}
+
+/**
+ * \brief write MIDI bytes to MIDI stream
+ * \param rawmidi RawMidi handle
+ * \param buffer buffer containing MIDI bytes
+ * \param size output buffer size in bytes
+ */
+ssize_t snd_rawmidi_write(snd_rawmidi_t *rawmidi, const void *buffer, size_t size)
+{
+ assert(rawmidi);
+ assert(rawmidi->stream == SND_RAWMIDI_STREAM_OUTPUT);
+ assert(buffer || size == 0);
+ return rawmidi->ops->write(rawmidi, buffer, size);
+}
+
+/**
+ * \brief read MIDI bytes from MIDI stream
+ * \param rawmidi RawMidi handle
+ * \param buffer buffer to store the input MIDI bytes
+ * \param size input buffer size in bytes
+ */
+ssize_t snd_rawmidi_read(snd_rawmidi_t *rawmidi, void *buffer, size_t size)
+{
+ assert(rawmidi);
+ assert(rawmidi->stream == SND_RAWMIDI_STREAM_INPUT);
+ assert(buffer || size == 0);
+ return (rawmidi->ops->read)(rawmidi, buffer, size);
+}
+
+int snd_rawmidi_conf_generic_id(const char *id)
+{
+ static const char ids[][8] = {
+ "comment",
+ "type",
+ "hint",
+ };
+ unsigned int k;
+
+ for (k = 0; k < sizeof ids / sizeof *ids; ++k) {
+ if (strcmp(id, ids[k]) == 0)
+ return 1;
+ }
+ return 0;
+}
diff --git a/alsa-lib/src/rawmidi/rawmidi_hw.c b/alsa-lib/src/rawmidi/rawmidi_hw.c
new file mode 100644
index 0000000..87829fd
--- /dev/null
+++ b/alsa-lib/src/rawmidi/rawmidi_hw.c
@@ -0,0 +1,372 @@
+/*
+ * RawMIDI - Hardware
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "../control/control_local.h"
+#include "rawmidi_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_rawmidi_hw = "";
+#endif
+
+#define SNDRV_FILE_RAWMIDI ALSA_DEVICE_DIRECTORY "midiC%iD%i"
+#define SNDRV_RAWMIDI_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ int open;
+ int fd;
+ int card, device, subdevice;
+} snd_rawmidi_hw_t;
+#endif
+
+static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ int err = 0;
+
+ hw->open--;
+ if (hw->open)
+ return 0;
+ if (close(hw->fd)) {
+ err = -errno;
+ SYSERR("close failed\n");
+ }
+ free(hw);
+ return err;
+}
+
+static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ long flags;
+
+ if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
+ SYSERR("F_GETFL failed");
+ return -errno;
+ }
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(hw->fd, F_SETFL, flags) < 0) {
+ SYSERR("F_SETFL for O_NONBLOCK failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_hw_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ info->stream = rmidi->stream;
+ if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_INFO, info) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_INFO failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_hw_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ params->stream = rmidi->stream;
+ if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_PARAMS, params) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_PARAMS failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_hw_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ status->stream = rmidi->stream;
+ if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_STATUS, status) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_STATUS failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_hw_drop(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ int str = rmidi->stream;
+ if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DROP, &str) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_DROP failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_hw_drain(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ int str = rmidi->stream;
+ if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DRAIN, &str) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_DRAIN failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static ssize_t snd_rawmidi_hw_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ ssize_t result;
+ result = write(hw->fd, buffer, size);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static ssize_t snd_rawmidi_hw_read(snd_rawmidi_t *rmidi, void *buffer, size_t size)
+{
+ snd_rawmidi_hw_t *hw = rmidi->private_data;
+ ssize_t result;
+ result = read(hw->fd, buffer, size);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static const snd_rawmidi_ops_t snd_rawmidi_hw_ops = {
+ .close = snd_rawmidi_hw_close,
+ .nonblock = snd_rawmidi_hw_nonblock,
+ .info = snd_rawmidi_hw_info,
+ .params = snd_rawmidi_hw_params,
+ .status = snd_rawmidi_hw_status,
+ .drop = snd_rawmidi_hw_drop,
+ .drain = snd_rawmidi_hw_drain,
+ .write = snd_rawmidi_hw_write,
+ .read = snd_rawmidi_hw_read,
+};
+
+
+int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, int card, int device, int subdevice,
+ int mode)
+{
+ int fd, ver, ret;
+ int attempt = 0;
+ char filename[sizeof(SNDRV_FILE_RAWMIDI) + 20];
+ snd_ctl_t *ctl;
+ snd_rawmidi_t *rmidi;
+ snd_rawmidi_hw_t *hw = NULL;
+ snd_rawmidi_info_t info;
+ int fmode;
+
+ if (inputp)
+ *inputp = NULL;
+ if (outputp)
+ *outputp = NULL;
+
+ if ((ret = snd_ctl_hw_open(&ctl, NULL, card, 0)) < 0)
+ return ret;
+ sprintf(filename, SNDRV_FILE_RAWMIDI, card, device);
+
+ __again:
+ if (attempt++ > 3) {
+ snd_ctl_close(ctl);
+ return -EBUSY;
+ }
+ ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
+ if (ret < 0) {
+ snd_ctl_close(ctl);
+ return ret;
+ }
+
+ if (!inputp)
+ fmode = O_WRONLY;
+ else if (!outputp)
+ fmode = O_RDONLY;
+ else
+ fmode = O_RDWR;
+
+ if (mode & SND_RAWMIDI_APPEND) {
+ assert(outputp);
+ fmode |= O_APPEND;
+ }
+
+ if (mode & SND_RAWMIDI_NONBLOCK) {
+ fmode |= O_NONBLOCK;
+ }
+
+ if (mode & SND_RAWMIDI_SYNC) {
+ fmode |= O_SYNC;
+ }
+
+ assert(!(mode & ~(SND_RAWMIDI_APPEND|SND_RAWMIDI_NONBLOCK|SND_RAWMIDI_SYNC)));
+
+ fd = snd_open_device(filename, fmode);
+ if (fd < 0) {
+ snd_card_load(card);
+ fd = snd_open_device(filename, fmode);
+ if (fd < 0) {
+ snd_ctl_close(ctl);
+ SYSERR("open %s failed", filename);
+ return -errno;
+ }
+ }
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ SYSERR("fcntl FD_CLOEXEC failed");
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+#endif
+ if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_PVERSION, &ver) < 0) {
+ ret = -errno;
+ SYSERR("SNDRV_RAWMIDI_IOCTL_PVERSION failed");
+ close(fd);
+ snd_ctl_close(ctl);
+ return ret;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_RAWMIDI_VERSION_MAX)) {
+ close(fd);
+ snd_ctl_close(ctl);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ if (subdevice >= 0) {
+ memset(&info, 0, sizeof(info));
+ info.stream = outputp ? SNDRV_RAWMIDI_STREAM_OUTPUT : SNDRV_RAWMIDI_STREAM_INPUT;
+ if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_INFO, &info) < 0) {
+ SYSERR("SNDRV_RAWMIDI_IOCTL_INFO failed");
+ ret = -errno;
+ close(fd);
+ snd_ctl_close(ctl);
+ return ret;
+ }
+ if (info.subdevice != (unsigned int) subdevice) {
+ close(fd);
+ goto __again;
+ }
+ }
+ snd_ctl_close(ctl);
+
+ hw = calloc(1, sizeof(snd_rawmidi_hw_t));
+ if (hw == NULL)
+ goto _nomem;
+ hw->card = card;
+ hw->device = device;
+ hw->subdevice = subdevice;
+ hw->fd = fd;
+
+ if (inputp) {
+ rmidi = calloc(1, sizeof(snd_rawmidi_t));
+ if (rmidi == NULL)
+ goto _nomem;
+ if (name)
+ rmidi->name = strdup(name);
+ rmidi->type = SND_RAWMIDI_TYPE_HW;
+ rmidi->stream = SND_RAWMIDI_STREAM_INPUT;
+ rmidi->mode = mode;
+ rmidi->poll_fd = fd;
+ rmidi->ops = &snd_rawmidi_hw_ops;
+ rmidi->private_data = hw;
+ hw->open++;
+ *inputp = rmidi;
+ }
+ if (outputp) {
+ rmidi = calloc(1, sizeof(snd_rawmidi_t));
+ if (rmidi == NULL)
+ goto _nomem;
+ if (name)
+ rmidi->name = strdup(name);
+ rmidi->type = SND_RAWMIDI_TYPE_HW;
+ rmidi->stream = SND_RAWMIDI_STREAM_OUTPUT;
+ rmidi->mode = mode;
+ rmidi->poll_fd = fd;
+ rmidi->ops = &snd_rawmidi_hw_ops;
+ rmidi->private_data = hw;
+ hw->open++;
+ *outputp = rmidi;
+ }
+ return 0;
+
+ _nomem:
+ close(fd);
+ free(hw);
+ if (inputp)
+ free(*inputp);
+ if (outputp)
+ free(*outputp);
+ return -ENOMEM;
+}
+
+int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ char *name, snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ long card = -1, device = 0, subdevice = -1;
+ const char *str;
+ int err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_rawmidi_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0)
+ return -EINVAL;
+ card = snd_card_get_index(str);
+ if (card < 0)
+ return card;
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ return -EINVAL;
+ }
+ if (card < 0)
+ return -EINVAL;
+ return snd_rawmidi_hw_open(inputp, outputp, name, card, device, subdevice, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);
diff --git a/alsa-lib/src/rawmidi/rawmidi_local.h b/alsa-lib/src/rawmidi/rawmidi_local.h
new file mode 100644
index 0000000..3388502
--- /dev/null
+++ b/alsa-lib/src/rawmidi/rawmidi_local.h
@@ -0,0 +1,61 @@
+/*
+ * Rawmidi interface - local header file
+ * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "local.h"
+
+typedef struct {
+ int (*close)(snd_rawmidi_t *rawmidi);
+ int (*nonblock)(snd_rawmidi_t *rawmidi, int nonblock);
+ int (*info)(snd_rawmidi_t *rawmidi, snd_rawmidi_info_t *info);
+ int (*params)(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params);
+ int (*status)(snd_rawmidi_t *rawmidi, snd_rawmidi_status_t *status);
+ int (*drop)(snd_rawmidi_t *rawmidi);
+ int (*drain)(snd_rawmidi_t *rawmidi);
+ ssize_t (*write)(snd_rawmidi_t *rawmidi, const void *buffer, size_t size);
+ ssize_t (*read)(snd_rawmidi_t *rawmidi, void *buffer, size_t size);
+} snd_rawmidi_ops_t;
+
+struct _snd_rawmidi {
+ void *dl_handle;
+ char *name;
+ snd_rawmidi_type_t type;
+ snd_rawmidi_stream_t stream;
+ int mode;
+ int poll_fd;
+ const snd_rawmidi_ops_t *ops;
+ void *private_data;
+ size_t buffer_size;
+ size_t avail_min;
+ unsigned int no_active_sensing: 1;
+};
+
+int snd_rawmidi_hw_open(snd_rawmidi_t **input, snd_rawmidi_t **output,
+ const char *name, int card, int device, int subdevice,
+ int mode);
+
+int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, snd_seq_t *seq_handle, int port,
+ int merge, int mode);
+
+int snd_rawmidi_conf_generic_id(const char *id);
diff --git a/alsa-lib/src/rawmidi/rawmidi_symbols.c b/alsa-lib/src/rawmidi/rawmidi_symbols.c
new file mode 100644
index 0000000..cdc06d7
--- /dev/null
+++ b/alsa-lib/src/rawmidi/rawmidi_symbols.c
@@ -0,0 +1,36 @@
+/*
+ * RawMidi Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+extern const char *_snd_module_rawmidi_hw;
+extern const char *_snd_module_rawmidi_virt;
+
+static const char **snd_rawmidi_open_objects[] = {
+ &_snd_module_rawmidi_hw,
+ &_snd_module_rawmidi_virt
+};
+
+void *snd_rawmidi_open_symbols(void)
+{
+ return snd_rawmidi_open_objects;
+}
+
+#endif /* !PIC */
diff --git a/alsa-lib/src/rawmidi/rawmidi_virt.c b/alsa-lib/src/rawmidi/rawmidi_virt.c
new file mode 100644
index 0000000..52b8984
--- /dev/null
+++ b/alsa-lib/src/rawmidi/rawmidi_virt.c
@@ -0,0 +1,469 @@
+/*
+ * RawMIDI - Virtual (sequencer mode)
+ * Copyright (c) 2003 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "rawmidi_local.h"
+#include "seq.h"
+#include "seq_midi_event.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_rawmidi_virt = "";
+#endif
+
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ int open;
+
+ snd_seq_t *handle;
+ int port;
+
+ snd_midi_event_t *midi_event;
+
+ snd_seq_event_t *in_event;
+ int in_buf_size;
+ int in_buf_ofs;
+ char *in_buf_ptr;
+ char in_tmp_buf[16];
+
+ snd_seq_event_t out_event;
+ int pending;
+} snd_rawmidi_virtual_t;
+
+int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
+ int streams, int mode, snd_config_t *lconf,
+ snd_config_t *parent_conf);
+#endif
+
+static int snd_rawmidi_virtual_close(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ virt->open--;
+ if (virt->open)
+ return 0;
+ snd_seq_close(virt->handle);
+ if (virt->midi_event)
+ snd_midi_event_free(virt->midi_event);
+ free(virt);
+ return 0;
+}
+
+static int snd_rawmidi_virtual_nonblock(snd_rawmidi_t *rmidi, int nonblock)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+
+ return snd_seq_nonblock(virt->handle, nonblock);
+}
+
+static int snd_rawmidi_virtual_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
+{
+ // snd_rawmidi_virtual_t *virt = rmidi->private_data;
+
+ info->stream = rmidi->stream;
+ /* FIXME: what values should be there? */
+ info->card = 0;
+ info->device = 0;
+ info->subdevice = 0;
+ info->flags = 0;
+ strcpy((char *)info->id, "Virtual");
+ strcpy((char *)info->name, "Virtual RawMIDI");
+ strcpy((char *)info->subname, "Virtual RawMIDI");
+ info->subdevices_count = 1;
+ info->subdevices_avail = 0;
+ return 0;
+}
+
+static int snd_rawmidi_virtual_input_params(snd_rawmidi_virtual_t *virt, snd_rawmidi_params_t *params)
+{
+ int err;
+
+ // snd_rawmidi_drain_input(substream);
+ if (params->buffer_size < sizeof(snd_seq_event_t) ||
+ params->buffer_size > 1024L * 1024L) {
+ return -EINVAL;
+ }
+ if (params->buffer_size != snd_seq_get_input_buffer_size(virt->handle)) {
+ err = snd_seq_set_input_buffer_size(virt->handle, params->buffer_size);
+ if (err < 0)
+ return err;
+ params->buffer_size = snd_seq_get_input_buffer_size(virt->handle);
+ /* FIXME: input pool size? */
+ }
+ return 0;
+}
+
+
+static int snd_rawmidi_virtual_output_params(snd_rawmidi_virtual_t *virt, snd_rawmidi_params_t *params)
+{
+ int err;
+
+ // snd_rawmidi_drain_output(substream);
+ if (params->buffer_size < sizeof(snd_seq_event_t) ||
+ params->buffer_size > 1024L * 1024L) {
+ return -EINVAL;
+ }
+ if (params->buffer_size != snd_seq_get_output_buffer_size(virt->handle)) {
+ err = snd_seq_set_output_buffer_size(virt->handle, params->buffer_size);
+ if (err < 0)
+ return err;
+ params->buffer_size = snd_seq_get_output_buffer_size(virt->handle);
+ }
+ return 0;
+}
+
+
+static int snd_rawmidi_virtual_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ params->stream = rmidi->stream;
+
+ if (rmidi->stream == SND_RAWMIDI_STREAM_INPUT)
+ return snd_rawmidi_virtual_input_params(virt, params);
+ else
+ return snd_rawmidi_virtual_output_params(virt, params);
+}
+
+static int snd_rawmidi_virtual_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status)
+{
+ // snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ memset(status, 0, sizeof(*status));
+ status->stream = rmidi->stream;
+ return 0;
+}
+
+static int snd_rawmidi_virtual_drop(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ if (rmidi->stream == SND_RAWMIDI_STREAM_OUTPUT) {
+ snd_seq_drop_output(virt->handle);
+ snd_midi_event_reset_encode(virt->midi_event);
+ virt->pending = 0;
+ } else {
+ snd_seq_drop_input(virt->handle);
+ snd_midi_event_reset_decode(virt->midi_event);
+ virt->in_buf_ofs = 0;
+ }
+ return 0;
+}
+
+static int snd_rawmidi_virtual_drain(snd_rawmidi_t *rmidi)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ int err;
+
+ if (rmidi->stream == SND_RAWMIDI_STREAM_OUTPUT) {
+ if (virt->pending) {
+ err = snd_seq_event_output(virt->handle, &virt->out_event);
+ if (err < 0)
+ return err;
+ virt->pending = 0;
+ }
+ snd_seq_drain_output(virt->handle);
+ snd_seq_sync_output_queue(virt->handle);
+ }
+ return snd_rawmidi_virtual_drop(rmidi);
+}
+
+static ssize_t snd_rawmidi_virtual_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ ssize_t result = 0;
+ ssize_t size1;
+ int err;
+
+ if (virt->pending) {
+ err = snd_seq_event_output(virt->handle, &virt->out_event);
+ if (err < 0) {
+ if (err != -EAGAIN)
+ /* we got some fatal error. removing this event
+ * at the next time
+ */
+ virt->pending = 0;
+ return err;
+ }
+ virt->pending = 0;
+ }
+
+ while (size > 0) {
+ size1 = snd_midi_event_encode(virt->midi_event, buffer, size, &virt->out_event);
+ if (size1 <= 0)
+ break;
+ size -= size1;
+ result += size1;
+ buffer += size1;
+ if (virt->out_event.type == SND_SEQ_EVENT_NONE)
+ continue;
+ snd_seq_ev_set_subs(&virt->out_event);
+ snd_seq_ev_set_source(&virt->out_event, virt->port);
+ snd_seq_ev_set_direct(&virt->out_event);
+ err = snd_seq_event_output(virt->handle, &virt->out_event);
+ if (err < 0) {
+ virt->pending = 1;
+ return result > 0 ? result : err;
+ }
+ }
+
+ if (result > 0)
+ snd_seq_drain_output(virt->handle);
+
+ return result;
+}
+
+static ssize_t snd_rawmidi_virtual_read(snd_rawmidi_t *rmidi, void *buffer, size_t size)
+{
+ snd_rawmidi_virtual_t *virt = rmidi->private_data;
+ ssize_t result = 0;
+ int size1, err;
+
+ while (size > 0) {
+ if (! virt->in_buf_ofs) {
+ err = snd_seq_event_input_pending(virt->handle, 1);
+ if (err <= 0 && result > 0)
+ return result;
+ err = snd_seq_event_input(virt->handle, &virt->in_event);
+ if (err < 0)
+ return result > 0 ? result : err;
+
+ if (virt->in_event->type == SND_SEQ_EVENT_SYSEX) {
+ virt->in_buf_ptr = virt->in_event->data.ext.ptr;
+ virt->in_buf_size = virt->in_event->data.ext.len;
+ } else {
+ virt->in_buf_ptr = virt->in_tmp_buf;
+ virt->in_buf_size = snd_midi_event_decode(virt->midi_event,
+ (unsigned char *)virt->in_tmp_buf,
+ sizeof(virt->in_tmp_buf),
+ virt->in_event);
+ }
+ if (virt->in_buf_size <= 0)
+ continue;
+ }
+ size1 = virt->in_buf_size - virt->in_buf_ofs;
+ if ((size_t)size1 > size) {
+ virt->in_buf_ofs += size1 - size;
+ memcpy(buffer, virt->in_buf_ptr, size);
+ result += size;
+ break;
+ }
+ memcpy(buffer, virt->in_buf_ptr + virt->in_buf_ofs, size1);
+ size -= size1;
+ result += size1;
+ buffer += size1;
+ virt->in_buf_ofs = 0;
+ }
+
+ return result;
+}
+
+static const snd_rawmidi_ops_t snd_rawmidi_virtual_ops = {
+ .close = snd_rawmidi_virtual_close,
+ .nonblock = snd_rawmidi_virtual_nonblock,
+ .info = snd_rawmidi_virtual_info,
+ .params = snd_rawmidi_virtual_params,
+ .status = snd_rawmidi_virtual_status,
+ .drop = snd_rawmidi_virtual_drop,
+ .drain = snd_rawmidi_virtual_drain,
+ .write = snd_rawmidi_virtual_write,
+ .read = snd_rawmidi_virtual_read,
+};
+
+
+/*! \page rawmidi RawMidi interface
+
+\section rawmidi_virt Virtual RawMidi interface
+
+The "virtual" plugin creates a virtual RawMidi instance on the ALSA
+sequencer, which can be accessed through the connection of the sequencer
+ports.
+There is no connection established as default.
+
+For creating a virtual RawMidi instance, pass "virtual" as its name at
+creation.
+
+Example:
+\code
+snd_rawmidi_open(&read_handle, &write_handle, "virtual", 0);
+\endcode
+
+*/
+
+int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ const char *name, snd_seq_t *seq_handle, int port,
+ int merge, int mode)
+{
+ int err;
+ snd_rawmidi_t *rmidi;
+ snd_rawmidi_virtual_t *virt = NULL;
+ struct pollfd pfd;
+
+ if (inputp)
+ *inputp = 0;
+ if (outputp)
+ *outputp = 0;
+
+ virt = calloc(1, sizeof(*virt));
+ if (virt == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ virt->handle = seq_handle;
+ virt->port = port;
+ err = snd_midi_event_new(256, &virt->midi_event);
+ if (err < 0)
+ goto _err;
+ snd_midi_event_init(virt->midi_event);
+ snd_midi_event_no_status(virt->midi_event, !merge);
+
+ if (inputp) {
+ rmidi = calloc(1, sizeof(*rmidi));
+ if (rmidi == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ if (name)
+ rmidi->name = strdup(name);
+ rmidi->type = SND_RAWMIDI_TYPE_VIRTUAL;
+ rmidi->stream = SND_RAWMIDI_STREAM_INPUT;
+ rmidi->mode = mode;
+ err = snd_seq_poll_descriptors(seq_handle, &pfd, 1, POLLIN);
+ if (err < 0)
+ goto _err;
+ rmidi->poll_fd = pfd.fd;
+ rmidi->ops = &snd_rawmidi_virtual_ops;
+ rmidi->private_data = virt;
+ virt->open++;
+ *inputp = rmidi;
+ }
+ if (outputp) {
+ rmidi = calloc(1, sizeof(*rmidi));
+ if (rmidi == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ if (name)
+ rmidi->name = strdup(name);
+ rmidi->type = SND_RAWMIDI_TYPE_VIRTUAL;
+ rmidi->stream = SND_RAWMIDI_STREAM_OUTPUT;
+ rmidi->mode = mode;
+ err = snd_seq_poll_descriptors(seq_handle, &pfd, 1, POLLOUT);
+ if (err < 0)
+ goto _err;
+ rmidi->poll_fd = pfd.fd;
+ rmidi->ops = &snd_rawmidi_virtual_ops;
+ rmidi->private_data = virt;
+ virt->open++;
+ *outputp = rmidi;
+ }
+
+ return 0;
+
+ _err:
+ if (seq_handle)
+ snd_seq_close(seq_handle);
+ if (virt->midi_event)
+ snd_midi_event_free(virt->midi_event);
+ free(virt);
+ if (inputp)
+ free(*inputp);
+ if (outputp)
+ free(*outputp);
+ return err;
+}
+
+int _snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
+ char *name, snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ const char *slave_str = NULL;
+ int err;
+ int streams, seq_mode;
+ int merge = 1;
+ int port;
+ unsigned int caps;
+ snd_seq_t *seq_handle;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (snd_rawmidi_conf_generic_id(id))
+ continue;
+ if (strcmp(id, "slave") == 0) {
+ err = snd_config_get_string(n, &slave_str);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "merge") == 0) {
+ merge = snd_config_get_bool(n);
+ continue;
+ }
+ return -EINVAL;
+ }
+
+ streams = 0;
+ if (inputp)
+ streams |= SND_SEQ_OPEN_INPUT;
+ if (outputp)
+ streams |= SND_SEQ_OPEN_OUTPUT;
+ if (! streams)
+ return -EINVAL;
+
+ seq_mode = 0;
+ if (mode & SND_RAWMIDI_NONBLOCK)
+ seq_mode |= SND_SEQ_NONBLOCK;
+
+ if (! slave_str)
+ slave_str = "default";
+ err = _snd_seq_open_lconf(&seq_handle, slave_str, streams, seq_mode,
+ root, conf);
+ if (err < 0)
+ return err;
+
+ caps = 0;
+ if (inputp)
+ caps |= SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SYNC_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE;
+ if (outputp)
+ caps |= SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SYNC_READ | SND_SEQ_PORT_CAP_SUBS_READ;
+ if (inputp && outputp)
+ caps |= SNDRV_SEQ_PORT_CAP_DUPLEX;
+
+ port = snd_seq_create_simple_port(seq_handle, "Virtual RawMIDI",
+ caps, SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC);
+ if (port < 0) {
+ snd_seq_close(seq_handle);
+ return port;
+ }
+
+ return snd_rawmidi_virtual_open(inputp, outputp, name, seq_handle, port,
+ merge, mode);
+}
+
+#ifndef DOC_HIDDEN
+SND_DLSYM_BUILD_VERSION(_snd_rawmidi_virtual_open, SND_RAWMIDI_DLSYM_VERSION);
+#endif
diff --git a/alsa-lib/src/seq/Makefile.am b/alsa-lib/src/seq/Makefile.am
new file mode 100644
index 0000000..1ea92f0
--- /dev/null
+++ b/alsa-lib/src/seq/Makefile.am
@@ -0,0 +1,13 @@
+EXTRA_LTLIBRARIES=libseq.la
+
+libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c \
+ seq_symbols.c
+if KEEP_OLD_SYMBOLS
+libseq_la_SOURCES += seq_old.c
+endif
+noinst_HEADERS = seq_local.h
+
+all: libseq.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/seq/Makefile.in b/alsa-lib/src/seq/Makefile.in
new file mode 100644
index 0000000..0263db6
--- /dev/null
+++ b/alsa-lib/src/seq/Makefile.in
@@ -0,0 +1,530 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@KEEP_OLD_SYMBOLS_TRUE@am__append_1 = seq_old.c
+subdir = src/seq
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libseq_la_LIBADD =
+am__libseq_la_SOURCES_DIST = seq_hw.c seq.c seq_event.c seqmid.c \
+ seq_midi_event.c seq_symbols.c seq_old.c
+@KEEP_OLD_SYMBOLS_TRUE@am__objects_1 = seq_old.lo
+am_libseq_la_OBJECTS = seq_hw.lo seq.lo seq_event.lo seqmid.lo \
+ seq_midi_event.lo seq_symbols.lo $(am__objects_1)
+libseq_la_OBJECTS = $(am_libseq_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libseq_la_SOURCES)
+DIST_SOURCES = $(am__libseq_la_SOURCES_DIST)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libseq.la
+libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c \
+ seq_midi_event.c seq_symbols.c $(am__append_1)
+noinst_HEADERS = seq_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/seq/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/seq/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libseq.la: $(libseq_la_OBJECTS) $(libseq_la_DEPENDENCIES)
+ $(LINK) $(libseq_la_LDFLAGS) $(libseq_la_OBJECTS) $(libseq_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_event.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_midi_event.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_old.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_symbols.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seqmid.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+
+all: libseq.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/seq/seq.c b/alsa-lib/src/seq/seq.c
new file mode 100644
index 0000000..feb9733
--- /dev/null
+++ b/alsa-lib/src/seq/seq.c
@@ -0,0 +1,4783 @@
+/**
+ * \file seq/seq.c
+ * \brief Sequencer Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2000-2001
+ *
+ * See \ref seq page for more details.
+ */
+
+/*
+ * Sequencer Interface - main file
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page seq Sequencer interface
+
+\section seq_general Genral
+
+The ALSA sequencer interface is designed to deliver the MIDI-like
+events between clients/ports.
+A typical usage is the MIDI patch-bay. A MIDI application can be
+connected arbitrarily from/to the other MIDI clients.
+The routing between clients can be changed dynamically, so the
+application can handle incoming or outgoing MIDI events regardless of
+the devices or the application connections.
+
+The sequencer core stuff only takes care of two things:
+scheduling events and dispatching them to the destination at the
+right time. All processing of MIDI events has to be done within the clients.
+The event can be dispatched immediately without queueing, too.
+The event scheduling can be done either on a MIDI tempo queue or
+on a wallclock-time queue.
+
+\section seq_client Client and Port
+
+A <i>client</i> is created at each time #snd_seq_open() is called.
+Later on, the attributes of client such as its name string can be changed
+via #snd_seq_set_client_info(). There are helper functions for ease of use,
+e.g. #snd_seq_set_client_name() and #snd_seq_set_client_event_filter().
+A typical code would be like below:
+\code
+// create a new client
+snd_seq_t *open_client()
+{
+ snd_seq_t *handle;
+ int err;
+ err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
+ if (err < 0)
+ return NULL;
+ snd_seq_set_client_name(handle, "My Client");
+ return handle;
+}
+\endcode
+
+You'll need to know the id number of the client eventually, for example,
+when accessing to a certain port (see the section \ref seq_subs).
+The client id can be obtained by #snd_seq_client_id() function.
+
+A client can have one or more <i>ports</i> to communicate between other
+clients. A port is corresponding to the MIDI port in the case of MIDI device,
+but in general it is nothing but the access point between other clients.
+Each port may have capability flags, which specify the read/write
+accessbility and subscription permissions of the port.
+For creation of a port, call #snd_seq_create_port()
+with the appropirate port attribute specified in #snd_seq_port_info_t
+reocrd.
+
+For creating a port for the normal use, there is a helper function
+#snd_seq_create_simple_port(). An example with this function is like below.
+\code
+// create a new port; return the port id
+// port will be writable and accept the write-subscription.
+int my_new_port(snd_seq_t *handle)
+{
+ return snd_seq_create_simple_port(handle, "my port",
+ SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+}
+\endcode
+
+\section seq_memory Memory Pool
+
+Each client owns memory pools on kernel space
+for each input and output events.
+Here, input and output mean
+input (read) from other clients and output (write) to others, respectively.
+Since memory pool of each client is independent from others,
+it avoids such a situation that a client eats the whole events pool
+and interfere other clients' responce.
+
+The all scheduled output events or input events from dispatcher are stored
+on these pools until delivered to other clients or extracted to user space.
+The size of input/output pools can be changed independently.
+The output pool has also a room size, which is used to wake up the
+thread when it falls into sleep in blocking write mode.
+
+Note that ports on the same client share the same memory pool.
+If a port fills the memory pool, another can't use it any more.
+For avoiding this, multiple clients can be used.
+
+For chancing the pool size and the condition, access to #snd_seq_client_pool_t
+record. There are helper functions, #snd_seq_set_client_pool_output(),
+#snd_seq_set_client_pool_output_room() and #snd_seq_set_client_pool_input(),
+for setting the total output-pool size, the output-room size and the input-pool
+size, respectively.
+
+\section seq_subs Subscription
+
+One of the new features in ALSA sequencer system is <i>subscription</i> of ports.
+In general, subscription is a connection between two sequencer ports.
+Even though an event can be delivered to a port without subscription
+using an explicit destination address,
+the subscription mechanism provides us more abstraction.
+
+Suppose a MIDI input device which sends events from a keyboard.
+The port associated with this device has READ capability - which means
+this port is readable from other ports.
+If a user program wants to capture events from keyboard and store them
+as MIDI stream, this program must subscribe itself to the MIDI port
+for read.
+Then, a connection from MIDI input port to this program is established.
+From this time, events from keyboard are automatically sent to this program.
+Timestamps will be updated according to the subscribed queue.
+\code
+ MIDI input port (keyboard)
+ |
+ V
+ ALSA sequencer - update timestamp
+ |
+ V
+ application port
+\endcode
+
+There is another subscription type for opposite direction:
+Suppose a MIDI sequencer program which sends events to a MIDI output device.
+In ALSA system, MIDI device is not opened until the associated MIDI port
+is accessed. Thus, in order to activate MIDI device, we have to subscribe
+to MIDI port for write.
+After this connection is established, events will be properly sent
+to MIDI output device.
+\code
+ application port
+ |
+ V
+ ALSA sequencer - events are scheduled
+ |
+ V
+ MIDI output port (WaveTable etc.)
+\endcode
+
+From the viewpoint of subscription, the examples above are special cases.
+Basically, subscription means the connection between two arbitrary ports.
+For example, imagine a filter application which modifies
+the MIDI events like program, velocity or chorus effects.
+This application can accept arbitrary MIDI input
+and send to arbitrary port, just like a Unix pipe application using
+stdin and stdout files.
+We can even connect several filter applictions which work individually
+in order to process the MIDI events.
+Subscription can be used for this purpose.
+The connection between ports can be done also by the "third" client.
+Thus, filter applications have to manage
+only input and output events regardless of receiver/sender addresses.
+\code
+ sequencer port #1
+ |
+ V
+ ALSA sequencer (scheduled or real-time)
+ |
+ V
+ sequencer port #2
+\endcode
+
+For the detail about subscription, see the section \ref seq_subs_more.
+
+\section seq_events Sequencer Events
+
+Messaging between clients is performed by sending events from one client to
+another. These events contain high-level MIDI oriented messages or sequencer
+specific messages.
+
+All the sequencer events are stored in a sequencer event record,
+#snd_seq_event_t type.
+Application can send and receive these event records to/from other
+clients via sequencer.
+An event has several stroage types according to its usage.
+For example, a SYSEX message is stored on the variable length event,
+and a large synth sample data is delivered using a user-space data pointer.
+
+
+\subsection seq_ev_struct Structure of an event
+
+An event consists of the following items:
+<ul>
+<li>The type of the event
+<li>Event flags. It describes various conditions:
+ <ul>
+ <li>time stamp; "real time" / "song ticks"
+ <li>time mode; "absolute" / "relative to current time"
+ </ul>
+<li>Timestamp of the event.
+<li>Scheduling queue id.
+<li>Source address of the event, given by the combination
+ of client id and port id numbers.
+<li>Destination address of the event.
+<li>The actual event data. (up to 12 bytes)
+</ul>
+
+The actual record is shown in #snd_seq_event_t.
+The type field contains the type of the event
+(1 byte).
+The flags field consists of bit flags which
+describe several conditions of the event (1 byte).
+It includes the time-stamp mode, data storage type, and scheduling prority.
+The tag field is an arbitrary tag.
+This tag can used for removing a distinct event from the event queue
+via #snd_seq_remove_events().
+The queue field is the queue id for scheduling.
+The source and dest fields are source and destination addresses.
+The data field is a union of event data.
+
+\subsection seq_ev_queue Scheduling queue
+
+An event can be delivered either on scheduled or direct dispatch mode.
+On the scheduling mode, an event is once stored on the priority queue
+and delivered later (or even immediately) to the destination,
+whereas on the direct disatch mode, an event is passed to the destination
+without any queue.
+
+For a scheduled delivery, a queue to process the event must exist.
+Usually, a client creates its own queue by
+#snd_seq_alloc_queue() function.
+Alternatively, a queue may be shared among several clients.
+For scheduling an event on the specified queue,
+a client needs to fill queue field
+with the preferred queue id.
+
+Meanwhile, for dispatching an event directly, just
+use #SND_SEQ_QUEUE_DIRECT as the target queue id.
+A macro #snd_seq_ev_set_direct() is provided for ease
+and compatibility.
+
+Note that scheduling at the current or earlier time is different
+from the direct dispatch mode even though the event is delivered immediately.
+On the former scheme, an event is once stored on priority queue, then
+delivered actually. Thus, it acquires a space from memory pool.
+On the other hand, the latter is passed without using memory pool.
+Although the direct dispatched event needs less memory, it means also
+that the event cannot be resent if the destination is unable to receive it
+momentarily.
+
+\subsection seq_ev_time Time stamp
+
+The timestamp of the event can either specified in
+<i>real time</i> or in <i>song ticks</i>.
+The former means the wallclock time while the latter corresponds to
+the MIDI ticks.
+Which format is used is determined by the event flags.
+
+The resolution of real-time value is in nano second.
+Since 64 bit length is required for the actual time calculation,
+it is represented by
+a structure of pair of second and nano second
+defined as #snd_seq_real_time_t type.
+The song tick is defined simply as a 32 bit integer,
+defined as #snd_seq_tick_time_t type.
+The time stored in an event record is a union of these two different
+time values.
+
+Note that the time format used for real time events is very similar to
+timeval struct used for unix system time.
+The absurd resolution of the timestamps allows us to perform very accurate
+conversions between songposition and real time. Round-off errors can be
+neglected.
+
+If a timestamp with a
+<i>relative</i> timestamp is delivered to ALSA, the
+specified timestamp will be used as an offset to the current time of the
+queue the event is sent into.
+An <i>absolute</i> timestamp is on the contrary the time
+counted from the moment when the queue started.
+
+An client that relies on these relative timestamps is the MIDI input port.
+As each sequencer queue has it's own clock the only way to deliver events at
+the right time is by using the relative timestamp format. When the event
+arrives at the queue it is normalised to absolute format.
+
+The timestamp format is specified in the flag bitfield masked by
+#SND_SEQ_TIME_STAMP_MASK.
+To schedule the event in a real-time queue or in a tick queue,
+macros #snd_seq_ev_schedule_real() and
+#snd_seq_ev_schedule_tick() are provided, respectively.
+
+\subsection seq_ev_addr Source and destination addresses
+
+To identify the source and destination of an event, the addressing field
+contains a combination of client id and port id numbers, defined as
+#snd_seq_addr_t type.
+When an event is passed to sequencer from a client, sequencer fills
+source.client field
+with the sender's id automatically.
+It is the responsibility of sender client to
+fill the port id of source.port and
+both client and port of dest field.
+
+If an existing address is set to the destination,
+the event is simplly delivered to it.
+When #SND_SEQ_ADDRESS_SUBSCRIBERS is set to the destination client id,
+the event is delivered to all the clients connected to the source port.
+
+
+A sequencer core has two pre-defined system ports on the system client
+#SND_SEQ_CLIENT_SYSTEM: #SND_SEQ_PORT_SYSTEM_TIMER and #SND_SEQ_PORT_SYSTEM_ANNOUNCE.
+The #SND_SEQ_PORT_SYSTEM_TIMER is the system timer port,
+and #SND_SEQ_PORT_SYSTEM_ANNOUNCE is the system
+announce port.
+In order to control a queue from a client, client should send a
+queue-control event
+like start, stop and continue queue, change tempo, etc.
+to the system timer port.
+Then the sequencer system handles the queue according to the received event.
+This port supports subscription. The received timer events are
+broadcasted to all subscribed clients.
+
+The latter port does not receive messages but supports subscription.
+When each client or port is attached, detached or modified,
+an announcement is sent to subscribers from this port.
+
+\subsection seq_ev_data Data storage type
+
+Some events like SYSEX message, however, need larger data space
+than the standard data.
+For such events, ALSA sequencer provides seveal different data storage types.
+The data type is specified in the flag bits masked by #SND_SEQ_EVENT_LENGTH_MASK.
+The following data types are available:
+
+\par Fixed size data
+Normal events stores their parameters on
+data field (12 byte).
+The flag-bit type is #SND_SEQ_EVENT_LENGTH_FIXED.
+A macro #snd_seq_ev_set_fixed() is provided to set this type.
+
+\par Variable length data
+SYSEX or a returned error use this type.
+The actual data is stored on an extra allocated space.
+On sequecer kernel, the whole extra-data is duplicated, so that the event
+can be scheduled on queue.
+The data contains only the length and the
+pointer of extra-data.
+The flag-bit type is #SND_SEQ_EVENT_LENGTH_VARIABLE.
+A macro #snd_seq_ev_set_variable() is provided to set this type.
+
+\par User-space data
+This type refers also an extra data space like variable length data,
+but the extra-data is not duplicated but
+but referred as a user-space data on kernel,
+so that it reduces the time and resource for transferring
+large bulk of data like synth sample wave.
+This data type, however, can be used only for direct dispatch mode,
+and supposed to be used only for a special purpose like a bulk data
+transfer.
+The data length and pointer are stored also in
+data.ext field as well as variable length data.
+The flag-bit type is #SND_SEQ_EVENT_LENGTH_VARUSR.
+A macro #snd_seq_ev_set_varusr() is provided to set this type.
+
+\subsection seq_ev_sched Scheduling priority
+
+There are two priorities for scheduling:
+\par Normal priority
+If an event with the same scheduling time is already present on the queue,
+the new event is appended to the older.
+\par High priority
+If an event with the same scheduling time is already present on the queue,
+the new event is inserted before others.
+
+The scheduling priority is set in the flag bitfeld masked by #SND_SEQ_PRIORITY_MASK.
+A macro #snd_seq_ev_set_priority() is provided to set the mode type.
+
+\section seq_queue Event Queues
+\subsection seq_ev_control Creation of a queue
+
+Creating a queue is done usually by calling #snd_seq_alloc_queue.
+You can create a queue with a certain name by #snd_seq_alloc_named_queue(), too.
+\code
+// create a queue and return its id
+int my_queue(snd_seq_t *handle)
+{
+ return snd_seq_alloc_named_queue(handle, "my queue");
+}
+\endcode
+These functions are the wrapper to the function #snd_seq_create_queue().
+For releasing the allocated queue, call #snd_seq_free_queue() with the
+obtained queue id.
+
+Once when a queue is created, the two queues are associated to that
+queue record in fact: one is the realtime queue and another is the
+tick queue. These two queues are bound together to work
+synchronously. Hence, when you schedule an event, you have to choose
+which queue type is used as described in the section \ref
+seq_ev_time.
+
+\subsection seq_ev_tempo Setting queue tempo
+
+The tempo (or the speed) of the scheduling queue is variable.
+In the case of <i>tick</i> queue, the tempo is controlled
+in the manner of MIDI. There are two parameters to define the
+actual tempo, PPQ (pulse per quarter note) and MIDI tempo.
+The former defines the base resolution of the ticks, while
+the latter defines the beat tempo in microseconds.
+As default, 96 PPQ and 120 BPM are used, respectively.
+That is, the tempo is set to 500000 (= 60 * 1000000 / 120).
+Note that PPQ cannot be changed while the queue is running.
+It must be set before the queue is started.
+
+On the other hand, in the case of <i>realtime</i> queue, the
+time resolution is fixed to nanosecononds. There is, however,
+a parameter to change the speed of this queue, called <i>skew</i>.
+You can make the queue faster or slower by setting the skew value
+bigger or smaller. In the API, the skew is defined by two values,
+the skew base and the skew value. The actual skew is the fraction
+of them, <i>value/base</i>. As default, the skew base is set to 16bit
+(0x10000) and the skew value is the identical, so that the queue is
+processed as well as in the real world.
+
+When the tempo of realtime queue is changed, the tempo of
+the associated tick queue is changed together, too.
+That's the reason why two queues are created always.
+This feature can be used to synchronize the event queue with
+the external synchronization source like SMPTE. In such a case,
+the realtime queue is skewed to match with the external source,
+so that both the realtime timestamp and the MIDI timestamp are
+synchronized.
+
+For setting these tempo parameters, use #snd_seq_queue_tempo_t record.
+For example, to set the tempo of the queue <code>q</code> to
+48 PPQ, 60 BPM,
+\code
+void set_tempo(snd_seq_t *handle)
+{
+ snd_seq_queue_tempo_t *tempo;
+ snd_seq_queue_tempo_alloca(&tempo);
+ snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
+ snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
+ snd_seq_set_queue_tempo(handle, tempo);
+}
+\endcode
+
+For changing the (running) queue's tempo on the fly, you can either
+set the tempo via #snd_seq_queue_tempo() or send a MIDI tempo event
+to the system timer port. For example,
+\code
+int change_tempo(snd_seq_t *handle, int q, unsigned int tempo)
+{
+ snd_seq_event_t ev;
+ snd_seq_ev_clear(&ev);
+ ev.dest.client = SND_SEQ_CLIENT_SYSTEM;
+ ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER;
+ ev.source.client = my_client_id;
+ ev.source.port = my_port_id;
+ ev.queue = SND_SEQ_QUEUE_DIRECT; // no scheduling
+ ev.data.queue.queue = q; // affected queue id
+ ev.data.queue.value = tempo; // new tempo in microsec.
+ return snd_seq_event_output(handle, &ev);
+}
+\endcode
+There is a helper function to do this easily,
+#snd_seq_change_queue_tempo().
+Set NULL to the last argument, if you don't need any
+special settings.
+
+In the above example, the tempo is changed immediately after
+the buffer is flushed by #snd_seq_drain_output() call.
+You can schedule the event in a certain queue so that the tempo
+change happes at the scheduled time, too.
+
+\subsection seq_ev_start Starting and stopping a queue
+
+To start, stop, or continue a queue, you need to send a queue-control
+event to the system timer port as well. There are helper functions,
+#snd_seq_start_queue(), #snd_seq_stop_queue() and
+#snd_seq_continue_queue().
+Note that if the last argument of these functions is NULL, the
+event is sent (i.e. operated) immediately after the buffer flush.
+If you want to schedule the event at the certain time, set up
+the event record and provide the pointer of that event record as the
+argument.
+
+Only calling these functions doesn't deliver the event to the
+sequencer core but only put to the output buffer. You'll need to
+call #snd_seq_drain_output() eventually.
+
+
+\section seq_subs_more More inside the subscription
+
+\subsection seq_subs_perm Permissions
+
+Each ALSA port can have capability flags.
+The most basic capability flags are
+#SND_SEQ_PORT_CAP_READ and #SND_SEQ_PORT_CAP_WRITE.
+The former means that the port allows to send events to other ports,
+whereas the latter capability menas
+that the port allows to receive events from other ports.
+You may have noticed that meanings of \c READ and \c WRITE
+are permissions of the port from the viewpoint of other ports.
+
+For allowing subscription from/to other clients, another capability
+flags must be set together with read/write capabilities above.
+For allowing read and write subscriptions,
+#SND_SEQ_PORT_CAP_SUBS_READ and
+#SND_SEQ_PORT_CAP_SUBS_WRITE are used,
+respectively.
+For example, the port with MIDI input device always has
+#SND_SEQ_PORT_CAP_SUBS_READ capability,
+and the port with MIDI output device always has
+#SND_SEQ_PORT_CAP_SUBS_WRITE capability together with
+#SND_SEQ_PORT_CAP_READ and #SND_SEQ_PORT_CAP_WRITE capabilities,
+respectively.
+Obviously, these flags have no influence
+if \c READ or \c WRITE> capability is not set.
+
+Note that these flags are not necessary if the client subscribes itself
+to the spcified port.
+For example, when a port makes READ subscription
+to MIDI input port, this port must have #SND_SEQ_PORT_CAP_WRITE capability,
+but no #SND_SEQ_PORT_CAP_SUBS_WRITE capability is required.
+Only MIDI input port must have #SND_SEQ_PORT_SUBS_READ capability.
+
+As default, the connection of ports via the third client is always allowed
+if proper read and write (subscription) capabilities are set both to the
+source and destination ports.
+For prohibiting this behavior, set a capability
+#SND_SEQ_PORT_CAP_NO_EXPORT to the port.
+If this flag is set, subscription must be done by sender or receiver
+client itself.
+It is useful to avoid unexpected disconnection.
+The ports which won't accept subscription should have this capability
+for better security.
+
+\subsection seq_subs_handle Subscription handlers
+
+In ALSA library, subscription is done via
+#snd_seq_subscribe_port() function.
+It takes the argument of #snd_seq_port_subscribe_t record pointer.
+Suppose that you have a client which will receive data from
+a MIDI input device. The source and destination addresses
+are like the below;
+\code
+snd_seq_addr_t sender, dest;
+sender.client = MIDI_input_client;
+sender.port = MIDI_input_port;
+dest.client = my_client;
+dest.port = my_port;
+\endcode
+To set these values as the connection call like this.
+\code
+snd_seq_port_subscribe_t *subs;
+snd_seq_port_subscribe_alloca(&subs);
+snd_seq_port_subscribe_set_sender(subs, &sender);
+snd_seq_port_subscribe_set_dest(subs, &dest);
+snd_seq_subscribe_port(handle, subs);
+\endcode
+
+When the connection should be exclusively done only between
+a certain pair, set <i>exclusive</i> attribute to the subscription
+record before calling #snd_seq_port_subscribe.
+\code
+snd_seq_port_subscribe_set_exclusive(subs, 1);
+\endcode
+The succeeding subscriptions will be refused.
+
+The timestamp can be updated independently on each connection.
+When set up, the timestamp of incoming queue to the destination port
+is updated automatically to the time of the specified queue.
+\code
+snd_seq_port_subscribe_set_time_update(subs, 1);
+snd_seq_port_subscribe_set_queue(subs, q);
+\endcode
+For getting the wallclock time (sec/nsec pair), set <i>real</i> attribute:
+\code
+snd_seq_port_subscribe_set_time_real(subs, 1);
+\endcode
+Otherwise, the timestamp is stored in tick unit.
+This feature is useful when receiving events from MIDI input device.
+The event time is automatically set in the event record.
+
+Note that an outsider client may connect other ports.
+In this case, however, the subscription may be refused
+if #SND_SEQ_PORT_CAP_NO_EXPORT capability is set in either sender or receiver port.
+
+\section seq_subs_ex Examples of subscription
+
+\subsection seq_subs_ex_capt Capture from keyboard
+
+Assume MIDI input port = 64:0, application port = 128:0, and
+queue for timestamp = 1 with real-time stamp.
+The application port must have capabilty #SND_SEQ_PORT_CAP_WRITE.
+\code
+void capture_keyboard(snd_seq_t *seq)
+{
+ snd_seq_addr_t sender, dest;
+ snd_seq_port_subscribe_t *subs;
+ sender.client = 64;
+ sender.port = 0;
+ dest.client = 128;
+ dest.port = 0;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_sender(subs, &sender);
+ snd_seq_port_subscribe_set_dest(subs, &dest);
+ snd_seq_port_subscribe_set_queue(subs, 1);
+ snd_seq_port_subscribe_set_time_update(subs, 1);
+ snd_seq_port_subscribe_set_time_real(subs, 1);
+ snd_seq_subscribe_port(seq, subs);
+}
+\endcode
+
+\subsection seq_subs_ex_out Output to MIDI device
+
+Assume MIDI output port = 65:1 and application port = 128:0.
+The application port must have capabilty #SND_SEQ_PORT_CAP_READ.
+\code
+void subscribe_output(snd_seq_t *seq)
+{
+ snd_seq_addr_t sender, dest;
+ snd_seq_port_subscribe_t *subs;
+ sender.client = 128;
+ sender.port = 0;
+ dest.client = 65;
+ dest.port = 1;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_sender(subs, &sender);
+ snd_seq_port_subscribe_set_dest(subs, &dest);
+ snd_seq_subscribe_port(seq, subs);
+}
+\endcode
+This example can be simplified by using #snd_seq_connect_to() function.
+\code
+void subscribe_output(snd_seq_t *seq)
+{
+ snd_seq_connect_to(seq, 0, 65, 1);
+}
+\endcode
+
+\subsection seq_subs_ex_arbit Arbitrary connection
+
+Assume connection from application 128:0 to 129:0,
+and that subscription is done by the third application (130:0).
+The sender must have capabilities both
+#SND_SEQ_PORT_CAP_READ and
+#SND_SEQ_PORT_SUBS_READ,
+and the receiver
+#SND_SEQ_PORT_CAP_WRITE and
+#SND_SEQ_PORT_CAP_SUBS_WRITE, respectively.
+\code
+// ..in the third application (130:0) ..
+void coupling(snd_seq_t *seq)
+{
+ snd_seq_addr_t sender, dest;
+ snd_seq_port_subscribe_t *subs;
+ sender.client = 128;
+ sender.port = 0;
+ dest.client = 129;
+ dest.port = 0;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_sender(subs, &sender);
+ snd_seq_port_subscribe_set_dest(subs, &dest);
+ snd_seq_subscribe_port(seq, subs);
+}
+\endcode
+
+\section seq_ex_event Event Processing
+
+\subsection seq_ex_address Addressing
+
+Now, two ports are connected by subscription. Then how to send events?
+
+The subscribed port doesn't have to know the exact sender address.
+Instead, there is a special address for subscribers,
+#SND_SEQ_ADDRESS_SUBSCRIBERS.
+The sender must set this value as the destination client.
+Destination port is ignored.
+
+The other values in source and destination addresses are identical with
+the normal event record.
+If the event is scheduled, proper queue and timestamp values must be set.
+
+There is a convenient function to set the address in an event record.
+In order to set destination as subscribers, use
+#snd_seq_ev_set_subs().
+
+\subsection Scheduled Delivery
+
+If we send an event at the scheduled time <code>t</code> (tick)
+on the queue <code>Q</code>,
+the sender must set both schedule queue and time in the
+event record.
+The program appears like this:
+\code
+void schedule_event(snd_seq_t *seq)
+{
+ snd_seq_event_t ev;
+
+ snd_seq_ev_clear(&ev);
+ snd_seq_ev_set_source(&ev, my_port);
+ snd_seq_ev_set_subs(&ev);
+ snd_seq_ev_schedule_tick(&ev, Q, 0, t);
+ ... // set event type, data, so on..
+
+ snd_seq_event_output(seq, &ev);
+ ...
+ snd_seq_drain_output(seq); // if necessary
+}
+\endcode
+Of course, you can use realtime stamp, too.
+
+\subsection seq_ex_direct Direct Delivery
+
+If the event is sent immediately without enqueued, the sender doesn't take
+care of queue and timestamp.
+As well as the case above, there is a function to set the direct delivery,
+#snd_seq_ev_set_direct().
+The program can be more simplified as follows:
+\code
+void direct_delivery(snd_seq_t *seq)
+{
+ snd_seq_event_t ev;
+
+ snd_seq_ev_clear(&ev);
+ snd_seq_ev_set_source(&ev, port);
+ snd_seq_ev_set_subs(&ev);
+ snd_seq_ev_set_direct(&ev);
+ ... // set event type, data, so on..
+
+ snd_seq_event_output(seq, &ev);
+ snd_seq_drain_output(seq);
+}
+\endcode
+You should flush event soon after output event.
+Otherwise, the event is enqueued on output queue of ALSA library
+(not in the kernel!), and will be never processed until
+this queue becomes full.
+
+\subsection seq_ex_filter Filter Application
+
+A typical filter program, which receives an event and sends it immediately
+after some modification, will appear as following:
+\code
+void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
+{
+ while (snd_seq_event_input(seq, &ev) >= 0) {
+ //.. modify input event ..
+
+ snd_seq_ev_set_source(ev, my_port);
+ snd_seq_ev_set_subs(ev);
+ snd_seq_ev_set_direct(ev);
+ snd_seq_event_output(seq, ev);
+ snd_seq_drain_output(seq);
+ }
+}
+\endcode
+
+*/
+
+#include <sys/poll.h>
+#include "seq_local.h"
+
+/****************************************************************************
+ * *
+ * seq.h *
+ * Sequencer *
+ * *
+ ****************************************************************************/
+
+/**
+ * \brief get identifier of sequencer handle
+ * \param seq sequencer handle
+ * \return ascii identifier of sequencer handle
+ *
+ * Returns the ASCII identifier of the given sequencer handle. It's the same
+ * identifier specified in snd_seq_open().
+ *
+ * \sa snd_seq_open()
+ */
+const char *snd_seq_name(snd_seq_t *seq)
+{
+ assert(seq);
+ return seq->name;
+}
+
+/**
+ * \brief get type of sequencer handle
+ * \param seq sequencer handle
+ * \return type of sequencer handle
+ *
+ * Returns the type #snd_seq_type_t of the given sequencer handle.
+ *
+ * \sa snd_seq_open()
+ */
+snd_seq_type_t snd_seq_type(snd_seq_t *seq)
+{
+ assert(seq);
+ return seq->type;
+}
+
+static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
+ snd_config_t *seq_root, snd_config_t *seq_conf,
+ int streams, int mode)
+{
+ const char *str;
+ char buf[256];
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_seq_t **, const char *,
+ snd_config_t *, snd_config_t *,
+ int, int) = NULL;
+#ifndef PIC
+ extern void *snd_seq_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for SEQ %s definition", name);
+ else
+ SNDERR("Invalid type for SEQ definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(seq_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(seq_root, "seq_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for SEQ type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str);
+ }
+#ifndef PIC
+ snd_seq_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (! err) {
+ err = open_func(seqp, name, seq_root, seq_conf, streams, mode);
+ if (err < 0)
+ snd_dlclose(h);
+ else
+ (*seqp)->dl_handle = h;
+ }
+ return err;
+}
+
+static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
+ const char *name, int streams, int mode,
+ int hop)
+{
+ int err;
+ snd_config_t *seq_conf;
+ err = snd_config_search_definition(root, "seq", name, &seq_conf);
+ if (err < 0) {
+ SNDERR("Unknown SEQ %s", name);
+ return err;
+ }
+ snd_config_set_hop(seq_conf, hop);
+ err = snd_seq_open_conf(seqp, name, root, seq_conf, streams, mode);
+ snd_config_delete(seq_conf);
+ return err;
+}
+
+
+/**
+ * \brief Open the ALSA sequencer
+ *
+ * \param seqp Pointer to a snd_seq_t pointer. This pointer must be
+ * kept and passed to most of the other sequencer functions.
+ * \param name The sequencer's "name". This is \em not a name you make
+ * up for your own purposes; it has special significance to the ALSA
+ * library. Usually you need to pass \c "default" here.
+ * \param streams The read/write mode of the sequencer. Can be one of
+ * three values:
+ * - #SND_SEQ_OPEN_OUTPUT - open the sequencer for output only
+ * - #SND_SEQ_OPEN_INPUT - open the sequencer for input only
+ * - #SND_SEQ_OPEN_DUPLEX - open the sequencer for output and input
+ * \note Internally, these are translated to \c O_WRONLY, \c O_RDONLY and
+ * \c O_RDWR respectively and used as the second argument to the C library
+ * open() call.
+ * \param mode Optional modifier. Can be either 0, or
+ * #SND_SEQ_NONBLOCK, which will make read/write operations
+ * non-blocking. This can also be set later using #snd_seq_nonblock().
+ * \return 0 on success otherwise a negative error code
+ *
+ * Creates a new handle and opens a connection to the kernel
+ * sequencer interface.
+ * After a client is created successfully, an event
+ * with #SND_SEQ_EVENT_CLIENT_START is broadcast to announce port.
+ *
+ * \sa snd_seq_open_lconf(), snd_seq_close(), snd_seq_type(), snd_seq_name(),
+ * snd_seq_nonblock(), snd_seq_client_id()
+ */
+int snd_seq_open(snd_seq_t **seqp, const char *name,
+ int streams, int mode)
+{
+ int err;
+ assert(seqp && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_seq_open_noupdate(seqp, snd_config, name, streams, mode, 0);
+}
+
+/**
+ * \brief Open the ALSA sequencer using local configuration
+ *
+ * \param seqp Pointer to a snd_seq_t pointer.
+ * \param name The name to open
+ * \param streams The read/write mode of the sequencer.
+ * \param mode Optional modifier
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ *
+ * See the snd_seq_open() function for further details. The extension
+ * is that the given configuration is used to resolve abstract name.
+ *
+ * \sa snd_seq_open()
+ */
+int snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
+ int streams, int mode, snd_config_t *lconf)
+{
+ assert(seqp && name && lconf);
+ return snd_seq_open_noupdate(seqp, lconf, name, streams, mode, 0);
+}
+
+#ifndef DOC_HIDDEN
+int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
+ int streams, int mode, snd_config_t *lconf,
+ snd_config_t *parent_conf)
+{
+ int hop;
+ assert(seqp && name && lconf);
+ if ((hop = snd_config_check_hop(parent_conf)) < 0)
+ return hop;
+ return snd_seq_open_noupdate(seqp, lconf, name, streams, mode, hop + 1);
+}
+#endif
+
+/**
+ * \brief Close the sequencer
+ * \param seq Handle returned from #snd_seq_open()
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the sequencer client and releases its resources.
+ * After a client is closed, an event with
+ * #SND_SEQ_EVENT_CLIENT_EXIT is broadcast to announce port.
+ * The connection between other clients are disconnected.
+ * Call this just before exiting your program.
+ *
+ * \sa snd_seq_close()
+ */
+int snd_seq_close(snd_seq_t *seq)
+{
+ int err;
+ assert(seq);
+ err = seq->ops->close(seq);
+ if (seq->dl_handle)
+ snd_dlclose(seq->dl_handle);
+ free(seq->obuf);
+ free(seq->ibuf);
+ free(seq->tmpbuf);
+ free(seq->name);
+ free(seq);
+ return err;
+}
+
+/**
+ * \brief Returns the number of poll descriptors
+ * \param seq sequencer handle
+ * \param events the poll events to be checked (\c POLLIN and \c POLLOUT)
+ * \return the number of poll descriptors.
+ *
+ * Get the number of poll descriptors. The polling events to be checked
+ * can be specified by the second argument. When both input and output
+ * are checked, pass \c POLLIN|POLLOUT
+ *
+ * \sa snd_seq_poll_descriptors()
+ */
+int snd_seq_poll_descriptors_count(snd_seq_t *seq, short events)
+{
+ int result = 0;
+ assert(seq);
+ if (events & POLLIN) {
+ assert(seq->streams & SND_SEQ_OPEN_INPUT);
+ result++;
+ }
+ if (events & POLLOUT) {
+ assert(seq->streams & SND_SEQ_OPEN_OUTPUT);
+ result++;
+ }
+ return result ? 1 : 0;
+}
+
+/**
+ * \brief Get poll descriptors
+ * \param seq sequencer handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \param events polling events to be checked (\c POLLIN and \c POLLOUT)
+ * \return count of filled descriptors
+ *
+ * Get poll descriptors assigned to the sequencer handle.
+ * Since a sequencer handle can duplex streams, you need to set which direction(s)
+ * is/are polled in \a events argument. When \c POLLIN bit is specified,
+ * the incoming events to the ports are checked.
+ *
+ * To check the returned poll-events, call #snd_seq_poll_descriptors_revents()
+ * instead of reading the pollfd structs directly.
+ *
+ * \sa snd_seq_poll_descriptors_count(), snd_seq_poll_descriptors_revents()
+ */
+int snd_seq_poll_descriptors(snd_seq_t *seq, struct pollfd *pfds, unsigned int space, short events)
+{
+ short revents = 0;
+
+ assert(seq);
+ if ((events & POLLIN) && space >= 1) {
+ assert(seq->streams & SND_SEQ_OPEN_INPUT);
+ revents |= POLLIN|POLLERR|POLLNVAL;
+ }
+ if ((events & POLLOUT) && space >= 1) {
+ assert(seq->streams & SND_SEQ_OPEN_OUTPUT);
+ revents |= POLLOUT|POLLERR|POLLNVAL;
+ }
+ if (!revents)
+ return 0;
+ pfds->fd = seq->poll_fd;
+ pfds->events = revents;
+ return 1;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param seq sequencer handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ *
+ * \sa snd_seq_poll_descriptors()
+ */
+int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(seq && pfds && revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief Set nonblock mode
+ * \param seq sequencer handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * Change the blocking mode of the given client.
+ * In block mode, the client falls into sleep when it fills the
+ * output memory pool with full events. The client will be woken up
+ * after a certain amount of free space becomes available.
+ *
+ * \sa snd_seq_open()
+ */
+int snd_seq_nonblock(snd_seq_t *seq, int nonblock)
+{
+ int err;
+ assert(seq);
+ err = seq->ops->nonblock(seq, nonblock);
+ if (err < 0)
+ return err;
+ if (nonblock)
+ seq->mode |= SND_SEQ_NONBLOCK;
+ else
+ seq->mode &= ~SND_SEQ_NONBLOCK;
+ return 0;
+}
+
+/**
+ * \brief Get the client id
+ * \param seq sequencer handle
+ * \return the client id
+ *
+ * Returns the id of the specified client.
+ * If an error occurs, function returns the negative error code.
+ * A client id is necessary to inquiry or to set the client information.
+ * A user client is assigned from 128 to 191.
+ *
+ * \sa snd_seq_open()
+ */
+int snd_seq_client_id(snd_seq_t *seq)
+{
+ assert(seq);
+ return seq->client;
+}
+
+/**
+ * \brief Return the size of output buffer
+ * \param seq sequencer handle
+ * \return the size of output buffer in bytes
+ *
+ * Obtains the size of output buffer.
+ * This buffer is used to store decoded byte-stream of output events
+ * before transferring to sequencer.
+ *
+ * \sa snd_seq_set_output_buffer_size()
+ */
+size_t snd_seq_get_output_buffer_size(snd_seq_t *seq)
+{
+ assert(seq);
+ if (!seq->obuf)
+ return 0;
+ return seq->obufsize;
+}
+
+/**
+ * \brief Return the size of input buffer
+ * \param seq sequencer handle
+ * \return the size of input buffer in bytes
+ *
+ * Obtains the size of input buffer.
+ * This buffer is used to read byte-stream of input events from sequencer.
+ *
+ * \sa snd_seq_set_input_buffer_size()
+ */
+size_t snd_seq_get_input_buffer_size(snd_seq_t *seq)
+{
+ assert(seq);
+ if (!seq->ibuf)
+ return 0;
+ return seq->ibufsize * sizeof(snd_seq_event_t);
+}
+
+/**
+ * \brief Change the size of output buffer
+ * \param seq sequencer handle
+ * \param size the size of output buffer to be changed in bytes
+ * \return 0 on success otherwise a negative error code
+ *
+ * Changes the size of output buffer.
+ *
+ * \sa snd_seq_get_output_buffer_size()
+ */
+int snd_seq_set_output_buffer_size(snd_seq_t *seq, size_t size)
+{
+ assert(seq && seq->obuf);
+ assert(size >= sizeof(snd_seq_event_t));
+ snd_seq_drop_output(seq);
+ if (size != seq->obufsize) {
+ char *newbuf;
+ newbuf = calloc(1, size);
+ if (newbuf == NULL)
+ return -ENOMEM;
+ free(seq->obuf);
+ seq->obuf = newbuf;
+ seq->obufsize = size;
+ }
+ return 0;
+}
+
+/**
+ * \brief Resize the input buffer
+ * \param seq sequencer handle
+ * \param size the size of input buffer to be changed in bytes
+ * \return 0 on success otherwise a negative error code
+ *
+ * Changes the size of input buffer.
+ *
+ * \sa snd_seq_get_input_buffer_size()
+ */
+int snd_seq_set_input_buffer_size(snd_seq_t *seq, size_t size)
+{
+ assert(seq && seq->ibuf);
+ assert(size >= sizeof(snd_seq_event_t));
+ snd_seq_drop_input(seq);
+ size = (size + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t);
+ if (size != seq->ibufsize) {
+ snd_seq_event_t *newbuf;
+ newbuf = calloc(sizeof(snd_seq_event_t), size);
+ if (newbuf == NULL)
+ return -ENOMEM;
+ free(seq->ibuf);
+ seq->ibuf = newbuf;
+ seq->ibufsize = size;
+ }
+ return 0;
+}
+
+
+/**
+ * \brief Get size of #snd_seq_system_info_t
+ * \return size in bytes
+ */
+size_t snd_seq_system_info_sizeof()
+{
+ return sizeof(snd_seq_system_info_t);
+}
+
+/**
+ * \brief Allocate an empty #snd_seq_system_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_system_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief Frees a previously allocated #snd_seq_system_info_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_system_info_free(snd_seq_system_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief Copy one #snd_seq_system_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get maximum number of queues
+ * \param info #snd_seq_system_info_t container
+ * \return maximum number of queues
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->queues;
+}
+
+/**
+ * \brief Get maximum number of clients
+ * \param info #snd_seq_system_info_t container
+ * \return maximum number of clients
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->clients;
+}
+
+/**
+ * \brief Get maximum number of ports
+ * \param info #snd_seq_system_info_t container
+ * \return maximum number of ports
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->ports;
+}
+
+/**
+ * \brief Get maximum number of channels
+ * \param info #snd_seq_system_info_t container
+ * \return maximum number of channels
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->channels;
+}
+
+/**
+ * \brief Get the current number of clients
+ * \param info #snd_seq_system_info_t container
+ * \return current number of clients
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->cur_clients;
+}
+
+/**
+ * \brief Get the current number of queues
+ * \param info #snd_seq_system_info_t container
+ * \return current number of queues
+ *
+ * \sa snd_seq_system_info()
+ */
+int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info)
+{
+ assert(info);
+ return info->cur_queues;
+}
+
+/**
+ * \brief obtain the sequencer system information
+ * \param seq sequencer handle
+ * \param info the pointer to be stored
+ * \return 0 on success otherwise a negative error code
+ *
+ * Stores the global system information of ALSA sequencer system.
+ * The returned data contains
+ * the maximum available numbers of queues, clients, ports and channels.
+ */
+int snd_seq_system_info(snd_seq_t *seq, snd_seq_system_info_t * info)
+{
+ assert(seq && info);
+ return seq->ops->system_info(seq, info);
+}
+
+
+/*----------------------------------------------------------------*/
+
+/**
+ * \brief get size of #snd_seq_client_info_t
+ * \return size in bytes
+ */
+size_t snd_seq_client_info_sizeof()
+{
+ return sizeof(snd_seq_client_info_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_client_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_client_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_client_info_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_client_info_free(snd_seq_client_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_client_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get client id of a client_info container
+ * \param info client_info container
+ * \return client id
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_set_client(), snd_seq_client_id()
+ */
+int snd_seq_client_info_get_client(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return info->client;
+}
+
+/**
+ * \brief Get client type of a client_info container
+ * \param info client_info container
+ * \return client type
+ *
+ * The client type is either #SEQ_CLIENT_TYPE_KERNEL or #SEQ_CLIENT_TYPE_USER
+ * for kernel or user client respectively.
+ *
+ * \sa snd_seq_get_client_info()
+ */
+snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return info->type;
+}
+
+/**
+ * \brief Get the name of a client_info container
+ * \param info client_info container
+ * \return name string
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_set_name()
+ */
+const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info)
+{
+ assert(info);
+ return info->name;
+}
+
+/**
+ * \brief Get the broadcast filter usage of a client_info container
+ * \param info client_info container
+ * \return 1 if broadcast is accepted
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_set_broadcast_filter()
+ */
+int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return (info->filter & SNDRV_SEQ_FILTER_BROADCAST) ? 1 : 0;
+}
+
+/**
+ * \brief Get the error-bounce usage of a client_info container
+ * \param info client_info container
+ * \return 1 if error-bounce is enabled
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_set_error_bounce()
+ */
+int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return (info->filter & SNDRV_SEQ_FILTER_BOUNCE) ? 1 : 0;
+}
+
+/**
+ * \brief (DEPRECATED) Get the event filter bitmap of a client_info container
+ * \param info client_info container
+ * \return NULL if no event filter, or pointer to event filter bitmap
+ *
+ * Use #snd_seq_client_info_event_filter_check() instead.
+ *
+ * \sa snd_seq_client_info_event_filter_add(),
+ * snd_seq_client_info_event_filter_del(),
+ * snd_seq_client_info_event_filter_check(),
+ * snd_seq_client_info_event_filter_clear(),
+ * snd_seq_get_client_info()
+ */
+const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ if (info->filter & SNDRV_SEQ_FILTER_USE_EVENT)
+ return info->event_filter;
+ else
+ return NULL;
+}
+
+/**
+ * \brief Disable event filtering of a client_info container
+ * \param info client_info container
+ *
+ * Remove all event types added with #snd_seq_client_info_event_filter_add and clear
+ * the event filtering flag of this client_info container.
+ *
+ * \sa snd_seq_client_info_event_filter_add(),
+ * snd_seq_client_info_event_filter_del(),
+ * snd_seq_client_info_event_filter_check(),
+ * snd_seq_get_client_info(),
+ * snd_seq_set_client_info()
+ */
+void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info)
+{
+ assert(info);
+ info->filter &= ~SNDRV_SEQ_FILTER_USE_EVENT;
+ memset(info->event_filter, 0, sizeof(info->event_filter));
+}
+
+/**
+ * \brief Add an event type to the event filtering of a client_info container
+ * \param info client_info container
+ * \param event_type event type to be added
+ *
+ * Set the event filtering flag of this client_info and add the specified event type to the
+ * filter bitmap of this client_info container.
+ *
+ * \sa snd_seq_get_client_info(),
+ * snd_seq_set_client_info(),
+ * snd_seq_client_info_event_filter_del(),
+ * snd_seq_client_info_event_filter_check(),
+ * snd_seq_client_info_event_filter_clear()
+ */
+void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type)
+{
+ assert(info);
+ info->filter |= SNDRV_SEQ_FILTER_USE_EVENT;
+ snd_seq_set_bit(event_type, info->event_filter);
+}
+
+/**
+ * \brief Remove an event type from the event filtering of a client_info container
+ * \param info client_info container
+ * \param event_type event type to be removed
+ *
+ * Removes the specified event from the filter bitmap of this client_info container. It will
+ * not clear the event filtering flag, use #snd_seq_client_info_event_filter_clear instead.
+ *
+ * \sa snd_seq_get_client_info(),
+ * snd_seq_set_client_info(),
+ * snd_seq_client_info_event_filter_add(),
+ * snd_seq_client_info_event_filter_check(),
+ * snd_seq_client_info_event_filter_clear()
+ */
+void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type)
+{
+ assert(info);
+ snd_seq_unset_bit(event_type, info->event_filter);
+}
+
+/**
+ * \brief Check if an event type is present in the event filtering of a client_info container
+ * \param info client_info container
+ * \param event_type event type to be checked
+ * \return 1 if the event type is present, 0 otherwise
+ *
+ * Test if the event type is in the filter bitamp of this client_info container.
+ *
+ * \sa snd_seq_get_client_info(),
+ * snd_seq_set_client_info(),
+ * snd_seq_client_info_event_filter_add(),
+ * snd_seq_client_info_event_filter_del(),
+ * snd_seq_client_info_event_filter_clear()
+ */
+int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type)
+{
+ assert(info);
+ return snd_seq_get_bit(event_type, info->event_filter);
+}
+
+/**
+ * \brief Get the number of opened ports of a client_info container
+ * \param info client_info container
+ * \return number of opened ports
+ *
+ * \sa snd_seq_get_client_info()
+ */
+int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return info->num_ports;
+}
+
+/**
+ * \brief Get the number of lost events of a client_info container
+ * \param info client_info container
+ * \return number of lost events
+ *
+ * \sa snd_seq_get_client_info()
+ */
+int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info)
+{
+ assert(info);
+ return info->event_lost;
+}
+
+/**
+ * \brief Set the client id of a client_info container
+ * \param info client_info container
+ * \param client client id
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_get_client()
+ */
+void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client)
+{
+ assert(info);
+ info->client = client;
+}
+
+/**
+ * \brief Set the name of a client_info container
+ * \param info client_info container
+ * \param name name string
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_get_name(),
+ * snd_seq_set_client_name()
+ */
+void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name)
+{
+ assert(info && name);
+ strncpy(info->name, name, sizeof(info->name));
+}
+
+/**
+ * \brief Set the broadcast filter usage of a client_info container
+ * \param info client_info container
+ * \param val non-zero if broadcast is accepted
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_get_broadcast_filter()
+ */
+void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->filter |= SNDRV_SEQ_FILTER_BROADCAST;
+ else
+ info->filter &= ~SNDRV_SEQ_FILTER_BROADCAST;
+}
+
+/**
+ * \brief Set the error-bounce usage of a client_info container
+ * \param info client_info container
+ * \param val non-zero if error is bounced
+ *
+ * \sa snd_seq_get_client_info(), snd_seq_client_info_get_error_bounce()
+ */
+void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->filter |= SNDRV_SEQ_FILTER_BOUNCE;
+ else
+ info->filter &= ~SNDRV_SEQ_FILTER_BOUNCE;
+}
+
+/**
+ * \brief (DEPRECATED) Set the event filter bitmap of a client_info container
+ * \param info client_info container
+ * \param filter event filter bitmap, pass NULL for no event filtering
+ *
+ * Use #snd_seq_client_info_event_filter_add instead.
+ *
+ * \sa snd_seq_client_info_event_filter_add(),
+ * snd_seq_client_info_event_filter_del(),
+ * snd_seq_client_info_event_filter_check(),
+ * snd_seq_client_info_event_filter_clear(),
+ * snd_seq_set_client_info()
+ */
+void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter)
+{
+ assert(info);
+ if (! filter)
+ info->filter &= ~SNDRV_SEQ_FILTER_USE_EVENT;
+ else {
+ info->filter |= SNDRV_SEQ_FILTER_USE_EVENT;
+ memcpy(info->event_filter, filter, sizeof(info->event_filter));
+ }
+}
+
+
+/**
+ * \brief obtain the information of the given client
+ * \param seq sequencer handle
+ * \param client client id
+ * \param info the pointer to be stored
+ * \return 0 on success otherwise a negative error code
+ *
+ * Obtains the information of the client with a client id specified by
+ * info argument.
+ * The obtained information is written on info parameter.
+ *
+ * \sa snd_seq_get_client_info()
+ */
+int snd_seq_get_any_client_info(snd_seq_t *seq, int client, snd_seq_client_info_t *info)
+{
+ assert(seq && info && client >= 0);
+ memset(info, 0, sizeof(snd_seq_client_info_t));
+ info->client = client;
+ return seq->ops->get_client_info(seq, info);
+}
+
+/**
+ * \brief obtain the current client information
+ * \param seq sequencer handle
+ * \param info the pointer to be stored
+ * \return 0 on success otherwise a negative error code
+ *
+ * Obtains the information of the current client stored on info.
+ * client and type fields are ignored.
+ *
+ * \sa snd_seq_get_any_client_info(), snd_seq_set_client_info(),
+ * snd_seq_query_next_client()
+ */
+int snd_seq_get_client_info(snd_seq_t *seq, snd_seq_client_info_t *info)
+{
+ return snd_seq_get_any_client_info(seq, seq->client, info);
+}
+
+/**
+ * \brief set the current client information
+ * \param seq sequencer handle
+ * \param info the client info data to set
+ * \return 0 on success otherwise a negative error code
+ *
+ * Obtains the information of the current client stored on info.
+ * client and type fields are ignored.
+ *
+ * \sa snd_seq_get_client_info()
+ */
+int snd_seq_set_client_info(snd_seq_t *seq, snd_seq_client_info_t *info)
+{
+ assert(seq && info);
+ info->client = seq->client;
+ info->type = USER_CLIENT;
+ return seq->ops->set_client_info(seq, info);
+}
+
+/**
+ * \brief query the next client
+ * \param seq sequencer handle
+ * \param info query pattern and result
+ *
+ * Queries the next client.
+ * The search begins at the client with an id one greater than
+ * client field in info.
+ * If a client is found, its attributes are stored in info,
+ * and zero is returned.
+ * Otherwise returns a negative error code.
+ *
+ * \sa snd_seq_get_any_client_info()
+ */
+int snd_seq_query_next_client(snd_seq_t *seq, snd_seq_client_info_t *info)
+{
+ assert(seq && info);
+ return seq->ops->query_next_client(seq, info);
+}
+
+
+/*----------------------------------------------------------------*/
+
+
+/*
+ * Port
+ */
+
+/**
+ * \brief get size of #snd_seq_port_info_t
+ * \return size in bytes
+ */
+size_t snd_seq_port_info_sizeof()
+{
+ return sizeof(snd_seq_port_info_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_port_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_port_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_port_info_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_port_info_free(snd_seq_port_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_port_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get client id of a port_info container
+ * \param info port_info container
+ * \return client id
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_client()
+ */
+int snd_seq_port_info_get_client(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->addr.client;
+}
+
+/**
+ * \brief Get port id of a port_info container
+ * \param info port_info container
+ * \return port id
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_port()
+ */
+int snd_seq_port_info_get_port(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->addr.port;
+}
+
+/**
+ * \brief Get client/port address of a port_info container
+ * \param info port_info container
+ * \return client/port address pointer
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_addr()
+ */
+const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return &info->addr;
+}
+
+/**
+ * \brief Get the name of a port_info container
+ * \param info port_info container
+ * \return name string
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_name()
+ */
+const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->name;
+}
+
+/**
+ * \brief Get the capability bits of a port_info container
+ * \param info port_info container
+ * \return capability bits
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_capability()
+ */
+unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->capability;
+}
+
+/**
+ * \brief Get the type bits of a port_info container
+ * \param info port_info container
+ * \return port type bits
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_type()
+ */
+unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->type;
+}
+
+/**
+ * \brief Get the number of read subscriptions of a port_info container
+ * \param info port_info container
+ * \return number of read subscriptions
+ *
+ * \sa snd_seq_get_port_info()
+ */
+int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->read_use;
+}
+
+/**
+ * \brief Get the number of write subscriptions of a port_info container
+ * \param info port_info container
+ * \return number of write subscriptions
+ *
+ * \sa snd_seq_get_port_info()
+ */
+int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->write_use;
+}
+
+/**
+ * \brief Get the midi channels of a port_info container
+ * \param info port_info container
+ * \return number of midi channels (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_midi_channels()
+ */
+int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->midi_channels;
+}
+
+/**
+ * \brief Get the midi voices of a port_info container
+ * \param info port_info container
+ * \return number of midi voices (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_midi_voices()
+ */
+int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->midi_voices;
+}
+
+/**
+ * \brief Get the synth voices of a port_info container
+ * \param info port_info container
+ * \return number of synth voices (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_synth_voices()
+ */
+int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->synth_voices;
+}
+
+/**
+ * \brief Get the port-specified mode of a port_info container
+ * \param info port_info container
+ * \return 1 if port id is specified at creation
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_port_specified()
+ */
+int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) ? 1 : 0;
+}
+
+/**
+ * \brief Get the time-stamping mode of the given port in a port_info container
+ * \param info port_info container
+ * \return 1 if the port updates timestamps of incoming events
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamping()
+ */
+int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_FLG_TIMESTAMP) ? 1 : 0;
+}
+
+/**
+ * \brief Get whether the time-stamping of the given port is real-time mode
+ * \param info port_info container
+ * \return 1 if the time-stamping is in the real-time mode
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamp_real()
+ */
+int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_FLG_TIME_REAL) ? 1 : 0;
+}
+
+/**
+ * \brief Get the queue id to update timestamps
+ * \param info port_info container
+ * \return the queue id to get the timestamps
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_set_timestamp_queue()
+ */
+int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->time_queue;
+}
+
+/**
+ * \brief Set the client id of a port_info container
+ * \param info port_info container
+ * \param client client id
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_client()
+ */
+void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client)
+{
+ assert(info);
+ info->addr.client = client;
+}
+
+/**
+ * \brief Set the port id of a port_info container
+ * \param info port_info container
+ * \param port port id
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_port()
+ */
+void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port)
+{
+ assert(info);
+ info->addr.port = port;
+}
+
+/**
+ * \brief Set the client/port address of a port_info container
+ * \param info port_info container
+ * \param addr client/port address
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_addr()
+ */
+void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr)
+{
+ assert(info);
+ info->addr = *addr;
+}
+
+/**
+ * \brief Set the name of a port_info container
+ * \param info port_info container
+ * \param name name string
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_name()
+ */
+void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name)
+{
+ assert(info && name);
+ strncpy(info->name, name, sizeof(info->name));
+}
+
+/**
+ * \brief set the capability bits of a port_info container
+ * \param info port_info container
+ * \param capability capability bits
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_capability()
+ */
+void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability)
+{
+ assert(info);
+ info->capability = capability;
+}
+
+/**
+ * \brief Get the type bits of a port_info container
+ * \param info port_info container
+ * \param type port type bits
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_type()
+ */
+void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type)
+{
+ assert(info);
+ info->type = type;
+}
+
+/**
+ * \brief set the midi channels of a port_info container
+ * \param info port_info container
+ * \param channels midi channels (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_midi_channels()
+ */
+void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels)
+{
+ assert(info);
+ info->midi_channels = channels;
+}
+
+/**
+ * \brief set the midi voices of a port_info container
+ * \param info port_info container
+ * \param voices midi voices (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_midi_voices()
+ */
+void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices)
+{
+ assert(info);
+ info->midi_voices = voices;
+}
+
+/**
+ * \brief set the synth voices of a port_info container
+ * \param info port_info container
+ * \param voices synth voices (default 0)
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_synth_voice()
+ */
+void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices)
+{
+ assert(info);
+ info->synth_voices = voices;
+}
+
+/**
+ * \brief Set the port-specified mode of a port_info container
+ * \param info port_info container
+ * \param val non-zero if specifying the port id at creation
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_port_specified()
+ */
+void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->flags |= SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
+}
+
+/**
+ * \brief Set the time-stamping mode of the given port
+ * \param info port_info container
+ * \param enable non-zero if updating the timestamps of incoming events
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamping()
+ */
+void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable)
+{
+ assert(info);
+ if (enable)
+ info->flags |= SNDRV_SEQ_PORT_FLG_TIMESTAMP;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_FLG_TIMESTAMP;
+}
+
+/**
+ * \brief Set whether the timestime is updated in the real-time mode
+ * \param info port_info container
+ * \param enable non-zero if updating the timestamps in real-time mode
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamp_real()
+ */
+void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int enable)
+{
+ assert(info);
+ if (enable)
+ info->flags |= SNDRV_SEQ_PORT_FLG_TIME_REAL;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_FLG_TIME_REAL;
+}
+
+/**
+ * \brief Set the queue id for timestamping
+ * \param info port_info container
+ * \param queue the queue id to get timestamps
+ *
+ * \sa snd_seq_get_port_info(), snd_seq_port_info_get_timestamp_queue()
+ */
+void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue)
+{
+ assert(info);
+ info->time_queue = queue;
+}
+
+
+/**
+ * \brief create a sequencer port on the current client
+ * \param seq sequencer handle
+ * \param port port information for the new port
+ * \return 0 on success otherwise a negative error code
+ *
+ * Creates a sequencer port on the current client.
+ * The attributes of created port is specified in \a info argument.
+ *
+ * The client field in \a info argument is overwritten with the current client id.
+ * The port id to be created can be specified via #snd_seq_port_info_set_port_specified.
+ * You can get the created port id by reading the port pointer via #snd_seq_port_info_get_port.
+ *
+ * Each port has the capability bit-masks to specify the access capability
+ * of the port from other clients.
+ * The capability bit flags are defined as follows:
+ * - #SND_SEQ_PORT_CAP_READ Readable from this port
+ * - #SND_SEQ_PORT_CAP_WRITE Writable to this port.
+ * - #SND_SEQ_PORT_CAP_SYNC_READ For synchronization (not implemented)
+ * - #SND_SEQ_PORT_CAP_SYNC_WRITE For synchronization (not implemented)
+ * - #SND_SEQ_PORT_CAP_DUPLEX Read/write duplex access is supported
+ * - #SND_SEQ_PORT_CAP_SUBS_READ Read subscription is allowed
+ * - #SND_SEQ_PORT_CAP_SUBS_WRITE Write subscription is allowed
+ * - #SND_SEQ_PORT_CAP_NO_EXPORT Subscription management from 3rd client is disallowed
+ *
+ * Each port has also the type bitmasks defined as follows:
+ * - #SND_SEQ_PORT_TYPE_SPECIFIC Hardware specific port
+ * - #SND_SEQ_PORT_TYPE_MIDI_GENERIC Generic MIDI device
+ * - #SND_SEQ_PORT_TYPE_MIDI_GM General MIDI compatible device
+ * - #SND_SEQ_PORT_TYPE_MIDI_GM2 General MIDI 2 compatible device
+ * - #SND_SEQ_PORT_TYPE_MIDI_GS GS compatible device
+ * - #SND_SEQ_PORT_TYPE_MIDI_XG XG compatible device
+ * - #SND_SEQ_PORT_TYPE_MIDI_MT32 MT-32 compatible device
+ * - #SND_SEQ_PORT_TYPE_HARDWARE Implemented in hardware
+ * - #SND_SEQ_PORT_TYPE_SOFTWARE Implemented in software
+ * - #SND_SEQ_PORT_TYPE_SYNTHESIZER Generates sound
+ * - #SND_SEQ_PORT_TYPE_PORT Connects to other device(s)
+ * - #SND_SEQ_PORT_TYPE_APPLICATION Application (sequencer/editor)
+ *
+ * A port may contain specific midi channels, midi voices and synth voices.
+ * These values could be zero as default.
+ *
+ * \sa snd_seq_delete_port(), snd_seq_get_port_info(),
+ * snd_seq_create_simple_port()
+ */
+int snd_seq_create_port(snd_seq_t *seq, snd_seq_port_info_t * port)
+{
+ assert(seq && port);
+ port->addr.client = seq->client;
+ return seq->ops->create_port(seq, port);
+}
+
+/**
+ * \brief delete a sequencer port on the current client
+ * \param seq sequencer handle
+ * \param port port to be deleted
+ * \return 0 on success otherwise a negative error code
+ *
+ * Deletes the existing sequencer port on the current client.
+ *
+ * \sa snd_seq_create_port(), snd_seq_delete_simple_port()
+ */
+int snd_seq_delete_port(snd_seq_t *seq, int port)
+{
+ snd_seq_port_info_t pinfo;
+ assert(seq);
+ memset(&pinfo, 0, sizeof(pinfo));
+ pinfo.addr.client = seq->client;
+ pinfo.addr.port = port;
+ return seq->ops->delete_port(seq, &pinfo);
+}
+
+/**
+ * \brief obtain the information of a port on an arbitrary client
+ * \param seq sequencer handle
+ * \param client client id to get
+ * \param port port id to get
+ * \param info pointer information returns
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_get_port_info()
+ */
+int snd_seq_get_any_port_info(snd_seq_t *seq, int client, int port, snd_seq_port_info_t * info)
+{
+ assert(seq && info && client >= 0 && port >= 0);
+ memset(info, 0, sizeof(snd_seq_port_info_t));
+ info->addr.client = client;
+ info->addr.port = port;
+ return seq->ops->get_port_info(seq, info);
+}
+
+/**
+ * \brief obtain the information of a port on the current client
+ * \param seq sequencer handle
+ * \param port port id to get
+ * \param info pointer information returns
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_create_port(), snd_seq_get_any_port_info(), snd_seq_set_port_info(),
+ * snd_seq_query_next_port()
+ */
+int snd_seq_get_port_info(snd_seq_t *seq, int port, snd_seq_port_info_t * info)
+{
+ return snd_seq_get_any_port_info(seq, seq->client, port, info);
+}
+
+/**
+ * \brief set the information of a port on the current client
+ * \param seq sequencer handle
+ * \param port port to be set
+ * \param info port information to be set
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_set_port_info()
+ */
+int snd_seq_set_port_info(snd_seq_t *seq, int port, snd_seq_port_info_t * info)
+{
+ assert(seq && info && port >= 0);
+ info->addr.client = seq->client;
+ info->addr.port = port;
+ return seq->ops->set_port_info(seq, info);
+}
+
+/**
+ * \brief query the next matching port
+ * \param seq sequencer handle
+ * \param info query pattern and result
+
+ * Queries the next matching port on the client specified in
+ * \a info argument.
+ * The search begins at the next port specified in
+ * port field of \a info argument.
+ * For finding the first port at a certain client, give -1.
+ *
+ * If a matching port is found, its attributes are stored on
+ * \a info and function returns zero.
+ * Otherwise, a negative error code is returned.
+ *
+ * \sa snd_seq_get_port_info()
+ */
+int snd_seq_query_next_port(snd_seq_t *seq, snd_seq_port_info_t *info)
+{
+ assert(seq && info);
+ return seq->ops->query_next_port(seq, info);
+}
+
+
+/*----------------------------------------------------------------*/
+
+/*
+ * subscription
+ */
+
+
+/**
+ * \brief get size of #snd_seq_port_subscribe_t
+ * \return size in bytes
+ */
+size_t snd_seq_port_subscribe_sizeof()
+{
+ return sizeof(snd_seq_port_subscribe_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_port_subscribe_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_port_subscribe_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_port_subscribe_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_port_subscribe_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get sender address of a port_subscribe container
+ * \param info port_subscribe container
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_sender()
+ */
+const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return &info->sender;
+}
+
+/**
+ * \brief Get destination address of a port_subscribe container
+ * \param info port_subscribe container
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_dest()
+ */
+const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return &info->dest;
+}
+
+/**
+ * \brief Get the queue id of a port_subscribe container
+ * \param info port_subscribe container
+ * \return queue id
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_queue()
+ */
+int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the exclusive mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \return 1 if exclusive mode
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_exclusive()
+ */
+int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE) ? 1 : 0;
+}
+
+/**
+ * \brief Get the time-update mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \return 1 if update timestamp
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_time_update()
+ */
+int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) ? 1 : 0;
+}
+
+/**
+ * \brief Get the real-time update mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \return 1 if real-time update mode
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_set_time_real()
+ */
+int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL) ? 1 : 0;
+}
+
+/**
+ * \brief Set sender address of a port_subscribe container
+ * \param info port_subscribe container
+ * \param addr sender address
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_sender()
+ */
+void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr)
+{
+ assert(info);
+ memcpy(&info->sender, addr, sizeof(*addr));
+}
+
+/**
+ * \brief Set destination address of a port_subscribe container
+ * \param info port_subscribe container
+ * \param addr destination address
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_dest()
+ */
+void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr)
+{
+ assert(info);
+ memcpy(&info->dest, addr, sizeof(*addr));
+}
+
+/**
+ * \brief Set the queue id of a port_subscribe container
+ * \param info port_subscribe container
+ * \param q queue id
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_queue()
+ */
+void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q)
+{
+ assert(info);
+ info->queue = q;
+}
+
+/**
+ * \brief Set the exclusive mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \param val non-zero to enable
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_exclusive()
+ */
+void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->flags |= SNDRV_SEQ_PORT_SUBS_EXCLUSIVE;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_SUBS_EXCLUSIVE;
+}
+
+/**
+ * \brief Set the time-update mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \param val non-zero to enable
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_update()
+ */
+void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->flags |= SNDRV_SEQ_PORT_SUBS_TIMESTAMP;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_SUBS_TIMESTAMP;
+}
+
+/**
+ * \brief Set the real-time mode of a port_subscribe container
+ * \param info port_subscribe container
+ * \param val non-zero to enable
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_port_subscribe_get_time_real()
+ */
+void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val)
+{
+ assert(info);
+ if (val)
+ info->flags |= SNDRV_SEQ_PORT_SUBS_TIME_REAL;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_SUBS_TIME_REAL;
+}
+
+
+/**
+ * \brief obtain subscription information
+ * \param seq sequencer handle
+ * \param sub pointer to return the subscription information
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_query_port_subscribers()
+ */
+int snd_seq_get_port_subscription(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ assert(seq && sub);
+ return seq->ops->get_port_subscription(seq, sub);
+}
+
+/**
+ * \brief subscribe a port connection
+ * \param seq sequencer handle
+ * \param sub subscription information
+ * \return 0 on success otherwise a negative error code
+ *
+ * Subscribes a connection between two ports.
+ * The subscription information is stored in sub argument.
+ *
+ * \sa snd_seq_get_port_subscription(), snd_seq_unsubscribe_port(),
+ * snd_seq_connect_from(), snd_seq_connect_to()
+ */
+int snd_seq_subscribe_port(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ assert(seq && sub);
+ return seq->ops->subscribe_port(seq, sub);
+}
+
+/**
+ * \brief unsubscribe a connection between ports
+ * \param seq sequencer handle
+ * \param sub subscription information to disconnect
+ * \return 0 on success otherwise a negative error code
+ *
+ * Unsubscribes a connection between two ports,
+ * described in sender and dest fields in sub argument.
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_disconnect_from(), snd_seq_disconnect_to()
+ */
+int snd_seq_unsubscribe_port(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ assert(seq && sub);
+ return seq->ops->unsubscribe_port(seq, sub);
+}
+
+
+/**
+ * \brief get size of #snd_seq_query_subscribe_t
+ * \return size in bytes
+ */
+size_t snd_seq_query_subscribe_sizeof()
+{
+ return sizeof(snd_seq_query_subscribe_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_query_subscribe_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_query_subscribe_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_query_subscribe_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_query_subscribe_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the client id of a query_subscribe container
+ * \param info query_subscribe container
+ * \return client id
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_client()
+ */
+int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->root.client;
+}
+
+/**
+ * \brief Get the port id of a query_subscribe container
+ * \param info query_subscribe container
+ * \return port id
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_port()
+ */
+int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->root.port;
+}
+
+/**
+ * \brief Get the client/port address of a query_subscribe container
+ * \param info query_subscribe container
+ * \return client/port address pointer
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_root()
+ */
+const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return &info->root;
+}
+
+/**
+ * \brief Get the query type of a query_subscribe container
+ * \param info query_subscribe container
+ * \return query type
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_type()
+ */
+snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->type;
+}
+
+/**
+ * \brief Get the index of subscriber of a query_subscribe container
+ * \param info query_subscribe container
+ * \return subscriber's index
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_set_index()
+ */
+int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->index;
+}
+
+/**
+ * \brief Get the number of subscriptions of a query_subscribe container
+ * \param info query_subscribe container
+ * \return number of subscriptions
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->num_subs;
+}
+
+/**
+ * \brief Get the address of subscriber of a query_subscribe container
+ * \param info query_subscribe container
+ * \return subscriber's address pointer
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return &info->addr;
+}
+
+/**
+ * \brief Get the queue id of subscriber of a query_subscribe container
+ * \param info query_subscribe container
+ * \return subscriber's queue id
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the exclusive mode of a query_subscribe container
+ * \param info query_subscribe container
+ * \return 1 if exclusive mode
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE) ? 1 : 0;
+}
+
+/**
+ * \brief Get the time-update mode of a query_subscribe container
+ * \param info query_subscribe container
+ * \return 1 if update timestamp
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) ? 1 : 0;
+}
+
+/**
+ * \brief Get the real-time update mode of a query_subscribe container
+ * \param info query_subscribe container
+ * \return 1 if real-time update mode
+ *
+ * \sa snd_seq_query_port_subscribers()
+ */
+int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) ? 1 : 0;
+}
+
+/**
+ * \brief Set the client id of a query_subscribe container
+ * \param info query_subscribe container
+ * \param client client id
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_client()
+ */
+void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client)
+{
+ assert(info);
+ info->root.client = client;
+}
+
+/**
+ * \brief Set the port id of a query_subscribe container
+ * \param info query_subscribe container
+ * \param port port id
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_port()
+ */
+void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port)
+{
+ assert(info);
+ info->root.port = port;
+}
+
+/**
+ * \brief Set the client/port address of a query_subscribe container
+ * \param info query_subscribe container
+ * \param addr client/port address pointer
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_root()
+ */
+void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr)
+{
+ assert(info);
+ info->root = *addr;
+}
+
+/**
+ * \brief Set the query type of a query_subscribe container
+ * \param info query_subscribe container
+ * \param type query type
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_type()
+ */
+void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type)
+{
+ assert(info);
+ info->type = type;
+}
+
+/**
+ * \brief Set the subscriber's index to be queried
+ * \param info query_subscribe container
+ * \param index index to be queried
+ *
+ * \sa snd_seq_query_port_subscribers(), snd_seq_query_subscribe_get_index()
+ */
+void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int index)
+{
+ assert(info);
+ info->index = index;
+}
+
+
+/**
+ * \brief query port subscriber list
+ * \param seq sequencer handle
+ * \param subs subscription to query
+ * \return 0 on success otherwise a negative error code
+ *
+ * Queries the subscribers accessing to a port.
+ * The query information is specified in subs argument.
+ *
+ * At least, the client id, the port id, the index number and
+ * the query type must be set to perform a proper query.
+ * As the query type, #SND_SEQ_QUERY_SUBS_READ or #SND_SEQ_QUERY_SUBS_WRITE
+ * can be specified to check whether the readers or the writers to the port.
+ * To query the first subscription, set 0 to the index number. To list up
+ * all the subscriptions, call this function with the index numbers from 0
+ * until this returns a negative value.
+ *
+ * \sa snd_seq_get_port_subscription()
+ */
+int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs)
+{
+ assert(seq && subs);
+ return seq->ops->query_port_subscribers(seq, subs);
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * queue handlers
+ */
+
+/**
+ * \brief get size of #snd_seq_queue_info_t
+ * \return size in bytes
+ */
+size_t snd_seq_queue_info_sizeof()
+{
+ return sizeof(snd_seq_queue_info_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_queue_info_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_queue_info_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_queue_info_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_queue_info_free(snd_seq_queue_info_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_queue_info_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the queue id of a queue_info container
+ * \param info queue_info container
+ * \return queue id
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_set_queue()
+ */
+int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the name of a queue_info container
+ * \param info queue_info container
+ * \return name string
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_set_name()
+ */
+const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info)
+{
+ assert(info);
+ return info->name;
+}
+
+/**
+ * \brief Get the owner client id of a queue_info container
+ * \param info queue_info container
+ * \return owner client id
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_set_owner()
+ */
+int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info)
+{
+ assert(info);
+ return info->owner;
+}
+
+/**
+ * \brief Get the lock status of a queue_info container
+ * \param info queue_info container
+ * \return lock status --- non-zero = locked
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_set_locked()
+ */
+int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info)
+{
+ assert(info);
+ return info->locked;
+}
+
+/**
+ * \brief Get the conditional bit flags of a queue_info container
+ * \param info queue_info container
+ * \return conditional bit flags
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_set_flags()
+ */
+unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info)
+{
+ assert(info);
+ return info->flags;
+}
+
+/**
+ * \brief Set the name of a queue_info container
+ * \param info queue_info container
+ * \param name name string
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_get_name()
+ */
+void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name)
+{
+ assert(info && name);
+ strncpy(info->name, name, sizeof(info->name));
+}
+
+/**
+ * \brief Set the owner client id of a queue_info container
+ * \param info queue_info container
+ * \param owner client id
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_get_owner()
+ */
+void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner)
+{
+ assert(info);
+ info->owner = owner;
+}
+
+/**
+ * \brief Set the lock status of a queue_info container
+ * \param info queue_info container
+ * \param locked lock status
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_get_locked()
+ */
+void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked)
+{
+ assert(info);
+ info->locked = locked;
+}
+
+/**
+ * \brief Set the conditional bit flags of a queue_info container
+ * \param info queue_info container
+ * \param flags conditional bit flags
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_queue_info_get_flags()
+ */
+void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags)
+{
+ assert(info);
+ info->flags = flags;
+}
+
+
+/**
+ * \brief create a queue
+ * \param seq sequencer handle
+ * \param info queue information to initialize
+ * \return the queue id (zero or positive) on success otherwise a negative error code
+ *
+ * \sa snd_seq_alloc_queue()
+ */
+int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ int err;
+ assert(seq && info);
+ info->owner = seq->client;
+ err = seq->ops->create_queue(seq, info);
+ if (err < 0)
+ return err;
+ return info->queue;
+}
+
+/**
+ * \brief allocate a queue with the specified name
+ * \param seq sequencer handle
+ * \param name the name of the new queue
+ * \return the queue id (zero or positive) on success otherwise a negative error code
+ *
+ * \sa snd_seq_alloc_queue()
+ */
+int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name)
+{
+ snd_seq_queue_info_t info;
+ memset(&info, 0, sizeof(info));
+ info.locked = 1;
+ if (name)
+ strncpy(info.name, name, sizeof(info.name) - 1);
+ return snd_seq_create_queue(seq, &info);
+}
+
+/**
+ * \brief allocate a queue
+ * \param seq sequencer handle
+ * \return the queue id (zero or positive) on success otherwise a negative error code
+ *
+ * \sa snd_seq_alloc_named_queue(), snd_seq_create_queue(), snd_seq_free_queue(),
+ * snd_seq_get_queue_info()
+ */
+int snd_seq_alloc_queue(snd_seq_t *seq)
+{
+ return snd_seq_alloc_named_queue(seq, NULL);
+}
+
+/**
+ * \brief delete the specified queue
+ * \param seq sequencer handle
+ * \param q queue id to delete
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_alloc_queue()
+ */
+int snd_seq_free_queue(snd_seq_t *seq, int q)
+{
+ snd_seq_queue_info_t info;
+ assert(seq);
+ memset(&info, 0, sizeof(info));
+ info.queue = q;
+ return seq->ops->delete_queue(seq, &info);
+}
+
+/**
+ * \brief obtain queue attributes
+ * \param seq sequencer handle
+ * \param q queue id to query
+ * \param info information returned
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_alloc_queue(), snd_seq_set_queue_info(), snd_seq_query_named_queue()
+ */
+int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info)
+{
+ assert(seq && info);
+ info->queue = q;
+ return seq->ops->get_queue_info(seq, info);
+}
+
+/**
+ * \brief change the queue attributes
+ * \param seq sequencer handle
+ * \param q queue id to change
+ * \param info information changed
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_get_queue_info()
+ */
+int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info)
+{
+ assert(seq && info);
+ info->queue = q;
+ return seq->ops->set_queue_info(seq, info);
+}
+
+/**
+ * \brief query the matching queue with the specified name
+ * \param seq sequencer handle
+ * \param name the name string to query
+ * \return the queue id if found or negative error code
+ *
+ * Searches the matching queue with the specified name string.
+ *
+ * \sa snd_seq_get_queue_info()
+ */
+int snd_seq_query_named_queue(snd_seq_t *seq, const char *name)
+{
+ int err;
+ snd_seq_queue_info_t info;
+ assert(seq && name);
+ strncpy(info.name, name, sizeof(info.name));
+ err = seq->ops->get_named_queue(seq, &info);
+ if (err < 0)
+ return err;
+ return info.queue;
+}
+
+/**
+ * \brief Get the queue usage flag to the client
+ * \param seq sequencer handle
+ * \param q queue id
+ * \return 1 = client is allowed to access the queue, 0 = not allowed,
+ * otherwise a negative error code
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_set_queue_usage()
+ */
+int snd_seq_get_queue_usage(snd_seq_t *seq, int q)
+{
+ struct sndrv_seq_queue_client info;
+ int err;
+ assert(seq);
+ memset(&info, 0, sizeof(info));
+ info.queue = q;
+ info.client = seq->client;
+ if ((err = seq->ops->get_queue_client(seq, &info)) < 0)
+ return err;
+ return info.used;
+}
+
+/**
+ * \brief Set the queue usage flag to the client
+ * \param seq sequencer handle
+ * \param q queue id
+ * \param used non-zero if the client is allowed
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_get_queue_info(), snd_seq_set_queue_usage()
+ */
+int snd_seq_set_queue_usage(snd_seq_t *seq, int q, int used)
+{
+ struct sndrv_seq_queue_client info;
+ assert(seq);
+ memset(&info, 0, sizeof(info));
+ info.queue = q;
+ info.client = seq->client;
+ info.used = used ? 1 : 0;
+ return seq->ops->set_queue_client(seq, &info);
+}
+
+
+/**
+ * \brief get size of #snd_seq_queue_status_t
+ * \return size in bytes
+ */
+size_t snd_seq_queue_status_sizeof()
+{
+ return sizeof(snd_seq_queue_status_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_queue_status_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_queue_status_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_queue_status_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_queue_status_free(snd_seq_queue_status_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_queue_status_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the queue id of a queue_status container
+ * \param info queue_status container
+ * \return queue id
+ *
+ * \sa snd_seq_get_queue_status()
+ */
+int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the number of events of a queue_status container
+ * \param info queue_status container
+ * \return number of events
+ *
+ * \sa snd_seq_get_queue_status()
+ */
+int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info)
+{
+ assert(info);
+ return info->events;
+}
+
+/**
+ * \brief Get the tick time of a queue_status container
+ * \param info queue_status container
+ * \return tick time
+ *
+ * \sa snd_seq_get_queue_status()
+ */
+snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info)
+{
+ assert(info);
+ return info->tick;
+}
+
+/**
+ * \brief Get the real time of a queue_status container
+ * \param info queue_status container
+ *
+ * \sa snd_seq_get_queue_status()
+ */
+const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info)
+{
+ assert(info);
+ return &info->time;
+}
+
+/**
+ * \brief Get the running status bits of a queue_status container
+ * \param info queue_status container
+ * \return running status bits
+ *
+ * \sa snd_seq_get_queue_status()
+ */
+unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info)
+{
+ assert(info);
+ return info->running;
+}
+
+
+/**
+ * \brief obtain the running state of the queue
+ * \param seq sequencer handle
+ * \param q queue id to query
+ * \param status pointer to store the current status
+ * \return 0 on success otherwise a negative error code
+ *
+ * Obtains the running state of the specified queue q.
+ */
+int snd_seq_get_queue_status(snd_seq_t *seq, int q, snd_seq_queue_status_t * status)
+{
+ assert(seq && status);
+ memset(status, 0, sizeof(snd_seq_queue_status_t));
+ status->queue = q;
+ return seq->ops->get_queue_status(seq, status);
+}
+
+
+/**
+ * \brief get size of #snd_seq_queue_tempo_t
+ * \return size in bytes
+ */
+size_t snd_seq_queue_tempo_sizeof()
+{
+ return sizeof(snd_seq_queue_tempo_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_queue_tempo_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_queue_tempo_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_queue_tempo_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_queue_tempo_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the queue id of a queue_status container
+ * \param info queue_status container
+ * \return queue id
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the tempo of a queue_status container
+ * \param info queue_status container
+ * \return tempo value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info)
+{
+ assert(info);
+ return info->tempo;
+}
+
+/**
+ * \brief Get the ppq of a queue_status container
+ * \param info queue_status container
+ * \return ppq value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info)
+{
+ assert(info);
+ return info->ppq;
+}
+
+/**
+ * \brief Get the timer skew value of a queue_status container
+ * \param info queue_status container
+ * \return timer skew value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info)
+{
+ assert(info);
+ return info->skew_value;
+}
+
+/**
+ * \brief Get the timer skew base value of a queue_status container
+ * \param info queue_status container
+ * \return timer skew base value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info)
+{
+ assert(info);
+ return info->skew_base;
+}
+
+/**
+ * \brief Set the tempo of a queue_status container
+ * \param info queue_status container
+ * \param tempo tempo value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo)
+{
+ assert(info);
+ info->tempo = tempo;
+}
+
+/**
+ * \brief Set the ppq of a queue_status container
+ * \param info queue_status container
+ * \param ppq ppq value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq)
+{
+ assert(info);
+ info->ppq = ppq;
+}
+
+/**
+ * \brief Set the timer skew value of a queue_status container
+ * \param info queue_status container
+ * \param skew timer skew value
+ *
+ * The skew of timer is calculated as skew / base.
+ * For example, to play with double speed, pass base * 2 as the skew value.
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew)
+{
+ assert(info);
+ info->skew_value = skew;
+}
+
+/**
+ * \brief Set the timer skew base value of a queue_status container
+ * \param info queue_status container
+ * \param base timer skew base value
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base)
+{
+ assert(info);
+ info->skew_base = base;
+}
+
+/**
+ * \brief obtain the current tempo of the queue
+ * \param seq sequencer handle
+ * \param q queue id to be queried
+ * \param tempo pointer to store the current tempo
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_set_queue_tempo()
+ */
+int snd_seq_get_queue_tempo(snd_seq_t *seq, int q, snd_seq_queue_tempo_t * tempo)
+{
+ assert(seq && tempo);
+ memset(tempo, 0, sizeof(snd_seq_queue_tempo_t));
+ tempo->queue = q;
+ return seq->ops->get_queue_tempo(seq, tempo);
+}
+
+/**
+ * \brief set the tempo of the queue
+ * \param seq sequencer handle
+ * \param q queue id to change the tempo
+ * \param tempo tempo information
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_get_queue_tempo()
+ */
+int snd_seq_set_queue_tempo(snd_seq_t *seq, int q, snd_seq_queue_tempo_t * tempo)
+{
+ assert(seq && tempo);
+ tempo->queue = q;
+ return seq->ops->set_queue_tempo(seq, tempo);
+}
+
+
+/*----------------------------------------------------------------*/
+
+/**
+ * \brief get size of #snd_seq_queue_timer_t
+ * \return size in bytes
+ */
+size_t snd_seq_queue_timer_sizeof()
+{
+ return sizeof(snd_seq_queue_timer_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_queue_timer_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_queue_timer_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_queue_timer_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_queue_timer_free(snd_seq_queue_timer_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_queue_timer_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the queue id of a queue_timer container
+ * \param info queue_timer container
+ * \return queue id
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the timer type of a queue_timer container
+ * \param info queue_timer container
+ * \return timer type
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info)
+{
+ assert(info);
+ return (snd_seq_queue_timer_type_t)info->type;
+}
+
+/**
+ * \brief Get the timer id of a queue_timer container
+ * \param info queue_timer container
+ * \return timer id pointer
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info)
+{
+ assert(info);
+ return &info->u.alsa.id;
+}
+
+/**
+ * \brief Get the timer resolution of a queue_timer container
+ * \param info queue_timer container
+ * \return timer resolution
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info)
+{
+ assert(info);
+ return info->u.alsa.resolution;
+}
+
+/**
+ * \brief Set the timer type of a queue_timer container
+ * \param info queue_timer container
+ * \param type timer type
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type)
+{
+ assert(info);
+ info->type = (int)type;
+}
+
+/**
+ * \brief Set the timer id of a queue_timer container
+ * \param info queue_timer container
+ * \param id timer id pointer
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id)
+{
+ assert(info && id);
+ info->u.alsa.id = *id;
+}
+
+/**
+ * \brief Set the timer resolution of a queue_timer container
+ * \param info queue_timer container
+ * \param resolution timer resolution
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution)
+{
+ assert(info);
+ info->u.alsa.resolution = resolution;
+}
+
+
+/**
+ * \brief obtain the queue timer information
+ * \param seq sequencer handle
+ * \param q queue id to query
+ * \param timer pointer to store the timer information
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_set_queue_timer()
+ */
+int snd_seq_get_queue_timer(snd_seq_t *seq, int q, snd_seq_queue_timer_t * timer)
+{
+ assert(seq && timer);
+ memset(timer, 0, sizeof(snd_seq_queue_timer_t));
+ timer->queue = q;
+ return seq->ops->get_queue_timer(seq, timer);
+}
+
+/**
+ * \brief set the queue timer information
+ * \param seq sequencer handle
+ * \param q queue id to change the timer
+ * \param timer timer information
+ * \return 0 on success otherwise a negative error code
+ *
+ * \sa snd_seq_get_queue_timer()
+ */
+int snd_seq_set_queue_timer(snd_seq_t *seq, int q, snd_seq_queue_timer_t * timer)
+{
+ assert(seq && timer);
+ timer->queue = q;
+ return seq->ops->set_queue_timer(seq, timer);
+}
+
+/*----------------------------------------------------------------*/
+
+#ifndef DOC_HIDDEN
+/**
+ * \brief (DEPRECATED) create an event cell
+ * \return the cell pointer allocated
+ *
+ * create an event cell via malloc. the returned pointer must be released
+ * by the application itself via normal free() call,
+ * not via snd_seq_free_event().
+ */
+snd_seq_event_t *snd_seq_create_event(void)
+{
+ return (snd_seq_event_t *) calloc(1, sizeof(snd_seq_event_t));
+}
+#endif
+
+/**
+ * \brief (DEPRECATED) free an event
+ *
+ * In the former version, this function was used to
+ * release the event pointer which was allocated by snd_seq_event_input().
+ * In the current version, the event record is not allocated, so
+ * you don't have to call this function any more.
+ */
+#ifndef DOXYGEN
+int snd_seq_free_event(snd_seq_event_t *ev ATTRIBUTE_UNUSED)
+#else
+int snd_seq_free_event(snd_seq_event_t *ev)
+#endif
+{
+ return 0;
+}
+
+/**
+ * \brief calculates the (encoded) byte-stream size of the event
+ * \param ev the event
+ * \return the size of decoded bytes
+ */
+ssize_t snd_seq_event_length(snd_seq_event_t *ev)
+{
+ ssize_t len = sizeof(snd_seq_event_t);
+ assert(ev);
+ if (snd_seq_ev_is_variable(ev))
+ len += ev->data.ext.len;
+ return len;
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * output to sequencer
+ */
+
+/**
+ * \brief output an event
+ * \param seq sequencer handle
+ * \param ev event to be output
+ * \return the number of remaining events or a negative error code
+ *
+ * An event is once expanded on the output buffer.
+ * The output buffer will be drained automatically if it becomes full.
+ *
+ * If events remain unprocessed on output buffer before drained,
+ * the size of total byte data on output buffer is returned.
+ * If the output buffer is empty, this returns zero.
+ *
+ * \sa snd_seq_event_output_direct(), snd_seq_event_output_buffer(),
+ * snd_seq_event_output_pending(), snd_seq_drain_output(),
+ * snd_seq_drop_output(), snd_seq_extract_output(),
+ * snd_seq_remove_events()
+ */
+int snd_seq_event_output(snd_seq_t *seq, snd_seq_event_t *ev)
+{
+ int result;
+
+ result = snd_seq_event_output_buffer(seq, ev);
+ if (result == -EAGAIN) {
+ result = snd_seq_drain_output(seq);
+ if (result < 0)
+ return result;
+ return snd_seq_event_output_buffer(seq, ev);
+ }
+ return result;
+}
+
+/**
+ * \brief output an event onto the lib buffer without draining buffer
+ * \param seq sequencer handle
+ * \param ev event to be output
+ * \return the byte size of remaining events. \c -EAGAIN if the buffer becomes full.
+ *
+ * This function doesn't drain buffer unlike snd_seq_event_output().
+ *
+ * \sa snd_seq_event_output()
+ */
+int snd_seq_event_output_buffer(snd_seq_t *seq, snd_seq_event_t *ev)
+{
+ int len;
+ assert(seq && ev);
+ len = snd_seq_event_length(ev);
+ if (len < 0)
+ return -EINVAL;
+ if ((size_t) len >= seq->obufsize)
+ return -EINVAL;
+ if ((seq->obufsize - seq->obufused) < (size_t) len)
+ return -EAGAIN;
+ memcpy(seq->obuf + seq->obufused, ev, sizeof(snd_seq_event_t));
+ seq->obufused += sizeof(snd_seq_event_t);
+ if (snd_seq_ev_is_variable(ev)) {
+ memcpy(seq->obuf + seq->obufused, ev->data.ext.ptr, ev->data.ext.len);
+ seq->obufused += ev->data.ext.len;
+ }
+ return seq->obufused;
+}
+
+/*
+ * allocate the temporary buffer
+ */
+static int alloc_tmpbuf(snd_seq_t *seq, size_t len)
+{
+ size_t size = ((len + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t));
+ if (seq->tmpbuf == NULL) {
+ if (size > DEFAULT_TMPBUF_SIZE)
+ seq->tmpbufsize = size;
+ else
+ seq->tmpbufsize = DEFAULT_TMPBUF_SIZE;
+ seq->tmpbuf = malloc(seq->tmpbufsize * sizeof(snd_seq_event_t));
+ if (seq->tmpbuf == NULL)
+ return -ENOMEM;
+ } else if (len > seq->tmpbufsize) {
+ seq->tmpbuf = realloc(seq->tmpbuf, size * sizeof(snd_seq_event_t));
+ if (seq->tmpbuf == NULL)
+ return -ENOMEM;
+ seq->tmpbufsize = size;
+ }
+ return 0;
+}
+
+/**
+ * \brief output an event directly to the sequencer NOT through output buffer
+ * \param seq sequencer handle
+ * \param ev event to be output
+ * \return the byte size sent to sequencer or a negative error code
+ *
+ * This function sends an event to the sequencer directly not through the
+ * output buffer. When the event is a variable length event, a temporary
+ * buffer is allocated inside alsa-lib and the data is copied there before
+ * actually sent.
+ *
+ * \sa snd_seq_event_output()
+ */
+int snd_seq_event_output_direct(snd_seq_t *seq, snd_seq_event_t *ev)
+{
+ ssize_t len;
+ void *buf;
+
+ len = snd_seq_event_length(ev);
+ if (len < 0)
+ return len;
+ else if (len == sizeof(*ev)) {
+ buf = ev;
+ } else {
+ if (alloc_tmpbuf(seq, (size_t)len) < 0)
+ return -ENOMEM;
+ *seq->tmpbuf = *ev;
+ memcpy(seq->tmpbuf + 1, ev->data.ext.ptr, ev->data.ext.len);
+ buf = seq->tmpbuf;
+ }
+ return seq->ops->write(seq, buf, (size_t) len);
+}
+
+/**
+ * \brief return the size of pending events on output buffer
+ * \param seq sequencer handle
+ * \return the byte size of total of pending events
+ *
+ * \sa snd_seq_event_output()
+ */
+int snd_seq_event_output_pending(snd_seq_t *seq)
+{
+ assert(seq);
+ return seq->obufused;
+}
+
+/**
+ * \brief drain output buffer to sequencer
+ * \param seq sequencer handle
+ * \return 0 when all events are drained and sent to sequencer.
+ * When events still remain on the buffer, the byte size of remaining
+ * events are returned. On error a negative error code is returned.
+ *
+ * This function drains all pending events on the output buffer.
+ * The function returns immediately after the events are sent to the queues
+ * regardless whether the events are processed or not.
+ * To get synchronization with the all event processes, use
+ * #snd_seq_sync_output_queue() after calling this function.
+ *
+ * \sa snd_seq_event_output(), snd_seq_sync_output_queue()
+ */
+int snd_seq_drain_output(snd_seq_t *seq)
+{
+ ssize_t result, processed = 0;
+ assert(seq);
+ while (seq->obufused > 0) {
+ result = seq->ops->write(seq, seq->obuf, seq->obufused);
+ if (result < 0) {
+ if (result == -EAGAIN && processed)
+ return seq->obufused;
+ return result;
+ }
+ if ((size_t)result < seq->obufused)
+ memmove(seq->obuf, seq->obuf + result, seq->obufused - result);
+ seq->obufused -= result;
+ }
+ return 0;
+}
+
+/**
+ * \brief extract the first event in output buffer
+ * \param seq sequencer handle
+ * \param ev_res event pointer to be extracted
+ * \return 0 on success otherwise a negative error code
+ *
+ * Extracts the first event in output buffer.
+ * If ev_res is NULL, just remove the event.
+ *
+ * \sa snd_seq_event_output()
+ */
+int snd_seq_extract_output(snd_seq_t *seq, snd_seq_event_t **ev_res)
+{
+ size_t len, olen;
+ snd_seq_event_t ev;
+ assert(seq);
+ if (ev_res)
+ *ev_res = NULL;
+ if ((olen = seq->obufused) < sizeof(snd_seq_event_t))
+ return -ENOENT;
+ memcpy(&ev, seq->obuf, sizeof(snd_seq_event_t));
+ len = snd_seq_event_length(&ev);
+ if (ev_res) {
+ /* extract the event */
+ if (alloc_tmpbuf(seq, len) < 0)
+ return -ENOMEM;
+ memcpy(seq->tmpbuf, seq->obuf, len);
+ *ev_res = seq->tmpbuf;
+ }
+ seq->obufused = olen - len;
+ memmove(seq->obuf, seq->obuf + len, seq->obufused);
+ return 0;
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * input from sequencer
+ */
+
+/*
+ * read from sequencer to input buffer
+ */
+static ssize_t snd_seq_event_read_buffer(snd_seq_t *seq)
+{
+ ssize_t len;
+ len = (seq->ops->read)(seq, seq->ibuf, seq->ibufsize * sizeof(snd_seq_event_t));
+ if (len < 0)
+ return len;
+ seq->ibuflen = len / sizeof(snd_seq_event_t);
+ seq->ibufptr = 0;
+ return seq->ibuflen;
+}
+
+static int snd_seq_event_retrieve_buffer(snd_seq_t *seq, snd_seq_event_t **retp)
+{
+ size_t ncells;
+ snd_seq_event_t *ev;
+
+ *retp = ev = &seq->ibuf[seq->ibufptr];
+ seq->ibufptr++;
+ seq->ibuflen--;
+ if (! snd_seq_ev_is_variable(ev))
+ return 1;
+ ncells = (ev->data.ext.len + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t);
+ if (seq->ibuflen < ncells) {
+ seq->ibuflen = 0; /* clear buffer */
+ *retp = NULL;
+ return -EINVAL;
+ }
+ ev->data.ext.ptr = ev + 1;
+ seq->ibuflen -= ncells;
+ seq->ibufptr += ncells;
+ return 1;
+}
+
+/**
+ * \brief retrieve an event from sequencer
+ * \param seq sequencer handle
+ * \param ev event pointer to be stored
+ * \return
+ *
+ * Obtains an input event from sequencer.
+ * The event is created via snd_seq_create_event(), and its pointer is stored on
+ * ev argument.
+ *
+ * This function firstly receives the event byte-stream data from sequencer
+ * as much as possible at once. Then it retrieves the first event record
+ * and store the pointer on ev.
+ * By calling this function sequentially, events are extracted from the input buffer.
+ *
+ * If there is no input from sequencer, function falls into sleep
+ * in blocking mode until an event is received,
+ * or returns \c -EAGAIN error in non-blocking mode.
+ * Occasionally, this function may return \c -ENOSPC error.
+ * This means that the input FIFO of sequencer overran, and some events are
+ * lost.
+ * Once this error is returned, the input FIFO is cleared automatically.
+ *
+ * Function returns the byte size of remaining events on the input buffer
+ * if an event is successfully received.
+ * Application can determine from the returned value whether to call
+ * input once more or not.
+ *
+ * \sa snd_seq_event_input_pending(), snd_seq_drop_input()
+ */
+int snd_seq_event_input(snd_seq_t *seq, snd_seq_event_t **ev)
+{
+ int err;
+ assert(seq);
+ *ev = NULL;
+ if (seq->ibuflen <= 0) {
+ if ((err = snd_seq_event_read_buffer(seq)) < 0)
+ return err;
+ }
+
+ return snd_seq_event_retrieve_buffer(seq, ev);
+}
+
+/*
+ * read input data from sequencer if available
+ */
+static int snd_seq_event_input_feed(snd_seq_t *seq, int timeout)
+{
+ struct pollfd pfd;
+ int err;
+ pfd.fd = seq->poll_fd;
+ pfd.events = POLLIN;
+ err = poll(&pfd, 1, timeout);
+ if (err < 0) {
+ SYSERR("poll");
+ return -errno;
+ }
+ if (pfd.revents & POLLIN)
+ return snd_seq_event_read_buffer(seq);
+ return seq->ibuflen;
+}
+
+/**
+ * \brief check events in input buffer
+ * \return the byte size of remaining input events on input buffer.
+ *
+ * If events remain on the input buffer of user-space, function returns
+ * the total byte size of events on it.
+ * If fetch_sequencer argument is non-zero,
+ * this function checks the presence of events on sequencer FIFO
+ * When events exist, they are transferred to the input buffer,
+ * and the number of received events are returned.
+ * If fetch_sequencer argument is zero and
+ * no events remain on the input buffer, function simply returns zero.
+ *
+ * \sa snd_seq_event_input()
+ */
+int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer)
+{
+ if (seq->ibuflen == 0 && fetch_sequencer) {
+ return snd_seq_event_input_feed(seq, 0);
+ }
+ return seq->ibuflen;
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * clear event buffers
+ */
+
+/**
+ * \brief remove all events on user-space output buffer
+ * \param seq sequencer handle
+ *
+ * Removes all events on user-space output buffer.
+ * Unlike snd_seq_drain_output(), this function doesn't remove
+ * events on output memory pool of sequencer.
+ *
+ * \sa snd_seq_drop_output()
+ */
+int snd_seq_drop_output_buffer(snd_seq_t *seq)
+{
+ assert(seq);
+ seq->obufused = 0;
+ return 0;
+}
+
+/**
+ * \brief remove all events on user-space input FIFO
+ * \param seq sequencer handle
+ *
+ * \sa snd_seq_drop_input()
+ */
+int snd_seq_drop_input_buffer(snd_seq_t *seq)
+{
+ assert(seq);
+ seq->ibufptr = 0;
+ seq->ibuflen = 0;
+ return 0;
+}
+
+/**
+ * \brief remove all events on output buffer
+ * \param seq sequencer handle
+ *
+ * Removes all events on both user-space output buffer and
+ * output memory pool on kernel.
+ *
+ * \sa snd_seq_drain_output(), snd_seq_drop_output_buffer(), snd_seq_remove_events()
+ */
+int snd_seq_drop_output(snd_seq_t *seq)
+{
+ snd_seq_remove_events_t rminfo;
+ assert(seq);
+
+ memset(&rminfo, 0, sizeof(rminfo));
+ rminfo.remove_mode = SNDRV_SEQ_REMOVE_OUTPUT;
+
+ return snd_seq_remove_events(seq, &rminfo);
+}
+
+/**
+ * \brief clear input buffer and and remove events in sequencer queue
+ * \param seq sequencer handle
+ *
+ * \sa snd_seq_drop_input_buffer(), snd_seq_remove_events()
+ */
+int snd_seq_drop_input(snd_seq_t *seq)
+{
+ snd_seq_remove_events_t rminfo;
+ assert(seq);
+
+ memset(&rminfo, 0, sizeof(rminfo));
+ rminfo.remove_mode = SNDRV_SEQ_REMOVE_INPUT;
+
+ return snd_seq_remove_events(seq, &rminfo);
+}
+
+
+/**
+ * \brief get size of #snd_seq_remove_events_t
+ * \return size in bytes
+ */
+size_t snd_seq_remove_events_sizeof()
+{
+ return sizeof(snd_seq_remove_events_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_remove_events_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_remove_events_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_remove_events_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_remove_events_free(snd_seq_remove_events_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_remove_events_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the removal condition bits
+ * \param info remove_events container
+ * \return removal condition bits
+ *
+ * \sa snd_seq_remove_events()
+ */
+unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return info->remove_mode;
+}
+
+/**
+ * \brief Get the queue as removal condition
+ * \param info remove_events container
+ * \return queue id
+ *
+ * \sa snd_seq_remove_events()
+ */
+int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return info->queue;
+}
+
+/**
+ * \brief Get the event timestamp as removal condition
+ * \param info remove_events container
+ * \return time stamp
+ *
+ * \sa snd_seq_remove_events()
+ */
+const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return &info->time;
+}
+
+/**
+ * \brief Get the event destination address as removal condition
+ * \param info remove_events container
+ * \return destination address
+ *
+ * \sa snd_seq_remove_events()
+ */
+const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return &info->dest;
+}
+
+/**
+ * \brief Get the event channel as removal condition
+ * \param info remove_events container
+ * \return channel number
+ *
+ * \sa snd_seq_remove_events()
+ */
+int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return info->channel;
+}
+
+/**
+ * \brief Get the event type as removal condition
+ * \param info remove_events container
+ * \return event type
+ *
+ * \sa snd_seq_remove_events()
+ */
+int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return info->type;
+}
+
+/**
+ * \brief Get the event tag id as removal condition
+ * \param info remove_events container
+ * \return tag id
+ *
+ * \sa snd_seq_remove_events()
+ */
+int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info)
+{
+ assert(info);
+ return info->tag;
+}
+
+/**
+ * \brief Set the removal condition bits
+ * \param info remove_events container
+ * \param flags removal condition bits
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags)
+{
+ assert(info);
+ info->remove_mode = flags;
+}
+
+/**
+ * \brief Set the queue as removal condition
+ * \param info remove_events container
+ * \param queue queue id
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue)
+{
+ assert(info);
+ info->queue = queue;
+}
+
+/**
+ * \brief Set the timestamp as removal condition
+ * \param info remove_events container
+ * \param time timestamp pointer
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time)
+{
+ assert(info);
+ info->time = *time;
+}
+
+/**
+ * \brief Set the destination address as removal condition
+ * \param info remove_events container
+ * \param addr destination address
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr)
+{
+ assert(info);
+ info->dest = *addr;
+}
+
+/**
+ * \brief Set the channel as removal condition
+ * \param info remove_events container
+ * \param channel channel number
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel)
+{
+ assert(info);
+ info->channel = channel;
+}
+
+/**
+ * \brief Set the event type as removal condition
+ * \param info remove_events container
+ * \param type event type
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type)
+{
+ assert(info);
+ info->type = type;
+}
+
+/**
+ * \brief Set the event tag as removal condition
+ * \param info remove_events container
+ * \param tag tag id
+ *
+ * \sa snd_seq_remove_events()
+ */
+void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag)
+{
+ assert(info);
+ info->tag = tag;
+}
+
+
+/* compare timestamp between events */
+/* return 1 if a >= b; otherwise return 0 */
+static inline int snd_seq_compare_tick_time(snd_seq_tick_time_t *a, snd_seq_tick_time_t *b)
+{
+ /* compare ticks */
+ return (*a >= *b);
+}
+
+static inline int snd_seq_compare_real_time(snd_seq_real_time_t *a, snd_seq_real_time_t *b)
+{
+ /* compare real time */
+ if (a->tv_sec > b->tv_sec)
+ return 1;
+ if ((a->tv_sec == b->tv_sec) && (a->tv_nsec >= b->tv_nsec))
+ return 1;
+ return 0;
+}
+
+/* Routine to match events to be removed */
+static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
+{
+ int res;
+
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_DEST) {
+ if (ev->dest.client != info->dest.client ||
+ ev->dest.port != info->dest.port)
+ return 0;
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_DEST_CHANNEL) {
+ if (! snd_seq_ev_is_channel_type(ev))
+ return 0;
+ /* data.note.channel and data.control.channel are identical */
+ if (ev->data.note.channel != info->channel)
+ return 0;
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_AFTER) {
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
+ res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
+ else
+ res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
+ if (!res)
+ return 0;
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_BEFORE) {
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
+ res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
+ else
+ res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
+ if (res)
+ return 0;
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_EVENT_TYPE) {
+ if (ev->type != info->type)
+ return 0;
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_IGNORE_OFF) {
+ /* Do not remove off events */
+ switch (ev->type) {
+ case SND_SEQ_EVENT_NOTEOFF:
+ /* case SND_SEQ_EVENT_SAMPLE_STOP: */
+ return 0;
+ default:
+ break;
+ }
+ }
+ if (info->remove_mode & SNDRV_SEQ_REMOVE_TAG_MATCH) {
+ if (info->tag != ev->tag)
+ return 0;
+ }
+
+ return 1;
+}
+
+/**
+ * \brief remove events on input/output buffers and pools
+ * \param seq sequencer handle
+ * \param rmp remove event container
+ *
+ * Removes matching events with the given condition from input/output buffers
+ * and pools.
+ * The removal condition is specified in \a rmp argument.
+ *
+ * \sa snd_seq_event_output(), snd_seq_drop_output(), snd_seq_reset_pool_output()
+ */
+int snd_seq_remove_events(snd_seq_t *seq, snd_seq_remove_events_t *rmp)
+{
+ if (rmp->remove_mode & SNDRV_SEQ_REMOVE_INPUT) {
+ /*
+ * First deal with any events that are still buffered
+ * in the library.
+ */
+ snd_seq_drop_input_buffer(seq);
+ }
+
+ if (rmp->remove_mode & SNDRV_SEQ_REMOVE_OUTPUT) {
+ /*
+ * First deal with any events that are still buffered
+ * in the library.
+ */
+ if (! (rmp->remove_mode & ~(SNDRV_SEQ_REMOVE_INPUT|SNDRV_SEQ_REMOVE_OUTPUT))) {
+ /* The simple case - remove all */
+ snd_seq_drop_output_buffer(seq);
+ } else {
+ char *ep;
+ size_t len;
+ snd_seq_event_t *ev;
+
+ ep = seq->obuf;
+ while (ep - seq->obuf < (ssize_t)seq->obufused) {
+
+ ev = (snd_seq_event_t *)ep;
+ len = snd_seq_event_length(ev);
+
+ if (remove_match(rmp, ev)) {
+ /* Remove event */
+ seq->obufused -= len;
+ memmove(ep, ep + len, seq->obufused - (ep - seq->obuf));
+ } else {
+ ep += len;
+ }
+ }
+ }
+ }
+
+ return seq->ops->remove_events(seq, rmp);
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * client memory pool
+ */
+
+/**
+ * \brief get size of #snd_seq_client_pool_t
+ * \return size in bytes
+ */
+size_t snd_seq_client_pool_sizeof()
+{
+ return sizeof(snd_seq_client_pool_t);
+}
+
+/**
+ * \brief allocate an empty #snd_seq_client_pool_t using standard malloc
+ * \param ptr returned pointer
+ * \return 0 on success otherwise negative error code
+ */
+int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr)
+{
+ assert(ptr);
+ *ptr = calloc(1, sizeof(snd_seq_client_pool_t));
+ if (!*ptr)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees a previously allocated #snd_seq_client_pool_t
+ * \param obj pointer to object to free
+ */
+void snd_seq_client_pool_free(snd_seq_client_pool_t *obj)
+{
+ free(obj);
+}
+
+/**
+ * \brief copy one #snd_seq_client_pool_t to another
+ * \param dst pointer to destination
+ * \param src pointer to source
+ */
+void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+/**
+ * \brief Get the client id of a queue_info container
+ * \param info client_pool container
+ * \return client id
+ */
+int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->client;
+}
+
+/**
+ * \brief Get the output pool size of a queue_info container
+ * \param info client_pool container
+ * \return output pool size
+ */
+size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->output_pool;
+}
+
+/**
+ * \brief Get the input pool size of a queue_info container
+ * \param info client_pool container
+ * \return input pool size
+ */
+size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->input_pool;
+}
+
+/**
+ * \brief Get the output room size of a queue_info container
+ * \param info client_pool container
+ * \return output room size
+ */
+size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->output_room;
+}
+
+/**
+ * \brief Get the available size on output pool of a queue_info container
+ * \param info client_pool container
+ * \return available output size
+ */
+size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->output_free;
+}
+
+/**
+ * \brief Get the available size on input pool of a queue_info container
+ * \param info client_pool container
+ * \return available input size
+ */
+size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info)
+{
+ assert(info);
+ return info->input_free;
+}
+
+/**
+ * \brief Set the output pool size of a queue_info container
+ * \param info client_pool container
+ * \param size output pool size
+ */
+void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size)
+{
+ assert(info);
+ info->output_pool = size;
+}
+
+/**
+ * \brief Set the input pool size of a queue_info container
+ * \param info client_pool container
+ * \param size input pool size
+ */
+void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size)
+{
+ assert(info);
+ info->input_pool = size;
+}
+
+/**
+ * \brief Set the output room size of a queue_info container
+ * \param info client_pool container
+ * \param size output room size
+ */
+void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size)
+{
+ assert(info);
+ info->output_room = size;
+}
+
+
+/**
+ * \brief obtain the pool information of the current client
+ * \param seq sequencer handle
+ * \param info information to be stored
+ */
+int snd_seq_get_client_pool(snd_seq_t *seq, snd_seq_client_pool_t *info)
+{
+ assert(seq && info);
+ info->client = seq->client;
+ return seq->ops->get_client_pool(seq, info);
+}
+
+/**
+ * \brief set the pool information
+ * \param seq sequencer handle
+ * \param info information to update
+ *
+ * Sets the pool information of the current client.
+ * The client field in \a info is replaced automatically with the current id.
+ */
+int snd_seq_set_client_pool(snd_seq_t *seq, snd_seq_client_pool_t *info)
+{
+ assert(seq && info);
+ info->client = seq->client;
+ return seq->ops->set_client_pool(seq, info);
+}
+
+/*----------------------------------------------------------------*/
+
+/*
+ * misc.
+ */
+
+/**
+ * \brief set a bit flag
+ */
+void snd_seq_set_bit(int nr, void *array)
+{
+ ((unsigned int *)array)[nr >> 5] |= 1UL << (nr & 31);
+}
+
+/**
+ * \brief unset a bit flag
+ */
+void snd_seq_unset_bit(int nr, void *array)
+{
+ ((unsigned int *)array)[nr >> 5] &= ~(1UL << (nr & 31));
+}
+
+/**
+ * \brief change a bit flag
+ */
+int snd_seq_change_bit(int nr, void *array)
+{
+ int result;
+
+ result = ((((unsigned int *)array)[nr >> 5]) & (1UL << (nr & 31))) ? 1 : 0;
+ ((unsigned int *)array)[nr >> 5] ^= 1UL << (nr & 31);
+ return result;
+}
+
+/**
+ * \brief get a bit flag state
+ */
+int snd_seq_get_bit(int nr, void *array)
+{
+ return ((((unsigned int *)array)[nr >> 5]) & (1UL << (nr & 31))) ? 1 : 0;
+}
diff --git a/alsa-lib/src/seq/seq_event.c b/alsa-lib/src/seq/seq_event.c
new file mode 100644
index 0000000..0571b21
--- /dev/null
+++ b/alsa-lib/src/seq/seq_event.c
@@ -0,0 +1,49 @@
+/**
+ * \file seq/seq_event.c
+ * \brief Sequencer Event Types
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \date 2001
+ */
+
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+#define FIXED_EV(x) (_SND_SEQ_TYPE(SND_SEQ_EVFLG_FIXED) | _SND_SEQ_TYPE(x))
+#endif
+
+/** Event types conversion array */
+const unsigned int snd_seq_event_types[256] = {
+ [SND_SEQ_EVENT_SYSTEM ... SND_SEQ_EVENT_RESULT]
+ = FIXED_EV(SND_SEQ_EVFLG_RESULT),
+ [SND_SEQ_EVENT_NOTE]
+ = FIXED_EV(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE_OPT(SND_SEQ_EVFLG_NOTE_TWOARG),
+ [SND_SEQ_EVENT_NOTEON ... SND_SEQ_EVENT_KEYPRESS]
+ = FIXED_EV(SND_SEQ_EVFLG_NOTE),
+ [SND_SEQ_EVENT_CONTROLLER ... SND_SEQ_EVENT_REGPARAM]
+ = FIXED_EV(SND_SEQ_EVFLG_CONTROL),
+ [SND_SEQ_EVENT_START ... SND_SEQ_EVENT_STOP]
+ = FIXED_EV(SND_SEQ_EVFLG_QUEUE),
+ [SND_SEQ_EVENT_SETPOS_TICK]
+ = FIXED_EV(SND_SEQ_EVFLG_QUEUE) | _SND_SEQ_TYPE_OPT(SND_SEQ_EVFLG_QUEUE_TICK),
+ [SND_SEQ_EVENT_SETPOS_TIME]
+ = FIXED_EV(SND_SEQ_EVFLG_QUEUE) | _SND_SEQ_TYPE_OPT(SND_SEQ_EVFLG_QUEUE_TIME),
+ [SND_SEQ_EVENT_TEMPO ... SND_SEQ_EVENT_SYNC_POS]
+ = FIXED_EV(SND_SEQ_EVFLG_QUEUE) | _SND_SEQ_TYPE_OPT(SND_SEQ_EVFLG_QUEUE_VALUE),
+ [SND_SEQ_EVENT_TUNE_REQUEST ... SND_SEQ_EVENT_SENSING]
+ = FIXED_EV(SND_SEQ_EVFLG_NONE),
+ [SND_SEQ_EVENT_ECHO ... SND_SEQ_EVENT_OSS]
+ = FIXED_EV(SND_SEQ_EVFLG_RAW) | FIXED_EV(SND_SEQ_EVFLG_SYSTEM),
+ [SND_SEQ_EVENT_CLIENT_START ... SND_SEQ_EVENT_PORT_CHANGE]
+ = FIXED_EV(SND_SEQ_EVFLG_MESSAGE),
+ [SND_SEQ_EVENT_PORT_SUBSCRIBED ... SND_SEQ_EVENT_PORT_UNSUBSCRIBED]
+ = FIXED_EV(SND_SEQ_EVFLG_CONNECTION),
+ [SND_SEQ_EVENT_USR0 ... SND_SEQ_EVENT_USR9]
+ = FIXED_EV(SND_SEQ_EVFLG_RAW) | FIXED_EV(SND_SEQ_EVFLG_USERS),
+ [SND_SEQ_EVENT_SYSEX ... SND_SEQ_EVENT_BOUNCE]
+ = _SND_SEQ_TYPE(SND_SEQ_EVFLG_VARIABLE),
+ [SND_SEQ_EVENT_USR_VAR0 ... SND_SEQ_EVENT_USR_VAR4]
+ = _SND_SEQ_TYPE(SND_SEQ_EVFLG_VARIABLE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_USERS),
+ [SND_SEQ_EVENT_NONE]
+ = FIXED_EV(SND_SEQ_EVFLG_NONE),
+};
+
diff --git a/alsa-lib/src/seq/seq_hw.c b/alsa-lib/src/seq/seq_hw.c
new file mode 100644
index 0000000..0e94593
--- /dev/null
+++ b/alsa-lib/src/seq/seq_hw.c
@@ -0,0 +1,568 @@
+/*
+ * Sequencer Interface - main file
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "seq_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_seq_hw = "";
+#endif
+
+#ifndef DOC_HIDDEN
+#define SNDRV_FILE_SEQ ALSA_DEVICE_DIRECTORY "seq"
+#define SNDRV_FILE_ALOADSEQ ALOAD_DEVICE_DIRECTORY "aloadSEQ"
+#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 1)
+
+typedef struct {
+ int fd;
+} snd_seq_hw_t;
+#endif /* DOC_HIDDEN */
+
+static int snd_seq_hw_close(snd_seq_t *seq)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ int err = 0;
+
+ if (close(hw->fd)) {
+ err = -errno;
+ SYSERR("close failed\n");
+ }
+ free(hw);
+ return err;
+}
+
+static int snd_seq_hw_nonblock(snd_seq_t *seq, int nonblock)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ long flags;
+
+ if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
+ SYSERR("F_GETFL failed");
+ return -errno;
+ }
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(hw->fd, F_SETFL, flags) < 0) {
+ SYSERR("F_SETFL for O_NONBLOCK failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_client_id(snd_seq_t *seq)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ int client;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_CLIENT_ID, &client) < 0) {
+ SYSERR("SNDRV_SEQ_IOCTL_CLIENT_ID failed");
+ return -errno;
+ }
+ return client;
+}
+
+static int snd_seq_hw_system_info(snd_seq_t *seq, snd_seq_system_info_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SYSTEM_INFO, info) < 0) {
+ SYSERR("SNDRV_SEQ_IOCTL_SYSTEM_INFO failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_client_info(snd_seq_t *seq, snd_seq_client_info_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_CLIENT_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_client_info(snd_seq_t *seq, snd_seq_client_info_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_CLIENT_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_create_port(snd_seq_t *seq, snd_seq_port_info_t * port)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_CREATE_PORT, port) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_CREATE_PORT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_delete_port(snd_seq_t *seq, snd_seq_port_info_t * port)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_DELETE_PORT, port) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_DELETE_PORT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_port_info(snd_seq_t *seq, snd_seq_port_info_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_PORT_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_PORT_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_port_info(snd_seq_t *seq, snd_seq_port_info_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_PORT_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_PORT_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_port_subscription(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION, sub) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_subscribe_port(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, sub) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_unsubscribe_port(snd_seq_t *seq, snd_seq_port_subscribe_t * sub)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, sub) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_QUERY_SUBS, subs) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_QUERY_SUBS failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_queue_status(snd_seq_t *seq, snd_seq_queue_status_t * status)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS, status) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_queue_tempo(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO, tempo) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_queue_tempo(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO, tempo) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_queue_timer(snd_seq_t *seq, snd_seq_queue_timer_t * timer)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER, timer) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_queue_timer(snd_seq_t *seq, snd_seq_queue_timer_t * timer)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER, timer) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_queue_client(snd_seq_t *seq, snd_seq_queue_client_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_queue_client(snd_seq_t *seq, snd_seq_queue_client_t * info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_CREATE_QUEUE, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_CREATE_QUEUE failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_delete_queue(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_DELETE_QUEUE, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_DELETE_QUEUE failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_queue_info(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_QUEUE_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_QUEUE_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_queue_info(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_QUEUE_INFO, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_QUEUE_INFO failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_named_queue(snd_seq_t *seq, snd_seq_queue_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static ssize_t snd_seq_hw_write(snd_seq_t *seq, void *buf, size_t len)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ ssize_t result = write(hw->fd, buf, len);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static ssize_t snd_seq_hw_read(snd_seq_t *seq, void *buf, size_t len)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ ssize_t result = read(hw->fd, buf, len);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static int snd_seq_hw_remove_events(snd_seq_t *seq, snd_seq_remove_events_t *rmp)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_REMOVE_EVENTS, rmp) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_REMOVE_EVENTS failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_get_client_pool(snd_seq_t *seq, snd_seq_client_pool_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_GET_CLIENT_POOL, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_GET_CLIENT_POOL failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_set_client_pool(snd_seq_t *seq, snd_seq_client_pool_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SET_CLIENT_POOL, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_SET_CLIENT_POOL failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_query_next_client(snd_seq_t *seq, snd_seq_client_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_seq_hw_query_next_port(snd_seq_t *seq, snd_seq_port_info_t *info)
+{
+ snd_seq_hw_t *hw = seq->private_data;
+ if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT, info) < 0) {
+ /*SYSERR("SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT failed");*/
+ return -errno;
+ }
+ return 0;
+}
+
+static const snd_seq_ops_t snd_seq_hw_ops = {
+ .close = snd_seq_hw_close,
+ .nonblock = snd_seq_hw_nonblock,
+ .system_info = snd_seq_hw_system_info,
+ .get_client_info = snd_seq_hw_get_client_info,
+ .set_client_info = snd_seq_hw_set_client_info,
+ .create_port = snd_seq_hw_create_port,
+ .delete_port = snd_seq_hw_delete_port,
+ .get_port_info = snd_seq_hw_get_port_info,
+ .set_port_info = snd_seq_hw_set_port_info,
+ .get_port_subscription = snd_seq_hw_get_port_subscription,
+ .subscribe_port = snd_seq_hw_subscribe_port,
+ .unsubscribe_port = snd_seq_hw_unsubscribe_port,
+ .query_port_subscribers = snd_seq_hw_query_port_subscribers,
+ .get_queue_status = snd_seq_hw_get_queue_status,
+ .get_queue_tempo = snd_seq_hw_get_queue_tempo,
+ .set_queue_tempo = snd_seq_hw_set_queue_tempo,
+ .get_queue_timer = snd_seq_hw_get_queue_timer,
+ .set_queue_timer = snd_seq_hw_set_queue_timer,
+ .get_queue_client = snd_seq_hw_get_queue_client,
+ .set_queue_client = snd_seq_hw_set_queue_client,
+ .create_queue = snd_seq_hw_create_queue,
+ .delete_queue = snd_seq_hw_delete_queue,
+ .get_queue_info = snd_seq_hw_get_queue_info,
+ .set_queue_info = snd_seq_hw_set_queue_info,
+ .get_named_queue = snd_seq_hw_get_named_queue,
+ .write = snd_seq_hw_write,
+ .read = snd_seq_hw_read,
+ .remove_events = snd_seq_hw_remove_events,
+ .get_client_pool = snd_seq_hw_get_client_pool,
+ .set_client_pool = snd_seq_hw_set_client_pool,
+ .query_next_client = snd_seq_hw_query_next_client,
+ .query_next_port = snd_seq_hw_query_next_port,
+};
+
+int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
+{
+ int fd, ver, client, fmode, ret;
+ const char *filename;
+ snd_seq_t *seq;
+ snd_seq_hw_t *hw;
+
+ *handle = NULL;
+
+ switch (streams) {
+ case SND_SEQ_OPEN_OUTPUT:
+ fmode = O_WRONLY;
+ break;
+ case SND_SEQ_OPEN_INPUT:
+ fmode = O_RDONLY;
+ break;
+ case SND_SEQ_OPEN_DUPLEX:
+ fmode = O_RDWR;
+ break;
+ default:
+ assert(0);
+ return -EINVAL;
+ }
+
+ if (mode & SND_SEQ_NONBLOCK)
+ fmode |= O_NONBLOCK;
+
+ filename = SNDRV_FILE_SEQ;
+ fd = snd_open_device(filename, fmode);
+#ifdef SUPPORT_ALOAD
+ if (fd < 0) {
+ fd = snd_open_device(SNDRV_FILE_ALOADSEQ, fmode);
+ if (fd >= 0)
+ close(fd);
+ fd = snd_open_device(filename, fmode);
+ }
+#endif
+ if (fd < 0) {
+ SYSERR("open %s failed", filename);
+ return -errno;
+ }
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ SYSERR("fcntl FD_CLOEXEC failed");
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+#endif
+ if (ioctl(fd, SNDRV_SEQ_IOCTL_PVERSION, &ver) < 0) {
+ SYSERR("SNDRV_SEQ_IOCTL_PVERSION failed");
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_SEQ_VERSION_MAX)) {
+ close(fd);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ hw = calloc(1, sizeof(snd_seq_hw_t));
+ if (hw == NULL) {
+ close(fd);
+ return -ENOMEM;
+ }
+
+ seq = calloc(1, sizeof(snd_seq_t));
+ if (seq == NULL) {
+ free(hw);
+ close(fd);
+ return -ENOMEM;
+ }
+ hw->fd = fd;
+ if (streams & SND_SEQ_OPEN_OUTPUT) {
+ seq->obuf = (char *) malloc(seq->obufsize = SND_SEQ_OBUF_SIZE);
+ if (!seq->obuf) {
+ free(hw);
+ free(seq);
+ close(fd);
+ return -ENOMEM;
+ }
+ }
+ if (streams & SND_SEQ_OPEN_INPUT) {
+ seq->ibuf = (snd_seq_event_t *) calloc(sizeof(snd_seq_event_t), seq->ibufsize = SND_SEQ_IBUF_SIZE);
+ if (!seq->ibuf) {
+ free(seq->obuf);
+ free(hw);
+ free(seq);
+ close(fd);
+ return -ENOMEM;
+ }
+ }
+ if (name)
+ seq->name = strdup(name);
+ seq->type = SND_SEQ_TYPE_HW;
+ seq->streams = streams;
+ seq->mode = mode;
+ seq->tmpbuf = NULL;
+ seq->tmpbufsize = 0;
+ seq->poll_fd = fd;
+ seq->ops = &snd_seq_hw_ops;
+ seq->private_data = hw;
+ client = snd_seq_hw_client_id(seq);
+ if (client < 0) {
+ snd_seq_close(seq);
+ return client;
+ } else
+ seq->client = client;
+
+#ifdef SNDRV_SEQ_IOCTL_RUNNING_MODE
+ {
+ struct sndrv_seq_running_info run_mode;
+ /* check running mode */
+ memset(&run_mode, 0, sizeof(run_mode));
+ run_mode.client = client;
+#ifdef SNDRV_BIG_ENDIAN
+ run_mode.big_endian = 1;
+#else
+ run_mode.big_endian = 0;
+#endif
+ run_mode.cpu_mode = sizeof(long);
+ ioctl(fd, SNDRV_SEQ_IOCTL_RUNNING_MODE, &run_mode);
+ }
+#endif
+
+ *handle = seq;
+ return 0;
+}
+
+int _snd_seq_hw_open(snd_seq_t **handlep, char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
+ int streams, int mode)
+{
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ return -EINVAL;
+ }
+ return snd_seq_hw_open(handlep, name, streams, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_seq_hw_open, SND_SEQ_DLSYM_VERSION);
diff --git a/alsa-lib/src/seq/seq_local.h b/alsa-lib/src/seq/seq_local.h
new file mode 100644
index 0000000..f0a0acd
--- /dev/null
+++ b/alsa-lib/src/seq/seq_local.h
@@ -0,0 +1,97 @@
+/*
+ * Sequencer Interface - definition of sequencer event handler
+ * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
+ * Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __SEQ_LOCAL_H
+#define __SEQ_LOCAL_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "local.h"
+
+#define SND_SEQ_OBUF_SIZE (16*1024) /* default size */
+#define SND_SEQ_IBUF_SIZE 500 /* in event_size aligned */
+#define DEFAULT_TMPBUF_SIZE 20
+
+typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
+
+
+typedef struct {
+ int (*close)(snd_seq_t *seq);
+ int (*nonblock)(snd_seq_t *seq, int nonblock);
+ int (*system_info)(snd_seq_t *seq, snd_seq_system_info_t * info);
+ int (*get_client_info)(snd_seq_t *seq, snd_seq_client_info_t * info);
+ int (*set_client_info)(snd_seq_t *seq, snd_seq_client_info_t * info);
+ int (*create_port)(snd_seq_t *seq, snd_seq_port_info_t * port);
+ int (*delete_port)(snd_seq_t *seq, snd_seq_port_info_t * port);
+ int (*get_port_info)(snd_seq_t *seq, snd_seq_port_info_t * info);
+ int (*set_port_info)(snd_seq_t *seq, snd_seq_port_info_t * info);
+ int (*get_port_subscription)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
+ int (*subscribe_port)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
+ int (*unsubscribe_port)(snd_seq_t *seq, snd_seq_port_subscribe_t * sub);
+ int (*query_port_subscribers)(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
+ int (*get_queue_status)(snd_seq_t *seq, snd_seq_queue_status_t * status);
+ int (*get_queue_tempo)(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo);
+ int (*set_queue_tempo)(snd_seq_t *seq, snd_seq_queue_tempo_t * tempo);
+ int (*get_queue_timer)(snd_seq_t *seq, snd_seq_queue_timer_t * timer);
+ int (*set_queue_timer)(snd_seq_t *seq, snd_seq_queue_timer_t * timer);
+ int (*get_queue_client)(snd_seq_t *seq, snd_seq_queue_client_t * client);
+ int (*set_queue_client)(snd_seq_t *seq, snd_seq_queue_client_t * client);
+ int (*create_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
+ int (*delete_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
+ int (*get_queue_info)(snd_seq_t *seq, snd_seq_queue_info_t *info);
+ int (*set_queue_info)(snd_seq_t *seq, snd_seq_queue_info_t *info);
+ int (*get_named_queue)(snd_seq_t *seq, snd_seq_queue_info_t *info);
+ ssize_t (*write)(snd_seq_t *seq, void *buf, size_t len);
+ ssize_t (*read)(snd_seq_t *seq, void *buf, size_t len);
+ int (*remove_events)(snd_seq_t *seq, snd_seq_remove_events_t *rmp);
+ int (*get_client_pool)(snd_seq_t *seq, snd_seq_client_pool_t *info);
+ int (*set_client_pool)(snd_seq_t *seq, snd_seq_client_pool_t *info);
+ int (*query_next_client)(snd_seq_t *seq, snd_seq_client_info_t *info);
+ int (*query_next_port)(snd_seq_t *seq, snd_seq_port_info_t *info);
+} snd_seq_ops_t;
+
+struct _snd_seq {
+ char *name;
+ snd_seq_type_t type;
+ int streams;
+ int mode;
+ int poll_fd;
+ void *dl_handle;
+ const snd_seq_ops_t *ops;
+ void *private_data;
+ int client; /* client number */
+ /* buffers */
+ char *obuf; /* output buffer */
+ size_t obufsize; /* output buffer size */
+ size_t obufused; /* output buffer used size */
+ snd_seq_event_t *ibuf; /* input buffer */
+ size_t ibufptr; /* current pointer of input buffer */
+ size_t ibuflen; /* queued length */
+ size_t ibufsize; /* input buffer size */
+ snd_seq_event_t *tmpbuf; /* temporary event for extracted event */
+ size_t tmpbufsize; /* size of errbuf */
+};
+
+int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode);
+
+#endif
diff --git a/alsa-lib/src/seq/seq_midi_event.c b/alsa-lib/src/seq/seq_midi_event.c
new file mode 100644
index 0000000..b5caa1b
--- /dev/null
+++ b/alsa-lib/src/seq/seq_midi_event.c
@@ -0,0 +1,586 @@
+/**
+ * \file seq/seq_midi_event.c
+ * \brief MIDI byte <-> sequencer event coder
+ * \author Takashi Iwai <tiwai@suse.de>
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2000-2001
+ */
+
+/*
+ * MIDI byte <-> sequencer event coder
+ *
+ * Copyright (C) 1998,99,2000 Takashi Iwai <tiwai@suse.de>,
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <malloc.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+
+/* midi status */
+struct snd_midi_event {
+ size_t qlen; /* queue length */
+ size_t read; /* chars read */
+ int type; /* current event type */
+ unsigned char lastcmd;
+ unsigned char nostat;
+ size_t bufsize;
+ unsigned char *buf; /* input buffer */
+};
+
+
+/* event type, index into status_event[] */
+/* from 0 to 6 are normal commands (note off, on, etc.) for 0x8?-0xe? */
+#define ST_INVALID 7
+#define ST_SPECIAL 8
+#define ST_SYSEX ST_SPECIAL
+/* from 8 to 15 are events for 0xf0-0xf7 */
+
+
+/* status event types */
+typedef void (*event_encode_t)(snd_midi_event_t *dev, snd_seq_event_t *ev);
+typedef void (*event_decode_t)(const snd_seq_event_t *ev, unsigned char *buf);
+
+#endif /* DOC_HIDDEN */
+
+/*
+ * prototypes
+ */
+static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev);
+static void note_decode(const snd_seq_event_t *ev, unsigned char *buf);
+static void one_param_decode(const snd_seq_event_t *ev, unsigned char *buf);
+static void pitchbend_decode(const snd_seq_event_t *ev, unsigned char *buf);
+static void two_param_decode(const snd_seq_event_t *ev, unsigned char *buf);
+static void songpos_decode(const snd_seq_event_t *ev, unsigned char *buf);
+
+/*
+ * event list
+ */
+#ifndef DOC_HIDDEN
+static const struct status_event_list_t {
+ int event;
+ int qlen;
+ event_encode_t encode;
+ event_decode_t decode;
+} status_event[] = {
+ /* 0x80 - 0xef */
+ {SND_SEQ_EVENT_NOTEOFF, 2, note_event, note_decode},
+ {SND_SEQ_EVENT_NOTEON, 2, note_event, note_decode},
+ {SND_SEQ_EVENT_KEYPRESS, 2, note_event, note_decode},
+ {SND_SEQ_EVENT_CONTROLLER, 2, two_param_ctrl_event, two_param_decode},
+ {SND_SEQ_EVENT_PGMCHANGE, 1, one_param_ctrl_event, one_param_decode},
+ {SND_SEQ_EVENT_CHANPRESS, 1, one_param_ctrl_event, one_param_decode},
+ {SND_SEQ_EVENT_PITCHBEND, 2, pitchbend_ctrl_event, pitchbend_decode},
+ /* invalid */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL},
+ /* 0xf0 - 0xff */
+ {SND_SEQ_EVENT_SYSEX, 1, NULL, NULL}, /* sysex: 0xf0 */
+ {SND_SEQ_EVENT_QFRAME, 1, one_param_event, one_param_decode}, /* 0xf1 */
+ {SND_SEQ_EVENT_SONGPOS, 2, songpos_event, songpos_decode}, /* 0xf2 */
+ {SND_SEQ_EVENT_SONGSEL, 1, one_param_event, one_param_decode}, /* 0xf3 */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL}, /* 0xf4 */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL}, /* 0xf5 */
+ {SND_SEQ_EVENT_TUNE_REQUEST, 0, NULL, NULL}, /* 0xf6 */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL}, /* 0xf7 */
+ {SND_SEQ_EVENT_CLOCK, 0, NULL, NULL}, /* 0xf8 */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL}, /* 0xf9 */
+ {SND_SEQ_EVENT_START, 0, NULL, NULL}, /* 0xfa */
+ {SND_SEQ_EVENT_CONTINUE, 0, NULL, NULL}, /* 0xfb */
+ {SND_SEQ_EVENT_STOP, 0, NULL, NULL}, /* 0xfc */
+ {SND_SEQ_EVENT_NONE, -1, NULL, NULL}, /* 0xfd */
+ {SND_SEQ_EVENT_SENSING, 0, NULL, NULL}, /* 0xfe */
+ {SND_SEQ_EVENT_RESET, 0, NULL, NULL}, /* 0xff */
+};
+
+static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
+static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev);
+
+static const struct extra_event_list_t {
+ int event;
+ int (*decode)(snd_midi_event_t *dev, unsigned char *buf, int len, const snd_seq_event_t *ev);
+} extra_event[] = {
+ {SND_SEQ_EVENT_CONTROL14, extra_decode_ctrl14},
+ {SND_SEQ_EVENT_NONREGPARAM, extra_decode_xrpn},
+ {SND_SEQ_EVENT_REGPARAM, extra_decode_xrpn},
+};
+
+#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
+#endif /* DOC_HIDDEN */
+
+/**
+ * \brief Initialize MIDI event parser
+ * \param bufsize buffer size for MIDI message
+ * \param rdev allocated MIDI event parser
+ * \return 0 on success otherwise a negative error code
+ *
+ * Allocates and initializes MIDI event parser.
+ */
+int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev)
+{
+ snd_midi_event_t *dev;
+
+ *rdev = NULL;
+ dev = (snd_midi_event_t *)calloc(1, sizeof(snd_midi_event_t));
+ if (dev == NULL)
+ return -ENOMEM;
+ if (bufsize > 0) {
+ dev->buf = malloc(bufsize);
+ if (dev->buf == NULL) {
+ free(dev);
+ return -ENOMEM;
+ }
+ }
+ dev->bufsize = bufsize;
+ dev->lastcmd = 0xff;
+ dev->type = ST_INVALID;
+ *rdev = dev;
+ return 0;
+}
+
+/**
+ * \brief Free MIDI event parser
+ * \param dev MIDI event parser
+ * \return 0 on success otherwise a negative error code
+ *
+ * Frees MIDI event parser.
+ */
+void snd_midi_event_free(snd_midi_event_t *dev)
+{
+ if (dev != NULL) {
+ free(dev->buf);
+ free(dev);
+ }
+}
+
+/**
+ * \brief Enable/disable MIDI command merging
+ * \param dev MIDI event parser
+ * \param on 0 - enable MIDI command merging, 1 - always pass the command
+ *
+ * Enable/disable MIDI command merging
+ */
+void snd_midi_event_no_status(snd_midi_event_t *dev, int on)
+{
+ dev->nostat = on ? 1 : 0;
+}
+
+/*
+ * initialize record
+ */
+inline static void reset_encode(snd_midi_event_t *dev)
+{
+ dev->read = 0;
+ dev->qlen = 0;
+ dev->type = ST_INVALID;
+}
+
+/**
+ * \brief Reset MIDI encode parser
+ * \param dev MIDI event parser
+ * \return 0 on success otherwise a negative error code
+ *
+ * Resets MIDI encode parser
+ */
+void snd_midi_event_reset_encode(snd_midi_event_t *dev)
+{
+ reset_encode(dev);
+}
+
+/**
+ * \brief Reset MIDI decode parser
+ * \param dev MIDI event parser
+ * \return 0 on success otherwise a negative error code
+ *
+ * Resets MIDI decode parser
+ */
+void snd_midi_event_reset_decode(snd_midi_event_t *dev)
+{
+ dev->lastcmd = 0xff;
+}
+
+/**
+ * \brief Initializes MIDI parsers
+ * \param dev MIDI event parser
+ * \return 0 on success otherwise a negative error code
+ *
+ * Initializes MIDI parsers (both encode and decode)
+ */
+void snd_midi_event_init(snd_midi_event_t *dev)
+{
+ snd_midi_event_reset_encode(dev);
+ snd_midi_event_reset_decode(dev);
+}
+
+/**
+ * \brief Resize MIDI message (event) buffer
+ * \param dev MIDI event parser
+ * \param bufsize new requested buffer size
+ * \return 0 on success otherwise a negative error code
+ *
+ * Resizes MIDI message (event) buffer.
+ */
+int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize)
+{
+ unsigned char *new_buf, *old_buf;
+
+ if (bufsize == dev->bufsize)
+ return 0;
+ new_buf = malloc(bufsize);
+ if (new_buf == NULL)
+ return -ENOMEM;
+ old_buf = dev->buf;
+ dev->buf = new_buf;
+ dev->bufsize = bufsize;
+ reset_encode(dev);
+ free(old_buf);
+ return 0;
+}
+
+/**
+ * \brief Read bytes and encode to sequencer event if finished
+ * \param dev MIDI event parser
+ * \param buf MIDI byte stream
+ * \param count count of bytes of MIDI byte stream to encode
+ * \param ev Result - sequencer event
+ * \return count of encoded bytes otherwise a negative error code
+ *
+ * Read bytes and encode to sequencer event if finished.
+ * If complete sequencer event is available, ev->type is not
+ * equal to #SND_SEQ_EVENT_NONE.
+ */
+long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev)
+{
+ long result = 0;
+ int rc;
+
+ ev->type = SND_SEQ_EVENT_NONE;
+
+ while (count-- > 0) {
+ rc = snd_midi_event_encode_byte(dev, *buf++, ev);
+ result++;
+ if (rc < 0)
+ return rc;
+ else if (rc > 0)
+ return result;
+ }
+
+ return result;
+}
+
+/**
+ * \brief Read one byte and encode to sequencer event if finished
+ * \param dev MIDI event parser
+ * \param c a byte of MIDI stream
+ * \param ev Result - sequencer event
+ * \return 1 - sequencer event is completed, 0 - next byte is required for completion, otherwise a negative error code
+ *
+ * Read byte and encode to sequencer event if finished.
+ */
+int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev)
+{
+ int rc = 0;
+
+ c &= 0xff;
+
+ if (c >= MIDI_CMD_COMMON_CLOCK) {
+ /* real-time event */
+ ev->type = status_event[ST_SPECIAL + c - 0xf0].event;
+ ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
+ ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
+ return ev->type != SND_SEQ_EVENT_NONE;
+ }
+
+ if ((c & 0x80) &&
+ (c != MIDI_CMD_COMMON_SYSEX_END || dev->type != ST_SYSEX)) {
+ /* new command */
+ dev->buf[0] = c;
+ if ((c & 0xf0) == 0xf0) /* system message */
+ dev->type = (c & 0x0f) + ST_SPECIAL;
+ else
+ dev->type = (c >> 4) & 0x07;
+ dev->read = 1;
+ dev->qlen = status_event[dev->type].qlen;
+ } else {
+ if (dev->qlen > 0) {
+ /* rest of command */
+ dev->buf[dev->read++] = c;
+ if (dev->type != ST_SYSEX)
+ dev->qlen--;
+ } else {
+ /* running status */
+ dev->buf[1] = c;
+ dev->qlen = status_event[dev->type].qlen - 1;
+ dev->read = 2;
+ }
+ }
+ if (dev->qlen == 0) {
+ ev->type = status_event[dev->type].event;
+ ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
+ ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
+ if (status_event[dev->type].encode) /* set data values */
+ status_event[dev->type].encode(dev, ev);
+ if (dev->type >= ST_SPECIAL)
+ dev->type = ST_INVALID;
+ rc = 1;
+ } else if (dev->type == ST_SYSEX) {
+ if (c == MIDI_CMD_COMMON_SYSEX_END ||
+ dev->read >= dev->bufsize) {
+ ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
+ ev->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE;
+ ev->type = SND_SEQ_EVENT_SYSEX;
+ ev->data.ext.len = dev->read;
+ ev->data.ext.ptr = dev->buf;
+ if (c != MIDI_CMD_COMMON_SYSEX_END)
+ dev->read = 0; /* continue to parse */
+ else
+ reset_encode(dev); /* all parsed */
+ rc = 1;
+ }
+ }
+
+ return rc;
+}
+
+/* encode note event */
+static void note_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.note.channel = dev->buf[0] & 0x0f;
+ ev->data.note.note = dev->buf[1];
+ ev->data.note.velocity = dev->buf[2];
+}
+
+/* encode one parameter controls */
+static void one_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.control.channel = dev->buf[0] & 0x0f;
+ ev->data.control.value = dev->buf[1];
+}
+
+/* encode pitch wheel change */
+static void pitchbend_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.control.channel = dev->buf[0] & 0x0f;
+ ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1] - 8192;
+}
+
+/* encode midi control change */
+static void two_param_ctrl_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.control.channel = dev->buf[0] & 0x0f;
+ ev->data.control.param = dev->buf[1];
+ ev->data.control.value = dev->buf[2];
+}
+
+/* encode one parameter value*/
+static void one_param_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.control.value = dev->buf[1];
+}
+
+/* encode song position */
+static void songpos_event(snd_midi_event_t *dev, snd_seq_event_t *ev)
+{
+ ev->data.control.value = (int)dev->buf[2] * 128 + (int)dev->buf[1];
+}
+
+/**
+ * \brief Decode sequencer event to MIDI byte stream
+ * \param dev MIDI event parser
+ * \param buf Result - MIDI byte stream
+ * \param count Available bytes in MIDI byte stream
+ * \param ev Event to decode
+ * \return count of decoded bytes otherwise a negative error code
+ *
+ * Decode sequencer event to MIDI byte stream.
+ */
+long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev)
+{
+ int cmd;
+ long qlen;
+ unsigned int type;
+
+ if (ev->type == SND_SEQ_EVENT_NONE)
+ return -ENOENT;
+
+ for (type = 0; type < numberof(status_event); type++) {
+ if (ev->type == status_event[type].event)
+ goto __found;
+ }
+ for (type = 0; type < numberof(extra_event); type++) {
+ if (ev->type == extra_event[type].event)
+ return extra_event[type].decode(dev, buf, count, ev);
+ }
+ return -ENOENT;
+
+ __found:
+ if (type >= ST_SPECIAL)
+ cmd = 0xf0 + (type - ST_SPECIAL);
+ else
+ /* data.note.channel and data.control.channel is identical */
+ cmd = 0x80 | (type << 4) | (ev->data.note.channel & 0x0f);
+
+
+ if (cmd == MIDI_CMD_COMMON_SYSEX) {
+ qlen = ev->data.ext.len;
+ if (count < qlen)
+ return -ENOMEM;
+ switch (ev->flags & SND_SEQ_EVENT_LENGTH_MASK) {
+ case SND_SEQ_EVENT_LENGTH_FIXED:
+ return -EINVAL; /* invalid event */
+ }
+ memcpy(buf, ev->data.ext.ptr, qlen);
+ return qlen;
+ } else {
+ unsigned char xbuf[4];
+
+ if ((cmd & 0xf0) == 0xf0 || dev->lastcmd != cmd || dev->nostat) {
+ dev->lastcmd = cmd;
+ xbuf[0] = cmd;
+ if (status_event[type].decode)
+ status_event[type].decode(ev, xbuf + 1);
+ qlen = status_event[type].qlen + 1;
+ } else {
+ if (status_event[type].decode)
+ status_event[type].decode(ev, xbuf + 0);
+ qlen = status_event[type].qlen;
+ }
+ if (count < qlen)
+ return -ENOMEM;
+ memcpy(buf, xbuf, qlen);
+ return qlen;
+ }
+}
+
+
+/* decode note event */
+static void note_decode(const snd_seq_event_t *ev, unsigned char *buf)
+{
+ buf[0] = ev->data.note.note & 0x7f;
+ buf[1] = ev->data.note.velocity & 0x7f;
+}
+
+/* decode one parameter controls */
+static void one_param_decode(const snd_seq_event_t *ev, unsigned char *buf)
+{
+ buf[0] = ev->data.control.value & 0x7f;
+}
+
+/* decode pitch wheel change */
+static void pitchbend_decode(const snd_seq_event_t *ev, unsigned char *buf)
+{
+ int value = ev->data.control.value + 8192;
+ buf[0] = value & 0x7f;
+ buf[1] = (value >> 7) & 0x7f;
+}
+
+/* decode midi control change */
+static void two_param_decode(const snd_seq_event_t *ev, unsigned char *buf)
+{
+ buf[0] = ev->data.control.param & 0x7f;
+ buf[1] = ev->data.control.value & 0x7f;
+}
+
+/* decode song position */
+static void songpos_decode(const snd_seq_event_t *ev, unsigned char *buf)
+{
+ buf[0] = ev->data.control.value & 0x7f;
+ buf[1] = (ev->data.control.value >> 7) & 0x7f;
+}
+
+/* decode 14bit control */
+static int extra_decode_ctrl14(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev)
+{
+ unsigned char cmd;
+ int idx = 0;
+
+ cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
+ if (ev->data.control.param < 32) {
+ if (count < 4)
+ return -ENOMEM;
+ if (dev->nostat && count < 6)
+ return -ENOMEM;
+ if (cmd != dev->lastcmd || dev->nostat) {
+ if (count < 5)
+ return -ENOMEM;
+ buf[idx++] = dev->lastcmd = cmd;
+ }
+ buf[idx++] = ev->data.control.param;
+ buf[idx++] = (ev->data.control.value >> 7) & 0x7f;
+ if (dev->nostat)
+ buf[idx++] = cmd;
+ buf[idx++] = ev->data.control.param + 32;
+ buf[idx++] = ev->data.control.value & 0x7f;
+ } else {
+ if (count < 2)
+ return -ENOMEM;
+ if (cmd != dev->lastcmd || dev->nostat) {
+ if (count < 3)
+ return -ENOMEM;
+ buf[idx++] = dev->lastcmd = cmd;
+ }
+ buf[idx++] = ev->data.control.param & 0x7f;
+ buf[idx++] = ev->data.control.value & 0x7f;
+ }
+ return idx;
+}
+
+/* decode reg/nonreg param */
+static int extra_decode_xrpn(snd_midi_event_t *dev, unsigned char *buf, int count, const snd_seq_event_t *ev)
+{
+ unsigned char cmd;
+ const char *cbytes;
+ static const char cbytes_nrpn[4] = { MIDI_CTL_NONREG_PARM_NUM_MSB,
+ MIDI_CTL_NONREG_PARM_NUM_LSB,
+ MIDI_CTL_MSB_DATA_ENTRY,
+ MIDI_CTL_LSB_DATA_ENTRY };
+ static const char cbytes_rpn[4] = { MIDI_CTL_REGIST_PARM_NUM_MSB,
+ MIDI_CTL_REGIST_PARM_NUM_LSB,
+ MIDI_CTL_MSB_DATA_ENTRY,
+ MIDI_CTL_LSB_DATA_ENTRY };
+ unsigned char bytes[4];
+ int idx = 0, i;
+
+ if (count < 8)
+ return -ENOMEM;
+ if (dev->nostat && count < 12)
+ return -ENOMEM;
+ cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
+ bytes[0] = ev->data.control.param & 0x007f;
+ bytes[1] = (ev->data.control.param & 0x3f80) >> 7;
+ bytes[2] = ev->data.control.value & 0x007f;
+ bytes[3] = (ev->data.control.value & 0x3f80) >> 7;
+ if (cmd != dev->lastcmd && !dev->nostat) {
+ if (count < 9)
+ return -ENOMEM;
+ buf[idx++] = dev->lastcmd = cmd;
+ }
+ cbytes = ev->type == SND_SEQ_EVENT_NONREGPARAM ? cbytes_nrpn : cbytes_rpn;
+ for (i = 0; i < 4; i++) {
+ if (dev->nostat)
+ buf[idx++] = dev->lastcmd = cmd;
+ buf[idx++] = cbytes[i];
+ buf[idx++] = bytes[i];
+ }
+ return idx;
+}
diff --git a/alsa-lib/src/seq/seq_old.c b/alsa-lib/src/seq/seq_old.c
new file mode 100644
index 0000000..60d5f4b
--- /dev/null
+++ b/alsa-lib/src/seq/seq_old.c
@@ -0,0 +1,222 @@
+/*
+ * place-holders to keep libasound linkable to old binaries
+ */
+
+#ifndef DOXYGEN
+
+#include "local.h"
+
+size_t snd_instr_header_sizeof(void)
+{
+ return 0;
+}
+
+int snd_instr_header_malloc(void **ptr ATTRIBUTE_UNUSED,
+ size_t len ATTRIBUTE_UNUSED)
+{
+ return -ENOMEM;
+}
+
+void snd_instr_header_free(void *obj ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_copy(void *dst ATTRIBUTE_UNUSED,
+ const void *src ATTRIBUTE_UNUSED)
+{
+}
+
+const void *snd_instr_header_get_id(const void *info ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+int snd_instr_header_get_cluster(const void *info ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+unsigned int snd_instr_header_get_cmd(const void *info ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+size_t snd_instr_header_get_len(const void *info ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+const char *snd_instr_header_get_name(const void *info ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+int snd_instr_header_get_type(const void *info ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+const char *snd_instr_header_get_format(const void *info ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+const void *snd_instr_header_get_alias(const void *info ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+void *snd_instr_header_get_data(const void *info ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+int snd_instr_header_get_follow_alias(const void *info ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+void snd_instr_header_set_id(void *info ATTRIBUTE_UNUSED,
+ const void *id ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_cluster(void *info ATTRIBUTE_UNUSED,
+ int cluster ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_cmd(void *info ATTRIBUTE_UNUSED,
+ unsigned int cmd ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_len(void *info ATTRIBUTE_UNUSED,
+ size_t len ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_name(void *info ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_type(void *info ATTRIBUTE_UNUSED,
+ int type ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_format(void *info ATTRIBUTE_UNUSED,
+ const char *format ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_alias(void *info ATTRIBUTE_UNUSED,
+ const void *instr ATTRIBUTE_UNUSED)
+{
+}
+
+void snd_instr_header_set_follow_alias(void *info ATTRIBUTE_UNUSED,
+ int val ATTRIBUTE_UNUSED)
+{
+}
+
+int snd_instr_fm_free(void *fm ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_instr_fm_convert_to_stream(void *fm ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ void **__data ATTRIBUTE_UNUSED,
+ size_t *__size ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_fm_convert_from_stream(void *__data ATTRIBUTE_UNUSED,
+ size_t size ATTRIBUTE_UNUSED,
+ void **simple ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+
+int snd_instr_iwffff_open(void **handle ATTRIBUTE_UNUSED,
+ const char *name_fff ATTRIBUTE_UNUSED,
+ const char *name_dat ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_iwffff_open_rom(void **handle ATTRIBUTE_UNUSED,
+ int card ATTRIBUTE_UNUSED,
+ int bank ATTRIBUTE_UNUSED,
+ int file ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_iwffff_open_rom_file(void **handle ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ int bank ATTRIBUTE_UNUSED,
+ int file ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_iwffff_close(void *handle ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_instr_iwffff_free(void *__instr ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_instr_iwffff_load(void *iwf ATTRIBUTE_UNUSED,
+ int bank ATTRIBUTE_UNUSED,
+ int prg ATTRIBUTE_UNUSED,
+ void **__iwffff ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_iwffff_convert_to_stream(void *iwffff ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ void **__data ATTRIBUTE_UNUSED,
+ size_t *__size ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_iwffff_convert_from_stream(void *data ATTRIBUTE_UNUSED,
+ size_t size ATTRIBUTE_UNUSED,
+ void **iwffff ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+
+int snd_instr_simple_free(void *simple ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int snd_instr_simple_convert_to_stream(void *simple ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ void **__data ATTRIBUTE_UNUSED,
+ size_t *__size ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+int snd_instr_simple_convert_from_stream(void *__data ATTRIBUTE_UNUSED,
+ size_t size ATTRIBUTE_UNUSED,
+ void **simple ATTRIBUTE_UNUSED)
+{
+ return -ENXIO;
+}
+
+#endif /* !DOXYGEN */
diff --git a/alsa-lib/src/seq/seq_symbols.c b/alsa-lib/src/seq/seq_symbols.c
new file mode 100644
index 0000000..1d30133
--- /dev/null
+++ b/alsa-lib/src/seq/seq_symbols.c
@@ -0,0 +1,34 @@
+/*
+ * Sequencer Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+extern const char *_snd_module_seq_hw;
+
+static const char **snd_seq_open_objects[] = {
+ &_snd_module_seq_hw
+};
+
+void *snd_seq_open_symbols(void)
+{
+ return snd_seq_open_objects;
+}
+
+#endif /* !PIC */
diff --git a/alsa-lib/src/seq/seqmid.c b/alsa-lib/src/seq/seqmid.c
new file mode 100644
index 0000000..3b0960d
--- /dev/null
+++ b/alsa-lib/src/seq/seqmid.c
@@ -0,0 +1,426 @@
+/*
+ * Sequencer Interface - middle-level routines
+ *
+ * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include "seq_local.h"
+
+/**
+ * \brief queue controls - start/stop/continue
+ * \param seq sequencer handle
+ * \param q queue id to control
+ * \param type event type
+ * \param value event value
+ * \param ev event instance
+ *
+ * This function sets up general queue control event and sends it.
+ * To send at scheduled time, set the schedule in \a ev.
+ * If \a ev is NULL, the event is composed locally and sent immediately
+ * to the specified queue. In any cases, you need to call #snd_seq_drain_output()
+ * appropriately to feed the event.
+ *
+ * \sa snd_seq_alloc_queue()
+ */
+int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev)
+{
+ snd_seq_event_t tmpev;
+ if (ev == NULL) {
+ snd_seq_ev_clear(&tmpev);
+ ev = &tmpev;
+ snd_seq_ev_set_direct(ev);
+ }
+ snd_seq_ev_set_queue_control(ev, type, q, value);
+ return snd_seq_event_output(seq, ev);
+}
+
+
+/**
+ * \brief create a port - simple version
+ * \param seq sequencer handle
+ * \param name the name of the port
+ * \param caps capability bits
+ * \param type type bits
+ * \return the created port number or negative error code
+ *
+ * Creates a port with the given capability and type bits.
+ *
+ * \sa snd_seq_create_port(), snd_seq_delete_simple_port()
+ */
+int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
+ unsigned int caps, unsigned int type)
+{
+ snd_seq_port_info_t pinfo;
+ int result;
+
+ memset(&pinfo, 0, sizeof(pinfo));
+ if (name)
+ strncpy(pinfo.name, name, sizeof(pinfo.name) - 1);
+ pinfo.capability = caps;
+ pinfo.type = type;
+ pinfo.midi_channels = 16;
+ pinfo.midi_voices = 64; /* XXX */
+ pinfo.synth_voices = 0; /* XXX */
+
+ result = snd_seq_create_port(seq, &pinfo);
+ if (result < 0)
+ return result;
+ else
+ return pinfo.addr.port;
+}
+
+/**
+ * \brief delete the port
+ * \param seq sequencer handle
+ * \param port port id
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_delete_port(), snd_seq_create_simple_port()
+ */
+int snd_seq_delete_simple_port(snd_seq_t *seq, int port)
+{
+ return snd_seq_delete_port(seq, port);
+}
+
+/**
+ * \brief simple subscription (w/o exclusive & time conversion)
+ * \param seq sequencer handle
+ * \param myport the port id as receiver
+ * \param src_client sender client id
+ * \param src_port sender port id
+ * \return 0 on success or negative error code
+ *
+ * Connect from the given sender client:port to the given destination port in the
+ * current client.
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_disconnect_from()
+ */
+int snd_seq_connect_from(snd_seq_t *seq, int myport, int src_client, int src_port)
+{
+ snd_seq_port_subscribe_t subs;
+
+ memset(&subs, 0, sizeof(subs));
+ subs.sender.client = src_client;
+ subs.sender.port = src_port;
+ /*subs.dest.client = seq->client;*/
+ subs.dest.client = snd_seq_client_id(seq);
+ subs.dest.port = myport;
+
+ return snd_seq_subscribe_port(seq, &subs);
+}
+
+/**
+ * \brief simple subscription (w/o exclusive & time conversion)
+ * \param seq sequencer handle
+ * \param myport the port id as sender
+ * \param dest_client destination client id
+ * \param dest_port destination port id
+ * \return 0 on success or negative error code
+ *
+ * Connect from the given receiver port in the current client
+ * to the given destination client:port.
+ *
+ * \sa snd_seq_subscribe_port(), snd_seq_disconnect_to()
+ */
+int snd_seq_connect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port)
+{
+ snd_seq_port_subscribe_t subs;
+
+ memset(&subs, 0, sizeof(subs));
+ /*subs.sender.client = seq->client;*/
+ subs.sender.client = snd_seq_client_id(seq);
+ subs.sender.port = myport;
+ subs.dest.client = dest_client;
+ subs.dest.port = dest_port;
+
+ return snd_seq_subscribe_port(seq, &subs);
+}
+
+/**
+ * \brief simple disconnection
+ * \param seq sequencer handle
+ * \param myport the port id as receiver
+ * \param src_client sender client id
+ * \param src_port sender port id
+ * \return 0 on success or negative error code
+ *
+ * Remove connection from the given sender client:port
+ * to the given destination port in the current client.
+ *
+ * \sa snd_seq_unsubscribe_port(), snd_seq_connect_from()
+ */
+int snd_seq_disconnect_from(snd_seq_t *seq, int myport, int src_client, int src_port)
+{
+ snd_seq_port_subscribe_t subs;
+
+ memset(&subs, 0, sizeof(subs));
+ subs.sender.client = src_client;
+ subs.sender.port = src_port;
+ /*subs.dest.client = seq->client;*/
+ subs.dest.client = snd_seq_client_id(seq);
+ subs.dest.port = myport;
+
+ return snd_seq_unsubscribe_port(seq, &subs);
+}
+
+/**
+ * \brief simple disconnection
+ * \param seq sequencer handle
+ * \param myport the port id as sender
+ * \param dest_client destination client id
+ * \param dest_port destination port id
+ * \return 0 on success or negative error code
+ *
+ * Remove connection from the given sender client:port
+ * to the given destination port in the current client.
+ *
+ * \sa snd_seq_unsubscribe_port(), snd_seq_connect_to()
+ */
+int snd_seq_disconnect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port)
+{
+ snd_seq_port_subscribe_t subs;
+
+ memset(&subs, 0, sizeof(subs));
+ /*subs.sender.client = seq->client;*/
+ subs.sender.client = snd_seq_client_id(seq);
+ subs.sender.port = myport;
+ subs.dest.client = dest_client;
+ subs.dest.port = dest_port;
+
+ return snd_seq_unsubscribe_port(seq, &subs);
+}
+
+/*
+ * set client information
+ */
+
+/**
+ * \brief set client name
+ * \param seq sequencer handle
+ * \param name name string
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_set_client_info()
+ */
+int snd_seq_set_client_name(snd_seq_t *seq, const char *name)
+{
+ snd_seq_client_info_t info;
+ int err;
+
+ if ((err = snd_seq_get_client_info(seq, &info)) < 0)
+ return err;
+ strncpy(info.name, name, sizeof(info.name) - 1);
+ return snd_seq_set_client_info(seq, &info);
+}
+
+/**
+ * \brief add client event filter
+ * \param seq sequencer handle
+ * \param event_type event type to be added
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_set_client_info()
+ */
+int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type)
+{
+ snd_seq_client_info_t info;
+ int err;
+
+ if ((err = snd_seq_get_client_info(seq, &info)) < 0)
+ return err;
+ snd_seq_client_info_event_filter_add(&info, event_type);
+ return snd_seq_set_client_info(seq, &info);
+}
+
+/**
+ * \brief change the output pool size of the given client
+ * \param seq sequencer handle
+ * \param size output pool size
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_set_client_pool()
+ */
+int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size)
+{
+ snd_seq_client_pool_t info;
+ int err;
+
+ if ((err = snd_seq_get_client_pool(seq, &info)) < 0)
+ return err;
+ info.output_pool = size;
+ return snd_seq_set_client_pool(seq, &info);
+}
+
+/**
+ * \brief change the output room size of the given client
+ * \param seq sequencer handle
+ * \param size output room size
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_set_client_pool()
+ */
+int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size)
+{
+ snd_seq_client_pool_t info;
+ int err;
+
+ if ((err = snd_seq_get_client_pool(seq, &info)) < 0)
+ return err;
+ info.output_room = size;
+ return snd_seq_set_client_pool(seq, &info);
+}
+
+/**
+ * \brief change the input pool size of the given client
+ * \param seq sequencer handle
+ * \param size input pool size
+ * \return 0 on success or negative error code
+ *
+ * \sa snd_seq_set_client_pool()
+ */
+int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size)
+{
+ snd_seq_client_pool_t info;
+ int err;
+
+ if ((err = snd_seq_get_client_pool(seq, &info)) < 0)
+ return err;
+ info.input_pool = size;
+ return snd_seq_set_client_pool(seq, &info);
+}
+
+/**
+ * \brief reset client output pool
+ * \param seq sequencer handle
+ * \return 0 on success or negative error code
+ *
+ * So far, this works ideically like #snd_seq_drop_output().
+ */
+int snd_seq_reset_pool_output(snd_seq_t *seq)
+{
+ return snd_seq_drop_output(seq);
+}
+
+/**
+ * \brief reset client input pool
+ * \param seq sequencer handle
+ * \return 0 on success or negative error code
+ *
+ * So far, this works ideically like #snd_seq_drop_input().
+ */
+int snd_seq_reset_pool_input(snd_seq_t *seq)
+{
+ return snd_seq_drop_input(seq);
+}
+
+/**
+ * \brief wait until all events are processed
+ * \param seq sequencer handle
+ * \return 0 on success or negative error code
+ *
+ * This function waits until all events of this client are processed.
+ *
+ * \sa snd_seq_drain_output()
+ */
+int snd_seq_sync_output_queue(snd_seq_t *seq)
+{
+ int err;
+ snd_seq_client_pool_t info;
+ int saved_room;
+ struct pollfd pfd;
+
+ assert(seq);
+ /* reprogram the room size to full */
+ if ((err = snd_seq_get_client_pool(seq, &info)) < 0)
+ return err;
+ saved_room = info.output_room;
+ info.output_room = info.output_pool; /* wait until all gone */
+ if ((err = snd_seq_set_client_pool(seq, &info)) < 0)
+ return err;
+ /* wait until all events are purged */
+ pfd.fd = seq->poll_fd;
+ pfd.events = POLLOUT;
+ err = poll(&pfd, 1, -1);
+ /* restore the room size */
+ info.output_room = saved_room;
+ snd_seq_set_client_pool(seq, &info);
+ return err;
+}
+
+/**
+ * \brief parse the given string and get the sequencer address
+ * \param seq sequencer handle
+ * \param addr the address pointer to be returned
+ * \param arg the string to be parsed
+ * \return 0 on success or negative error code
+ *
+ * This function parses the sequencer client and port numbers from the given string.
+ * The client and port tokes are separated by either colon or period, e.g. 128:1.
+ * When \a seq is not NULL, the function accepts also a client name not only
+ * digit numbers.
+ */
+int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *arg)
+{
+ char *p;
+ int client, port;
+ int len;
+
+ assert(addr && arg);
+
+ if ((p = strpbrk(arg, ":.")) != NULL) {
+ if ((port = atoi(p + 1)) < 0)
+ return -EINVAL;
+ len = (int)(p - arg); /* length of client name */
+ } else {
+ port = 0;
+ len = strlen(arg);
+ }
+ addr->port = port;
+ if (isdigit(*arg)) {
+ client = atoi(arg);
+ if (client < 0)
+ return -EINVAL;
+ addr->client = client;
+ } else {
+ /* convert from the name */
+ snd_seq_client_info_t cinfo;
+
+ if (! seq)
+ return -EINVAL;
+ if (len <= 0)
+ return -EINVAL;
+ cinfo.client = -1;
+ while (snd_seq_query_next_client(seq, &cinfo) >= 0) {
+ if (! strncmp(arg, cinfo.name, len)) {
+ addr->client = cinfo.client;
+ return 0;
+ }
+ }
+ return -ENOENT; /* not found */
+ }
+ return 0;
+}
+
diff --git a/alsa-lib/src/shmarea.c b/alsa-lib/src/shmarea.c
new file mode 100644
index 0000000..071f9f3
--- /dev/null
+++ b/alsa-lib/src/shmarea.c
@@ -0,0 +1,108 @@
+/*
+ * IPC SHM area manager
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/poll.h>
+#include <sys/mman.h>
+#include <sys/shm.h>
+#include "list.h"
+
+#ifndef DOC_HIDDEN
+struct snd_shm_area {
+ struct list_head list;
+ int shmid;
+ void *ptr;
+ int share;
+};
+#endif
+
+static LIST_HEAD(shm_areas);
+
+/**
+ * \brief Create a shm area record
+ * \param shmid IPC SHM ID
+ * \param ptr the shared area pointer
+ * \return The allocated shm area record, NULL if fail
+ *
+ * Allocates a shared area record with the given SHM ID and pointer.
+ * The record has a reference counter, which is initialized to 1 by this function.
+ */
+struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr)
+{
+ struct snd_shm_area *area = malloc(sizeof(*area));
+ if (area) {
+ area->shmid = shmid;
+ area->ptr = ptr;
+ area->share = 1;
+ list_add_tail(&area->list, &shm_areas);
+ }
+ return area;
+}
+
+/**
+ * \brief Increase the reference counter of shm area record
+ * \param area shm area record
+ * \return the shm area record (identical with the argument)
+ *
+ * Increases the reference counter of the given shared area record.
+ */
+struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area)
+{
+ if (area == NULL)
+ return NULL;
+ area->share++;
+ return area;
+}
+
+/**
+ * \brief Release the shared area record
+ * \param area the shared are record
+ * \return 0 if successful, or a negative error code
+ *
+ * Decreases the reference counter of the given shared area record, and
+ * releases the resources automaticall if it reaches to 0.
+ */
+int snd_shm_area_destroy(struct snd_shm_area *area)
+{
+ if (area == NULL)
+ return -ENOENT;
+ if (--area->share)
+ return 0;
+ list_del(&area->list);
+ shmdt(area->ptr);
+ free(area);
+ return 0;
+}
+
+void snd_shm_area_destructor(void) __attribute__ ((destructor));
+
+void snd_shm_area_destructor(void)
+{
+ struct list_head *pos;
+ struct snd_shm_area *area;
+
+ list_for_each(pos, &shm_areas) {
+ area = list_entry(pos, struct snd_shm_area, list);
+ shmdt(area->ptr);
+ }
+}
diff --git a/alsa-lib/src/socket.c b/alsa-lib/src/socket.c
new file mode 100644
index 0000000..97c919f
--- /dev/null
+++ b/alsa-lib/src/socket.c
@@ -0,0 +1,158 @@
+/**
+ * \file socket.c
+ * \brief Socket helper routines
+ * \author Abramo Bagnara <abramo@alsa-project.org>
+ * \date 2003
+ */
+/*
+ * Socket helper routines
+ * Copyright (c) 2003 by Abramo Bagnara <abramo@alsa-project.org>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netdb.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+int snd_send_fd(int sock, void *data, size_t len, int fd)
+{
+ int ret;
+ size_t cmsg_len = CMSG_LEN(sizeof(int));
+ struct cmsghdr *cmsg = alloca(cmsg_len);
+ int *fds = (int *) CMSG_DATA(cmsg);
+ struct msghdr msghdr;
+ struct iovec vec;
+
+ vec.iov_base = (void *)&data;
+ vec.iov_len = len;
+
+ cmsg->cmsg_len = cmsg_len;
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ *fds = fd;
+
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &vec;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = cmsg;
+ msghdr.msg_controllen = cmsg_len;
+ msghdr.msg_flags = 0;
+
+ ret = sendmsg(sock, &msghdr, 0 );
+ if (ret < 0) {
+ SYSERR("sendmsg failed");
+ return -errno;
+ }
+ return ret;
+}
+
+int snd_receive_fd(int sock, void *data, size_t len, int *fd)
+{
+ int ret;
+ size_t cmsg_len = CMSG_LEN(sizeof(int));
+ struct cmsghdr *cmsg = alloca(cmsg_len);
+ int *fds = (int *) CMSG_DATA(cmsg);
+ struct msghdr msghdr;
+ struct iovec vec;
+
+ vec.iov_base = (void *)&data;
+ vec.iov_len = len;
+
+ cmsg->cmsg_len = cmsg_len;
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ *fds = -1;
+
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &vec;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = cmsg;
+ msghdr.msg_controllen = cmsg_len;
+ msghdr.msg_flags = 0;
+
+ ret = recvmsg(sock, &msghdr, 0);
+ if (ret < 0) {
+ SYSERR("recvmsg failed");
+ return -errno;
+ }
+ *fd = *fds;
+ return ret;
+}
+
+int snd_is_local(struct hostent *hent)
+{
+ int s;
+ int err;
+ struct ifconf conf;
+ size_t numreqs = 10;
+ size_t i;
+ struct in_addr *haddr = (struct in_addr*) hent->h_addr_list[0];
+
+ s = socket(PF_INET, SOCK_STREAM, 0);
+ if (s < 0) {
+ SYSERR("socket failed");
+ return -errno;
+ }
+
+ conf.ifc_len = numreqs * sizeof(struct ifreq);
+ conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
+ if (! conf.ifc_buf)
+ return -ENOMEM;
+ while (1) {
+ err = ioctl(s, SIOCGIFCONF, &conf);
+ if (err < 0) {
+ SYSERR("SIOCGIFCONF failed");
+ return -errno;
+ }
+ if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq))
+ break;
+ numreqs *= 2;
+ conf.ifc_len = numreqs * sizeof(struct ifreq);
+ conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
+ if (! conf.ifc_buf)
+ return -ENOMEM;
+ }
+ numreqs = conf.ifc_len / sizeof(struct ifreq);
+ for (i = 0; i < numreqs; ++i) {
+ struct ifreq *req = &conf.ifc_req[i];
+ struct sockaddr_in *s_in = (struct sockaddr_in *)&req->ifr_addr;
+ s_in->sin_family = AF_INET;
+ err = ioctl(s, SIOCGIFADDR, req);
+ if (err < 0)
+ continue;
+ if (haddr->s_addr == s_in->sin_addr.s_addr)
+ break;
+ }
+ close(s);
+ free(conf.ifc_buf);
+ return i < numreqs;
+}
+#endif
diff --git a/alsa-lib/src/timer/Makefile.am b/alsa-lib/src/timer/Makefile.am
new file mode 100644
index 0000000..e7cf77b
--- /dev/null
+++ b/alsa-lib/src/timer/Makefile.am
@@ -0,0 +1,9 @@
+EXTRA_LTLIBRARIES=libtimer.la
+
+libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c \
+ timer_symbols.c
+noinst_HEADERS = timer_local.h
+all: libtimer.la
+
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/src/timer/Makefile.in b/alsa-lib/src/timer/Makefile.in
new file mode 100644
index 0000000..019ee86
--- /dev/null
+++ b/alsa-lib/src/timer/Makefile.in
@@ -0,0 +1,524 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/timer
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+libtimer_la_LIBADD =
+am_libtimer_la_OBJECTS = timer.lo timer_hw.lo timer_query.lo \
+ timer_query_hw.lo timer_symbols.lo
+libtimer_la_OBJECTS = $(am_libtimer_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libtimer_la_SOURCES)
+DIST_SOURCES = $(libtimer_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_LTLIBRARIES = libtimer.la
+libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c \
+ timer_symbols.c
+
+noinst_HEADERS = timer_local.h
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/timer/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/timer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+libtimer.la: $(libtimer_la_OBJECTS) $(libtimer_la_DEPENDENCIES)
+ $(LINK) $(libtimer_la_LDFLAGS) $(libtimer_la_OBJECTS) $(libtimer_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_query.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_query_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer_symbols.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+all: libtimer.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/src/timer/timer.c b/alsa-lib/src/timer/timer.c
new file mode 100644
index 0000000..b71a9f8
--- /dev/null
+++ b/alsa-lib/src/timer/timer.c
@@ -0,0 +1,959 @@
+/**
+ * \file timer/timer.c
+ * \brief Timer Interface
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 1998-2001
+ *
+ * Timer Interface is designed to access timers.
+ * See \ref timer page for more details.
+ */
+/*
+ * Timer Interface - main file
+ * Copyright (c) 1998-2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+/*! \page timer Timer interface
+
+<P> Timer interface is designed to use internal timers in sound hardware, but
+it can be driven with any timer.
+
+\section timer_general_overview General overview
+
+The timer implementation uses ring buffer to store information about timing
+events. In this buffer is recorded count of ticks and current tick resolution
+in nanoseconds.
+
+\section timer_open Opening
+
+Timer devices can be opened in two ways. When #SND_TIMER_OPEN_NONBLOCK flag
+is used, then the open functions return immediately with -EBUSY error code when
+resources are occupied with another application. When #SND_TIMER_OPEN_NONBLOCK
+is not used (by default) the open functions block the application requesting
+device until resources are not free.
+
+\section timer_events Events
+
+Events are read via snd_timer_read() function.
+
+\section timer_examples Examples
+
+The full featured examples with cross-links:
+
+\par Simple timer test program
+\ref example_test_timer "example code"
+\par
+This example shows opening a timer device and reading of timer events.
+
+*/
+
+/**
+ * \example ../test/timer.c
+ * \anchor example_test_timer
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include "timer_local.h"
+
+static int snd_timer_open_conf(snd_timer_t **timer,
+ const char *name, snd_config_t *timer_root,
+ snd_config_t *timer_conf, int mode)
+{
+ const char *str;
+ char buf[256];
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_timer_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_timer_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for TIMER %s definition", name);
+ else
+ SNDERR("Invalid type for TIMER definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(timer_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(timer_root, "timer_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for TIMER type %s definition", str);
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_timer_%s_open", str);
+ }
+#ifndef PIC
+ snd_timer_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (! err) {
+ err = open_func(timer, name, timer_root, timer_conf, mode);
+ if (err < 0)
+ snd_dlclose(h);
+ else
+ (*timer)->dl_handle = h;
+ }
+ return err;
+}
+
+static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t *root, const char *name, int mode)
+{
+ int err;
+ snd_config_t *timer_conf;
+ err = snd_config_search_definition(root, "timer", name, &timer_conf);
+ if (err < 0) {
+ SNDERR("Unknown timer %s", name);
+ return err;
+ }
+ err = snd_timer_open_conf(timer, name, root, timer_conf, mode);
+ snd_config_delete(timer_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a new connection to the timer interface.
+ * \param timer Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the timer handle
+ * \param mode Open mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the timer interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_timer_open(snd_timer_t **timer, const char *name, int mode)
+{
+ int err;
+ assert(timer && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_timer_open_noupdate(timer, snd_config, name, mode);
+}
+
+/**
+ * \brief Opens a new connection to the timer interface using local configuration
+ * \param timer Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the timer handle
+ * \param mode Open mode
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the timer interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_timer_open_lconf(snd_timer_t **timer, const char *name,
+ int mode, snd_config_t *lconf)
+{
+ assert(timer && name && lconf);
+ return snd_timer_open_noupdate(timer, lconf, name, mode);
+}
+
+/**
+ * \brief close timer handle
+ * \param timer timer handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified timer handle and frees all associated
+ * resources.
+ */
+int snd_timer_close(snd_timer_t *timer)
+{
+ int err;
+ assert(timer);
+ while (!list_empty(&timer->async_handlers)) {
+ snd_async_handler_t *h = list_entry(timer->async_handlers.next, snd_async_handler_t, hlist);
+ snd_async_del_handler(h);
+ }
+ err = timer->ops->close(timer);
+ if (timer->dl_handle)
+ snd_dlclose(timer->dl_handle);
+ free(timer->name);
+ free(timer);
+ return err;
+}
+
+/**
+ * \brief get identifier of timer handle
+ * \param timer a timer handle
+ * \return ascii identifier of timer handle
+ *
+ * Returns the ASCII identifier of given timer handle. It's the same
+ * identifier specified in snd_timer_open().
+ */
+const char *snd_timer_name(snd_timer_t *timer)
+{
+ assert(timer);
+ return timer->name;
+}
+
+/**
+ * \brief get type of timer handle
+ * \param timer a timer handle
+ * \return type of timer handle
+ *
+ * Returns the type #snd_timer_type_t of given timer handle.
+ */
+snd_timer_type_t snd_timer_type(snd_timer_t *timer)
+{
+ assert(timer);
+ return timer->type;
+}
+
+/**
+ * \brief Add an async handler for a timer
+ * \param handler Returned handler handle
+ * \param timer timer handle
+ * \param callback Callback function
+ * \param private_data Callback private data
+ * \return 0 otherwise a negative error code on failure
+ *
+ * The asynchronous callback is called when new timer event occurs.
+ */
+int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
+ snd_async_callback_t callback, void *private_data)
+{
+ int err;
+ int was_empty;
+ snd_async_handler_t *h;
+ err = snd_async_add_handler(&h, timer->poll_fd,
+ callback, private_data);
+ if (err < 0)
+ return err;
+ h->type = SND_ASYNC_HANDLER_TIMER;
+ h->u.timer = timer;
+ was_empty = list_empty(&timer->async_handlers);
+ list_add_tail(&h->hlist, &timer->async_handlers);
+ if (was_empty) {
+ err = snd_timer_async(timer, snd_async_handler_get_signo(h), getpid());
+ if (err < 0) {
+ snd_async_del_handler(h);
+ return err;
+ }
+ }
+ *handler = h;
+ return 0;
+}
+
+/**
+ * \brief Return timer handle related to an async handler
+ * \param handler Async handler handle
+ * \return timer handle
+ */
+snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler)
+{
+ if (handler->type != SND_ASYNC_HANDLER_TIMER) {
+ SNDMSG("invalid handler type %d", handler->type);
+ return NULL;
+ }
+ return handler->u.timer;
+}
+
+/**
+ * \brief get count of poll descriptors for timer handle
+ * \param timer timer handle
+ * \return count of poll descriptors
+ */
+int snd_timer_poll_descriptors_count(snd_timer_t *timer)
+{
+ assert(timer);
+ return 1;
+}
+
+/**
+ * \brief get poll descriptors
+ * \param timer timer handle
+ * \param pfds array of poll descriptors
+ * \param space space in the poll descriptor array
+ * \return count of filled descriptors
+ */
+int snd_timer_poll_descriptors(snd_timer_t *timer, struct pollfd *pfds, unsigned int space)
+{
+ assert(timer);
+ if (space >= 1) {
+ pfds->fd = timer->poll_fd;
+ switch (timer->mode & O_ACCMODE) {
+ case O_WRONLY:
+ pfds->events = POLLOUT|POLLERR|POLLNVAL;
+ break;
+ case O_RDONLY:
+ pfds->events = POLLIN|POLLERR|POLLNVAL;
+ break;
+ case O_RDWR:
+ pfds->events = POLLOUT|POLLIN|POLLERR|POLLNVAL;
+ break;
+ default:
+ return -EIO;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * \brief get returned events from poll descriptors
+ * \param timer timer handle
+ * \param pfds array of poll descriptors
+ * \param nfds count of poll descriptors
+ * \param revents returned events
+ * \return zero if success, otherwise a negative error code
+ */
+int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
+{
+ assert(timer && pfds && revents);
+ if (nfds == 1) {
+ *revents = pfds->revents;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+/**
+ * \brief set nonblock mode
+ * \param timer timer handle
+ * \param nonblock 0 = block, 1 = nonblock mode
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_nonblock(snd_timer_t *timer, int nonblock)
+{
+ int err;
+ assert(timer);
+ if ((err = timer->ops->nonblock(timer, nonblock)) < 0)
+ return err;
+ if (nonblock)
+ timer->mode |= SND_TIMER_OPEN_NONBLOCK;
+ else
+ timer->mode &= ~SND_TIMER_OPEN_NONBLOCK;
+ return 0;
+}
+
+#ifndef DOC_HIDDEN
+/**
+ * \brief set async mode
+ * \param timer timer handle
+ * \param sig Signal to raise: < 0 disable, 0 default (SIGIO)
+ * \param pid Process ID to signal: 0 current
+ * \return 0 on success otherwise a negative error code
+ *
+ * A signal is raised every period.
+ */
+int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid)
+{
+ assert(timer);
+ if (sig == 0)
+ sig = SIGIO;
+ if (pid == 0)
+ pid = getpid();
+ return timer->ops->async(timer, sig, pid);
+}
+#endif
+
+/**
+ * \brief get size of the snd_timer_info_t structure in bytes
+ * \return size of the snd_timer_info_t structure in bytes
+ */
+size_t snd_timer_info_sizeof()
+{
+ return sizeof(snd_timer_info_t);
+}
+
+/**
+ * \brief allocate a new snd_timer_info_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_timer_info_t structure using the standard
+ * malloc C library function.
+ */
+int snd_timer_info_malloc(snd_timer_info_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_timer_info_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_timer_info_t structure
+ * \param info pointer to the snd_timer_info_t structure to free
+ *
+ * Frees the given snd_timer_info_t structure using the standard
+ * free C library function.
+ */
+void snd_timer_info_free(snd_timer_info_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_timer_info_t structure to another
+ * \param dst destination snd_timer_info_t structure
+ * \param src source snd_timer_info_t structure
+ */
+void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief determine, if timer is slave
+ * \param info pointer to #snd_timer_info_t structure
+ * \return nonzero if timer is slave
+ */
+int snd_timer_info_is_slave(snd_timer_info_t * info)
+{
+ assert(info);
+ return info->flags & SNDRV_TIMER_FLG_SLAVE ? 1 : 0;
+}
+
+/**
+ * \brief get timer card
+ * \param info pointer to #snd_timer_info_t structure
+ * \return timer card number
+ */
+int snd_timer_info_get_card(snd_timer_info_t * info)
+{
+ assert(info);
+ return info->card;
+}
+
+/**
+ * \brief get timer id
+ * \param info pointer to #snd_timer_info_t structure
+ * \return timer id
+ */
+const char *snd_timer_info_get_id(snd_timer_info_t * info)
+{
+ assert(info);
+ return (const char *)info->id;
+}
+
+/**
+ * \brief get timer name
+ * \param info pointer to #snd_timer_info_t structure
+ * \return timer name
+ */
+const char *snd_timer_info_get_name(snd_timer_info_t * info)
+{
+ assert(info);
+ return (const char *)info->name;
+}
+
+
+/**
+ * \brief get timer resolution in us
+ * \param info pointer to #snd_timer_info_t structure
+ * \return timer resolution
+ */
+long snd_timer_info_get_resolution(snd_timer_info_t * info)
+{
+ assert(info);
+ return info->resolution;
+}
+
+/**
+ * \brief get information about timer handle
+ * \param timer timer handle
+ * \param info pointer to a snd_timer_info_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_info(snd_timer_t *timer, snd_timer_info_t * info)
+{
+ assert(timer);
+ assert(info);
+ return timer->ops->info(timer, info);
+}
+
+/**
+ * \brief get size of the snd_timer_params_t structure in bytes
+ * \return size of the snd_timer_params_t structure in bytes
+ */
+size_t snd_timer_params_sizeof()
+{
+ return sizeof(snd_timer_params_t);
+}
+
+/**
+ * \brief allocate a new snd_timer_params_t structure
+ * \param params returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_timer_params_t structure using the standard
+ * malloc C library function.
+ */
+int snd_timer_params_malloc(snd_timer_params_t **params)
+{
+ assert(params);
+ *params = calloc(1, sizeof(snd_timer_params_t));
+ if (!*params)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_timer_params_t structure
+ * \param params pointer to the snd_timer_params_t structure to free
+ *
+ * Frees the given snd_timer_params_t structure using the standard
+ * free C library function.
+ */
+void snd_timer_params_free(snd_timer_params_t *params)
+{
+ assert(params);
+ free(params);
+}
+
+/**
+ * \brief copy one snd_timer_params_t structure to another
+ * \param dst destination snd_timer_params_t structure
+ * \param src source snd_timer_params_t structure
+ */
+void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief set timer auto start
+ * \param params pointer to #snd_timer_params_t structure
+ * \param auto_start The boolean value to set
+ */
+int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start)
+{
+ assert(params);
+ if (auto_start)
+ params->flags |= SNDRV_TIMER_PSFLG_AUTO;
+ else
+ params->flags &= ~SNDRV_TIMER_PSFLG_AUTO;
+ return 0;
+}
+
+/**
+ * \brief determine if timer has auto start flag
+ * \param params pointer to #snd_timer_params_t structure
+ * \return nonzero if timer has auto start flag
+ */
+int snd_timer_params_get_auto_start(snd_timer_params_t * params)
+{
+ assert(params);
+ return params->flags & SNDRV_TIMER_PSFLG_AUTO ? 1 : 0;
+}
+
+/**
+ * \brief set timer exclusive use
+ * \param params pointer to #snd_timer_params_t structure
+ * \param exclusive The boolean value to set
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_timer_params_set_exclusive)(snd_timer_params_t * params, int exclusive)
+#else
+int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive)
+#endif
+{
+ assert(params);
+ if (exclusive)
+ params->flags |= SNDRV_TIMER_PSFLG_EXCLUSIVE;
+ else
+ params->flags &= ~SNDRV_TIMER_PSFLG_EXCLUSIVE;
+ return 0;
+}
+use_default_symbol_version(__snd_timer_params_set_exclusive, snd_timer_params_set_exclusive, ALSA_0.9.0);
+
+/**
+ * \brief determine if timer has exclusive flag
+ * \param params pointer to #snd_timer_params_t structure
+ * \return nonzero if timer has exclusive flag
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_timer_params_get_exclusive)(snd_timer_params_t * params)
+#else
+int snd_timer_params_get_exclusive(snd_timer_params_t * params)
+#endif
+{
+ assert(params);
+ return params->flags & SNDRV_TIMER_PSFLG_EXCLUSIVE ? 1 : 0;
+}
+use_default_symbol_version(__snd_timer_params_get_exclusive, snd_timer_params_get_exclusive, ALSA_0.9.0);
+
+/**
+ * \brief set timer early event
+ * \param params pointer to #snd_timer_params_t structure
+ * \param early_event The boolean value to set
+ */
+int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event)
+{
+ assert(params);
+ if (early_event)
+ params->flags |= SNDRV_TIMER_PSFLG_EARLY_EVENT;
+ else
+ params->flags &= ~SNDRV_TIMER_PSFLG_EARLY_EVENT;
+ return 0;
+}
+
+/**
+ * \brief determine if timer has early event flag
+ * \param params pointer to #snd_timer_params_t structure
+ * \return nonzero if timer has early event flag set
+ */
+int snd_timer_params_get_early_event(snd_timer_params_t * params)
+{
+ assert(params);
+ return params->flags & SNDRV_TIMER_PSFLG_EARLY_EVENT ? 1 : 0;
+}
+
+/**
+ * \brief set timer ticks
+ * \param params pointer to #snd_timer_params_t structure
+ * \param ticks Ticks to set
+ */
+void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks)
+{
+ assert(params);
+ params->ticks = ticks;
+}
+
+/**
+ * \brief get timer ticks
+ * \param params pointer to #snd_timer_params_t structure
+ * \return timer ticks
+ */
+long snd_timer_params_get_ticks(snd_timer_params_t * params)
+{
+ assert(params);
+ return params->ticks;
+}
+
+/**
+ * \brief set timer queue size (32-1024)
+ * \param params pointer to #snd_timer_params_t structure
+ * \param queue_size The queue size to set
+ */
+void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size)
+{
+ assert(params);
+ params->queue_size = queue_size;
+}
+
+/**
+ * \brief get queue size
+ * \param params pointer to #snd_timer_params_t structure
+ * \return queue size
+ */
+long snd_timer_params_get_queue_size(snd_timer_params_t * params)
+{
+ assert(params);
+ return params->queue_size;
+}
+
+/**
+ * \brief set timer event filter
+ * \param params pointer to #snd_timer_params_t structure
+ * \param filter The event filter bits to set
+ */
+#ifndef DOXYGEN
+void INTERNAL(snd_timer_params_set_filter)(snd_timer_params_t * params, unsigned int filter)
+#else
+void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter)
+#endif
+{
+ assert(params);
+ params->filter = filter;
+}
+use_default_symbol_version(__snd_timer_params_set_filter, snd_timer_params_set_filter, ALSA_0.9.0);
+
+/**
+ * \brief get timer event filter
+ * \param params pointer to #snd_timer_params_t structure
+ * \return timer event filter
+ */
+#ifndef DOXYGEN
+unsigned int INTERNAL(snd_timer_params_get_filter)(snd_timer_params_t * params)
+#else
+unsigned int snd_timer_params_get_filter(snd_timer_params_t * params)
+#endif
+{
+ assert(params);
+ return params->filter;
+}
+use_default_symbol_version(__snd_timer_params_get_filter, snd_timer_params_get_filter, ALSA_0.9.0);
+
+/**
+ * \brief set parameters for timer handle
+ * \param timer timer handle
+ * \param params pointer to a #snd_timer_params_t structure
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_params(snd_timer_t *timer, snd_timer_params_t * params)
+{
+ assert(timer);
+ assert(params);
+ return timer->ops->params(timer, params);
+}
+
+/**
+ * \brief get size of the snd_timer_status_t structure in bytes
+ * \return size of the snd_timer_status_t structure in bytes
+ */
+size_t snd_timer_status_sizeof()
+{
+ return sizeof(snd_timer_status_t);
+}
+
+/**
+ * \brief allocate a new snd_timer_status_t structure
+ * \param status returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_timer_status_t structure using the standard
+ * malloc C library function.
+ */
+int snd_timer_status_malloc(snd_timer_status_t **status)
+{
+ assert(status);
+ *status = calloc(1, sizeof(snd_timer_status_t));
+ if (!*status)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_timer_status_t structure
+ * \param status pointer to the snd_timer_status_t structure to free
+ *
+ * Frees the given snd_timer_status_t structure using the standard
+ * free C library function.
+ */
+void snd_timer_status_free(snd_timer_status_t *status)
+{
+ assert(status);
+ free(status);
+}
+
+/**
+ * \brief copy one snd_timer_status_t structure to another
+ * \param dst destination snd_timer_status_t structure
+ * \param src source snd_timer_status_t structure
+ */
+void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+
+
+/**
+ * \brief get timestamp
+ * \param status pointer to #snd_timer_status_t structure
+ * \return timestamp
+ */
+snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status)
+{
+ assert(status);
+ return status->tstamp;
+}
+
+/**
+ * \brief get resolution in us
+ * \param status pointer to #snd_timer_status_t structure
+ * \return resolution
+ */
+long snd_timer_status_get_resolution(snd_timer_status_t * status)
+{
+ assert(status);
+ return status->resolution;
+}
+
+/**
+ * \brief get master tick lost count
+ * \param status pointer to #snd_timer_status_t structure
+ * \return master tick lost count
+ */
+long snd_timer_status_get_lost(snd_timer_status_t * status)
+{
+ assert(status);
+ return status->lost;
+}
+
+/**
+ * \brief get overrun count
+ * \param status pointer to #snd_timer_status_t structure
+ * \return overrun count
+ */
+long snd_timer_status_get_overrun(snd_timer_status_t * status)
+{
+ assert(status);
+ return status->overrun;
+}
+
+/**
+ * \brief get count of used queue elements
+ * \param status pointer to #snd_timer_status_t structure
+ * \return count of used queue elements
+ */
+long snd_timer_status_get_queue(snd_timer_status_t * status)
+{
+ assert(status);
+ return status->queue;
+}
+
+/**
+ * \brief get status from timer handle
+ * \param timer timer handle
+ * \param status pointer to a #snd_timer_status_t structure to be filled
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_status(snd_timer_t *timer, snd_timer_status_t * status)
+{
+ assert(timer);
+ assert(status);
+ return timer->ops->status(timer, status);
+}
+
+/**
+ * \brief start the timer
+ * \param timer timer handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_start(snd_timer_t *timer)
+{
+ assert(timer);
+ return timer->ops->rt_start(timer);
+}
+
+/**
+ * \brief stop the timer
+ * \param timer timer handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_stop(snd_timer_t *timer)
+{
+ assert(timer);
+ return timer->ops->rt_stop(timer);
+}
+
+/**
+ * \brief continue the timer
+ * \param timer timer handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_timer_continue(snd_timer_t *timer)
+{
+ assert(timer);
+ return timer->ops->rt_continue(timer);
+}
+
+/**
+ * \brief read bytes using timer handle
+ * \param timer timer handle
+ * \param buffer buffer to store the input bytes
+ * \param size input buffer size in bytes
+ */
+ssize_t snd_timer_read(snd_timer_t *timer, void *buffer, size_t size)
+{
+ assert(timer);
+ assert(((timer->mode & O_ACCMODE) == O_RDONLY) || ((timer->mode & O_ACCMODE) == O_RDWR));
+ assert(buffer || size == 0);
+ return (timer->ops->read)(timer, buffer, size);
+}
+
+/**
+ * \brief (DEPRECATED) get maximum timer ticks
+ * \param info pointer to #snd_timer_info_t structure
+ * \return maximum timer ticks
+ */
+long snd_timer_info_get_ticks(snd_timer_info_t * info)
+{
+ assert(info);
+ return 1;
+}
+#ifndef DOC_HIDDEN
+link_warning(snd_timer_info_get_ticks, "Warning: snd_timer_info_get_ticks is deprecated");
+#endif
diff --git a/alsa-lib/src/timer/timer_hw.c b/alsa-lib/src/timer/timer_hw.c
new file mode 100644
index 0000000..3453858
--- /dev/null
+++ b/alsa-lib/src/timer/timer_hw.c
@@ -0,0 +1,361 @@
+/*
+ * Timer Interface - main file
+ * Copyright (c) 1998-2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#define __USE_GNU
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "timer_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_timer_hw = "";
+#endif
+
+#define SNDRV_FILE_TIMER ALSA_DEVICE_DIRECTORY "timer"
+#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 5)
+
+#define SNDRV_TIMER_IOCTL_STATUS_OLD _IOW('T', 0x14, struct sndrv_timer_status)
+
+enum {
+ SNDRV_TIMER_IOCTL_START_OLD = _IO('T', 0x20),
+ SNDRV_TIMER_IOCTL_STOP_OLD = _IO('T', 0x21),
+ SNDRV_TIMER_IOCTL_CONTINUE_OLD = _IO('T', 0x22),
+ SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23),
+};
+
+static int snd_timer_hw_close(snd_timer_t *handle)
+{
+ snd_timer_t *tmr = handle;
+ int res;
+
+ if (!tmr)
+ return -EINVAL;
+ res = close(tmr->poll_fd) < 0 ? -errno : 0;
+ return res;
+}
+
+static int snd_timer_hw_nonblock(snd_timer_t *timer, int nonblock)
+{
+ long flags;
+ assert(timer);
+ if ((flags = fcntl(timer->poll_fd, F_GETFL)) < 0)
+ return -errno;
+ if (nonblock)
+ flags |= O_NONBLOCK;
+ else
+ flags &= ~O_NONBLOCK;
+ if (fcntl(timer->poll_fd, F_SETFL, flags) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
+{
+ long flags;
+ int fd;
+
+ assert(timer);
+ fd = timer->poll_fd;
+ if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ SYSERR("F_GETFL failed");
+ return -errno;
+ }
+ if (sig >= 0)
+ flags |= O_ASYNC;
+ else
+ flags &= ~O_ASYNC;
+ if (fcntl(fd, F_SETFL, flags) < 0) {
+ SYSERR("F_SETFL for O_ASYNC failed");
+ return -errno;
+ }
+ if (sig < 0)
+ return 0;
+ if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
+ SYSERR("F_SETSIG failed");
+ return -errno;
+ }
+ if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
+ SYSERR("F_SETOWN failed");
+ return -errno;
+ }
+ return 0;
+}
+
+static int snd_timer_hw_info(snd_timer_t *handle, snd_timer_info_t * info)
+{
+ snd_timer_t *tmr;
+
+ tmr = handle;
+ if (!tmr || !info)
+ return -EINVAL;
+ if (ioctl(tmr->poll_fd, SNDRV_TIMER_IOCTL_INFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_params(snd_timer_t *handle, snd_timer_params_t * params)
+{
+ snd_timer_t *tmr;
+
+ tmr = handle;
+ if (!tmr || !params)
+ return -EINVAL;
+ if (ioctl(tmr->poll_fd, SNDRV_TIMER_IOCTL_PARAMS, params) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_status(snd_timer_t *handle, snd_timer_status_t * status)
+{
+ snd_timer_t *tmr;
+ int cmd;
+
+ tmr = handle;
+ if (!tmr || !status)
+ return -EINVAL;
+ if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 1))
+ cmd = SNDRV_TIMER_IOCTL_STATUS_OLD;
+ else
+ cmd = SNDRV_TIMER_IOCTL_STATUS;
+ if (ioctl(tmr->poll_fd, cmd, status) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_start(snd_timer_t *handle)
+{
+ snd_timer_t *tmr;
+ unsigned int cmd;
+
+ tmr = handle;
+ if (!tmr)
+ return -EINVAL;
+ if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ cmd = SNDRV_TIMER_IOCTL_START_OLD;
+ else
+ cmd = SNDRV_TIMER_IOCTL_START;
+ if (ioctl(tmr->poll_fd, cmd) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_stop(snd_timer_t *handle)
+{
+ snd_timer_t *tmr;
+ unsigned int cmd;
+
+ tmr = handle;
+ if (!tmr)
+ return -EINVAL;
+ if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ cmd = SNDRV_TIMER_IOCTL_STOP_OLD;
+ else
+ cmd = SNDRV_TIMER_IOCTL_STOP;
+ if (ioctl(tmr->poll_fd, cmd) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_hw_continue(snd_timer_t *handle)
+{
+ snd_timer_t *tmr;
+ unsigned int cmd;
+
+ tmr = handle;
+ if (!tmr)
+ return -EINVAL;
+ if (tmr->version < SNDRV_PROTOCOL_VERSION(2, 0, 4))
+ cmd = SNDRV_TIMER_IOCTL_CONTINUE_OLD;
+ else
+ cmd = SNDRV_TIMER_IOCTL_CONTINUE;
+ if (ioctl(tmr->poll_fd, cmd) < 0)
+ return -errno;
+ return 0;
+}
+
+static ssize_t snd_timer_hw_read(snd_timer_t *handle, void *buffer, size_t size)
+{
+ snd_timer_t *tmr;
+ ssize_t result;
+
+ tmr = handle;
+ if (!tmr || (!buffer && size > 0))
+ return -EINVAL;
+ result = read(tmr->poll_fd, buffer, size);
+ if (result < 0)
+ return -errno;
+ return result;
+}
+
+static const snd_timer_ops_t snd_timer_hw_ops = {
+ .close = snd_timer_hw_close,
+ .nonblock = snd_timer_hw_nonblock,
+ .async = snd_timer_hw_async,
+ .info = snd_timer_hw_info,
+ .params = snd_timer_hw_params,
+ .status = snd_timer_hw_status,
+ .rt_start = snd_timer_hw_start,
+ .rt_stop = snd_timer_hw_stop,
+ .rt_continue = snd_timer_hw_continue,
+ .read = snd_timer_hw_read,
+};
+
+int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int dev_sclass, int card, int device, int subdevice, int mode)
+{
+ int fd, ver, tmode, ret;
+ snd_timer_t *tmr;
+ struct sndrv_timer_select sel;
+
+ *handle = NULL;
+
+ tmode = O_RDONLY;
+ if (mode & SND_TIMER_OPEN_NONBLOCK)
+ tmode |= O_NONBLOCK;
+ fd = snd_open_device(SNDRV_FILE_TIMER, tmode);
+ if (fd < 0)
+ return -errno;
+#if 0
+ /*
+ * this is bogus, an application have to care about open filedescriptors
+ */
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
+ SYSERR("fcntl FD_CLOEXEC failed");
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+#endif
+ if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) {
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_TIMER_VERSION_MAX)) {
+ close(fd);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ if (mode & SND_TIMER_OPEN_TREAD) {
+ int arg = 1;
+ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 3)) {
+ ret = -ENOTTY;
+ goto __no_tread;
+ }
+ if (ioctl(fd, SNDRV_TIMER_IOCTL_TREAD, &arg) < 0) {
+ ret = -errno;
+ __no_tread:
+ close(fd);
+ SNDMSG("extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)");
+ return ret;
+ }
+ }
+ memset(&sel, 0, sizeof(sel));
+ sel.id.dev_class = dev_class;
+ sel.id.dev_sclass = dev_sclass;
+ sel.id.card = card;
+ sel.id.device = device;
+ sel.id.subdevice = subdevice;
+ if (ioctl(fd, SNDRV_TIMER_IOCTL_SELECT, &sel) < 0) {
+ ret = -errno;
+ close(fd);
+ return ret;
+ }
+ tmr = (snd_timer_t *) calloc(1, sizeof(snd_timer_t));
+ if (tmr == NULL) {
+ close(fd);
+ return -ENOMEM;
+ }
+ tmr->type = SND_TIMER_TYPE_HW;
+ tmr->version = ver;
+ tmr->mode = tmode;
+ tmr->name = strdup(name);
+ tmr->poll_fd = fd;
+ tmr->ops = &snd_timer_hw_ops;
+ INIT_LIST_HEAD(&tmr->async_handlers);
+ *handle = tmr;
+ return 0;
+}
+
+int _snd_timer_hw_open(snd_timer_t **timer, char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ long dev_class = SND_TIMER_CLASS_GLOBAL, dev_sclass = SND_TIMER_SCLASS_NONE;
+ long card = 0, device = 0, subdevice = 0;
+ const char *str;
+ int err;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ if (strcmp(id, "class") == 0) {
+ err = snd_config_get_integer(n, &dev_class);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "sclass") == 0) {
+ err = snd_config_get_integer(n, &dev_sclass);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "card") == 0) {
+ err = snd_config_get_integer(n, &card);
+ if (err < 0) {
+ err = snd_config_get_string(n, &str);
+ if (err < 0)
+ return -EINVAL;
+ card = snd_card_get_index(str);
+ if (card < 0)
+ return card;
+ }
+ continue;
+ }
+ if (strcmp(id, "device") == 0) {
+ err = snd_config_get_integer(n, &device);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "subdevice") == 0) {
+ err = snd_config_get_integer(n, &subdevice);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ SNDERR("Unexpected field %s", id);
+ return -EINVAL;
+ }
+ if (card < 0)
+ return -EINVAL;
+ return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION);
diff --git a/alsa-lib/src/timer/timer_local.h b/alsa-lib/src/timer/timer_local.h
new file mode 100644
index 0000000..19cadfe
--- /dev/null
+++ b/alsa-lib/src/timer/timer_local.h
@@ -0,0 +1,76 @@
+/*
+ * Timer interface - local header file
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "local.h"
+
+#ifndef DOC_HIDDEN
+typedef struct {
+ int (*close)(snd_timer_t *timer);
+ int (*nonblock)(snd_timer_t *timer, int nonblock);
+ int (*async)(snd_timer_t *timer, int sig, pid_t pid);
+ int (*info)(snd_timer_t *timer, snd_timer_info_t *info);
+ int (*params)(snd_timer_t *timer, snd_timer_params_t *params);
+ int (*status)(snd_timer_t *timer, snd_timer_status_t *status);
+ int (*rt_start)(snd_timer_t *timer);
+ int (*rt_stop)(snd_timer_t *timer);
+ int (*rt_continue)(snd_timer_t *timer);
+ ssize_t (*read)(snd_timer_t *timer, void *buffer, size_t size);
+} snd_timer_ops_t;
+
+struct _snd_timer {
+ unsigned int version;
+ void *dl_handle;
+ char *name;
+ snd_timer_type_t type;
+ int mode;
+ int poll_fd;
+ const snd_timer_ops_t *ops;
+ void *private_data;
+ struct list_head async_handlers;
+};
+
+typedef struct {
+ int (*close)(snd_timer_query_t *timer);
+ int (*next_device)(snd_timer_query_t *timer, snd_timer_id_t *tid);
+ int (*info)(snd_timer_query_t *timer, snd_timer_ginfo_t *info);
+ int (*params)(snd_timer_query_t *timer, snd_timer_gparams_t *info);
+ int (*status)(snd_timer_query_t *timer, snd_timer_gstatus_t *info);
+} snd_timer_query_ops_t;
+
+struct _snd_timer_query {
+ void *dl_handle;
+ char *name;
+ snd_timer_type_t type;
+ int mode;
+ int poll_fd;
+ snd_timer_query_ops_t *ops;
+ void *private_data;
+};
+#endif /* DOC_HIDDEN */
+
+int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int dev_sclass, int card, int device, int subdevice, int mode);
+
+int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mode);
+
+int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid);
diff --git a/alsa-lib/src/timer/timer_query.c b/alsa-lib/src/timer/timer_query.c
new file mode 100644
index 0000000..50b098a
--- /dev/null
+++ b/alsa-lib/src/timer/timer_query.c
@@ -0,0 +1,594 @@
+/**
+ * \file timer/timer_query.c
+ * \author Jaroslav Kysela <perex@perex.cz>
+ * \date 2001
+ *
+ * Timer Query Interface is designed to obtain identification of timers.
+ */
+/*
+ * Timer Query Interface - main file
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "timer_local.h"
+
+static int snd_timer_query_open_conf(snd_timer_query_t **timer,
+ const char *name, snd_config_t *timer_root,
+ snd_config_t *timer_conf, int mode)
+{
+ const char *str;
+ char buf[256];
+ int err;
+ snd_config_t *conf, *type_conf = NULL;
+ snd_config_iterator_t i, next;
+ const char *id;
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_timer_query_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
+#ifndef PIC
+ extern void *snd_timer_query_open_symbols(void);
+#endif
+ void *h = NULL;
+ if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ if (name)
+ SNDERR("Invalid type for TIMER %s definition", name);
+ else
+ SNDERR("Invalid type for TIMER definition");
+ return -EINVAL;
+ }
+ err = snd_config_search(timer_conf, "type", &conf);
+ if (err < 0) {
+ SNDERR("type is not defined");
+ return err;
+ }
+ err = snd_config_get_id(conf, &id);
+ if (err < 0) {
+ SNDERR("unable to get id");
+ return err;
+ }
+ err = snd_config_get_string(conf, &str);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ return err;
+ }
+ err = snd_config_search_definition(timer_root, "timer_query_type", str, &type_conf);
+ if (err >= 0) {
+ if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
+ SNDERR("Invalid type for TIMER type %s definition", str);
+ err = -EINVAL;
+ goto _err;
+ }
+ snd_config_for_each(i, next, type_conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "lib") == 0) {
+ err = snd_config_get_string(n, &lib);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ if (strcmp(id, "open") == 0) {
+ err = snd_config_get_string(n, &open_name);
+ if (err < 0) {
+ SNDERR("Invalid type for %s", id);
+ goto _err;
+ }
+ continue;
+ }
+ SNDERR("Unknown field %s", id);
+ err = -EINVAL;
+ goto _err;
+ }
+ }
+ if (!open_name) {
+ open_name = buf;
+ snprintf(buf, sizeof(buf), "_snd_timer_query_%s_open", str);
+ }
+#ifndef PIC
+ snd_timer_query_open_symbols();
+#endif
+ h = snd_dlopen(lib, RTLD_NOW);
+ if (h)
+ open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION));
+ err = 0;
+ if (!h) {
+ SNDERR("Cannot open shared library %s", lib);
+ err = -ENOENT;
+ } else if (!open_func) {
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_dlclose(h);
+ err = -ENXIO;
+ }
+ _err:
+ if (type_conf)
+ snd_config_delete(type_conf);
+ if (! err) {
+ err = open_func(timer, name, timer_root, timer_conf, mode);
+ if (err < 0)
+ snd_dlclose(h);
+ else
+ (*timer)->dl_handle = h;
+ }
+ return err;
+}
+
+static int snd_timer_query_open_noupdate(snd_timer_query_t **timer, snd_config_t *root, const char *name, int mode)
+{
+ int err;
+ snd_config_t *timer_conf;
+ err = snd_config_search_definition(root, "timer_query", name, &timer_conf);
+ if (err < 0) {
+ SNDERR("Unknown timer %s", name);
+ return err;
+ }
+ err = snd_timer_query_open_conf(timer, name, root, timer_conf, mode);
+ snd_config_delete(timer_conf);
+ return err;
+}
+
+/**
+ * \brief Opens a new connection to the timer query interface.
+ * \param timer Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the RawMidi handle
+ * \param mode Open mode
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the RawMidi interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_timer_query_open(snd_timer_query_t **timer, const char *name, int mode)
+{
+ int err;
+ assert(timer && name);
+ err = snd_config_update();
+ if (err < 0)
+ return err;
+ return snd_timer_query_open_noupdate(timer, snd_config, name, mode);
+}
+
+/**
+ * \brief Opens a new connection to the timer query interface using local configuration
+ * \param timer Returned handle (NULL if not wanted)
+ * \param name ASCII identifier of the RawMidi handle
+ * \param mode Open mode
+ * \param lconf Local configuration
+ * \return 0 on success otherwise a negative error code
+ *
+ * Opens a new connection to the RawMidi interface specified with
+ * an ASCII identifier and mode.
+ */
+int snd_timer_query_open_lconf(snd_timer_query_t **timer, const char *name,
+ int mode, snd_config_t *lconf)
+{
+ assert(timer && name && lconf);
+ return snd_timer_query_open_noupdate(timer, lconf, name, mode);
+}
+
+/**
+ * \brief close timer query handle
+ * \param timer timer handle
+ * \return 0 on success otherwise a negative error code
+ *
+ * Closes the specified timer handle and frees all associated
+ * resources.
+ */
+int snd_timer_query_close(snd_timer_query_t *timer)
+{
+ int err;
+ assert(timer);
+ err = timer->ops->close(timer);
+ if (timer->dl_handle)
+ snd_dlclose(timer->dl_handle);
+ free(timer->name);
+ free(timer);
+ return err;
+}
+
+/**
+ * \brief obtain the next timer identification
+ * \param timer timer handle
+ * \param tid timer identification
+ * \return 0 on success otherwise a negative error code
+ *
+ * if tid->dev_class is -1, then the first device is returned
+ * if result tid->dev_class is -1, no more devices are left
+ */
+int snd_timer_query_next_device(snd_timer_query_t *timer, snd_timer_id_t *tid)
+{
+ assert(timer);
+ assert(tid);
+ return timer->ops->next_device(timer, tid);
+}
+
+/**
+ * \brief get size of the snd_timer_ginfo_t structure in bytes
+ * \return size of the snd_timer_ginfo_t structure in bytes
+ */
+size_t snd_timer_ginfo_sizeof(void)
+{
+ return sizeof(snd_timer_ginfo_t);
+}
+
+/**
+ * \brief allocate a new snd_timer_ginfo_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_timer_info_t structure using the standard
+ * malloc C library function.
+ */
+int snd_timer_ginfo_malloc(snd_timer_ginfo_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_timer_ginfo_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_timer_ginfo_t structure
+ * \param info pointer to the snd_timer_ginfo_t structure to free
+ *
+ * Frees the given snd_timer_info_t structure using the standard
+ * free C library function.
+ */
+void snd_timer_ginfo_free(snd_timer_ginfo_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_timer_info_t structure to another
+ * \param dst destination snd_timer_info_t structure
+ * \param src source snd_timer_info_t structure
+ */
+void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief set timer identification
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return zero on success otherwise a negative error number
+ */
+int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid)
+{
+ obj->tid = *((snd_timer_id_t *)tid);
+ return 0;
+}
+
+/**
+ * \brief get timer identification
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return pointer to snd_timer_id_t
+ */
+snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj)
+{
+ return (snd_timer_id_t *)&obj->tid;
+}
+
+/**
+ * \brief get timer flags
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer flags
+ */
+unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj)
+{
+ return obj->flags;
+}
+
+/**
+ * \brief get associated card with timer
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return associated card
+ */
+int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj)
+{
+ return obj->card;
+}
+
+/**
+ * \brief get timer identification
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer identification
+ */
+char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj)
+{
+ return (char *)obj->id;
+}
+
+/**
+ * \brief get timer name
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer name
+ */
+char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj)
+{
+ return (char *)obj->name;
+}
+
+/**
+ * \brief get timer resolution in ns
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer resolution in ns
+ */
+unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj)
+{
+ return obj->resolution;
+}
+
+/**
+ * \brief get timer minimal resolution in ns
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer minimal resolution in ns
+ */
+unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj)
+{
+ return obj->resolution_min;
+}
+
+/**
+ * \brief get timer maximal resolution in ns
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return timer maximal resolution in ns
+ */
+unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj)
+{
+ return obj->resolution_max;
+}
+
+/**
+ * \brief get current timer clients
+ * \param obj pointer to #snd_timer_ginfo_t structure
+ * \return current timer clients
+ */
+unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj)
+{
+ return obj->clients;
+}
+
+/**
+ * \brief obtain the timer global information
+ * \param timer timer handle
+ * \param info timer information
+ * \return 0 on success otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_timer_query_info)(snd_timer_query_t *timer, snd_timer_ginfo_t *info)
+#else
+int snd_timer_query_info(snd_timer_query_t *timer, snd_timer_ginfo_t *info)
+#endif
+{
+ assert(timer);
+ assert(info);
+ return timer->ops->info(timer, info);
+}
+use_default_symbol_version(__snd_timer_query_info, snd_timer_query_info, ALSA_0.9.0);
+
+/**
+ * \brief set the timer global parameters
+ * \param timer timer handle
+ * \param params timer parameters
+ * \return 0 on success otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_timer_query_params)(snd_timer_query_t *timer, snd_timer_gparams_t *params)
+#else
+int snd_timer_query_params(snd_timer_query_t *timer, snd_timer_gparams_t *params)
+#endif
+{
+ assert(timer);
+ assert(params);
+ return timer->ops->params(timer, params);
+}
+use_default_symbol_version(__snd_timer_query_params, snd_timer_query_params, ALSA_0.9.0);
+
+/**
+ * \brief get the timer global status
+ * \param timer timer handle
+ * \param status timer status
+ * \return 0 on success otherwise a negative error code
+ */
+#ifndef DOXYGEN
+int INTERNAL(snd_timer_query_status)(snd_timer_query_t *timer, snd_timer_gstatus_t *status)
+#else
+int snd_timer_query_status(snd_timer_query_t *timer, snd_timer_gstatus_t *status)
+#endif
+{
+ assert(timer);
+ assert(status);
+ return timer->ops->status(timer, status);
+}
+use_default_symbol_version(__snd_timer_query_status, snd_timer_query_status, ALSA_0.9.0);
+
+/**
+ * \brief get size of the snd_timer_id_t structure in bytes
+ * \return size of the snd_timer_id_t structure in bytes
+ */
+size_t snd_timer_id_sizeof()
+{
+ return sizeof(snd_timer_id_t);
+}
+
+/**
+ * \brief allocate a new snd_timer_id_t structure
+ * \param info returned pointer
+ * \return 0 on success otherwise a negative error code if fails
+ *
+ * Allocates a new snd_timer_id_t structure using the standard
+ * malloc C library function.
+ */
+int snd_timer_id_malloc(snd_timer_id_t **info)
+{
+ assert(info);
+ *info = calloc(1, sizeof(snd_timer_id_t));
+ if (!*info)
+ return -ENOMEM;
+ return 0;
+}
+
+/**
+ * \brief frees the snd_timer_id_t structure
+ * \param info pointer to the snd_timer_id_t structure to free
+ *
+ * Frees the given snd_timer_id_t structure using the standard
+ * free C library function.
+ */
+void snd_timer_id_free(snd_timer_id_t *info)
+{
+ assert(info);
+ free(info);
+}
+
+/**
+ * \brief copy one snd_timer_id_t structure to another
+ * \param dst destination snd_timer_id_t structure
+ * \param src source snd_timer_id_t structure
+ */
+void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src)
+{
+ assert(dst && src);
+ *dst = *src;
+}
+
+/**
+ * \brief set timer class
+ * \param tid pointer to #snd_timer_id_t structure
+ * \param dev_class class of timer device
+ */
+void snd_timer_id_set_class(snd_timer_id_t * tid, int dev_class)
+{
+ assert(tid);
+ tid->dev_class = dev_class;
+}
+
+/**
+ * \brief get timer class
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return timer class
+ */
+int snd_timer_id_get_class(snd_timer_id_t * tid)
+{
+ assert(tid);
+ return tid->dev_class;
+}
+
+/**
+ * \brief set timer sub-class
+ * \param tid pointer to #snd_timer_id_t structure
+ * \param dev_sclass sub-class of timer device
+ */
+void snd_timer_id_set_sclass(snd_timer_id_t * tid, int dev_sclass)
+{
+ assert(tid);
+ tid->dev_sclass = dev_sclass;
+}
+
+/**
+ * \brief get timer sub-class
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return timer sub-class
+ */
+int snd_timer_id_get_sclass(snd_timer_id_t * tid)
+{
+ assert(tid);
+ return tid->dev_sclass;
+}
+
+/**
+ * \brief set timer card
+ * \param tid pointer to #snd_timer_id_t structure
+ * \param card card number
+ */
+void snd_timer_id_set_card(snd_timer_id_t * tid, int card)
+{
+ assert(tid);
+ tid->card = card;
+}
+
+/**
+ * \brief get timer card
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return timer card number
+ */
+int snd_timer_id_get_card(snd_timer_id_t * tid)
+{
+ assert(tid);
+ return tid->card;
+}
+
+/**
+ * \brief set timer device
+ * \param tid pointer to #snd_timer_id_t structure
+ * \param device device number
+ */
+void snd_timer_id_set_device(snd_timer_id_t * tid, int device)
+{
+ assert(tid);
+ tid->device = device;
+}
+
+/**
+ * \brief get timer device
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return timer device number
+ */
+int snd_timer_id_get_device(snd_timer_id_t * tid)
+{
+ assert(tid);
+ return tid->device;
+}
+
+/**
+ * \brief set timer subdevice
+ * \param tid pointer to #snd_timer_id_t structure
+ * \param subdevice subdevice number
+ */
+void snd_timer_id_set_subdevice(snd_timer_id_t * tid, int subdevice)
+{
+ assert(tid);
+ tid->subdevice = subdevice;
+}
+
+/**
+ * \brief get timer subdevice
+ * \param tid pointer to #snd_timer_id_t structure
+ * \return timer subdevice number
+ */
+int snd_timer_id_get_subdevice(snd_timer_id_t * tid)
+{
+ assert(tid);
+ return tid->subdevice;
+}
diff --git a/alsa-lib/src/timer/timer_query_hw.c b/alsa-lib/src/timer/timer_query_hw.c
new file mode 100644
index 0000000..9f62b78
--- /dev/null
+++ b/alsa-lib/src/timer/timer_query_hw.c
@@ -0,0 +1,146 @@
+/*
+ * Timer Interface - main file
+ * Copyright (c) 1998-2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include "timer_local.h"
+
+#ifndef PIC
+/* entry for static linking */
+const char *_snd_module_timer_query_hw = "";
+#endif
+
+#define SNDRV_FILE_TIMER ALSA_DEVICE_DIRECTORY "timer"
+#define SNDRV_TIMER_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
+
+static int snd_timer_query_hw_close(snd_timer_query_t *handle)
+{
+ int res;
+
+ if (!handle)
+ return -EINVAL;
+ res = close(handle->poll_fd) < 0 ? -errno : 0;
+ return res;
+}
+
+static int snd_timer_query_hw_next_device(snd_timer_query_t *handle, snd_timer_id_t * tid)
+{
+ if (!handle || !tid)
+ return -EINVAL;
+ if (ioctl(handle->poll_fd, SNDRV_TIMER_IOCTL_NEXT_DEVICE, tid) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_query_hw_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info)
+{
+ if (!handle || !info)
+ return -EINVAL;
+ if (ioctl(handle->poll_fd, SNDRV_TIMER_IOCTL_GINFO, info) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_query_hw_params(snd_timer_query_t *handle, snd_timer_gparams_t *params)
+{
+ if (!handle || !params)
+ return -EINVAL;
+ if (ioctl(handle->poll_fd, SNDRV_TIMER_IOCTL_GPARAMS, params) < 0)
+ return -errno;
+ return 0;
+}
+
+static int snd_timer_query_hw_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status)
+{
+ if (!handle || !status)
+ return -EINVAL;
+ if (ioctl(handle->poll_fd, SNDRV_TIMER_IOCTL_GSTATUS, status) < 0)
+ return -errno;
+ return 0;
+}
+
+static const snd_timer_query_ops_t snd_timer_query_hw_ops = {
+ .close = snd_timer_query_hw_close,
+ .next_device = snd_timer_query_hw_next_device,
+ .info = snd_timer_query_hw_info,
+ .params = snd_timer_query_hw_params,
+ .status = snd_timer_query_hw_status
+};
+
+int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mode)
+{
+ int fd, ver, tmode;
+ snd_timer_query_t *tmr;
+
+ *handle = NULL;
+
+ tmode = O_RDONLY;
+ if (mode & SND_TIMER_OPEN_NONBLOCK)
+ tmode |= O_NONBLOCK;
+ fd = snd_open_device(SNDRV_FILE_TIMER, tmode);
+ if (fd < 0)
+ return -errno;
+ if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) {
+ close(fd);
+ return -errno;
+ }
+ if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_TIMER_VERSION_MAX)) {
+ close(fd);
+ return -SND_ERROR_INCOMPATIBLE_VERSION;
+ }
+ tmr = (snd_timer_query_t *) calloc(1, sizeof(snd_timer_t));
+ if (tmr == NULL) {
+ close(fd);
+ return -ENOMEM;
+ }
+ tmr->type = SND_TIMER_TYPE_HW;
+ tmr->mode = tmode;
+ tmr->name = strdup(name);
+ tmr->poll_fd = fd;
+ tmr->ops = &snd_timer_query_hw_ops;
+ *handle = tmr;
+ return 0;
+}
+
+int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name,
+ snd_config_t *root ATTRIBUTE_UNUSED,
+ snd_config_t *conf, int mode)
+{
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "comment") == 0)
+ continue;
+ if (strcmp(id, "type") == 0)
+ continue;
+ SNDERR("Unexpected field %s", id);
+ return -EINVAL;
+ }
+ return snd_timer_query_hw_open(timer, name, mode);
+}
+SND_DLSYM_BUILD_VERSION(_snd_timer_query_hw_open, SND_TIMER_QUERY_DLSYM_VERSION);
diff --git a/alsa-lib/src/timer/timer_symbols.c b/alsa-lib/src/timer/timer_symbols.c
new file mode 100644
index 0000000..797721e
--- /dev/null
+++ b/alsa-lib/src/timer/timer_symbols.c
@@ -0,0 +1,46 @@
+/*
+ * Timer Symbols
+ * Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef PIC
+
+extern const char *_snd_module_timer_hw;
+
+static const char **snd_timer_open_objects[] = {
+ &_snd_module_timer_hw
+};
+
+void *snd_timer_open_symbols(void)
+{
+ return (void *)snd_timer_open_objects[0];
+}
+
+
+extern const char *_snd_module_timer_query_hw;
+
+static const char **snd_timer_query_open_objects[] = {
+ &_snd_module_timer_query_hw
+};
+
+void *snd_timer_query_open_symbols(void)
+{
+ return snd_timer_query_open_objects;
+}
+
+#endif /* !PIC */
diff --git a/alsa-lib/src/userfile.c b/alsa-lib/src/userfile.c
new file mode 100644
index 0000000..3a73836
--- /dev/null
+++ b/alsa-lib/src/userfile.c
@@ -0,0 +1,72 @@
+/*
+ * Get full filename
+ * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <errno.h>
+
+/**
+ * \brief Get the full file name
+ * \param file The file name string to parse
+ * \param result The pointer to store the resultant file name
+ * \return 0 if successful, or a negative error code
+ *
+ * Parses the given file name with POSIX-Shell-like expansion and
+ * stores the first matchine one. The returned string is strdup'ed.
+ */
+
+#ifdef HAVE_WORDEXP_H
+#include <wordexp.h>
+#include <assert.h>
+int snd_user_file(const char *file, char **result)
+{
+ wordexp_t we;
+ int err;
+
+ assert(file && result);
+ err = wordexp(file, &we, WRDE_NOCMD);
+ switch (err) {
+ case WRDE_NOSPACE:
+ return -ENOMEM;
+ case 0:
+ if (we.we_wordc == 1)
+ break;
+ /* fall thru */
+ default:
+ wordfree(&we);
+ return -EINVAL;
+ }
+ *result = strdup(we.we_wordv[0]);
+ if (*result == NULL)
+ return -ENOMEM;
+ wordfree(&we);
+ return 0;
+}
+
+#else /* !HAVE_WORDEXP_H */
+/* just copy the string - would be nicer to expand by ourselves, though... */
+int snd_user_file(const char *file, char **result)
+{
+ *result = strdup(file);
+ if (! *result)
+ return -ENOMEM;
+ return 0;
+}
+#endif /* HAVE_WORDEXP_H */
diff --git a/alsa-lib/test/Makefile.am b/alsa-lib/test/Makefile.am
new file mode 100644
index 0000000..2d7e92b
--- /dev/null
+++ b/alsa-lib/test/Makefile.am
@@ -0,0 +1,23 @@
+check_PROGRAMS=control pcm pcm_min latency seq \
+ playmidi1 timer rawmidi midiloop \
+ oldapi queue_timer namehint client_event_filter
+
+control_LDADD=../src/libasound.la
+pcm_LDADD=../src/libasound.la
+pcm_min_LDADD=../src/libasound.la
+latency_LDADD=../src/libasound.la
+seq_LDADD=../src/libasound.la
+playmidi1_LDADD=../src/libasound.la
+timer_LDADD=../src/libasound.la
+rawmidi_LDADD=../src/libasound.la
+midiloop_LDADD=../src/libasound.la
+oldapi_LDADD=../src/libasound.la
+queue_timer_LDADD=../src/libasound.la
+namehint_LDADD=../src/libasound.la
+client_event_filter_LDADD=../src/libasound.la
+code_CFLAGS=-Wall -pipe -g -O2
+
+INCLUDES=-I$(top_srcdir)/include
+AM_CFLAGS=-Wall -pipe -g
+
+EXTRA_DIST=seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3
diff --git a/alsa-lib/test/Makefile.in b/alsa-lib/test/Makefile.in
new file mode 100644
index 0000000..d1a6a43
--- /dev/null
+++ b/alsa-lib/test/Makefile.in
@@ -0,0 +1,630 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = control$(EXEEXT) pcm$(EXEEXT) pcm_min$(EXEEXT) \
+ latency$(EXEEXT) seq$(EXEEXT) playmidi1$(EXEEXT) \
+ timer$(EXEEXT) rawmidi$(EXEEXT) midiloop$(EXEEXT) \
+ oldapi$(EXEEXT) queue_timer$(EXEEXT) namehint$(EXEEXT) \
+ client_event_filter$(EXEEXT)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+client_event_filter_SOURCES = client_event_filter.c
+client_event_filter_OBJECTS = client_event_filter.$(OBJEXT)
+client_event_filter_DEPENDENCIES = ../src/libasound.la
+control_SOURCES = control.c
+control_OBJECTS = control.$(OBJEXT)
+control_DEPENDENCIES = ../src/libasound.la
+latency_SOURCES = latency.c
+latency_OBJECTS = latency.$(OBJEXT)
+latency_DEPENDENCIES = ../src/libasound.la
+midiloop_SOURCES = midiloop.c
+midiloop_OBJECTS = midiloop.$(OBJEXT)
+midiloop_DEPENDENCIES = ../src/libasound.la
+namehint_SOURCES = namehint.c
+namehint_OBJECTS = namehint.$(OBJEXT)
+namehint_DEPENDENCIES = ../src/libasound.la
+oldapi_SOURCES = oldapi.c
+oldapi_OBJECTS = oldapi.$(OBJEXT)
+oldapi_DEPENDENCIES = ../src/libasound.la
+pcm_SOURCES = pcm.c
+pcm_OBJECTS = pcm.$(OBJEXT)
+pcm_DEPENDENCIES = ../src/libasound.la
+pcm_min_SOURCES = pcm_min.c
+pcm_min_OBJECTS = pcm_min.$(OBJEXT)
+pcm_min_DEPENDENCIES = ../src/libasound.la
+playmidi1_SOURCES = playmidi1.c
+playmidi1_OBJECTS = playmidi1.$(OBJEXT)
+playmidi1_DEPENDENCIES = ../src/libasound.la
+queue_timer_SOURCES = queue_timer.c
+queue_timer_OBJECTS = queue_timer.$(OBJEXT)
+queue_timer_DEPENDENCIES = ../src/libasound.la
+rawmidi_SOURCES = rawmidi.c
+rawmidi_OBJECTS = rawmidi.$(OBJEXT)
+rawmidi_DEPENDENCIES = ../src/libasound.la
+seq_SOURCES = seq.c
+seq_OBJECTS = seq.$(OBJEXT)
+seq_DEPENDENCIES = ../src/libasound.la
+timer_SOURCES = timer.c
+timer_OBJECTS = timer.$(OBJEXT)
+timer_DEPENDENCIES = ../src/libasound.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = client_event_filter.c control.c latency.c midiloop.c \
+ namehint.c oldapi.c pcm.c pcm_min.c playmidi1.c queue_timer.c \
+ rawmidi.c seq.c timer.c
+DIST_SOURCES = client_event_filter.c control.c latency.c midiloop.c \
+ namehint.c oldapi.c pcm.c pcm_min.c playmidi1.c queue_timer.c \
+ rawmidi.c seq.c timer.c
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+control_LDADD = ../src/libasound.la
+pcm_LDADD = ../src/libasound.la
+pcm_min_LDADD = ../src/libasound.la
+latency_LDADD = ../src/libasound.la
+seq_LDADD = ../src/libasound.la
+playmidi1_LDADD = ../src/libasound.la
+timer_LDADD = ../src/libasound.la
+rawmidi_LDADD = ../src/libasound.la
+midiloop_LDADD = ../src/libasound.la
+oldapi_LDADD = ../src/libasound.la
+queue_timer_LDADD = ../src/libasound.la
+namehint_LDADD = ../src/libasound.la
+client_event_filter_LDADD = ../src/libasound.la
+code_CFLAGS = -Wall -pipe -g -O2
+INCLUDES = -I$(top_srcdir)/include
+AM_CFLAGS = -Wall -pipe -g
+EXTRA_DIST = seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+client_event_filter$(EXEEXT): $(client_event_filter_OBJECTS) $(client_event_filter_DEPENDENCIES)
+ @rm -f client_event_filter$(EXEEXT)
+ $(LINK) $(client_event_filter_LDFLAGS) $(client_event_filter_OBJECTS) $(client_event_filter_LDADD) $(LIBS)
+control$(EXEEXT): $(control_OBJECTS) $(control_DEPENDENCIES)
+ @rm -f control$(EXEEXT)
+ $(LINK) $(control_LDFLAGS) $(control_OBJECTS) $(control_LDADD) $(LIBS)
+latency$(EXEEXT): $(latency_OBJECTS) $(latency_DEPENDENCIES)
+ @rm -f latency$(EXEEXT)
+ $(LINK) $(latency_LDFLAGS) $(latency_OBJECTS) $(latency_LDADD) $(LIBS)
+midiloop$(EXEEXT): $(midiloop_OBJECTS) $(midiloop_DEPENDENCIES)
+ @rm -f midiloop$(EXEEXT)
+ $(LINK) $(midiloop_LDFLAGS) $(midiloop_OBJECTS) $(midiloop_LDADD) $(LIBS)
+namehint$(EXEEXT): $(namehint_OBJECTS) $(namehint_DEPENDENCIES)
+ @rm -f namehint$(EXEEXT)
+ $(LINK) $(namehint_LDFLAGS) $(namehint_OBJECTS) $(namehint_LDADD) $(LIBS)
+oldapi$(EXEEXT): $(oldapi_OBJECTS) $(oldapi_DEPENDENCIES)
+ @rm -f oldapi$(EXEEXT)
+ $(LINK) $(oldapi_LDFLAGS) $(oldapi_OBJECTS) $(oldapi_LDADD) $(LIBS)
+pcm$(EXEEXT): $(pcm_OBJECTS) $(pcm_DEPENDENCIES)
+ @rm -f pcm$(EXEEXT)
+ $(LINK) $(pcm_LDFLAGS) $(pcm_OBJECTS) $(pcm_LDADD) $(LIBS)
+pcm_min$(EXEEXT): $(pcm_min_OBJECTS) $(pcm_min_DEPENDENCIES)
+ @rm -f pcm_min$(EXEEXT)
+ $(LINK) $(pcm_min_LDFLAGS) $(pcm_min_OBJECTS) $(pcm_min_LDADD) $(LIBS)
+playmidi1$(EXEEXT): $(playmidi1_OBJECTS) $(playmidi1_DEPENDENCIES)
+ @rm -f playmidi1$(EXEEXT)
+ $(LINK) $(playmidi1_LDFLAGS) $(playmidi1_OBJECTS) $(playmidi1_LDADD) $(LIBS)
+queue_timer$(EXEEXT): $(queue_timer_OBJECTS) $(queue_timer_DEPENDENCIES)
+ @rm -f queue_timer$(EXEEXT)
+ $(LINK) $(queue_timer_LDFLAGS) $(queue_timer_OBJECTS) $(queue_timer_LDADD) $(LIBS)
+rawmidi$(EXEEXT): $(rawmidi_OBJECTS) $(rawmidi_DEPENDENCIES)
+ @rm -f rawmidi$(EXEEXT)
+ $(LINK) $(rawmidi_LDFLAGS) $(rawmidi_OBJECTS) $(rawmidi_LDADD) $(LIBS)
+seq$(EXEEXT): $(seq_OBJECTS) $(seq_DEPENDENCIES)
+ @rm -f seq$(EXEEXT)
+ $(LINK) $(seq_LDFLAGS) $(seq_OBJECTS) $(seq_LDADD) $(LIBS)
+timer$(EXEEXT): $(timer_OBJECTS) $(timer_DEPENDENCIES)
+ @rm -f timer$(EXEEXT)
+ $(LINK) $(timer_LDFLAGS) $(timer_OBJECTS) $(timer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client_event_filter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/latency.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/midiloop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namehint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldapi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm_min.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playmidi1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue_timer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawmidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/test/client_event_filter.c b/alsa-lib/test/client_event_filter.c
new file mode 100644
index 0000000..0650314
--- /dev/null
+++ b/alsa-lib/test/client_event_filter.c
@@ -0,0 +1,46 @@
+#include <alsa/asoundlib.h>
+
+void dump_event_filter(snd_seq_client_info_t *client_info) {
+ int i, b;
+
+ for (i = 0; i <= 255;) {
+ b = snd_seq_client_info_event_filter_check(client_info, i);
+ i++;
+ printf("%c%s%s", (b ? 'X' : '.'),
+ (i % 8 == 0 ? " " : ""),
+ (i % 32 == 0 ? "\n" : ""));
+ }
+ printf("\n");
+}
+
+int main(void) {
+ snd_seq_client_info_t *client_info;
+
+ snd_seq_client_info_alloca(&client_info);
+
+ printf("first client_info_event_filter :\n");
+ dump_event_filter(client_info);
+
+ snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
+ printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
+ dump_event_filter(client_info);
+
+ snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);
+ printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);\n");
+ dump_event_filter(client_info);
+
+ snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);
+ printf("after snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);\n");
+ dump_event_filter(client_info);
+
+ snd_seq_client_info_event_filter_clear(client_info);
+ printf("after snd_seq_client_info_event_filter_clear(client_info);\n");
+ dump_event_filter(client_info);
+
+ snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
+ printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
+ dump_event_filter(client_info);
+
+ return 0;
+}
+
diff --git a/alsa-lib/test/control.c b/alsa-lib/test/control.c
new file mode 100644
index 0000000..f4b437e
--- /dev/null
+++ b/alsa-lib/test/control.c
@@ -0,0 +1,106 @@
+#include <stdio.h>
+#include <string.h>
+#include "../include/asoundlib.h"
+
+int main(void)
+{
+ int idx, dev, err;
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t *info;
+ snd_pcm_info_t *pcminfo;
+ snd_rawmidi_info_t *rawmidiinfo;
+ char str[128];
+
+ snd_ctl_card_info_alloca(&info);
+ snd_pcm_info_alloca(&pcminfo);
+ snd_rawmidi_info_alloca(&rawmidiinfo);
+
+ idx = -1;
+ while (1) {
+ if ((err = snd_card_next(&idx)) < 0) {
+ printf("Card next error: %s\n", snd_strerror(err));
+ break;
+ }
+ if (idx < 0)
+ break;
+ sprintf(str, "hw:CARD=%i", idx);
+ if ((err = snd_ctl_open(&handle, str, 0)) < 0) {
+ printf("Open error: %s\n", snd_strerror(err));
+ continue;
+ }
+ if ((err = snd_ctl_card_info(handle, info)) < 0) {
+ printf("HW info error: %s\n", snd_strerror(err));
+ continue;
+ }
+ printf("Soundcard #%i:\n", idx + 1);
+ printf(" card - %i\n", snd_ctl_card_info_get_card(info));
+ printf(" id - '%s'\n", snd_ctl_card_info_get_id(info));
+ printf(" driver - '%s'\n", snd_ctl_card_info_get_driver(info));
+ printf(" name - '%s'\n", snd_ctl_card_info_get_name(info));
+ printf(" longname - '%s'\n", snd_ctl_card_info_get_longname(info));
+ printf(" mixername - '%s'\n", snd_ctl_card_info_get_mixername(info));
+ printf(" components - '%s'\n", snd_ctl_card_info_get_components(info));
+ dev = -1;
+ while (1) {
+ snd_pcm_sync_id_t sync;
+ if ((err = snd_ctl_pcm_next_device(handle, &dev)) < 0) {
+ printf(" PCM next device error: %s\n", snd_strerror(err));
+ break;
+ }
+ if (dev < 0)
+ break;
+ snd_pcm_info_set_device(pcminfo, dev);
+ snd_pcm_info_set_subdevice(pcminfo, 0);
+ snd_pcm_info_set_stream(pcminfo, SND_PCM_STREAM_PLAYBACK);
+ if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
+ printf(" PCM info error: %s\n", snd_strerror(err));
+ continue;
+ }
+ printf("PCM info, device #%i:\n", dev);
+ printf(" device - %i\n", snd_pcm_info_get_device(pcminfo));
+ printf(" subdevice - %i\n", snd_pcm_info_get_subdevice(pcminfo));
+ printf(" stream - %i\n", snd_pcm_info_get_stream(pcminfo));
+ printf(" card - %i\n", snd_pcm_info_get_card(pcminfo));
+ printf(" id - '%s'\n", snd_pcm_info_get_id(pcminfo));
+ printf(" name - '%s'\n", snd_pcm_info_get_name(pcminfo));
+ printf(" subdevice name - '%s'\n", snd_pcm_info_get_subdevice_name(pcminfo));
+ printf(" class - 0x%x\n", snd_pcm_info_get_class(pcminfo));
+ printf(" subclass - 0x%x\n", snd_pcm_info_get_subclass(pcminfo));
+ printf(" subdevices count - %i\n", snd_pcm_info_get_subdevices_count(pcminfo));
+ printf(" subdevices avail - %i\n", snd_pcm_info_get_subdevices_avail(pcminfo));
+ sync = snd_pcm_info_get_sync(pcminfo);
+ printf(" sync - 0x%x,0x%x,0x%x,0x%x\n", sync.id32[0], sync.id32[1], sync.id32[2], sync.id32[3]);
+ }
+ dev = -1;
+ while (1) {
+ if ((err = snd_ctl_rawmidi_next_device(handle, &dev)) < 0) {
+ printf(" RAWMIDI next device error: %s\n", snd_strerror(err));
+ break;
+ }
+ if (dev < 0)
+ break;
+ snd_rawmidi_info_set_device(rawmidiinfo, dev);
+ snd_rawmidi_info_set_subdevice(rawmidiinfo, 0);
+ snd_rawmidi_info_set_stream(rawmidiinfo, SND_RAWMIDI_STREAM_OUTPUT);
+ if ((err = snd_ctl_rawmidi_info(handle, rawmidiinfo)) < 0) {
+ printf(" RAWMIDI info error: %s\n", snd_strerror(err));
+ continue;
+ }
+ printf("RAWMIDI info, device #%i:\n", dev);
+ printf(" device - %i\n", snd_rawmidi_info_get_device(rawmidiinfo));
+ printf(" subdevice - %i\n", snd_rawmidi_info_get_subdevice(rawmidiinfo));
+ printf(" stream - %i\n", snd_rawmidi_info_get_stream(rawmidiinfo));
+ printf(" card - %i\n", snd_rawmidi_info_get_card(rawmidiinfo));
+ printf(" flags - 0x%x\n", snd_rawmidi_info_get_flags(rawmidiinfo));
+ printf(" id - '%s'\n", snd_rawmidi_info_get_id(rawmidiinfo));
+ printf(" name - '%s'\n", snd_rawmidi_info_get_name(rawmidiinfo));
+ printf(" subname - '%s'\n", snd_rawmidi_info_get_subdevice_name(rawmidiinfo));
+ printf(" subdevices count - %i\n", snd_rawmidi_info_get_subdevices_count(rawmidiinfo));
+ printf(" subdevices avail - %i\n", snd_rawmidi_info_get_subdevices_avail(rawmidiinfo));
+ }
+ snd_ctl_close(handle);
+ }
+
+ snd_config_update_free_global();
+ return 0;
+}
diff --git a/alsa-lib/test/latency.c b/alsa-lib/test/latency.c
new file mode 100644
index 0000000..304e012
--- /dev/null
+++ b/alsa-lib/test/latency.c
@@ -0,0 +1,689 @@
+/*
+ * Latency test program
+ *
+ * Author: Jaroslav Kysela <perex@perex.cz>
+ *
+ * Author of bandpass filter sweep effect:
+ * Maarten de Boer <mdeboer@iua.upf.es>
+ *
+ * This small demo program can be used for measuring latency between
+ * capture and playback. This latency is measured from driver (diff when
+ * playback and capture was started). Scheduler is set to SCHED_RR.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sched.h>
+#include <errno.h>
+#include <getopt.h>
+#include "../include/asoundlib.h"
+#include <sys/time.h>
+#include <math.h>
+
+char *pdevice = "hw:0,0";
+char *cdevice = "hw:0,0";
+snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
+int rate = 22050;
+int channels = 2;
+int buffer_size = 0; /* auto */
+int period_size = 0; /* auto */
+int latency_min = 32; /* in frames / 2 */
+int latency_max = 2048; /* in frames / 2 */
+int loop_sec = 30; /* seconds */
+int block = 0; /* block mode */
+int use_poll = 0;
+int resample = 1;
+unsigned long loop_limit;
+
+snd_output_t *output = NULL;
+
+int setparams_stream(snd_pcm_t *handle,
+ snd_pcm_hw_params_t *params,
+ const char *id)
+{
+ int err;
+ unsigned int rrate;
+
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0) {
+ printf("Broken configuration for %s PCM: no configurations available: %s\n", snd_strerror(err), id);
+ return err;
+ }
+ err = snd_pcm_hw_params_set_rate_resample(handle, params, resample);
+ if (err < 0) {
+ printf("Resample setup failed for %s (val %i): %s\n", id, resample, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (err < 0) {
+ printf("Access type not available for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_hw_params_set_format(handle, params, format);
+ if (err < 0) {
+ printf("Sample format not available for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_hw_params_set_channels(handle, params, channels);
+ if (err < 0) {
+ printf("Channels count (%i) not available for %s: %s\n", channels, id, snd_strerror(err));
+ return err;
+ }
+ rrate = rate;
+ err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
+ if (err < 0) {
+ printf("Rate %iHz not available for %s: %s\n", rate, id, snd_strerror(err));
+ return err;
+ }
+ if ((int)rrate != rate) {
+ printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+int setparams_bufsize(snd_pcm_t *handle,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_params_t *tparams,
+ snd_pcm_uframes_t bufsize,
+ const char *id)
+{
+ int err;
+ snd_pcm_uframes_t periodsize;
+
+ snd_pcm_hw_params_copy(params, tparams);
+ periodsize = bufsize * 2;
+ err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &periodsize);
+ if (err < 0) {
+ printf("Unable to set buffer size %li for %s: %s\n", bufsize * 2, id, snd_strerror(err));
+ return err;
+ }
+ if (period_size > 0)
+ periodsize = period_size;
+ else
+ periodsize /= 2;
+ err = snd_pcm_hw_params_set_period_size_near(handle, params, &periodsize, 0);
+ if (err < 0) {
+ printf("Unable to set period size %li for %s: %s\n", periodsize, id, snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+int setparams_set(snd_pcm_t *handle,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_sw_params_t *swparams,
+ const char *id)
+{
+ int err;
+ snd_pcm_uframes_t val;
+
+ err = snd_pcm_hw_params(handle, params);
+ if (err < 0) {
+ printf("Unable to set hw params for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_sw_params_current(handle, swparams);
+ if (err < 0) {
+ printf("Unable to determine current swparams for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_sw_params_set_start_threshold(handle, swparams, 0x7fffffff);
+ if (err < 0) {
+ printf("Unable to set start threshold mode for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ if (!block)
+ val = 4;
+ else
+ snd_pcm_hw_params_get_period_size(params, &val, NULL);
+ err = snd_pcm_sw_params_set_avail_min(handle, swparams, val);
+ if (err < 0) {
+ printf("Unable to set avail min for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_sw_params(handle, swparams);
+ if (err < 0) {
+ printf("Unable to set sw params for %s: %s\n", id, snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
+{
+ int err, last_bufsize = *bufsize;
+ snd_pcm_hw_params_t *pt_params, *ct_params; /* templates with rate, format and channels */
+ snd_pcm_hw_params_t *p_params, *c_params;
+ snd_pcm_sw_params_t *p_swparams, *c_swparams;
+ snd_pcm_uframes_t p_size, c_size, p_psize, c_psize;
+ unsigned int p_time, c_time;
+
+ snd_pcm_hw_params_alloca(&p_params);
+ snd_pcm_hw_params_alloca(&c_params);
+ snd_pcm_hw_params_alloca(&pt_params);
+ snd_pcm_hw_params_alloca(&ct_params);
+ snd_pcm_sw_params_alloca(&p_swparams);
+ snd_pcm_sw_params_alloca(&c_swparams);
+ if ((err = setparams_stream(phandle, pt_params, "playback")) < 0) {
+ printf("Unable to set parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ if ((err = setparams_stream(chandle, ct_params, "capture")) < 0) {
+ printf("Unable to set parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+
+ if (buffer_size > 0) {
+ *bufsize = buffer_size;
+ goto __set_it;
+ }
+
+ __again:
+ if (buffer_size > 0)
+ return -1;
+ if (last_bufsize == *bufsize)
+ *bufsize += 4;
+ last_bufsize = *bufsize;
+ if (*bufsize > latency_max)
+ return -1;
+ __set_it:
+ if ((err = setparams_bufsize(phandle, p_params, pt_params, *bufsize, "playback")) < 0) {
+ printf("Unable to set sw parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ if ((err = setparams_bufsize(chandle, c_params, ct_params, *bufsize, "capture")) < 0) {
+ printf("Unable to set sw parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+
+ snd_pcm_hw_params_get_period_size(p_params, &p_psize, NULL);
+ if (p_psize > (unsigned int)*bufsize)
+ *bufsize = p_psize;
+ snd_pcm_hw_params_get_period_size(c_params, &c_psize, NULL);
+ if (c_psize > (unsigned int)*bufsize)
+ *bufsize = c_psize;
+ snd_pcm_hw_params_get_period_time(p_params, &p_time, NULL);
+ snd_pcm_hw_params_get_period_time(c_params, &c_time, NULL);
+ if (p_time != c_time)
+ goto __again;
+
+ snd_pcm_hw_params_get_buffer_size(p_params, &p_size);
+ if (p_psize * 2 < p_size)
+ goto __again;
+ snd_pcm_hw_params_get_buffer_size(c_params, &c_size);
+ if (c_psize * 2 < c_size)
+ goto __again;
+
+ if ((err = setparams_set(phandle, p_params, p_swparams, "playback")) < 0) {
+ printf("Unable to set sw parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ if ((err = setparams_set(chandle, c_params, c_swparams, "capture")) < 0) {
+ printf("Unable to set sw parameters for playback stream: %s\n", snd_strerror(err));
+ exit(0);
+ }
+
+ if ((err = snd_pcm_prepare(phandle)) < 0) {
+ printf("Prepare error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+
+ snd_pcm_dump(phandle, output);
+ snd_pcm_dump(chandle, output);
+ fflush(stdout);
+ return 0;
+}
+
+void showstat(snd_pcm_t *handle, size_t frames)
+{
+ int err;
+ snd_pcm_status_t *status;
+
+ snd_pcm_status_alloca(&status);
+ if ((err = snd_pcm_status(handle, status)) < 0) {
+ printf("Stream status error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ printf("*** frames = %li ***\n", (long)frames);
+ snd_pcm_status_dump(status, output);
+}
+
+void showlatency(size_t latency)
+{
+ double d;
+ latency *= 2;
+ d = (double)latency / (double)rate;
+ printf("Trying latency %li frames, %.3fus, %.6fms (%.4fHz)\n", (long)latency, d * 1000000, d * 1000, (double)1 / d);
+}
+
+void showinmax(size_t in_max)
+{
+ double d;
+
+ printf("Maximum read: %li frames\n", (long)in_max);
+ d = (double)in_max / (double)rate;
+ printf("Maximum read latency: %.3fus, %.6fms (%.4fHz)\n", d * 1000000, d * 1000, (double)1 / d);
+}
+
+void gettimestamp(snd_pcm_t *handle, snd_timestamp_t *timestamp)
+{
+ int err;
+ snd_pcm_status_t *status;
+
+ snd_pcm_status_alloca(&status);
+ if ((err = snd_pcm_status(handle, status)) < 0) {
+ printf("Stream status error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ snd_pcm_status_get_trigger_tstamp(status, timestamp);
+}
+
+void setscheduler(void)
+{
+ struct sched_param sched_param;
+
+ if (sched_getparam(0, &sched_param) < 0) {
+ printf("Scheduler getparam failed...\n");
+ return;
+ }
+ sched_param.sched_priority = sched_get_priority_max(SCHED_RR);
+ if (!sched_setscheduler(0, SCHED_RR, &sched_param)) {
+ printf("Scheduler set to Round Robin with priority %i...\n", sched_param.sched_priority);
+ fflush(stdout);
+ return;
+ }
+ printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority);
+}
+
+long timediff(snd_timestamp_t t1, snd_timestamp_t t2)
+{
+ signed long l;
+
+ t1.tv_sec -= t2.tv_sec;
+ l = (signed long) t1.tv_usec - (signed long) t2.tv_usec;
+ if (l < 0) {
+ t1.tv_sec--;
+ l = -l;
+ l %= 1000000;
+ }
+ return (t1.tv_sec * 1000000) + l;
+}
+
+long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max)
+{
+ long r;
+
+ if (!block) {
+ do {
+ r = snd_pcm_readi(handle, buf, len);
+ } while (r == -EAGAIN);
+ if (r > 0) {
+ *frames += r;
+ if ((long)*max < r)
+ *max = r;
+ }
+ // printf("read = %li\n", r);
+ } else {
+ int frame_bytes = (snd_pcm_format_width(format) / 8) * channels;
+ do {
+ r = snd_pcm_readi(handle, buf, len);
+ if (r > 0) {
+ buf += r * frame_bytes;
+ len -= r;
+ *frames += r;
+ if ((long)*max < r)
+ *max = r;
+ }
+ // printf("r = %li, len = %li\n", r, len);
+ } while (r >= 1 && len > 0);
+ }
+ // showstat(handle, 0);
+ return r;
+}
+
+long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
+{
+ long r;
+
+ while (len > 0) {
+ r = snd_pcm_writei(handle, buf, len);
+ if (r == -EAGAIN)
+ continue;
+ // printf("write = %li\n", r);
+ if (r < 0)
+ return r;
+ // showstat(handle, 0);
+ buf += r * 4;
+ len -= r;
+ *frames += r;
+ }
+ return 0;
+}
+
+#define FILTERSWEEP_LFO_CENTER 2000.
+#define FILTERSWEEP_LFO_DEPTH 1800.
+#define FILTERSWEEP_LFO_FREQ 0.2
+#define FILTER_BANDWIDTH 50
+
+/* filter the sweep variables */
+float lfo,dlfo,fs,fc,BW,C,D,a0,a1,a2,b1,b2,*x[3],*y[3];
+
+void applyeffect(char* buffer,int r)
+{
+ short* samples = (short*) buffer;
+ int i;
+ for (i=0;i<r;i++)
+ {
+ int chn;
+
+ fc = sin(lfo)*FILTERSWEEP_LFO_DEPTH+FILTERSWEEP_LFO_CENTER;
+ lfo += dlfo;
+ if (lfo>2.*M_PI) lfo -= 2.*M_PI;
+ C = 1./tan(M_PI*BW/fs);
+ D = 2.*cos(2*M_PI*fc/fs);
+ a0 = 1./(1.+C);
+ a1 = 0;
+ a2 = -a0;
+ b1 = -C*D*a0;
+ b2 = (C-1)*a0;
+
+ for (chn=0;chn<channels;chn++)
+ {
+ x[chn][2] = x[chn][1];
+ x[chn][1] = x[chn][0];
+
+ y[chn][2] = y[chn][1];
+ y[chn][1] = y[chn][0];
+
+ x[chn][0] = samples[i*channels+chn];
+ y[chn][0] = a0*x[chn][0] + a1*x[chn][1] + a2*x[chn][2]
+ - b1*y[chn][1] - b2*y[chn][2];
+ samples[i*channels+chn] = y[chn][0];
+ }
+ }
+}
+
+void help(void)
+{
+ int k;
+ printf(
+"Usage: latency [OPTION]... [FILE]...\n"
+"-h,--help help\n"
+"-P,--pdevice playback device\n"
+"-C,--cdevice capture device\n"
+"-m,--min minimum latency in frames\n"
+"-M,--max maximum latency in frames\n"
+"-F,--frames frames to transfer\n"
+"-f,--format sample format\n"
+"-c,--channels channels\n"
+"-r,--rate rate\n"
+"-B,--buffer buffer size in frames\n"
+"-E,--period period size in frames\n"
+"-s,--seconds duration of test in seconds\n"
+"-b,--block block mode\n"
+"-p,--poll use poll (wait for event - reduces CPU usage)\n"
+"-e,--effect apply an effect (bandpass filter sweep)\n"
+);
+ printf("Recognized sample formats are:");
+ for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
+ const char *s = snd_pcm_format_name(k);
+ if (s)
+ printf(" %s", s);
+ }
+ printf("\n\n");
+ printf(
+"Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,\n"
+" superb xrun prevention):\n"
+" latency -m 8192 -M 8192 -t 1 -p\n"
+"Tip #2 (superb latency, non-blocking mode, but heavy CPU usage):\n"
+" latency -m 128 -M 128\n"
+);
+}
+
+int main(int argc, char *argv[])
+{
+ struct option long_option[] =
+ {
+ {"help", 0, NULL, 'h'},
+ {"pdevice", 1, NULL, 'P'},
+ {"cdevice", 1, NULL, 'C'},
+ {"min", 1, NULL, 'm'},
+ {"max", 1, NULL, 'M'},
+ {"frames", 1, NULL, 'F'},
+ {"format", 1, NULL, 'f'},
+ {"channels", 1, NULL, 'c'},
+ {"rate", 1, NULL, 'r'},
+ {"buffer", 1, NULL, 'B'},
+ {"period", 1, NULL, 'E'},
+ {"seconds", 1, NULL, 's'},
+ {"block", 0, NULL, 'b'},
+ {"poll", 0, NULL, 'p'},
+ {"effect", 0, NULL, 'e'},
+ {NULL, 0, NULL, 0},
+ };
+ snd_pcm_t *phandle, *chandle;
+ char *buffer;
+ int err, latency, morehelp;
+ int ok;
+ snd_timestamp_t p_tstamp, c_tstamp;
+ ssize_t r;
+ size_t frames_in, frames_out, in_max;
+ int effect = 0;
+ morehelp = 0;
+ while (1) {
+ int c;
+ if ((c = getopt_long(argc, argv, "hP:C:m:M:F:f:c:r:s:bpen", long_option, NULL)) < 0)
+ break;
+ switch (c) {
+ case 'h':
+ morehelp++;
+ break;
+ case 'P':
+ pdevice = strdup(optarg);
+ break;
+ case 'C':
+ cdevice = strdup(optarg);
+ break;
+ case 'm':
+ err = atoi(optarg) / 2;
+ latency_min = err >= 4 ? err : 4;
+ if (latency_max < latency_min)
+ latency_max = latency_min;
+ break;
+ case 'M':
+ err = atoi(optarg) / 2;
+ latency_max = latency_min > err ? latency_min : err;
+ break;
+ case 'f':
+ format = snd_pcm_format_value(optarg);
+ if (format == SND_PCM_FORMAT_UNKNOWN) {
+ printf("Unknown format, setting to default S16_LE\n");
+ format = SND_PCM_FORMAT_S16_LE;
+ }
+ break;
+ case 'c':
+ err = atoi(optarg);
+ channels = err >= 1 && err < 1024 ? err : 1;
+ break;
+ case 'r':
+ err = atoi(optarg);
+ rate = err >= 4000 && err < 200000 ? err : 44100;
+ break;
+ case 'B':
+ err = atoi(optarg);
+ buffer_size = err >= 32 && err < 200000 ? err : 0;
+ break;
+ case 'E':
+ err = atoi(optarg);
+ period_size = err >= 32 && err < 200000 ? err : 0;
+ break;
+ case 's':
+ err = atoi(optarg);
+ loop_sec = err >= 1 && err <= 100000 ? err : 30;
+ break;
+ case 'b':
+ block = 1;
+ break;
+ case 'p':
+ use_poll = 1;
+ break;
+ case 'e':
+ effect = 1;
+ break;
+ case 'n':
+ resample = 0;
+ break;
+ }
+ }
+
+ if (morehelp) {
+ help();
+ return 0;
+ }
+ err = snd_output_stdio_attach(&output, stdout, 0);
+ if (err < 0) {
+ printf("Output failed: %s\n", snd_strerror(err));
+ return 0;
+ }
+
+ loop_limit = loop_sec * rate;
+ latency = latency_min - 4;
+ buffer = malloc((latency_max * snd_pcm_format_width(format) / 8) * 2);
+
+ setscheduler();
+
+ printf("Playback device is %s\n", pdevice);
+ printf("Capture device is %s\n", cdevice);
+ printf("Parameters are %iHz, %s, %i channels, %s mode\n", rate, snd_pcm_format_name(format), channels, block ? "blocking" : "non-blocking");
+ printf("Poll mode: %s\n", use_poll ? "yes" : "no");
+ printf("Loop limit is %li frames, minimum latency = %i, maximum latency = %i\n", loop_limit, latency_min * 2, latency_max * 2);
+
+ if ((err = snd_pcm_open(&phandle, pdevice, SND_PCM_STREAM_PLAYBACK, block ? 0 : SND_PCM_NONBLOCK)) < 0) {
+ printf("Playback open error: %s\n", snd_strerror(err));
+ return 0;
+ }
+ if ((err = snd_pcm_open(&chandle, cdevice, SND_PCM_STREAM_CAPTURE, block ? 0 : SND_PCM_NONBLOCK)) < 0) {
+ printf("Record open error: %s\n", snd_strerror(err));
+ return 0;
+ }
+
+ /* initialize the filter sweep variables */
+ if (effect) {
+ fs = (float) rate;
+ BW = FILTER_BANDWIDTH;
+
+ lfo = 0;
+ dlfo = 2.*M_PI*FILTERSWEEP_LFO_FREQ/fs;
+
+ x[0] = (float*) malloc(channels*sizeof(float));
+ x[1] = (float*) malloc(channels*sizeof(float));
+ x[2] = (float*) malloc(channels*sizeof(float));
+ y[0] = (float*) malloc(channels*sizeof(float));
+ y[1] = (float*) malloc(channels*sizeof(float));
+ y[2] = (float*) malloc(channels*sizeof(float));
+ }
+
+ while (1) {
+ frames_in = frames_out = 0;
+ if (setparams(phandle, chandle, &latency) < 0)
+ break;
+ showlatency(latency);
+ if ((err = snd_pcm_link(chandle, phandle)) < 0) {
+ printf("Streams link error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ if (snd_pcm_format_set_silence(format, buffer, latency*channels) < 0) {
+ fprintf(stderr, "silence error\n");
+ break;
+ }
+ if (writebuf(phandle, buffer, latency, &frames_out) < 0) {
+ fprintf(stderr, "write error\n");
+ break;
+ }
+ if (writebuf(phandle, buffer, latency, &frames_out) < 0) {
+ fprintf(stderr, "write error\n");
+ break;
+ }
+
+ if ((err = snd_pcm_start(chandle)) < 0) {
+ printf("Go error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ gettimestamp(phandle, &p_tstamp);
+ gettimestamp(chandle, &c_tstamp);
+#if 0
+ printf("Playback:\n");
+ showstat(phandle, frames_out);
+ printf("Capture:\n");
+ showstat(chandle, frames_in);
+#endif
+
+ ok = 1;
+ in_max = 0;
+ while (ok && frames_in < loop_limit) {
+ if (use_poll) {
+ /* use poll to wait for next event */
+ snd_pcm_wait(chandle, 1000);
+ }
+ if ((r = readbuf(chandle, buffer, latency, &frames_in, &in_max)) < 0)
+ ok = 0;
+ else {
+ if (effect)
+ applyeffect(buffer,r);
+ if (writebuf(phandle, buffer, r, &frames_out) < 0)
+ ok = 0;
+ }
+ }
+ if (ok)
+ printf("Success\n");
+ else
+ printf("Failure\n");
+ printf("Playback:\n");
+ showstat(phandle, frames_out);
+ printf("Capture:\n");
+ showstat(chandle, frames_in);
+ showinmax(in_max);
+ if (p_tstamp.tv_sec == p_tstamp.tv_sec &&
+ p_tstamp.tv_usec == c_tstamp.tv_usec)
+ printf("Hardware sync\n");
+ snd_pcm_drop(chandle);
+ snd_pcm_nonblock(phandle, 0);
+ snd_pcm_drain(phandle);
+ snd_pcm_nonblock(phandle, !block ? 1 : 0);
+ if (ok) {
+#if 1
+ printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
+ p_tstamp.tv_sec,
+ (int)p_tstamp.tv_usec,
+ c_tstamp.tv_sec,
+ (int)c_tstamp.tv_usec,
+ timediff(p_tstamp, c_tstamp));
+#endif
+ break;
+ }
+ snd_pcm_unlink(chandle);
+ snd_pcm_hw_free(phandle);
+ snd_pcm_hw_free(chandle);
+ }
+ snd_pcm_close(phandle);
+ snd_pcm_close(chandle);
+ return 0;
+}
diff --git a/alsa-lib/test/midifile.3 b/alsa-lib/test/midifile.3
new file mode 100644
index 0000000..3aadb6d
--- /dev/null
+++ b/alsa-lib/test/midifile.3
@@ -0,0 +1,336 @@
+.TH MIDIFILE 3
+.SH NAME
+mfread,mfwrite \- read and write a standard MIDI file
+.SH SYNOPSIS
+\fC#include "mfread.h"
+
+mfread ()
+
+.nf
+int (*Mf_getc) ();
+int (*Mf_putc) ();
+int (*Mf_error) (char *msg);
+int (*Mf_header) (int format, int ntrks, int division);
+int (*Mf_trackstart) ();
+int (*Mf_trackend) ();
+int (*Mf_noteon) (int chan, int pitch, int vol);
+int (*Mf_noteoff) (int chan, int pitch, int vol);
+int (*Mf_pressure) (int chan, int pitch, int pressure);
+int (*Mf_parameter) (int chan, int control, int value);
+int (*Mf_pitchbend) (int chan, int msb, int lsb);
+int (*Mf_program) (int chan, int program);
+int (*Mf_chanpressure) (int chan, int pressure);
+int (*Mf_sysex) (int leng, char *msg);
+int (*Mf_metamisc) (int type, int leng, int msg);
+int (*Mf_seqspecific) (int type, int leng, int msg);
+int (*Mf_seqnum) (int num);
+int (*Mf_text) (int type, int leng, int msg);
+int (*Mf_eot) ();
+int (*Mf_timesig) (int numer, int denom, int clocks, int qnotes);
+int (*Mf_smpte) (int hour, int min, int sec, int frame, int fract);
+int (*Mf_tempo) (int microsecs);
+int (*Mf_keysig) (int sharpflat, int minor);
+int (*Mf_arbitrary) (int leng, int msg);
+int Mf_nomerge;
+long Mf_currtime;
+.fi
+.sp 1
+mfwrite(int format, int ntracks, int division, FILE *fp)
+.sp 1
+.nf
+int (*Mf_writetrack)(int track);
+int (*Mf_writetempotrack)();
+
+void mf_write_midi_event(delta, type, chan, data, size)
+unsigned long delta;
+unsigned int type,chan,size;
+char *data;
+
+void mf_write_meta_event(delta, type, data, size)
+unsigned long delta;
+unsigned int type,chan,size;
+char *data;
+
+void mf_write_tempo(tempo)
+unsigned long tempo;
+
+unsigned long mf_sec2ticks(float seconds, int division, int tempo)
+float seconds;
+int division;
+unsigned int tempo;
+
+float mf_ticks2sec(ticks, division, tempo)
+unsigned long ticks;
+int division;
+unsigned int tempo;
+.fi
+
+.SH DESCRIPTION
+The \fCmfread\fR function reads and interprets a standard MIDI file.
+To use it you need to understand the general form of a
+MIDI file and the type of information it contains, but you don't
+need to know much, if anything, about the detailed format of the file
+and the mechanics of reading it reliably and portably.
+
+The \fCmfwrite\fR function writes a standard MIDI file making
+use of user-defined functions that access the program's
+data structure. To use it you need to define your own Mf_writetrack
+routine and then make use of the write_* family of routines to
+write out the MIDI data. The \fCmfwrite\fR routine takes
+care of the file format and writing the file and track chunk headers.
+
+.SH READING STANDARD MIDI FILES
+A single call to \fCmfread\fR will read an entire MIDI file.
+The interface to \fCmfread\fR is a set of external variables
+named \fCMf_*\fR, most of which are function pointers to be called
+from within \fCmfread\fR during the process of parsing the MIDI file.
+Before calling \fCmfread\fR, the only
+requirement is that you assign a value
+to \fCMf_getc\fR - a pointer to a function that will return
+characters from the MIDI file, using \-1 to indicate EOF.
+All the rest of the function
+pointers are initialized to NULL, and the default action for each
+is to do nothing. The following is a complete program using \fCmfread\fR
+that could serve as a 'syntax checker' for MIDI files:
+
+.in +1i
+.ft C
+.nf
+#include <stdio.h>
+#include "midifile.h"
+
+mygetc()
+{
+ /* use standard input */
+ return(getchar());
+}
+
+main()
+{
+ Mf_getc = mygetc;
+ mfread();
+ exit(0);
+}
+.fi
+.ft R
+.in -1i
+
+This takes advantage of the default action when an error is detected, which
+is to exit silently with a return code of 1. An error function of your
+own can be used by giving a value to \fCMf_error\fR; the function will be
+called with the error message as an argument.
+The other \fCMf_* variables can similarly be used to call arbitrary
+functions while parsing the MIDI file. The descriptions below
+of the information passed to these functions is sparse; refer to
+the MIDI file standard for the complete descriptions.
+
+\fCMf_header\fR is the first function to be called, and its arguments
+contain information from the MIDI file's header; the format (0,1, or 2),
+the number of tracks, and the division of a quarter-note that defines
+the times units.
+\fCMf_trackstart\fR and
+\fCMf_trackend\fR are called at the beginning and end of each track.
+
+Once inside a track, each separate message causes a function to be called.
+For example, each note-on message causes \fCMf_noteon\fR to be called
+with the channel, pitch, and volume as arguments. The time at which
+the message occurred is stored in \fCMf_currtime\fR - one of the few
+external variables that isn't a function pointer. The other channel messages
+are handled in a similar and obvious fashion -
+\fCMf_noteoff\fR,
+\fCMf_pressure\fR,
+\fCMf_parameter\fR,
+\fCMf_pitchbend\fR,
+\fCMf_program\fR,
+and \fCMf_chanpressure\fR. See the declarations above for the arguments
+that are passed to each.
+
+System exclusive messages are handled by calling \fCMf_sysex\fR, passing
+as arguments the message length and a pointer to a static buffer containing
+the entire message.
+The buffer is expanded when necessary; memory availability is the only limit
+to its size. Normally, 'continued' system exclusives are automatically
+merged, and \fCMf_sysex\fR is only called once. It you want to disable this
+you can set \fCMf_nomerge\fR to 1, causing \fCMf_sysex\fR to be called
+once for each part of the message.
+
+\fCMf_seqnum\fR is called by the \fImeta\fR message that provides
+a sequence number,
+which if present must appear at the beginning of a track.
+The tempo \fImeta\fR message causes \fCMf_tempo\fR to be called; its
+argument is the number of microseconds per MIDI quarter-note (24 MIDI clocks).
+The end-of-track \fImeta\fR message causes \fCMf_eot\fR to be called.
+The key signature \fImeta\fR message causes \fCMf_keysig\fR to be called;
+the first argument conveys the number of sharps or flats, the second
+argument is 1 if the key is minor.
+
+The \fCMf_timesig\fR and \fCMf_smpte\fR functions are called when the
+corresponding \fImeta\fR messages are seen. See the MIDI file standard
+for a description of their arguments.
+
+The \fItext\fR messages in the MIDI file standard are of the following
+types:
+
+.in +1i
+.nf
+0x01 Text Event
+0x02 Copyright
+0x03 Sequence/Track Name
+0x04 Instrument
+0x05 Lyric
+0x06 Marker
+0x07 Cue Point
+0x08-0x0F Reserved but Undefined
+.fi
+.in -1i
+
+\fCMf_text\fR is called for each of these; the arguments are
+the type number, the message length, and a pointer to the message buffer.
+
+Miscellaneous \fImeta\fR messages are handled by \fCMf_metamisc\fR,
+sequencer-specific messages are handled by \fCMf_seqspecific\fR, and
+arbitrary "escape" messages (started with 0xF7) are handled by
+\fCMf_arbitrary\fR.
+.SH READING EXAMPLE
+The following is a \fCstrings\fR-like program for MIDI files:
+
+.in +1i
+.ft C
+.nf
+#include <stdio.h>
+#include <ctype.h>
+#include "midifile.h"
+
+FILE *F;
+
+mygetc() { return(getc(F)); }
+
+mytext(type,leng,msg)
+char *msg;
+{
+ char *p;
+ char *ep = msg + leng;
+
+ for ( p=msg; p<ep ; p++ )
+ putchar( isprint(*p) ? *p : '?' );
+ putchar('\n');
+}
+
+main(argc,argv)
+char **argv;
+{
+ if ( argc > 1 )
+ F = fopen(argv[1],"r");
+ else
+ F = stdin;
+
+ Mf_getc = mygetc;
+ Mf_text = mytext;
+
+ mfread();
+
+ exit(0);
+}
+.fi
+.ft R
+.in -1i
+.sp
+.SH WRITING STANDARD MIDI FILES
+A single call to \fCmfwrite\fR will write an entire MIDI file. Before
+calling \fCmfwrite\fR, you must assign values to function pointers
+\fCMf_writetrack\fR and \fCMf_putc\fR. The first is a routine to
+access your MIDI data structure, which can make use of other library
+routines to write the actual MIDI data. The routine
+\fCMf_writetrack\fR will be passed a single parameter which is the
+number of the track to be written. The pointer \fCMf_putc\fR should be
+set to point to a routine that accepts a character as input, writes that
+character to a file, and returns the value that was written. In the
+case of a format 1 file, a routine has to be written to write a tempo
+map, and assigned to the function pointer \fCMf_writetempotrack\fR.
+This is because format 1 files assume the first track written is a
+tempo track.
+
+\fCmf_write_midi_event\fR and \fCmf_write_meta_event\fR are routines
+that should be called from your \fCMf_writetrack\fR routine to write
+out MIDI events. The delta time param is the number of ticks since the
+last event. The int "type" is the type of MIDI message. The int "chan"
+is the MIDI channel, which can be between 1 and 16. The char pointer
+"data" points to an array containing the data bytes, if any exist. The
+int "size" is the number of data bytes.
+
+\fCmf_sec2ticks\fR and \fCmf_ticks2sec\fR are utility routines
+to help you convert between the MIDI file parameter of ticks
+and the more standard seconds. The int "division" is the same
+division parameter from the file header, and tempo is expressed
+in microseconds per MIDI quarter-note, or "24ths of a microsecond
+per MIDI clock". The division has two meanings, depending on
+whether bit 15 is set or not. If bit 15 of division is zero,
+bits 14 through 0 represent the number of delta-time "ticks"
+which make up a quarter note. If bit 15 of division is a one,
+delta-times in a file correspond to subdivisions of a second
+similar to SMPTE and MIDI time code. In this format bits
+14 through 8 contain one of four values \-24, \-25, \-29, or \-30,
+corresponding to the four standard SMPTE and MIDI time code
+frame per second formats, where \-29 represents 30 drop frame.
+The second byte consisting of bits 7 through 0 corresponds
+the the resolution within a frame. Refer the Standard MIDI Files
+1.0 spec for more details.
+
+.SH WRITING EXAMPLE
+The following is a simple program to demonstrate writing MIDI files.
+The track would consist of a series of quarter notes from lowest to
+highest in pitch at constant velocity, each separated by a quarter-note
+rest.
+.sp
+.in +1i
+.ft C
+.nf
+#include <stdio.h>
+#include <ctype.h>
+#include "midifile.h"
+
+FILE *fp;
+myputc(c) { return(putc(c,fp));}
+
+int mywritetrack(track)
+int track;
+{
+ int i;
+ char data[2];
+
+ /* 120 beats/per/second */
+ mf_write_tempo((long)500000);
+
+ for(i = 1 ; i < 128; i++){
+ data[0] = i; /* note number */
+ data[1] = 64; /* velocity */
+ if(!mf_write_midi_event(480,note_on,1,data,2))
+ return(\-1);
+ if(!mf_write_midi_event(480,note_off,1,data,2))
+ return(\-1);
+ }
+
+ return(1);
+} /* end of write_track() */
+
+main(argc,argv)
+char **argv;
+{
+ if((fp = fopen(argv[1],"w")) == 0L)
+ exit(1);
+
+ Mf_putc = myputc;
+ Mf_writetrack = mywritetrack;
+
+ /* write a single track */
+ mfwrite(0,1,480,fp);
+}
+.sp
+.fi
+.ft R
+.in -1i
+.sp
+.SH AUTHOR
+Tim Thompson (att!twitch!glimmer!tjt)
+.SH CONTRIBUTORS
+Michael Czeiszperger (mike@pan.com)
diff --git a/alsa-lib/test/midifile.c b/alsa-lib/test/midifile.c
new file mode 100644
index 0000000..8d6ba90
--- /dev/null
+++ b/alsa-lib/test/midifile.c
@@ -0,0 +1,1173 @@
+/*
+ * midifile 1.11
+ *
+ * Read and write a MIDI file. Externally-assigned function pointers are
+ * called upon recognizing things in the file.
+ *
+ * Original release ?
+ * June 1989 - Added writing capability, M. Czeiszperger.
+ *
+ * The file format implemented here is called
+ * Standard MIDI Files, and is part of the Musical
+ * instrument Digital Interface specification.
+ * The spec is available from:
+ *
+ * International MIDI Association
+ * 5316 West 57th Street
+ * Los Angeles, CA 90056
+ *
+ * An in-depth description of the spec can also be found
+ * in the article "Introducing Standard MIDI Files", published
+ * in Electronic Musician magazine, April, 1989.
+ *
+ * February 1993 - Minor adjustments, Greg Lee:
+ * (1) can now set the global variable Mf_interactive to 1 to prevent the
+ * reading functions from looking for file and track headers
+ * (2) can now write system exclusive data with
+ * mf_write_midi_event(delta_time, system_exclusive, 0, data, size)
+ * (3) changed definition of 'sequencer_specific' in midifile.h to 0x7f
+ * (4) changed mf_write_tempo to take additional delta_time as first argument
+ * (since delta need not be zero)
+ * (5) added function mf_write_seqnum(unsigned long delta_time, unsigned seqnum)
+ * (6) changed mf_write_midi_event to use running status
+ * (7) removed the code to write an end of track meta event automatically
+ * -- this must now be done by the user of the library (I changed
+ * it because I need to be able to control the time delta of this
+ * meta event)
+ * (8) added global variables Mf_division, Mf_currtempo, Mf_realtime, which
+ * are updated by the reading functions. Mf_realtime is useful,
+ * because Mf_currtime does not really measure time at all, since
+ * its units change value at every tempo change. Mf_realtime is
+ * the midi-time elapsed in units of 1/16 of a centisecond (but it
+ * does not handle SMPTE times)
+ * (9) maintains a history of tempo settings to update Mf_currtempo,
+ * to handle tempo tracks.
+ * (10) if there is an Mf_error function, the error routine no longer
+ * exits, leaving it to the application to do this.
+ * (11) chanmessage skips over invalid c1 command bytes > 127 and
+ * adjusts invalid c2 argument byte > 127 to 127.
+ * (12) readmt returns EOF when it encounters a 0 or 0x1a byte instead of an expected
+ * header string (some midi files have padding at end).
+ */
+#define NO_LC_DEFINES
+#include "midifile.h"
+#ifdef NO_LC_DEFINES
+#define system_exclusive 0xf0
+#define meta_event 0xFF
+#define set_tempo 0x51
+#define lowerbyte(x) ((unsigned char)(x & 0xff))
+#define upperbyte(x) ((unsigned char)((x & 0xff00)>>8))
+#endif
+
+#define NULLFUNC 0
+#if 0
+#define NULL 0
+#endif
+
+#define THINK
+
+#ifdef THINK
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>
+#include <values.h>
+
+#include <string.h>
+/*void exit(), free();*/
+
+/* public stuff */
+
+/* Functions to be called while processing the MIDI file. */
+int (*Mf_getc) () = NULLFUNC;
+void (*Mf_error) () = NULLFUNC;
+void (*Mf_header) () = NULLFUNC;
+void (*Mf_trackstart) () = NULLFUNC;
+void (*Mf_trackend) () = NULLFUNC;
+void (*Mf_noteon) () = NULLFUNC;
+void (*Mf_noteoff) () = NULLFUNC;
+void (*Mf_pressure) () = NULLFUNC;
+void (*Mf_parameter) () = NULLFUNC;
+void (*Mf_pitchbend) () = NULLFUNC;
+void (*Mf_program) () = NULLFUNC;
+void (*Mf_chanpressure) () = NULLFUNC;
+void (*Mf_sysex) () = NULLFUNC;
+void (*Mf_arbitrary) () = NULLFUNC;
+void (*Mf_metamisc) () = NULLFUNC;
+void (*Mf_seqnum) () = NULLFUNC;
+void (*Mf_eot) () = NULLFUNC;
+void (*Mf_smpte) () = NULLFUNC;
+void (*Mf_tempo) () = NULLFUNC;
+void (*Mf_timesig) () = NULLFUNC;
+void (*Mf_keysig) () = NULLFUNC;
+void (*Mf_seqspecific) () = NULLFUNC;
+void (*Mf_text) () = NULLFUNC;
+
+/* Functions to implement in order to write a MIDI file */
+int (*Mf_putc) () = NULLFUNC;
+int (*Mf_writetrack) () = NULLFUNC;
+int (*Mf_writetempotrack) () = NULLFUNC;
+
+int Mf_nomerge = 0; /* 1 => continue'ed system exclusives are */
+ /* not collapsed. */
+int Mf_interactive = 0; /* 1 => file and track headers are not required */
+unsigned long Mf_currtime = 0L; /* current time in delta-time units */
+unsigned long Mf_realtime = 0L; /* current time in 1/16 centisecond-time units */
+static double Mf_f_realtime = 0;/* as above, floating */
+static double old_f_realtime = 0;
+int Mf_division = 96;
+unsigned long Mf_currtempo = 500000;
+static unsigned long old_currtempo = 500000;
+static unsigned long old_realtime = 0;
+static unsigned long old_currtime = 0;
+static unsigned long revised_time = 0;
+static unsigned long tempo_change_time = 0;
+
+#define MAX_HISTORY 512
+static unsigned long tempo_history[MAX_HISTORY];
+static unsigned long tempo_history_time[MAX_HISTORY];
+static int tempo_history_count = 0;
+
+/* private stuff */
+static long Mf_toberead = 0L;
+static long Mf_numbyteswritten = 0L;
+
+static long readvarinum ();
+static long read32bit ();
+static long to32bit ();
+static int read16bit ();
+static int to16bit ();
+static char *msg ();
+static void readheader ();
+static int readtrack ();
+static void badbyte ();
+static void metaevent ();
+static void sysex ();
+static void chanmessage ();
+static void msginit ();
+static int msgleng ();
+static void msgadd ();
+static void biggermsg ();
+static int eputc (unsigned char c);
+
+double mf_ticks2sec (unsigned long ticks, int division, unsigned long tempo);
+int mf_write_meta_event ();
+void mf_write_tempo ();
+void mf_write_seqnum ();
+void WriteVarLen ();
+
+#ifdef READ_MODS
+#include "mp_mod.c"
+static int mod_file_flag = 0;
+#endif /* READ_MODS */
+static int force_exit;
+
+void
+mfread ()
+{
+ force_exit = 0;
+ if (Mf_getc == NULLFUNC)
+ mferror ("mfread() called without setting Mf_getc");
+
+ readheader ();
+#ifdef READ_MODS
+ if (mod_file_flag)
+ do_module();
+ else
+#endif
+ while (readtrack () && !force_exit)
+ ;
+}
+
+/* for backward compatibility with the original lib */
+void
+midifile ()
+{
+ mfread ();
+}
+
+static
+int
+readmt (s) /* read through the "MThd" or "MTrk" header string */
+ char *s;
+{
+ int n = 0;
+ char *p = s;
+ int c;
+
+ while (n++ < 4 && (c = (*Mf_getc) ()) != EOF)
+ {
+ if (c != *p++)
+ {
+ char buff[32];
+ if (!c) return(EOF);
+ if (c == 0x1a) return(EOF);
+ (void) strcpy (buff, "expecting ");
+ (void) strcat (buff, s);
+ mferror (buff);
+ break;
+ }
+ }
+ return (c);
+}
+
+static
+int
+egetc () /* read a single character and abort on EOF */
+{
+ int c = (*Mf_getc) ();
+
+ if (c == EOF) {
+ mferror ("premature EOF");
+ force_exit = 1;
+ }
+ Mf_toberead--;
+ return (c);
+}
+
+static
+void
+readheader () /* read a header chunk */
+{
+ int format, ntrks, division;
+
+
+ Mf_division = 96;
+ Mf_currtempo = 500000;
+ old_currtempo = 500000;
+ tempo_history_count = 0;
+ tempo_history[tempo_history_count] = Mf_currtempo;
+ tempo_history_time[tempo_history_count] = 0;
+
+ if (Mf_interactive)
+ {
+ Mf_toberead = 0;
+ format = 0;
+ ntrks = 1;
+ division = 96;
+ }
+ else
+#ifdef READ_MODS
+ if (!strncmp(Mf_file_contents, "MThd", 4))
+#endif
+ {
+ if (readmt ("MThd") == EOF)
+ return;
+
+ Mf_toberead = read32bit ();
+ format = read16bit ();
+ ntrks = read16bit ();
+ Mf_division = division = read16bit ();
+ }
+#ifdef READ_MODS
+ else
+ {
+ format = 0;
+ ntrks = 1;
+ division = Mf_division;
+ Mf_toberead = 0;
+ mod_file_flag = 1;
+ }
+#endif
+
+ if (Mf_header)
+ (*Mf_header) (format, ntrks, division);
+
+ /* flush any extra stuff, in case the length of header is not 6 */
+ while (Mf_toberead > 0 && !force_exit)
+ (void) egetc ();
+}
+
+
+/*#define DEBUG_TIMES*/
+static
+unsigned long
+find_tempo()
+{
+ int i;
+ unsigned long old_tempo = Mf_currtempo;
+ unsigned long new_tempo = Mf_currtempo;
+
+ for (i = 0; i <= tempo_history_count; i++) {
+ if (tempo_history_time[i] <= Mf_currtime) old_tempo = tempo_history[i];
+ new_tempo = tempo_history[i];
+ if (tempo_history_time[i] > revised_time) break;
+ }
+ if (i > tempo_history_count || tempo_history_time[i] > Mf_currtime) {
+#ifdef DEBUG_TIMES
+printf("[past %d, old_tempo %d]\n", tempo_history_time[i], old_tempo);
+#endif
+ revised_time = Mf_currtime;
+ return(old_tempo);
+ }
+ tempo_change_time = revised_time = tempo_history_time[i];
+#ifdef DEBUG_TIMES
+printf("[revised_time %d, new_tempo %d]\n", revised_time, new_tempo);
+#endif
+ return(new_tempo);
+}
+
+static
+int
+readtrack () /* read a track chunk */
+{
+ /* This array is indexed by the high half of a status byte. It's */
+ /* value is either the number of bytes needed (1 or 2) for a channel */
+ /* message, or 0 (meaning it's not a channel message). */
+ static int chantype[] =
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 through 0x70 */
+ 2, 2, 2, 2, 1, 1, 2, 0 /* 0x80 through 0xf0 */
+ };
+ long lookfor;
+ int c, c1, type;
+ int sysexcontinue = 0; /* 1 if last message was an unfinished sysex */
+ int running = 0; /* 1 when running status used */
+ int status = 0; /* status value (e.g. 0x90==note-on) */
+ int needed;
+
+ if (Mf_interactive)
+ {
+ Mf_toberead = MAXINT;
+ }
+ else
+ {
+ if (readmt ("MTrk") == EOF)
+ return (0);
+
+ Mf_toberead = read32bit ();
+ }
+ Mf_currtime = Mf_realtime = 0;
+ Mf_f_realtime = old_f_realtime = 0;
+ old_currtime = old_realtime = 0;
+ Mf_currtempo = find_tempo();
+
+ if (Mf_trackstart)
+ (*Mf_trackstart) ();
+
+ while (!force_exit && (Mf_interactive || Mf_toberead > 0))
+ {
+
+ if (Mf_interactive)
+ Mf_currtime += 1;
+ else
+ {
+ double delta_secs;
+ unsigned long delta_ticks = readvarinum ();
+ revised_time = Mf_currtime;
+ Mf_currtime += delta_ticks; /* delta time */
+
+/*
+ * Step through each tempo change from old_currtime up to now,
+ * revising Mf_realtime after each change.
+ */
+
+ while (revised_time < Mf_currtime) {
+ unsigned long save_time = revised_time;
+ unsigned long save_tempo = Mf_currtempo;
+ Mf_currtempo = find_tempo();
+
+ if (Mf_currtempo != old_currtempo) {
+ old_currtempo = Mf_currtempo;
+ old_realtime = Mf_realtime;
+ if (revised_time != tempo_change_time) {
+ old_f_realtime = Mf_f_realtime;
+ old_currtime = save_time;
+ }
+ delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, save_tempo);
+#ifdef DEBUG_TIMES
+printf("d(rev %d - old %d, div %d, tempo %d) = %.3f\n",
+revised_time, old_currtime, Mf_division, save_tempo, delta_secs * 1600.0);
+#endif
+ Mf_f_realtime = old_f_realtime + delta_secs * 1600.0;
+ Mf_realtime = (unsigned long)(0.5 + Mf_f_realtime);
+#ifdef DEBUG_TIMES
+printf("\tt=%d ticks ( = %d csec/16 < old %.2f + %.2f)\n", Mf_currtime, Mf_realtime,
+old_f_realtime, delta_secs * 1600.0);
+#endif
+ if (revised_time == tempo_change_time) {
+ old_currtime = revised_time;
+ old_f_realtime = Mf_f_realtime;
+ }
+ }
+ else {
+ delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, Mf_currtempo);
+#ifdef DEBUG_TIMES
+printf("d(rev %d - old %d, div %d, tempo %d) = %.3f\n",
+revised_time, old_currtime, Mf_division, Mf_currtempo, delta_secs * 1600.0);
+#endif
+ Mf_f_realtime = old_f_realtime + delta_secs * 1600.0;
+ Mf_realtime = (unsigned long)(0.5 + Mf_f_realtime);
+#ifdef DEBUG_TIMES
+printf("\tt=%d ticks ( = %d csec/16 < old %.2f + %.2f)\n", Mf_currtime, Mf_realtime,
+old_f_realtime, delta_secs * 1600.0);
+#endif
+ }
+
+
+ }
+ }
+
+ c = egetc ();
+
+ if (sysexcontinue && c != 0xf7)
+ mferror ("didn't find expected continuation of a sysex");
+
+ if ((c & 0x80) == 0)
+ { /* running status? */
+ if (status == 0)
+ mferror ("unexpected running status");
+ running = 1;
+ }
+ else
+ {
+ status = c;
+ running = 0;
+ }
+
+ needed = chantype[(status >> 4) & 0xf];
+
+ if (needed)
+ { /* ie. is it a channel message? */
+
+ if (running)
+ c1 = c;
+ else
+ c1 = egetc ();
+ chanmessage (status, c1, (needed > 1) ? egetc () : 0);
+ continue;;
+ }
+
+ switch (c)
+ {
+
+ case 0xff: /* meta event */
+
+ type = egetc ();
+ lookfor = Mf_toberead - readvarinum ();
+ msginit ();
+
+ while (Mf_toberead > lookfor)
+ msgadd (egetc ());
+
+ metaevent (type);
+ break;
+
+ case 0xf0: /* start of system exclusive */
+
+ lookfor = Mf_toberead - readvarinum ();
+ msginit ();
+ msgadd (0xf0);
+
+ while (Mf_toberead > lookfor)
+ msgadd (c = egetc ());
+
+ if (c == 0xf7 || Mf_nomerge == 0)
+ sysex ();
+ else
+ sysexcontinue = 1; /* merge into next msg */
+ break;
+
+ case 0xf7: /* sysex continuation or arbitrary stuff */
+
+ lookfor = Mf_toberead - readvarinum ();
+
+ if (!sysexcontinue)
+ msginit ();
+
+ while (Mf_toberead > lookfor)
+ msgadd (c = egetc ());
+
+ if (!sysexcontinue)
+ {
+ if (Mf_arbitrary)
+ (*Mf_arbitrary) (msgleng (), msg ());
+ }
+ else if (c == 0xf7)
+ {
+ sysex ();
+ sysexcontinue = 0;
+ }
+ break;
+ default:
+ badbyte (c);
+ break;
+ }
+ }
+ if (Mf_trackend)
+ (*Mf_trackend) ();
+ return (1);
+}
+
+static
+void
+badbyte (c)
+ int c;
+{
+ char buff[32];
+
+ (void) sprintf (buff, "unexpected byte: 0x%02x", c);
+ mferror (buff);
+}
+
+static
+void
+metaevent (int type)
+{
+ int leng = msgleng ();
+ char *m = msg ();
+
+ switch (type)
+ {
+ case 0x00:
+ if (Mf_seqnum)
+ (*Mf_seqnum) (to16bit (m[0], m[1]));
+ break;
+ case 0x01: /* Text event */
+ case 0x02: /* Copyright notice */
+ case 0x03: /* Sequence/Track name */
+ case 0x04: /* Instrument name */
+ case 0x05: /* Lyric */
+ case 0x06: /* Marker */
+ case 0x07: /* Cue point */
+ case 0x08:
+ case 0x09:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
+ /* These are all text events */
+ if (Mf_text)
+ (*Mf_text) (type, leng, m);
+ break;
+ case 0x2f: /* End of Track */
+ if (Mf_eot)
+ (*Mf_eot) ();
+ break;
+ case 0x51: /* Set tempo */
+ if (Mf_tempo)
+ (*Mf_tempo) (Mf_currtempo = to32bit (0, m[0], m[1], m[2]));
+ if (tempo_history[tempo_history_count] == Mf_currtempo) break;
+ if (tempo_history_time[tempo_history_count] > Mf_currtime) break;
+ if (tempo_history_count < MAX_HISTORY - 1) tempo_history_count++;
+ tempo_history[tempo_history_count] = Mf_currtempo;
+ tempo_history_time[tempo_history_count] = Mf_currtime;
+ break;
+ case 0x54:
+ if (Mf_smpte)
+ (*Mf_smpte) (m[0], m[1], m[2], m[3], m[4]);
+ break;
+ case 0x58:
+ if (Mf_timesig)
+ (*Mf_timesig) (m[0], m[1], m[2], m[3]);
+ break;
+ case 0x59:
+ if (Mf_keysig)
+ (*Mf_keysig) (m[0], m[1]);
+ break;
+ case 0x7f:
+ if (Mf_seqspecific)
+ (*Mf_seqspecific) (leng, m);
+ break;
+ default:
+ if (Mf_metamisc)
+ (*Mf_metamisc) (type, leng, m);
+ }
+}
+
+static
+void
+sysex ()
+{
+ if (Mf_sysex)
+ (*Mf_sysex) (msgleng (), msg ());
+}
+
+static
+void
+chanmessage (status, c1, c2)
+ int status;
+ int c1, c2;
+{
+ int chan = status & 0xf;
+
+ /* I found a midi file with Mod Wheel values 128. --gl */
+
+ if (c1 > 127) /*mferror("chanmessage: bad c1") ??*/ return;
+ if (c2 > 127) c2 = 127;
+
+ switch (status & 0xf0)
+ {
+ case 0x80:
+ if (Mf_noteoff)
+ (*Mf_noteoff) (chan, c1, c2);
+ break;
+ case 0x90:
+ if (Mf_noteon)
+ (*Mf_noteon) (chan, c1, c2);
+ break;
+ case 0xa0:
+ if (Mf_pressure)
+ (*Mf_pressure) (chan, c1, c2);
+ break;
+ case 0xb0:
+ if (Mf_parameter)
+ (*Mf_parameter) (chan, c1, c2);
+ break;
+ case 0xe0:
+ if (Mf_pitchbend)
+ (*Mf_pitchbend) (chan, c1, c2);
+ break;
+ case 0xc0:
+ if (Mf_program)
+ (*Mf_program) (chan, c1);
+ break;
+ case 0xd0:
+ if (Mf_chanpressure)
+ (*Mf_chanpressure) (chan, c1);
+ break;
+ }
+}
+
+/* readvarinum - read a varying-length number, and return the */
+/* number of characters it took. */
+
+static long
+readvarinum ()
+{
+ long value;
+ int c;
+
+ c = egetc ();
+ value = c;
+ if (c & 0x80)
+ {
+ value &= 0x7f;
+ do
+ {
+ c = egetc ();
+ value = (value << 7) + (c & 0x7f);
+ }
+ while (c & 0x80);
+ }
+ return (value);
+}
+
+static long
+to32bit (int c1, int c2, int c3, int c4)
+{
+ long value = 0L;
+
+ value = (c1 & 0xff);
+ value = (value << 8) + (c2 & 0xff);
+ value = (value << 8) + (c3 & 0xff);
+ value = (value << 8) + (c4 & 0xff);
+ return (value);
+}
+
+static int
+to16bit (c1, c2)
+ int c1, c2;
+{
+ return ((c1 & 0xff) << 8) + (c2 & 0xff);
+}
+
+static long
+read32bit ()
+{
+ int c1, c2, c3, c4;
+
+ c1 = egetc ();
+ c2 = egetc ();
+ c3 = egetc ();
+ c4 = egetc ();
+ return to32bit (c1, c2, c3, c4);
+}
+
+static int
+read16bit ()
+{
+ int c1, c2;
+ c1 = egetc ();
+ c2 = egetc ();
+ return to16bit (c1, c2);
+}
+
+/* static */
+void
+mferror (s)
+ char *s;
+{
+ if (Mf_error)
+ (*Mf_error) (s);
+ else exit (1);
+}
+
+/* The code below allows collection of a system exclusive message of */
+/* arbitrary length. The Msgbuff is expanded as necessary. The only */
+/* visible data/routines are msginit(), msgadd(), msg(), msgleng(). */
+
+#define MSGINCREMENT 128
+static char *Msgbuff = NULL; /* message buffer */
+static int Msgsize = 0; /* Size of currently allocated Msg */
+static int Msgindex = 0; /* index of next available location in Msg */
+
+static
+void
+msginit ()
+{
+ Msgindex = 0;
+}
+
+static char *
+msg ()
+{
+ return (Msgbuff);
+}
+
+static
+int
+msgleng ()
+{
+ return (Msgindex);
+}
+
+static
+void
+msgadd (c)
+ int c;
+{
+ /* If necessary, allocate larger message buffer. */
+ if (Msgindex >= Msgsize)
+ biggermsg ();
+ Msgbuff[Msgindex++] = c;
+}
+
+static
+void
+biggermsg ()
+{
+/* char *malloc(); */
+ char *newmess;
+ char *oldmess = Msgbuff;
+ int oldleng = Msgsize;
+
+ Msgsize += MSGINCREMENT;
+ newmess = (char *) malloc ((unsigned) (sizeof (char) * Msgsize));
+
+ if (newmess == NULL)
+ mferror ("malloc error!");
+
+ /* copy old message into larger new one */
+ if (oldmess != NULL)
+ {
+ register char *p = newmess;
+ register char *q = oldmess;
+ register char *endq = &oldmess[oldleng];
+
+ for (; q != endq; p++, q++)
+ *p = *q;
+ free (oldmess);
+ }
+ Msgbuff = newmess;
+}
+
+static int laststatus = 0;
+
+/*
+ * mfwrite() - The only function you'll need to call to write out
+ * a midi file.
+ *
+ * format 0 - Single multi-channel track
+ * 1 - Multiple simultaneous tracks
+ * 2 - One or more sequentially independent
+ * single track patterns
+ * ntracks The number of tracks in the file.
+ * division This is kind of tricky, it can represent two
+ * things, depending on whether it is positive or negative
+ * (bit 15 set or not). If bit 15 of division is zero,
+ * bits 14 through 0 represent the number of delta-time
+ * "ticks" which make up a quarter note. If bit 15 of
+ * division is a one, delta-times in a file correspond to
+ * subdivisions of a second similar to SMPTE and MIDI
+ * time code. In this format bits 14 through 8 contain
+ * one of four values - 24, -25, -29, or -30,
+ * corresponding to the four standard SMPTE and MIDI
+ * time code frame per second formats, where -29
+ * represents 30 drop frame. The second byte
+ * consisting of bits 7 through 0 corresponds the the
+ * resolution within a frame. Refer the Standard MIDI
+ * Files 1.0 spec for more details.
+ * fp This should be the open file pointer to the file you
+ * want to write. It will have be a global in order
+ * to work with Mf_putc.
+ */
+void
+mfwrite (format, ntracks, division, fp)
+ int format, ntracks, division;
+ FILE *fp;
+{
+ int i;
+ void mf_write_track_chunk (), mf_write_header_chunk ();
+
+ if (Mf_putc == NULLFUNC)
+ mferror ("mfmf_write() called without setting Mf_putc");
+
+ if (Mf_writetrack == NULLFUNC)
+ mferror ("mfmf_write() called without setting Mf_mf_writetrack");
+
+ laststatus = 0;
+
+ /* every MIDI file starts with a header */
+ mf_write_header_chunk (format, ntracks, division);
+
+ laststatus = 0;
+
+ /* In format 1 files, the first track is a tempo map */
+ if (format == 1 && (Mf_writetempotrack))
+ {
+ (*Mf_writetempotrack) ();
+ }
+
+ /* The rest of the file is a series of tracks */
+ for (i = 0; i < ntracks; i++)
+ mf_write_track_chunk (i, fp);
+}
+
+void
+mf_write_track_chunk (which_track, fp)
+ int which_track;
+ FILE *fp;
+{
+ unsigned long trkhdr, trklength;
+ long offset, place_marker;
+ void write16bit (), write32bit ();
+
+
+ laststatus = 0;
+
+ trkhdr = MTrk;
+ trklength = 0;
+
+ /* Remember where the length was written, because we don't
+ know how long it will be until we've finished writing */
+ offset = ftell (fp);
+
+#ifdef DEBUG
+ printf ("offset = %d\n", (int) offset);
+#endif
+
+ /* Write the track chunk header */
+ write32bit (trkhdr);
+ write32bit (trklength);
+
+ Mf_numbyteswritten = 0L; /* the header's length doesn't count */
+
+ if (Mf_writetrack)
+ {
+ (*Mf_writetrack) (which_track);
+ }
+
+ /* mf_write End of track meta event */
+/* but this does not necessarily have a delta of 0, so
+ * I don't want to do it -- leave it up to the user of the
+ * library functions to do
+ * --gl
+ eputc(0);
+ eputc(laststatus = meta_event);
+ eputc(end_of_track);
+
+ eputc(0);
+ */
+
+ /* It's impossible to know how long the track chunk will be beforehand,
+ so the position of the track length data is kept so that it can
+ be written after the chunk has been generated */
+ place_marker = ftell (fp);
+
+ /* This method turned out not to be portable because the
+ parameter returned from ftell is not guaranteed to be
+ in bytes on every machine */
+ /* track.length = place_marker - offset - (long) sizeof(track); */
+
+#ifdef DEBUG
+ printf ("length = %d\n", (int) trklength);
+#endif
+
+ if (fseek (fp, offset, 0) < 0)
+ mferror ("error seeking during final stage of write");
+
+ trklength = Mf_numbyteswritten;
+
+ /* Re-mf_write the track chunk header with right length */
+ write32bit (trkhdr);
+ write32bit (trklength);
+
+ fseek (fp, place_marker, 0);
+} /* End gen_track_chunk() */
+
+
+void
+mf_write_header_chunk (format, ntracks, division)
+ int format, ntracks, division;
+{
+ unsigned long ident, length;
+ void write16bit (), write32bit ();
+
+ ident = MThd; /* Head chunk identifier */
+ length = 6; /* Chunk length */
+
+ /* individual bytes of the header must be written separately
+ to preserve byte order across cpu types :-( */
+ write32bit (ident);
+ write32bit (length);
+ write16bit (format);
+ write16bit (ntracks);
+ write16bit (division);
+} /* end gen_header_chunk() */
+
+
+/*
+ * mf_write_midi_event()
+ *
+ * Library routine to mf_write a single MIDI track event in the standard MIDI
+ * file format. The format is:
+ *
+ * <delta-time><event>
+ *
+ * In this case, event can be any multi-byte midi message, such as
+ * "note on", "note off", etc.
+ *
+ * delta_time - the time in ticks since the last event.
+ * type - the type of meta event.
+ * chan - The midi channel.
+ * data - A pointer to a block of chars containing the META EVENT,
+ * data.
+ * size - The length of the meta-event data.
+ */
+int
+mf_write_midi_event (delta_time, type, chan, data, size)
+ unsigned long delta_time;
+ int chan, type;
+ unsigned long size;
+ char *data;
+{
+ int i;
+ unsigned char c;
+
+ WriteVarLen (delta_time);
+
+ /* all MIDI events start with the type in the first four bits,
+ and the channel in the lower four bits */
+ if (type == system_exclusive || type == 0xf7)
+ {
+ c = type;
+ laststatus = 0;
+ }
+ else
+ c = type | chan;
+
+ if (chan > 15)
+ perror ("error: MIDI channel greater than 16\n");
+
+ if (laststatus != c)
+ eputc (laststatus = c);
+
+ if (type == system_exclusive || type == 0xf7)
+ WriteVarLen (size);
+
+ /* write out the data bytes */
+ for (i = 0; i < (int)size; i++)
+ eputc (data[i]);
+
+ return (size);
+} /* end mf_write MIDI event */
+
+/*
+ * mf_write_meta_event()
+ *
+ * Library routine to mf_write a single meta event in the standard MIDI
+ * file format. The format of a meta event is:
+ *
+ * <delta-time><FF><type><length><bytes>
+ *
+ * delta_time - the time in ticks since the last event.
+ * type - the type of meta event.
+ * data - A pointer to a block of chars containing the META EVENT,
+ * data.
+ * size - The length of the meta-event data.
+ */
+int
+mf_write_meta_event (delta_time, type, data, size)
+ unsigned long delta_time;
+ unsigned char *data, type;
+ unsigned long size;
+{
+ int i;
+
+ WriteVarLen (delta_time);
+
+ /* This marks the fact we're writing a meta-event */
+ eputc (laststatus = meta_event);
+
+ /* The type of meta event */
+ eputc (type);
+
+ /* The length of the data bytes to follow */
+ WriteVarLen (size);
+
+ for (i = 0; i < (int)size; i++)
+ {
+ if (eputc (data[i]) != data[i])
+ return (-1);
+ }
+ return (size);
+} /* end mf_write_meta_event */
+
+void
+mf_write_tempo (delta_time, tempo)
+ unsigned long delta_time;
+ unsigned long tempo;
+{
+ /* Write tempo */
+ /* all tempos are written as 120 beats/minute, */
+ /* expressed in microseconds/quarter note */
+
+ WriteVarLen (delta_time);
+ eputc (laststatus = meta_event);
+ eputc (set_tempo);
+
+ eputc (3);
+ eputc ((unsigned) (0xff & (tempo >> 16)));
+ eputc ((unsigned) (0xff & (tempo >> 8)));
+ eputc ((unsigned) (0xff & tempo));
+}
+
+void
+mf_write_seqnum (delta_time, seqnum)
+ unsigned long delta_time;
+ unsigned seqnum;
+{
+
+ WriteVarLen (delta_time);
+ eputc (laststatus = meta_event);
+ eputc (0);
+
+ eputc ((unsigned) (0xff & (seqnum >> 8)));
+ eputc ((unsigned) (0xff & seqnum));
+}
+
+unsigned long
+mf_sec2ticks (secs, division, tempo)
+ int division;
+ unsigned long tempo;
+ double secs;
+{
+ return (unsigned long) (((secs * 1000.0) / 4.0 * division) / tempo);
+}
+
+/*
+ * Write multi-length bytes to MIDI format files
+ */
+void
+WriteVarLen (value)
+ unsigned long value;
+{
+ unsigned long buffer;
+
+ buffer = value & 0x7f;
+ while ((value >>= 7) > 0)
+ {
+ buffer <<= 8;
+ buffer |= 0x80;
+ buffer += (value & 0x7f);
+ }
+ while (1)
+ {
+ eputc ((unsigned) (buffer & 0xff));
+
+ if (buffer & 0x80)
+ buffer >>= 8;
+ else
+ return;
+ }
+} /* end of WriteVarLen */
+
+/*
+ * This routine converts delta times in ticks into seconds. The
+ * else statement is needed because the formula is different for tracks
+ * based on notes and tracks based on SMPTE times.
+ *
+ */
+double
+mf_ticks2sec (ticks, division, tempo)
+ int division;
+ unsigned long tempo;
+ unsigned long ticks;
+{
+ double smpte_format, smpte_resolution;
+
+ if (division > 0)
+ return ((double) (((double) (ticks) * (double) (tempo)) / ((double) (division) * 1000000.0)));
+ else
+ {
+ smpte_format = upperbyte (division);
+ smpte_resolution = lowerbyte (division);
+ return (double) ((double) ticks / (smpte_format * smpte_resolution * 1000000.0));
+ }
+} /* end of ticks2sec() */
+
+
+/*
+ * write32bit()
+ * write16bit()
+ *
+ * These routines are used to make sure that the byte order of
+ * the various data types remains constant between machines. This
+ * helps make sure that the code will be portable from one system
+ * to the next. It is slightly dangerous that it assumes that longs
+ * have at least 32 bits and ints have at least 16 bits, but this
+ * has been true at least on PCs, UNIX machines, and Macintosh's.
+ *
+ */
+void
+write32bit (data)
+ unsigned long data;
+{
+ eputc ((unsigned) ((data >> 24) & 0xff));
+ eputc ((unsigned) ((data >> 16) & 0xff));
+ eputc ((unsigned) ((data >> 8) & 0xff));
+ eputc ((unsigned) (data & 0xff));
+}
+
+void
+write16bit (data)
+ int data;
+{
+ eputc ((unsigned) ((data & 0xff00) >> 8));
+ eputc ((unsigned) (data & 0xff));
+}
+
+/* write a single character and abort on error */
+static int
+eputc (c)
+ unsigned char c;
+{
+ int return_val;
+
+ if ((Mf_putc) == NULLFUNC)
+ {
+ mferror ("Mf_putc undefined");
+ return (-1);
+ }
+
+ return_val = (*Mf_putc) (c);
+
+ if (return_val == EOF)
+ mferror ("error writing");
+
+ Mf_numbyteswritten++;
+ return (return_val);
+}
diff --git a/alsa-lib/test/midifile.h b/alsa-lib/test/midifile.h
new file mode 100644
index 0000000..7dd4626
--- /dev/null
+++ b/alsa-lib/test/midifile.h
@@ -0,0 +1,132 @@
+/* definitions for MIDI file parsing code */
+extern int (*Mf_getc)();
+extern void (*Mf_header)();
+extern void (*Mf_trackstart)();
+extern void (*Mf_trackend)();
+extern void (*Mf_noteon)();
+extern void (*Mf_noteoff)();
+extern void (*Mf_pressure)();
+extern void (*Mf_parameter)();
+extern void (*Mf_pitchbend)();
+extern void (*Mf_program)();
+extern void (*Mf_chanpressure)();
+extern void (*Mf_sysex)();
+extern void (*Mf_metamisc)();
+extern void (*Mf_seqspecific)();
+extern void (*Mf_seqnum)();
+extern void (*Mf_text)();
+extern void (*Mf_eot)();
+extern void (*Mf_timesig)();
+extern void (*Mf_smpte)();
+extern void (*Mf_tempo)();
+extern void (*Mf_keysig)();
+extern void (*Mf_arbitrary)();
+extern void (*Mf_error)();
+extern unsigned long Mf_currtime;
+extern unsigned long Mf_realtime;
+extern unsigned long Mf_currtempo;
+extern int Mf_division;
+extern int Mf_nomerge;
+#ifdef READ_MODS
+extern unsigned char *Mf_file_contents;
+extern int Mf_file_size;
+#endif
+
+/* definitions for MIDI file writing code */
+extern int (*Mf_putc)();
+extern int (*Mf_writetrack)();
+extern int (*Mf_writetempotrack)();
+
+extern void midifile();
+extern unsigned long mf_sec2ticks();
+extern void mfwrite();
+extern int mf_write_meta_event();
+extern int mf_write_midi_event(unsigned long delta_time, int type,
+ int chan, char *data, unsigned long size);
+extern double mf_ticks2sec(unsigned long ticks,int division,unsigned long tempo);
+extern void mf_write_tempo();
+extern void mf_write_seqnum();
+extern void mfread();
+extern void mferror(char *s);
+
+#ifndef NO_LC_DEFINES
+/* MIDI status commands most significant bit is 1 */
+#define note_off 0x80
+#define note_on 0x90
+#define poly_aftertouch 0xa0
+#define control_change 0xb0
+#define program_chng 0xc0
+#define channel_aftertouch 0xd0
+#define pitch_wheel 0xe0
+#define system_exclusive 0xf0
+#define delay_packet (1111)
+
+/* 7 bit controllers */
+#define damper_pedal 0x40
+#define portamento 0x41
+#define sustenuto 0x42
+#define soft_pedal 0x43
+#define general_4 0x44
+#define hold_2 0x45
+#define general_5 0x50
+#define general_6 0x51
+#define general_7 0x52
+#define general_8 0x53
+#ifndef PLAYMIDI
+#define tremolo_depth 0x5c
+#define ctrl_chorus_depth 0x5d
+#define detune 0x5e
+#define phaser_depth 0x5f
+#endif
+
+/* parameter values */
+#define data_inc 0x60
+#define data_dec 0x61
+
+/* parameter selection */
+#define non_reg_lsb 0x62
+#define non_reg_msb 0x63
+#define reg_lsb 0x64
+#define reg_msb 0x65
+
+/* Standard MIDI Files meta event definitions */
+#define meta_event 0xFF
+#define sequence_number 0x00
+#define text_event 0x01
+#define copyright_notice 0x02
+#define sequence_name 0x03
+#define instrument_name 0x04
+#define lyric 0x05
+#define marker 0x06
+#define cue_point 0x07
+#define channel_prefix 0x20
+#define end_of_track 0x2f
+#define set_tempo 0x51
+#define smpte_offset 0x54
+#define time_signature 0x58
+#define key_signature 0x59
+#define sequencer_specific 0x74
+
+/* Manufacturer's ID number */
+#define Seq_Circuits (0x01) /* Sequential Circuits Inc. */
+#define Big_Briar (0x02) /* Big Briar Inc. */
+#define Octave (0x03) /* Octave/Plateau */
+#define Moog (0x04) /* Moog Music */
+#define Passport (0x05) /* Passport Designs */
+#define Lexicon (0x06) /* Lexicon */
+#define Tempi (0x20) /* Bon Tempi */
+#define Siel (0x21) /* S.I.E.L. */
+#define Kawai (0x41)
+#define Roland (0x42)
+#define Korg (0x42)
+#define Yamaha (0x43)
+#endif
+
+/* miscellaneous definitions */
+#define MThd 0x4d546864
+#define MTrk 0x4d54726b
+
+#ifndef NO_LC_DEFINES
+#define lowerbyte(x) ((unsigned char)(x & 0xff))
+#define upperbyte(x) ((unsigned char)((x & 0xff00)>>8))
+#endif
diff --git a/alsa-lib/test/midiloop.c b/alsa-lib/test/midiloop.c
new file mode 100644
index 0000000..31fbcd3
--- /dev/null
+++ b/alsa-lib/test/midiloop.c
@@ -0,0 +1,190 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/time.h>
+#include "../include/asoundlib.h"
+#include <string.h>
+#include <signal.h>
+
+static void usage(void)
+{
+ fprintf(stderr, "Usage: midiloop [options]\n");
+ fprintf(stderr, " options:\n");
+ fprintf(stderr, " -v: verbose mode\n");
+ fprintf(stderr, " -i <rawmidi device> : test input device\n");
+ fprintf(stderr, " -o <rawmidi device> : test output device\n");
+}
+
+int stop = 0;
+
+void sighandler(int dummy ATTRIBUTE_UNUSED)
+{
+ stop=1;
+}
+
+long long timediff(struct timeval t1, struct timeval t2)
+{
+ signed long l;
+
+ t1.tv_sec -= t2.tv_sec;
+ l = (signed long) t1.tv_usec - (signed long) t2.tv_usec;
+ if (l < 0) {
+ t1.tv_sec--;
+ l = -l;
+ l %= 1000000;
+ }
+ return ((long long)t1.tv_sec * (long long)1000000) + (long long)l;
+}
+
+int writepattern(snd_rawmidi_t *handle_out, unsigned char *obuf)
+{
+ int patsize, i;
+
+ patsize = 0;
+ for (i = 0; i < 15; i++) {
+ obuf[patsize++] = 0x90 + i;
+ obuf[patsize++] = 0x40;
+ obuf[patsize++] = 0x3f;
+ obuf[patsize++] = 0xb0 + i;
+ obuf[patsize++] = 0x2e;
+ obuf[patsize++] = 0x7a;
+ obuf[patsize++] = 0x80 + i;
+ obuf[patsize++] = 0x23;
+ obuf[patsize++] = 0x24;
+ obuf[patsize++] = 0xf0;
+ obuf[patsize++] = i;
+ obuf[patsize++] = 0xf7;
+ }
+ i = snd_rawmidi_write(handle_out, obuf, patsize);
+ if (i != patsize) {
+ printf("Written only %i bytes from %i bytes\n", i, patsize);
+ exit(EXIT_FAILURE);
+ }
+ return patsize;
+}
+
+int main(int argc, char** argv)
+{
+ int i, j, k, opos, ipos, patsize;
+ int err;
+ int verbose = 0;
+ snd_rawmidi_t *handle_in = NULL, *handle_out = NULL;
+ unsigned char ibuf[512], obuf[512];
+ char *iname = "hw:0,0", *oname = "hw:0,0";
+ struct timeval start, end;
+ long long diff;
+ snd_rawmidi_status_t *istat, *ostat;
+
+ for (i = 1 ; i<argc ; i++) {
+ if (argv[i][0]=='-') {
+ if (!strcmp(argv[i], "--help")) {
+ usage();
+ return 0;
+ }
+ switch (argv[i][1]) {
+ case 'h':
+ usage();
+ return 0;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'i':
+ if (i + 1 < argc)
+ iname = argv[++i];
+ break;
+ case 'o':
+ if (i + 1 < argc)
+ oname = argv[++i];
+ break;
+ }
+ }
+ }
+
+ if (iname == NULL)
+ iname = oname;
+ if (oname == NULL)
+ oname = iname;
+
+ if (verbose) {
+ fprintf(stderr, "Using: \n");
+ fprintf(stderr, " Input: %s Output: %s\n", iname, oname);
+ }
+
+ err = snd_rawmidi_open(&handle_in, NULL, iname, SND_RAWMIDI_NONBLOCK);
+ if (err) {
+ fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",iname,err);
+ exit(EXIT_FAILURE);
+ }
+
+ err = snd_rawmidi_open(NULL, &handle_out, oname, 0);
+ if (err) {
+ fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",oname,err);
+ exit(EXIT_FAILURE);
+ }
+
+ signal(SIGINT, sighandler);
+
+ i = snd_rawmidi_read(handle_in, ibuf, sizeof(ibuf));
+ if (i > 0) {
+ printf("Read ahead: %i\n", i);
+ for (j = 0; j < i; j++)
+ printf("%02x:", ibuf[j]);
+ printf("\n");
+ exit(EXIT_FAILURE);
+ }
+
+ snd_rawmidi_nonblock(handle_in, 0);
+
+ patsize = writepattern(handle_out, obuf);
+ gettimeofday(&start, NULL);
+ patsize = writepattern(handle_out, obuf);
+
+ k = ipos = opos = err = 0;
+ while (!stop) {
+ i = snd_rawmidi_read(handle_in, ibuf, sizeof(ibuf));
+ for (j = 0; j < i; j++, ipos++)
+ if (obuf[k] != ibuf[j]) {
+ printf("ipos = %i, i[0x%x] != o[0x%x]\n", ipos, ibuf[j], obuf[k]);
+ if (opos > 0)
+ stop = 1;
+ } else {
+ printf("match success: ipos = %i, opos = %i [%i:0x%x]\n", ipos, opos, k, obuf[k]);
+ k++; opos++;
+ if (k >= patsize) {
+ patsize = writepattern(handle_out, obuf);
+ k = 0;
+ }
+ }
+ }
+
+ gettimeofday(&end, NULL);
+
+ printf("End...\n");
+
+ snd_rawmidi_status_alloca(&istat);
+ snd_rawmidi_status_alloca(&ostat);
+ err = snd_rawmidi_status(handle_in, istat);
+ if (err < 0)
+ fprintf(stderr, "input stream status error: %d\n", err);
+ err = snd_rawmidi_status(handle_out, ostat);
+ if (err < 0)
+ fprintf(stderr, "output stream status error: %d\n", err);
+ printf("input.status.avail = %i\n", snd_rawmidi_status_get_avail(istat));
+ printf("input.status.xruns = %i\n", snd_rawmidi_status_get_xruns(istat));
+ printf("output.status.avail = %i\n", snd_rawmidi_status_get_avail(ostat));
+ printf("output.status.xruns = %i\n", snd_rawmidi_status_get_xruns(ostat));
+
+ diff = timediff(end, start);
+ printf("Time diff: %Liusec (%Li bytes/sec)\n", diff, ((long long)opos * 1000000) / diff);
+
+ if (verbose) {
+ fprintf(stderr,"Closing\n");
+ }
+
+ snd_rawmidi_drain(handle_in);
+ snd_rawmidi_close(handle_in);
+ snd_rawmidi_drain(handle_out);
+ snd_rawmidi_close(handle_out);
+
+ return 0;
+}
diff --git a/alsa-lib/test/namehint.c b/alsa-lib/test/namehint.c
new file mode 100644
index 0000000..e978d5c
--- /dev/null
+++ b/alsa-lib/test/namehint.c
@@ -0,0 +1,22 @@
+#include "../include/asoundlib.h"
+#include <err.h>
+
+int main(int argc, char *argv[])
+{
+ const char *iface = "pcm";
+ char **hints, **n;
+ int err;
+
+ if (argc > 1)
+ iface = argv[1];
+ err = snd_device_name_hint(-1, iface, &hints);
+ if (err < 0)
+ errx(1, "snd_device_name_hint error: %s", snd_strerror(err));
+ n = hints;
+ while (*n != NULL) {
+ printf("%s\n", *n);
+ n++;
+ }
+ snd_device_name_free_hint(hints);
+ return 0;
+}
diff --git a/alsa-lib/test/oldapi.c b/alsa-lib/test/oldapi.c
new file mode 100644
index 0000000..e325f4c
--- /dev/null
+++ b/alsa-lib/test/oldapi.c
@@ -0,0 +1,42 @@
+/*
+ * Old PCM API compilation test
+ *
+ * Author: Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sched.h>
+#include <errno.h>
+#include <getopt.h>
+#define ALSA_PCM_OLD_HW_PARAMS_API
+#define ALSA_PCM_OLD_SW_PARAMS_API
+#include "../include/asoundlib.h"
+#include <sys/time.h>
+
+typedef void (myfcn)(void *);
+
+int main(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
+{
+ myfcn *fcn;
+ snd_pcm_hw_params_get_access(NULL);
+ fcn = &snd_pcm_hw_params_get_access;
+ return 0;
+}
diff --git a/alsa-lib/test/pcm.c b/alsa-lib/test/pcm.c
new file mode 100644
index 0000000..ee27422
--- /dev/null
+++ b/alsa-lib/test/pcm.c
@@ -0,0 +1,902 @@
+/*
+ * This small demo sends a simple sinusoidal wave to your speakers.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sched.h>
+#include <errno.h>
+#include <getopt.h>
+#include "../include/asoundlib.h"
+#include <sys/time.h>
+#include <math.h>
+
+static char *device = "plughw:0,0"; /* playback device */
+static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
+static unsigned int rate = 44100; /* stream rate */
+static unsigned int channels = 1; /* count of channels */
+static unsigned int buffer_time = 500000; /* ring buffer length in us */
+static unsigned int period_time = 100000; /* period time in us */
+static double freq = 440; /* sinusoidal wave frequency in Hz */
+static int verbose = 0; /* verbose flag */
+static int resample = 1; /* enable alsa-lib resampling */
+static int period_event = 0; /* produce poll event after each period */
+
+static snd_pcm_sframes_t buffer_size;
+static snd_pcm_sframes_t period_size;
+static snd_output_t *output = NULL;
+
+static void generate_sine(const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ int count, double *_phase)
+{
+ static double max_phase = 2. * M_PI;
+ double phase = *_phase;
+ double step = max_phase*freq/(double)rate;
+ double res;
+ unsigned char *samples[channels], *tmp;
+ int steps[channels];
+ unsigned int chn, byte;
+ union {
+ int i;
+ unsigned char c[4];
+ } ires;
+ unsigned int maxval = (1 << (snd_pcm_format_width(format) - 1)) - 1;
+ int bps = snd_pcm_format_width(format) / 8; /* bytes per sample */
+
+ /* verify and prepare the contents of areas */
+ for (chn = 0; chn < channels; chn++) {
+ if ((areas[chn].first % 8) != 0) {
+ printf("areas[%i].first == %i, aborting...\n", chn, areas[chn].first);
+ exit(EXIT_FAILURE);
+ }
+ samples[chn] = /*(signed short *)*/(((unsigned char *)areas[chn].addr) + (areas[chn].first / 8));
+ if ((areas[chn].step % 16) != 0) {
+ printf("areas[%i].step == %i, aborting...\n", chn, areas[chn].step);
+ exit(EXIT_FAILURE);
+ }
+ steps[chn] = areas[chn].step / 8;
+ samples[chn] += offset * steps[chn];
+ }
+ /* fill the channel areas */
+ while (count-- > 0) {
+ res = sin(phase) * maxval;
+ ires.i = res;
+ tmp = ires.c;
+ for (chn = 0; chn < channels; chn++) {
+ for (byte = 0; byte < (unsigned int)bps; byte++)
+ *(samples[chn] + byte) = tmp[byte];
+ samples[chn] += steps[chn];
+ }
+ phase += step;
+ if (phase >= max_phase)
+ phase -= max_phase;
+ }
+ *_phase = phase;
+}
+
+static int set_hwparams(snd_pcm_t *handle,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_access_t access)
+{
+ unsigned int rrate;
+ snd_pcm_uframes_t size;
+ int err, dir;
+
+ /* choose all parameters */
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0) {
+ printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* set hardware resampling */
+ err = snd_pcm_hw_params_set_rate_resample(handle, params, resample);
+ if (err < 0) {
+ printf("Resampling setup failed for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* set the interleaved read/write format */
+ err = snd_pcm_hw_params_set_access(handle, params, access);
+ if (err < 0) {
+ printf("Access type not available for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* set the sample format */
+ err = snd_pcm_hw_params_set_format(handle, params, format);
+ if (err < 0) {
+ printf("Sample format not available for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* set the count of channels */
+ err = snd_pcm_hw_params_set_channels(handle, params, channels);
+ if (err < 0) {
+ printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err));
+ return err;
+ }
+ /* set the stream rate */
+ rrate = rate;
+ err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
+ if (err < 0) {
+ printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
+ return err;
+ }
+ if (rrate != rate) {
+ printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
+ return -EINVAL;
+ }
+ /* set the buffer time */
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir);
+ if (err < 0) {
+ printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_hw_params_get_buffer_size(params, &size);
+ if (err < 0) {
+ printf("Unable to get buffer size for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ buffer_size = size;
+ /* set the period time */
+ err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir);
+ if (err < 0) {
+ printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err));
+ return err;
+ }
+ err = snd_pcm_hw_params_get_period_size(params, &size, &dir);
+ if (err < 0) {
+ printf("Unable to get period size for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ period_size = size;
+ /* write the parameters to device */
+ err = snd_pcm_hw_params(handle, params);
+ if (err < 0) {
+ printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams)
+{
+ int err;
+
+ /* get the current swparams */
+ err = snd_pcm_sw_params_current(handle, swparams);
+ if (err < 0) {
+ printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* start the transfer when the buffer is almost full: */
+ /* (buffer_size / avail_min) * avail_min */
+ err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / period_size) * period_size);
+ if (err < 0) {
+ printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* allow the transfer when at least period_size samples can be processed */
+ /* or disable this mechanism when period event is enabled (aka interrupt like style processing) */
+ err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_event ? buffer_size : period_size);
+ if (err < 0) {
+ printf("Unable to set avail min for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ /* enable period events when requested */
+ if (period_event) {
+ err = snd_pcm_sw_params_set_period_event(handle, swparams, 1);
+ if (err < 0) {
+ printf("Unable to set period event: %s\n", snd_strerror(err));
+ return err;
+ }
+ }
+ /* write the parameters to the playback device */
+ err = snd_pcm_sw_params(handle, swparams);
+ if (err < 0) {
+ printf("Unable to set sw params for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+/*
+ * Underrun and suspend recovery
+ */
+
+static int xrun_recovery(snd_pcm_t *handle, int err)
+{
+ if (verbose)
+ printf("stream recovery\n");
+ if (err == -EPIPE) { /* under-run */
+ err = snd_pcm_prepare(handle);
+ if (err < 0)
+ printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
+ return 0;
+ } else if (err == -ESTRPIPE) {
+ while ((err = snd_pcm_resume(handle)) == -EAGAIN)
+ sleep(1); /* wait until the suspend flag is released */
+ if (err < 0) {
+ err = snd_pcm_prepare(handle);
+ if (err < 0)
+ printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
+ }
+ return 0;
+ }
+ return err;
+}
+
+/*
+ * Transfer method - write only
+ */
+
+static int write_loop(snd_pcm_t *handle,
+ signed short *samples,
+ snd_pcm_channel_area_t *areas)
+{
+ double phase = 0;
+ signed short *ptr;
+ int err, cptr;
+
+ while (1) {
+ generate_sine(areas, 0, period_size, &phase);
+ ptr = samples;
+ cptr = period_size;
+ while (cptr > 0) {
+ err = snd_pcm_writei(handle, ptr, cptr);
+ if (err == -EAGAIN)
+ continue;
+ if (err < 0) {
+ if (xrun_recovery(handle, err) < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ break; /* skip one period */
+ }
+ ptr += err * channels;
+ cptr -= err;
+ }
+ }
+}
+
+/*
+ * Transfer method - write and wait for room in buffer using poll
+ */
+
+static int wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count)
+{
+ unsigned short revents;
+
+ while (1) {
+ poll(ufds, count, -1);
+ snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents);
+ if (revents & POLLERR)
+ return -EIO;
+ if (revents & POLLOUT)
+ return 0;
+ }
+}
+
+static int write_and_poll_loop(snd_pcm_t *handle,
+ signed short *samples,
+ snd_pcm_channel_area_t *areas)
+{
+ struct pollfd *ufds;
+ double phase = 0;
+ signed short *ptr;
+ int err, count, cptr, init;
+
+ count = snd_pcm_poll_descriptors_count (handle);
+ if (count <= 0) {
+ printf("Invalid poll descriptors count\n");
+ return count;
+ }
+
+ ufds = malloc(sizeof(struct pollfd) * count);
+ if (ufds == NULL) {
+ printf("No enough memory\n");
+ return -ENOMEM;
+ }
+ if ((err = snd_pcm_poll_descriptors(handle, ufds, count)) < 0) {
+ printf("Unable to obtain poll descriptors for playback: %s\n", snd_strerror(err));
+ return err;
+ }
+
+ init = 1;
+ while (1) {
+ if (!init) {
+ err = wait_for_poll(handle, ufds, count);
+ if (err < 0) {
+ if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN ||
+ snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) {
+ err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE;
+ if (xrun_recovery(handle, err) < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ init = 1;
+ } else {
+ printf("Wait for poll failed\n");
+ return err;
+ }
+ }
+ }
+
+ generate_sine(areas, 0, period_size, &phase);
+ ptr = samples;
+ cptr = period_size;
+ while (cptr > 0) {
+ err = snd_pcm_writei(handle, ptr, cptr);
+ if (err < 0) {
+ if (xrun_recovery(handle, err) < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ init = 1;
+ break; /* skip one period */
+ }
+ if (snd_pcm_state(handle) == SND_PCM_STATE_RUNNING)
+ init = 0;
+ ptr += err * channels;
+ cptr -= err;
+ if (cptr == 0)
+ break;
+ /* it is possible, that the initial buffer cannot store */
+ /* all data from the last period, so wait awhile */
+ err = wait_for_poll(handle, ufds, count);
+ if (err < 0) {
+ if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN ||
+ snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) {
+ err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE;
+ if (xrun_recovery(handle, err) < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ init = 1;
+ } else {
+ printf("Wait for poll failed\n");
+ return err;
+ }
+ }
+ }
+ }
+}
+
+/*
+ * Transfer method - asynchronous notification
+ */
+
+struct async_private_data {
+ signed short *samples;
+ snd_pcm_channel_area_t *areas;
+ double phase;
+};
+
+static void async_callback(snd_async_handler_t *ahandler)
+{
+ snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler);
+ struct async_private_data *data = snd_async_handler_get_callback_private(ahandler);
+ signed short *samples = data->samples;
+ snd_pcm_channel_area_t *areas = data->areas;
+ snd_pcm_sframes_t avail;
+ int err;
+
+ avail = snd_pcm_avail_update(handle);
+ while (avail >= period_size) {
+ generate_sine(areas, 0, period_size, &data->phase);
+ err = snd_pcm_writei(handle, samples, period_size);
+ if (err < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if (err != period_size) {
+ printf("Write error: written %i expected %li\n", err, period_size);
+ exit(EXIT_FAILURE);
+ }
+ avail = snd_pcm_avail_update(handle);
+ }
+}
+
+static int async_loop(snd_pcm_t *handle,
+ signed short *samples,
+ snd_pcm_channel_area_t *areas)
+{
+ struct async_private_data data;
+ snd_async_handler_t *ahandler;
+ int err, count;
+
+ data.samples = samples;
+ data.areas = areas;
+ data.phase = 0;
+ err = snd_async_add_pcm_handler(&ahandler, handle, async_callback, &data);
+ if (err < 0) {
+ printf("Unable to register async handler\n");
+ exit(EXIT_FAILURE);
+ }
+ for (count = 0; count < 2; count++) {
+ generate_sine(areas, 0, period_size, &data.phase);
+ err = snd_pcm_writei(handle, samples, period_size);
+ if (err < 0) {
+ printf("Initial write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if (err != period_size) {
+ printf("Initial write error: written %i expected %li\n", err, period_size);
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (snd_pcm_state(handle) == SND_PCM_STATE_PREPARED) {
+ err = snd_pcm_start(handle);
+ if (err < 0) {
+ printf("Start error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ /* because all other work is done in the signal handler,
+ suspend the process */
+ while (1) {
+ sleep(1);
+ }
+}
+
+/*
+ * Transfer method - asynchronous notification + direct write
+ */
+
+static void async_direct_callback(snd_async_handler_t *ahandler)
+{
+ snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler);
+ struct async_private_data *data = snd_async_handler_get_callback_private(ahandler);
+ const snd_pcm_channel_area_t *my_areas;
+ snd_pcm_uframes_t offset, frames, size;
+ snd_pcm_sframes_t avail, commitres;
+ snd_pcm_state_t state;
+ int first = 0, err;
+
+ while (1) {
+ state = snd_pcm_state(handle);
+ if (state == SND_PCM_STATE_XRUN) {
+ err = xrun_recovery(handle, -EPIPE);
+ if (err < 0) {
+ printf("XRUN recovery failed: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ } else if (state == SND_PCM_STATE_SUSPENDED) {
+ err = xrun_recovery(handle, -ESTRPIPE);
+ if (err < 0) {
+ printf("SUSPEND recovery failed: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ }
+ avail = snd_pcm_avail_update(handle);
+ if (avail < 0) {
+ err = xrun_recovery(handle, avail);
+ if (err < 0) {
+ printf("avail update failed: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ continue;
+ }
+ if (avail < period_size) {
+ if (first) {
+ first = 0;
+ err = snd_pcm_start(handle);
+ if (err < 0) {
+ printf("Start error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ break;
+ }
+ continue;
+ }
+ size = period_size;
+ while (size > 0) {
+ frames = size;
+ err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames);
+ if (err < 0) {
+ if ((err = xrun_recovery(handle, err)) < 0) {
+ printf("MMAP begin avail error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ }
+ generate_sine(my_areas, offset, frames, &data->phase);
+ commitres = snd_pcm_mmap_commit(handle, offset, frames);
+ if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) {
+ if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) {
+ printf("MMAP commit error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ }
+ size -= frames;
+ }
+ }
+}
+
+static int async_direct_loop(snd_pcm_t *handle,
+ signed short *samples ATTRIBUTE_UNUSED,
+ snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
+{
+ struct async_private_data data;
+ snd_async_handler_t *ahandler;
+ const snd_pcm_channel_area_t *my_areas;
+ snd_pcm_uframes_t offset, frames, size;
+ snd_pcm_sframes_t commitres;
+ int err, count;
+
+ data.samples = NULL; /* we do not require the global sample area for direct write */
+ data.areas = NULL; /* we do not require the global areas for direct write */
+ data.phase = 0;
+ err = snd_async_add_pcm_handler(&ahandler, handle, async_direct_callback, &data);
+ if (err < 0) {
+ printf("Unable to register async handler\n");
+ exit(EXIT_FAILURE);
+ }
+ for (count = 0; count < 2; count++) {
+ size = period_size;
+ while (size > 0) {
+ frames = size;
+ err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames);
+ if (err < 0) {
+ if ((err = xrun_recovery(handle, err)) < 0) {
+ printf("MMAP begin avail error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ }
+ generate_sine(my_areas, offset, frames, &data.phase);
+ commitres = snd_pcm_mmap_commit(handle, offset, frames);
+ if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) {
+ if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) {
+ printf("MMAP commit error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ }
+ size -= frames;
+ }
+ }
+ err = snd_pcm_start(handle);
+ if (err < 0) {
+ printf("Start error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+
+ /* because all other work is done in the signal handler,
+ suspend the process */
+ while (1) {
+ sleep(1);
+ }
+}
+
+/*
+ * Transfer method - direct write only
+ */
+
+static int direct_loop(snd_pcm_t *handle,
+ signed short *samples ATTRIBUTE_UNUSED,
+ snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED)
+{
+ double phase = 0;
+ const snd_pcm_channel_area_t *my_areas;
+ snd_pcm_uframes_t offset, frames, size;
+ snd_pcm_sframes_t avail, commitres;
+ snd_pcm_state_t state;
+ int err, first = 1;
+
+ while (1) {
+ state = snd_pcm_state(handle);
+ if (state == SND_PCM_STATE_XRUN) {
+ err = xrun_recovery(handle, -EPIPE);
+ if (err < 0) {
+ printf("XRUN recovery failed: %s\n", snd_strerror(err));
+ return err;
+ }
+ first = 1;
+ } else if (state == SND_PCM_STATE_SUSPENDED) {
+ err = xrun_recovery(handle, -ESTRPIPE);
+ if (err < 0) {
+ printf("SUSPEND recovery failed: %s\n", snd_strerror(err));
+ return err;
+ }
+ }
+ avail = snd_pcm_avail_update(handle);
+ if (avail < 0) {
+ err = xrun_recovery(handle, avail);
+ if (err < 0) {
+ printf("avail update failed: %s\n", snd_strerror(err));
+ return err;
+ }
+ first = 1;
+ continue;
+ }
+ if (avail < period_size) {
+ if (first) {
+ first = 0;
+ err = snd_pcm_start(handle);
+ if (err < 0) {
+ printf("Start error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ err = snd_pcm_wait(handle, -1);
+ if (err < 0) {
+ if ((err = xrun_recovery(handle, err)) < 0) {
+ printf("snd_pcm_wait error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ }
+ }
+ continue;
+ }
+ size = period_size;
+ while (size > 0) {
+ frames = size;
+ err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames);
+ if (err < 0) {
+ if ((err = xrun_recovery(handle, err)) < 0) {
+ printf("MMAP begin avail error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ }
+ generate_sine(my_areas, offset, frames, &phase);
+ commitres = snd_pcm_mmap_commit(handle, offset, frames);
+ if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) {
+ if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) {
+ printf("MMAP commit error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ first = 1;
+ }
+ size -= frames;
+ }
+ }
+}
+
+/*
+ * Transfer method - direct write only using mmap_write functions
+ */
+
+static int direct_write_loop(snd_pcm_t *handle,
+ signed short *samples,
+ snd_pcm_channel_area_t *areas)
+{
+ double phase = 0;
+ signed short *ptr;
+ int err, cptr;
+
+ while (1) {
+ generate_sine(areas, 0, period_size, &phase);
+ ptr = samples;
+ cptr = period_size;
+ while (cptr > 0) {
+ err = snd_pcm_mmap_writei(handle, ptr, cptr);
+ if (err == -EAGAIN)
+ continue;
+ if (err < 0) {
+ if (xrun_recovery(handle, err) < 0) {
+ printf("Write error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ break; /* skip one period */
+ }
+ ptr += err * channels;
+ cptr -= err;
+ }
+ }
+}
+
+/*
+ *
+ */
+
+struct transfer_method {
+ const char *name;
+ snd_pcm_access_t access;
+ int (*transfer_loop)(snd_pcm_t *handle,
+ signed short *samples,
+ snd_pcm_channel_area_t *areas);
+};
+
+static struct transfer_method transfer_methods[] = {
+ { "write", SND_PCM_ACCESS_RW_INTERLEAVED, write_loop },
+ { "write_and_poll", SND_PCM_ACCESS_RW_INTERLEAVED, write_and_poll_loop },
+ { "async", SND_PCM_ACCESS_RW_INTERLEAVED, async_loop },
+ { "async_direct", SND_PCM_ACCESS_MMAP_INTERLEAVED, async_direct_loop },
+ { "direct_interleaved", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_loop },
+ { "direct_noninterleaved", SND_PCM_ACCESS_MMAP_NONINTERLEAVED, direct_loop },
+ { "direct_write", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_write_loop },
+ { NULL, SND_PCM_ACCESS_RW_INTERLEAVED, NULL }
+};
+
+static void help(void)
+{
+ int k;
+ printf(
+"Usage: pcm [OPTION]... [FILE]...\n"
+"-h,--help help\n"
+"-D,--device playback device\n"
+"-r,--rate stream rate in Hz\n"
+"-c,--channels count of channels in stream\n"
+"-f,--frequency sine wave frequency in Hz\n"
+"-b,--buffer ring buffer size in us\n"
+"-p,--period period size in us\n"
+"-m,--method transfer method\n"
+"-o,--format sample format\n"
+"-v,--verbose show the PCM setup parameters\n"
+"-n,--noresample do not resample\n"
+"-e,--pevent enable poll event after each period\n"
+"\n");
+ printf("Recognized sample formats are:");
+ for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
+ const char *s = snd_pcm_format_name(k);
+ if (s)
+ printf(" %s", s);
+ }
+ printf("\n");
+ printf("Recognized transfer methods are:");
+ for (k = 0; transfer_methods[k].name; k++)
+ printf(" %s", transfer_methods[k].name);
+ printf("\n");
+}
+
+int main(int argc, char *argv[])
+{
+ struct option long_option[] =
+ {
+ {"help", 0, NULL, 'h'},
+ {"device", 1, NULL, 'D'},
+ {"rate", 1, NULL, 'r'},
+ {"channels", 1, NULL, 'c'},
+ {"frequency", 1, NULL, 'f'},
+ {"buffer", 1, NULL, 'b'},
+ {"period", 1, NULL, 'p'},
+ {"method", 1, NULL, 'm'},
+ {"format", 1, NULL, 'o'},
+ {"verbose", 1, NULL, 'v'},
+ {"noresample", 1, NULL, 'n'},
+ {"pevent", 1, NULL, 'e'},
+ {NULL, 0, NULL, 0},
+ };
+ snd_pcm_t *handle;
+ int err, morehelp;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_sw_params_t *swparams;
+ int method = 0;
+ signed short *samples;
+ unsigned int chn;
+ snd_pcm_channel_area_t *areas;
+
+ snd_pcm_hw_params_alloca(&hwparams);
+ snd_pcm_sw_params_alloca(&swparams);
+
+ morehelp = 0;
+ while (1) {
+ int c;
+ if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:o:vne", long_option, NULL)) < 0)
+ break;
+ switch (c) {
+ case 'h':
+ morehelp++;
+ break;
+ case 'D':
+ device = strdup(optarg);
+ break;
+ case 'r':
+ rate = atoi(optarg);
+ rate = rate < 4000 ? 4000 : rate;
+ rate = rate > 196000 ? 196000 : rate;
+ break;
+ case 'c':
+ channels = atoi(optarg);
+ channels = channels < 1 ? 1 : channels;
+ channels = channels > 1024 ? 1024 : channels;
+ break;
+ case 'f':
+ freq = atoi(optarg);
+ freq = freq < 50 ? 50 : freq;
+ freq = freq > 5000 ? 5000 : freq;
+ break;
+ case 'b':
+ buffer_time = atoi(optarg);
+ buffer_time = buffer_time < 1000 ? 1000 : buffer_time;
+ buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time;
+ break;
+ case 'p':
+ period_time = atoi(optarg);
+ period_time = period_time < 1000 ? 1000 : period_time;
+ period_time = period_time > 1000000 ? 1000000 : period_time;
+ break;
+ case 'm':
+ for (method = 0; transfer_methods[method].name; method++)
+ if (!strcasecmp(transfer_methods[method].name, optarg))
+ break;
+ if (transfer_methods[method].name == NULL)
+ method = 0;
+ break;
+ case 'o':
+ for (format = 0; format < SND_PCM_FORMAT_LAST; format++) {
+ const char *format_name = snd_pcm_format_name(format);
+ if (format_name)
+ if (!strcasecmp(format_name, optarg))
+ break;
+ }
+ if (format == SND_PCM_FORMAT_LAST)
+ format = SND_PCM_FORMAT_S16;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'n':
+ resample = 0;
+ break;
+ case 'e':
+ period_event = 1;
+ break;
+ }
+ }
+
+ if (morehelp) {
+ help();
+ return 0;
+ }
+
+ err = snd_output_stdio_attach(&output, stdout, 0);
+ if (err < 0) {
+ printf("Output failed: %s\n", snd_strerror(err));
+ return 0;
+ }
+
+ printf("Playback device is %s\n", device);
+ printf("Stream parameters are %iHz, %s, %i channels\n", rate, snd_pcm_format_name(format), channels);
+ printf("Sine wave rate is %.4fHz\n", freq);
+ printf("Using transfer method: %s\n", transfer_methods[method].name);
+
+ if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+ printf("Playback open error: %s\n", snd_strerror(err));
+ return 0;
+ }
+
+ if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) {
+ printf("Setting of hwparams failed: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if ((err = set_swparams(handle, swparams)) < 0) {
+ printf("Setting of swparams failed: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+
+ if (verbose > 0)
+ snd_pcm_dump(handle, output);
+
+ samples = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8);
+ if (samples == NULL) {
+ printf("No enough memory\n");
+ exit(EXIT_FAILURE);
+ }
+
+ areas = calloc(channels, sizeof(snd_pcm_channel_area_t));
+ if (areas == NULL) {
+ printf("No enough memory\n");
+ exit(EXIT_FAILURE);
+ }
+ for (chn = 0; chn < channels; chn++) {
+ areas[chn].addr = samples;
+ areas[chn].first = chn * snd_pcm_format_physical_width(format);
+ areas[chn].step = channels * snd_pcm_format_physical_width(format);
+ }
+
+ err = transfer_methods[method].transfer_loop(handle, samples, areas);
+ if (err < 0)
+ printf("Transfer failed: %s\n", snd_strerror(err));
+
+ free(areas);
+ free(samples);
+ snd_pcm_close(handle);
+ return 0;
+}
+
diff --git a/alsa-lib/test/pcm_min.c b/alsa-lib/test/pcm_min.c
new file mode 100644
index 0000000..e971405
--- /dev/null
+++ b/alsa-lib/test/pcm_min.c
@@ -0,0 +1,51 @@
+/*
+ * This extra small demo sends a random samples to your speakers.
+ */
+
+#include "../include/asoundlib.h"
+
+static char *device = "default"; /* playback device */
+
+snd_output_t *output = NULL;
+unsigned char buffer[16*1024]; /* some random data */
+
+int main(void)
+{
+ int err;
+ unsigned int i;
+ snd_pcm_t *handle;
+ snd_pcm_sframes_t frames;
+
+ for (i = 0; i < sizeof(buffer); i++)
+ buffer[i] = random() & 0xff;
+
+ if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+ printf("Playback open error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if ((err = snd_pcm_set_params(handle,
+ SND_PCM_FORMAT_U8,
+ SND_PCM_ACCESS_RW_INTERLEAVED,
+ 1,
+ 48000,
+ 1,
+ 500000)) < 0) { /* 0.5sec */
+ printf("Playback open error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+
+ for (i = 0; i < 16; i++) {
+ frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
+ if (frames < 0)
+ frames = snd_pcm_recover(handle, frames, 0);
+ if (frames < 0) {
+ printf("snd_pcm_writei failed: %s\n", snd_strerror(err));
+ break;
+ }
+ if (frames > 0 && frames < (long)sizeof(buffer))
+ printf("Short write (expected %li, wrote %li)\n", (long)sizeof(buffer), frames);
+ }
+
+ snd_pcm_close(handle);
+ return 0;
+}
diff --git a/alsa-lib/test/playmidi1.c b/alsa-lib/test/playmidi1.c
new file mode 100644
index 0000000..a7f3a63
--- /dev/null
+++ b/alsa-lib/test/playmidi1.c
@@ -0,0 +1,617 @@
+/*
+ * MIDI file player for ALSA sequencer
+ * (type 0 only!, the library that is used doesn't support merging of tracks)
+ *
+ * Copyright (c) 1998 by Frank van de Pol <F.K.W.van.de.Pol@inter.nl.net>
+ *
+ * Modified so that this uses alsa-lib
+ * 1999 Jan. by Isaku Yamahata <yamahata@kusm.kyoto-u.ac.jp>
+ *
+ * 19990604 Takashi Iwai <iwai@ww.uni-erlangen.de>
+ * - use blocking mode
+ * - fix tempo event bug
+ * - add command line options
+ *
+ * 19990827 Takashi Iwai <iwai@ww.uni-erlangen.de>
+ * - use snd_seq_alloc_queue()
+ *
+ * 19990916 Takashi Iwai <iwai@ww.uni-erlangen.de>
+ * - use middle-level sequencer routines and macros
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include "midifile.h" /* SMF library header */
+#include "midifile.c" /* SMF library code */
+
+#include "../include/asoundlib.h"
+
+/* send the real-time time stamps (instead of midi ticks) to the ALSA sequencer */
+static int use_realtime = 0;
+
+/* control the event buffering by using a blocking mode */
+static int use_blocking_mode = 1;
+
+/* default destination queue, client and port numbers */
+#define DEST_CLIENT_NUMBER 65
+#define DEST_PORT_NUMBER 0
+
+/* event pool size */
+#define WRITE_POOL_SIZE 200
+#define WRITE_POOL_SPACE 10
+#define READ_POOL_SIZE 10 /* we need to read the pool only for echoing */
+
+static FILE *F;
+static snd_seq_t *seq_handle = NULL;
+static int ppq = 96;
+static int slave_ppq = 96;
+
+static double local_secs = 0;
+static int local_ticks = 0;
+static int local_tempo = 500000;
+
+static int dest_queue = -1;
+static int shared_queue = 0;
+static int tick_offset = 0;
+static int dest_client = DEST_CLIENT_NUMBER;
+static int dest_port = DEST_PORT_NUMBER;
+static int my_port = 0;
+
+static int verbose = 0;
+static int slave = 0; /* allow external sync */
+
+#define VERB_INFO 1
+#define VERB_MUCH 2
+#define VERB_EVENT 3
+
+static void alsa_start_timer(void);
+static void alsa_stop_timer(void);
+static void wait_start(void);
+
+
+static inline double tick2time_dbl(int tick)
+{
+ return local_secs + ((double) (tick - local_ticks) * (double) local_tempo * 1.0E-6 / (double) ppq);
+}
+
+static void tick2time(snd_seq_real_time_t * tm, int tick)
+{
+ double secs = tick2time_dbl(tick);
+ tm->tv_sec = secs;
+ tm->tv_nsec = (secs - tm->tv_sec) * 1.0E9;
+}
+
+static void write_ev(snd_seq_event_t *ev)
+{
+ int rc;
+
+ if (use_blocking_mode) {
+ rc = snd_seq_event_output(seq_handle, ev);
+ if (rc < 0) {
+ printf("written = %i (%s)\n", rc, snd_strerror(rc));
+ exit(1);
+ }
+ return;
+ }
+ while ((rc = snd_seq_event_output(seq_handle, ev)) < 0) {
+ int npfds = snd_seq_poll_descriptors_count(seq_handle, POLLOUT);
+ struct pollfd *pfds = alloca(sizeof(*pfds) * npfds);
+ snd_seq_poll_descriptors(seq_handle, pfds, npfds, POLLOUT);
+ if ((rc = poll(pfds, npfds, -1)) < 0) {
+ printf("poll error = %i (%s)\n", rc, snd_strerror(errno));
+ exit(1);
+ }
+ }
+}
+
+/* read the byte */
+static int mygetc(void)
+{
+ return getc(F);
+}
+
+/* print out the text */
+static void mytext(int type ATTRIBUTE_UNUSED, int leng, char *msg)
+{
+ char *p;
+ char *ep = msg + leng;
+
+ if (verbose >= VERB_INFO) {
+ for (p = msg; p < ep; p++)
+ putchar(isprint(*p) ? *p : '?');
+ putchar('\n');
+ }
+}
+
+static void do_header(int format, int ntracks, int division)
+{
+ snd_seq_queue_tempo_t *tempo;
+
+ if (verbose >= VERB_INFO)
+ printf("smf format %d, %d tracks, %d ppq\n", format, ntracks, division);
+ ppq = division;
+
+ if (format != 0 || ntracks != 1) {
+ printf("This player does not support merging of tracks.\n");
+ if (! shared_queue)
+ alsa_stop_timer();
+ exit(1);
+ }
+ /* set the ppq */
+ snd_seq_queue_tempo_alloca(&tempo);
+ /* ppq must be set before starting the timer */
+ if (snd_seq_get_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
+ perror("get_queue_tempo");
+ exit(1);
+ }
+ if ((slave_ppq = snd_seq_queue_tempo_get_ppq(tempo)) != ppq) {
+ snd_seq_queue_tempo_set_ppq(tempo, ppq);
+ if (snd_seq_set_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
+ perror("set_queue_tempo");
+ if (!slave && !shared_queue)
+ exit(1);
+ else
+ printf("different PPQ %d in SMF from queue PPQ %d\n", ppq, slave_ppq);
+ } else
+ slave_ppq = ppq;
+ if (verbose >= VERB_INFO)
+ printf("ALSA Timer updated, PPQ = %d\n", snd_seq_queue_tempo_get_ppq(tempo));
+ }
+
+ /* start playing... */
+ if (slave) {
+ if (verbose >= VERB_INFO)
+ printf("Wait till timer starts...\n");
+ wait_start();
+ if (verbose >= VERB_INFO)
+ printf("Go!\n");
+ } else if (shared_queue) {
+ snd_seq_queue_status_t *stat;
+ snd_seq_queue_status_alloca(&stat);
+ snd_seq_get_queue_status(seq_handle, dest_queue, stat);
+ tick_offset = snd_seq_queue_status_get_tick_time(stat);
+ fprintf(stderr, "tick offset = %d\n", tick_offset);
+ } else {
+ alsa_start_timer();
+ tick_offset = 0;
+ }
+}
+
+/* fill the event time */
+static void set_event_time(snd_seq_event_t *ev, unsigned int currtime)
+{
+ if (use_realtime) {
+ snd_seq_real_time_t rtime;
+ if (ppq != slave_ppq)
+ currtime = (currtime * slave_ppq) / ppq;
+ tick2time(&rtime, currtime);
+ snd_seq_ev_schedule_real(ev, dest_queue, 0, &rtime);
+ } else {
+ if (ppq != slave_ppq)
+ currtime = (currtime * slave_ppq) / ppq;
+ currtime += tick_offset;
+ snd_seq_ev_schedule_tick(ev, dest_queue, 0, currtime);
+ }
+}
+
+/* fill the normal event header */
+static void set_event_header(snd_seq_event_t *ev)
+{
+ snd_seq_ev_clear(ev);
+ snd_seq_ev_set_dest(ev, dest_client, dest_port);
+ snd_seq_ev_set_source(ev, my_port);
+ set_event_time(ev, Mf_currtime);
+}
+
+/* start the timer */
+static void alsa_start_timer(void)
+{
+ snd_seq_start_queue(seq_handle, dest_queue, NULL);
+}
+
+/* stop the timer */
+static void alsa_stop_timer(void)
+{
+ snd_seq_event_t ev;
+ set_event_header(&ev);
+ snd_seq_stop_queue(seq_handle, dest_queue, &ev);
+}
+
+/* change the tempo */
+static void do_tempo(int us)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_MUCH) {
+ double bpm;
+ bpm = 60.0E6 / (double) us;
+ printf("Tempo %d us/beat, %.2f bpm\n", us, bpm);
+ }
+
+ /* store the new tempo and timestamp of the tempo change */
+ local_secs = tick2time_dbl(Mf_currtime);
+ local_ticks = Mf_currtime;
+ local_tempo = us;
+
+ set_event_header(&ev);
+ if (!slave)
+ snd_seq_change_queue_tempo(seq_handle, dest_queue, us, &ev);
+}
+
+static void do_noteon(int chan, int pitch, int vol)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: NoteOn (%d) %d %d\n", Mf_currtime, chan, pitch, vol);
+ set_event_header(&ev);
+ snd_seq_ev_set_noteon(&ev, chan, pitch, vol);
+ write_ev(&ev);
+}
+
+
+static void do_noteoff(int chan, int pitch, int vol)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: NoteOff (%d) %d %d\n", Mf_currtime, chan, pitch, vol);
+ set_event_header(&ev);
+ snd_seq_ev_set_noteoff(&ev, chan, pitch, vol);
+ write_ev(&ev);
+}
+
+
+static void do_program(int chan, int program)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: Program (%d) %d\n", Mf_currtime, chan, program);
+ set_event_header(&ev);
+ snd_seq_ev_set_pgmchange(&ev, chan, program);
+ write_ev(&ev);
+}
+
+
+static void do_parameter(int chan, int control, int value)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: Control (%d) %d %d\n", Mf_currtime, chan, control, value);
+ set_event_header(&ev);
+ snd_seq_ev_set_controller(&ev, chan, control, value);
+ write_ev(&ev);
+}
+
+
+static void do_pitchbend(int chan, int lsb, int msb)
+{ /* !@#$% lsb & msb are in the wrong order in docs */
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: Pitchbend (%d) %d %d\n", Mf_currtime, chan, lsb, msb);
+ set_event_header(&ev);
+ snd_seq_ev_set_pitchbend(&ev, chan, (lsb + (msb << 7)) - 8192);
+ write_ev(&ev);
+}
+
+static void do_pressure(int chan, int pitch, int pressure)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: KeyPress (%d) %d %d\n", Mf_currtime, chan, pitch, pressure);
+ set_event_header(&ev);
+ snd_seq_ev_set_keypress(&ev, chan, pitch, pressure);
+ write_ev(&ev);
+}
+
+static void do_chanpressure(int chan, int pressure)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_EVENT)
+ printf("%ld: ChanPress (%d) %d\n", Mf_currtime, chan, pressure);
+ set_event_header(&ev);
+ snd_seq_ev_set_chanpress(&ev, chan, pressure);
+ write_ev(&ev);
+}
+
+static void do_sysex(int len, char *msg)
+{
+ snd_seq_event_t ev;
+
+ if (verbose >= VERB_MUCH) {
+ int c;
+ printf("%ld: Sysex, len=%d\n", Mf_currtime, len);
+ for (c = 0; c < len; c++) {
+ printf(" %02x", (unsigned char)msg[c]);
+ if (c % 16 == 15)
+ putchar('\n');
+ }
+ if (c % 16 != 15)
+ putchar('\n');
+ }
+
+ set_event_header(&ev);
+ snd_seq_ev_set_sysex(&ev, len, msg);
+ write_ev(&ev);
+}
+
+static snd_seq_event_t *wait_for_event(void)
+{
+ int left;
+ snd_seq_event_t *input_event;
+
+ if (use_blocking_mode) {
+ /* read the event - blocked until any event is read */
+ left = snd_seq_event_input(seq_handle, &input_event);
+ } else {
+ /* read the event - using select syscall */
+ while ((left = snd_seq_event_input(seq_handle, &input_event)) >= 0 &&
+ input_event == NULL) {
+ int npfds = snd_seq_poll_descriptors_count(seq_handle, POLLIN);
+ struct pollfd *pfds = alloca(sizeof(*pfds) * npfds);
+ snd_seq_poll_descriptors(seq_handle, pfds, npfds, POLLIN);
+ if ((left = poll(pfds, npfds, -1)) < 0) {
+ printf("poll error = %i (%s)\n", errno, snd_strerror(errno));
+ exit(1);
+ }
+ }
+ }
+
+ if (left < 0) {
+ printf("alsa_sync error!:%s\n", snd_strerror(left));
+ return NULL;
+ }
+
+ return input_event;
+}
+
+/* synchronize to the end of the event */
+static void alsa_sync(void)
+{
+ /* send the echo event to the self client. */
+ if (verbose >= VERB_MUCH)
+ printf("alsa_sync syncing...\n");
+ /* dump the buffer */
+ snd_seq_drain_output(seq_handle);
+ snd_seq_sync_output_queue(seq_handle);
+ if (verbose >= VERB_MUCH)
+ printf("alsa_sync synced\n");
+ sleep(1); /* give a time for note releasing.. */
+}
+
+
+/* wait for the start of the queue */
+static void wait_start(void)
+{
+ snd_seq_event_t *input_event;
+
+ /* wait for the start event from the system timer */
+ for (;;) {
+ input_event = wait_for_event();
+ if (input_event) {
+ if (verbose >= VERB_MUCH)
+ printf("wait_start got event. type=%d, flags=%d\n",
+ input_event->type, input_event->flags);
+ if (input_event->type == SND_SEQ_EVENT_START &&
+ input_event->data.queue.queue == dest_queue) {
+ snd_seq_free_event(input_event);
+ break;
+ }
+ snd_seq_free_event(input_event);
+ }
+ }
+ if (verbose >= VERB_MUCH)
+ printf("start received\n");
+}
+
+
+/* print the usage */
+static void usage(void)
+{
+ fprintf(stderr, "usage: playmidi1 [options] [file]\n");
+ fprintf(stderr, " options:\n");
+ fprintf(stderr, " -v: verbose mode\n");
+ fprintf(stderr, " -a client:port : set destination address (default=%d:%d)\n",
+ DEST_CLIENT_NUMBER, DEST_PORT_NUMBER);
+ fprintf(stderr, " -q queue: use the specified queue\n");
+ fprintf(stderr, " -s queue: slave mode (allow external clock synchronization)\n");
+ fprintf(stderr, " -r : play on real-time mode\n");
+ fprintf(stderr, " -b : play on non-blocking mode\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int tmp;
+ int c;
+ snd_seq_addr_t dest_addr;
+ const char *addr = "65:0";
+
+ while ((c = getopt(argc, argv, "s:a:p:q:vrb")) != -1) {
+ switch (c) {
+ case 'v':
+ verbose++;
+ break;
+ case 'a':
+ case 'p':
+ addr = optarg;
+ break;
+ case 'q':
+ dest_queue = atoi(optarg);
+ if (dest_queue < 0) {
+ fprintf(stderr, "invalid queue number %d\n", dest_queue);
+ exit(1);
+ }
+ break;
+ case 's':
+ slave = 1;
+ dest_queue = atoi(optarg);
+ if (dest_queue < 0) {
+ fprintf(stderr, "invalid queue number %d\n", dest_queue);
+ exit(1);
+ }
+ break;
+ case 'r':
+ use_realtime = 1;
+ break;
+ case 'b':
+ use_blocking_mode = 0;
+ break;
+ default:
+ usage();
+ exit(1);
+ }
+ }
+
+ if (verbose >= VERB_INFO) {
+ if (use_realtime)
+ printf("ALSA MIDI Player, feeding events to real-time queue\n");
+ else
+ printf("ALSA MIDI Player, feeding events to song queue\n");
+ }
+
+ /* open the sequencer device */
+ /* Here we open the device in read/write for slave mode. */
+ tmp = snd_seq_open(&seq_handle, "hw", slave ? SND_SEQ_OPEN_DUPLEX : SND_SEQ_OPEN_OUTPUT, 0);
+ if (tmp < 0) {
+ perror("open /dev/snd/seq");
+ exit(1);
+ }
+
+ tmp = snd_seq_nonblock(seq_handle, !use_blocking_mode);
+ if (tmp < 0) {
+ perror("block_mode");
+ exit(1);
+ }
+
+ /* set the name */
+ /* set the event filter to receive only the echo event */
+ /* if running in slave mode, also listen for a START event */
+ if (slave)
+ snd_seq_set_client_event_filter(seq_handle, SND_SEQ_EVENT_START);
+ snd_seq_set_client_name(seq_handle, "MIDI file player");
+
+ /* create the port */
+ my_port = snd_seq_create_simple_port(seq_handle, "Port 0",
+ SND_SEQ_PORT_CAP_WRITE |
+ SND_SEQ_PORT_CAP_READ,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+ if (my_port < 0) {
+ perror("create port");
+ exit(1);
+ }
+
+ if (snd_seq_parse_address(seq_handle, &dest_addr, addr) < 0) {
+ perror("invalid destination address");
+ exit(1);
+ }
+ dest_client = dest_addr.client;
+ dest_port = dest_addr.port;
+
+ /* set the queue */
+ if (dest_queue >= 0) {
+ shared_queue = 1;
+ if (snd_seq_set_queue_usage(seq_handle, dest_queue, 1) < 0) {
+ perror("use queue");
+ exit(1);
+ }
+ } else {
+ shared_queue = 0;
+ dest_queue = snd_seq_alloc_queue(seq_handle);
+ if (dest_queue < 0) {
+ perror("alloc queue");
+ exit(1);
+ }
+ }
+
+ /* set the subscriber */
+ tmp = snd_seq_connect_to(seq_handle, my_port, dest_client, dest_port);
+ if (tmp < 0) {
+ perror("subscribe");
+ exit(1);
+ }
+
+ /* subscribe for the timer START event */
+ if (slave) {
+ tmp = snd_seq_connect_from(seq_handle, my_port,
+ SND_SEQ_CLIENT_SYSTEM,
+ dest_queue + 16 /*snd_seq_queue_sync_port(dest_queue)*/);
+ if (tmp < 0) {
+ perror("subscribe");
+ exit(1);
+ }
+ }
+
+ /* change the pool size */
+ if (snd_seq_set_client_pool_output(seq_handle, WRITE_POOL_SIZE) < 0 ||
+ snd_seq_set_client_pool_input(seq_handle, READ_POOL_SIZE) < 0 ||
+ snd_seq_set_client_pool_output_room(seq_handle, WRITE_POOL_SPACE) < 0) {
+ perror("pool");
+ exit(1);
+ }
+
+ if (optind < argc) {
+ F = fopen(argv[optind], "r");
+ if (F == NULL) {
+ fprintf(stderr, "playmidi1: can't open file %s\n", argv[optind]);
+ exit(1);
+ }
+ } else
+ F = stdin;
+
+ Mf_header = do_header;
+ Mf_tempo = do_tempo;
+ Mf_getc = mygetc;
+ Mf_text = mytext;
+
+ Mf_noteon = do_noteon;
+ Mf_noteoff = do_noteoff;
+ Mf_program = do_program;
+ Mf_parameter = do_parameter;
+ Mf_pitchbend = do_pitchbend;
+ Mf_pressure = do_pressure;
+ Mf_chanpressure = do_chanpressure;
+ Mf_sysex = do_sysex;
+
+ /* go.. go.. go.. */
+ mfread();
+
+ alsa_sync();
+ if (! shared_queue)
+ alsa_stop_timer();
+
+ snd_seq_close(seq_handle);
+
+ if (verbose >= VERB_INFO) {
+ printf("Stopping at %f s, tick %f\n",
+ tick2time_dbl(Mf_currtime + 1), (double) (Mf_currtime + 1));
+ }
+
+ exit(0);
+}
diff --git a/alsa-lib/test/queue_timer.c b/alsa-lib/test/queue_timer.c
new file mode 100644
index 0000000..c4ffb19
--- /dev/null
+++ b/alsa-lib/test/queue_timer.c
@@ -0,0 +1,128 @@
+#include <unistd.h>
+#include <sys/time.h>
+#include <alsa/asoundlib.h>
+#include <alsa/seq.h>
+
+void normalize(struct timeval *tv)
+{
+ if (tv->tv_sec == 0) {
+ while (tv->tv_usec <= -1000000) { tv->tv_usec += 1000000; --tv->tv_sec; }
+ while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; ++tv->tv_sec; }
+ } else if (tv->tv_sec < 0) {
+ while (tv->tv_usec <= -1000000) { tv->tv_usec += 1000000; --tv->tv_sec; }
+ while (tv->tv_usec > 0) { tv->tv_usec -= 1000000; ++tv->tv_sec; }
+ } else {
+ while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; ++tv->tv_sec; }
+ while (tv->tv_usec < 0) { tv->tv_usec += 1000000; --tv->tv_sec; }
+ }
+}
+
+int
+main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+{
+ snd_seq_t *handle;
+ int portid;
+ /* int npfd;
+ struct pollfd *pfd;
+ */
+ int queue;
+ /* int i;
+ int rval;'
+ */
+ struct timeval starttv, prevdiff;
+ int countdown = -1;
+ /* snd_seq_queue_timer_t *timer;
+ snd_timer_id_t *timerid;
+ */
+
+ if (snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
+ fprintf(stderr, "failed to open ALSA sequencer interface\n");
+ return 1;
+ }
+
+ snd_seq_set_client_name(handle, "generator");
+
+ if ((portid = snd_seq_create_simple_port
+ (handle, "generator",
+ SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ, 0)) < 0) {
+ fprintf(stderr, "failed to create ALSA sequencer port\n");
+ return 1;
+ }
+
+ if ((queue = snd_seq_alloc_queue(handle)) < 0) {
+ fprintf(stderr, "failed to create ALSA sequencer queue\n");
+ return 1;
+ }
+/*
+ snd_seq_queue_timer_alloca(&timer);
+ snd_seq_get_queue_timer(handle, queue, timer);
+ snd_timer_id_alloca(&timerid);
+ snd_timer_id_set_class(timerid, SND_TIMER_CLASS_PCM);
+ snd_timer_id_set_sclass(timerid, SND_TIMER_SCLASS_NONE);
+ snd_timer_id_set_card(timerid, 0);
+ snd_timer_id_set_device(timerid, 0);
+ snd_timer_id_set_subdevice(timerid, 0);
+ snd_seq_queue_timer_set_id(timer, timerid);
+ snd_seq_set_queue_timer(handle, queue, timer);
+*/
+ snd_seq_start_queue(handle, queue, 0);
+ snd_seq_drain_output(handle);
+
+ gettimeofday(&starttv, 0);
+ prevdiff.tv_sec = 0;
+ prevdiff.tv_usec = 0;
+
+ while (countdown != 0) {
+
+ snd_seq_queue_status_t *status;
+ const snd_seq_real_time_t *rtime;
+ struct timeval tv, diff, diffdiff;
+ struct timespec ts;
+
+ snd_seq_queue_status_alloca(&status);
+
+ snd_seq_get_queue_status(handle, queue, status);
+ rtime = snd_seq_queue_status_get_real_time(status);
+
+ gettimeofday(&tv, 0);
+
+ tv.tv_sec -= starttv.tv_sec;
+ tv.tv_usec -= starttv.tv_usec;
+ normalize(&tv);
+
+ diff.tv_sec = tv.tv_sec - rtime->tv_sec;
+ diff.tv_usec = tv.tv_usec - rtime->tv_nsec / 1000;
+ normalize(&diff);
+
+ diffdiff.tv_sec = diff.tv_sec - prevdiff.tv_sec;
+ diffdiff.tv_usec = diff.tv_usec - prevdiff.tv_usec;
+ normalize(&diffdiff);
+ prevdiff = diff;
+
+ fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n diff: %12ld sec %8ld usec\n diffdiff: %12ld sec %8ld usec\n",
+ tv.tv_sec, tv.tv_usec,
+ (long)rtime->tv_sec, (long)rtime->tv_nsec / 1000,
+ diff.tv_sec, diff.tv_usec,
+ (long)diffdiff.tv_sec, (long)diffdiff.tv_usec);
+
+ if (diffdiff.tv_usec > 5000 ||
+ diffdiff.tv_usec < -5000) {
+ fprintf(stderr, "oops! queue slipped\n");
+ if (tv.tv_sec < 5) {
+ fprintf(stderr, "(ignoring in first few seconds)\n");
+ } else {
+ countdown = 2;
+ }
+ } else {
+ if (countdown > 0) --countdown;
+ }
+
+ fprintf(stderr, "\n");
+// sleep(1);
+ ts.tv_sec = 0;
+ ts.tv_nsec = 500000000;
+ nanosleep(&ts, 0);
+ }
+ return EXIT_SUCCESS;
+}
+
diff --git a/alsa-lib/test/rawmidi.c b/alsa-lib/test/rawmidi.c
new file mode 100644
index 0000000..67f585b
--- /dev/null
+++ b/alsa-lib/test/rawmidi.c
@@ -0,0 +1,241 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "../include/asoundlib.h"
+#include <signal.h>
+
+static void usage(void)
+{
+ fprintf(stderr, "usage: rawmidi [options]\n");
+ fprintf(stderr, " options:\n");
+ fprintf(stderr, " -v: verbose mode\n");
+ fprintf(stderr, " -i device-id : test ALSA input device\n");
+ fprintf(stderr, " -o device-id : test ALSA output device\n");
+ fprintf(stderr, " -I node : test input node\n");
+ fprintf(stderr, " -O node : test output node\n");
+ fprintf(stderr, " -t: test midi thru\n");
+ fprintf(stderr, " example:\n");
+ fprintf(stderr, " rawmidi -i hw:0,0 -O /dev/midi1\n");
+ fprintf(stderr, " tests input for card 0, device 0, using snd_rawmidi API\n");
+ fprintf(stderr, " and /dev/midi1 using file descriptors\n");
+}
+
+int stop=0;
+
+void sighandler(int dum)
+{
+ stop=1;
+}
+
+int main(int argc,char** argv)
+{
+ int i;
+ int err;
+ int thru=0;
+ int verbose = 0;
+ char *device_in = NULL;
+ char *device_out = NULL;
+ char *node_in = NULL;
+ char *node_out = NULL;
+
+ int fd_in = -1,fd_out = -1;
+ snd_rawmidi_t *handle_in = 0,*handle_out = 0;
+
+ if (argc==1) {
+ usage();
+ exit(0);
+ }
+
+ for (i = 1 ; i<argc ; i++) {
+ if (argv[i][0]=='-') {
+ switch (argv[i][1]) {
+ case 'h':
+ usage();
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 't':
+ thru = 1;
+ break;
+ case 'i':
+ if (i + 1 < argc)
+ device_in = argv[++i];
+ break;
+ case 'I':
+ if (i + 1 < argc)
+ node_in = argv[++i];
+ break;
+ case 'o':
+ if (i + 1 < argc)
+ device_out = argv[++i];
+ break;
+ case 'O':
+ if (i + 1 < argc)
+ node_out = argv[++i];
+ break;
+ }
+ }
+ }
+
+ if (verbose) {
+ fprintf(stderr,"Using: \n");
+ fprintf(stderr,"Input: ");
+ if (device_in) {
+ fprintf(stderr,"device %s\n",device_in);
+ }else if (node_in){
+ fprintf(stderr,"%s\n",node_in);
+ }else{
+ fprintf(stderr,"NONE\n");
+ }
+ fprintf(stderr,"Output: ");
+ if (device_out) {
+ fprintf(stderr,"device %s\n",device_out);
+ }else if (node_out){
+ fprintf(stderr,"%s\n",node_out);
+ }else{
+ fprintf(stderr,"NONE\n");
+ }
+ }
+
+ if (device_in) {
+ err = snd_rawmidi_open(&handle_in,NULL,device_in,0);
+ if (err) {
+ fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",device_in,err);
+ }
+ }
+ if (node_in && (!node_out || strcmp(node_out,node_in))) {
+ fd_in = open(node_in,O_RDONLY);
+ if (fd_in<0) {
+ fprintf(stderr,"open %s for input failed\n",node_in);
+ }
+ }
+
+ signal(SIGINT,sighandler);
+
+ if (device_out) {
+ err = snd_rawmidi_open(NULL,&handle_out,device_out,0);
+ if (err) {
+ fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",device_out,err);
+ }
+ }
+ if (node_out && (!node_in || strcmp(node_out,node_in))) {
+ fd_out = open(node_out,O_WRONLY);
+ if (fd_out<0) {
+ fprintf(stderr,"open %s for output failed\n",node_out);
+ }
+ }
+
+ if (node_in && node_out && strcmp(node_out,node_in)==0) {
+ fd_in = fd_out = open(node_out,O_RDWR);
+ if (fd_out<0) {
+ fprintf(stderr,"open %s for input and output failed\n",node_out);
+ }
+ }
+
+
+
+ if (!thru) {
+ if (handle_in || fd_in!=-1) {
+ fprintf(stderr,"Read midi in\n");
+ fprintf(stderr,"Press ctrl-c to stop\n");
+ }
+
+ if (handle_in) {
+ unsigned char ch;
+ while (!stop) {
+ snd_rawmidi_read(handle_in,&ch,1);
+ if (verbose) {
+ fprintf(stderr,"read %02x\n",ch);
+ }
+ }
+ }
+ if (fd_in!=-1) {
+ unsigned char ch;
+ while (!stop) {
+ read(fd_in,&ch,1);
+ if (verbose) {
+ fprintf(stderr,"read %02x\n",ch);
+ }
+ }
+ }
+
+ if (handle_out || fd_out!=-1) {
+ fprintf(stderr,"Writing note on / note off\n");
+ }
+
+ if (handle_out) {
+ unsigned char ch;
+ ch=0x90; snd_rawmidi_write(handle_out,&ch,1);
+ ch=60; snd_rawmidi_write(handle_out,&ch,1);
+ ch=100; snd_rawmidi_write(handle_out,&ch,1);
+ snd_rawmidi_drain(handle_out);
+ sleep(1);
+ ch=0x90; snd_rawmidi_write(handle_out,&ch,1);
+ ch=60; snd_rawmidi_write(handle_out,&ch,1);
+ ch=0; snd_rawmidi_write(handle_out,&ch,1);
+ snd_rawmidi_drain(handle_out);
+ }
+ if (fd_out!=-1) {
+ unsigned char ch;
+ ch=0x90; write(fd_out,&ch,1);
+ ch=60; write(fd_out,&ch,1);
+ ch=100; write(fd_out,&ch,1);
+ sleep(1);
+ ch=0x90; write(fd_out,&ch,1);
+ ch=60; write(fd_out,&ch,1);
+ ch=0; write(fd_out,&ch,1);
+ }
+ } else {
+ if ((handle_in || fd_in!=-1) && (handle_out || fd_out!=-1)) {
+ if (verbose) {
+ fprintf(stderr,"Testing midi thru in\n");
+ }
+ while (!stop) {
+ unsigned char ch;
+
+ if (handle_in) {
+ snd_rawmidi_read(handle_in,&ch,1);
+ }
+ if (fd_in!=-1) {
+ read(fd_in,&ch,1);
+ }
+ if (verbose) {
+ fprintf(stderr,"thru: %02x\n",ch);
+ }
+
+ if (handle_out) {
+ snd_rawmidi_write(handle_out,&ch,1);
+ snd_rawmidi_drain(handle_out);
+ }
+ if (fd_out!=-1) {
+ write(fd_out,&ch,1);
+ }
+ }
+ }else{
+ fprintf(stderr,"Testing midi thru needs both input and output\n");
+ exit(-1);
+ }
+ }
+
+ if (verbose) {
+ fprintf(stderr,"Closing\n");
+ }
+
+ if (handle_in) {
+ snd_rawmidi_drain(handle_in);
+ snd_rawmidi_close(handle_in);
+ }
+ if (handle_out) {
+ snd_rawmidi_drain(handle_out);
+ snd_rawmidi_close(handle_out);
+ }
+ if (fd_in!=-1) {
+ close(fd_in);
+ }
+ if (fd_out!=-1) {
+ close(fd_out);
+ }
+
+ return 0;
+}
diff --git a/alsa-lib/test/seq-decoder.c b/alsa-lib/test/seq-decoder.c
new file mode 100644
index 0000000..b110e98
--- /dev/null
+++ b/alsa-lib/test/seq-decoder.c
@@ -0,0 +1,353 @@
+/*
+ * Simple event decoder
+ */
+
+static char *event_names[256] = {
+ [SND_SEQ_EVENT_SYSTEM]= "System",
+ [SND_SEQ_EVENT_RESULT]= "Result",
+ [SND_SEQ_EVENT_NOTE]= "Note",
+ [SND_SEQ_EVENT_NOTEON]= "Note On",
+ [SND_SEQ_EVENT_NOTEOFF]= "Note Off",
+ [SND_SEQ_EVENT_KEYPRESS]= "Key Pressure",
+ [SND_SEQ_EVENT_CONTROLLER]= "Controller",
+ [SND_SEQ_EVENT_PGMCHANGE]= "Program Change",
+ [SND_SEQ_EVENT_CHANPRESS]= "Channel Pressure",
+ [SND_SEQ_EVENT_PITCHBEND]= "Pitchbend",
+ [SND_SEQ_EVENT_CONTROL14]= "Control14",
+ [SND_SEQ_EVENT_NONREGPARAM]= "Nonregparam",
+ [SND_SEQ_EVENT_REGPARAM]= "Regparam",
+ [SND_SEQ_EVENT_SONGPOS]= "Song Position",
+ [SND_SEQ_EVENT_SONGSEL]= "Song Select",
+ [SND_SEQ_EVENT_QFRAME]= "Qframe",
+ [SND_SEQ_EVENT_TIMESIGN]= "SMF Time Signature",
+ [SND_SEQ_EVENT_KEYSIGN]= "SMF Key Signature",
+ [SND_SEQ_EVENT_START]= "Start",
+ [SND_SEQ_EVENT_CONTINUE]= "Continue",
+ [SND_SEQ_EVENT_STOP]= "Stop",
+ [SND_SEQ_EVENT_SETPOS_TICK]= "Set Position Tick",
+ [SND_SEQ_EVENT_SETPOS_TIME]= "Set Position Time",
+ [SND_SEQ_EVENT_TEMPO]= "Tempo",
+ [SND_SEQ_EVENT_CLOCK]= "Clock",
+ [SND_SEQ_EVENT_TICK]= "Tick",
+ [SND_SEQ_EVENT_TUNE_REQUEST]= "Tune Request",
+ [SND_SEQ_EVENT_RESET]= "Reset",
+ [SND_SEQ_EVENT_SENSING]= "Active Sensing",
+ [SND_SEQ_EVENT_ECHO]= "Echo",
+ [SND_SEQ_EVENT_OSS]= "OSS",
+ [SND_SEQ_EVENT_CLIENT_START]= "Client Start",
+ [SND_SEQ_EVENT_CLIENT_EXIT]= "Client Exit",
+ [SND_SEQ_EVENT_CLIENT_CHANGE]= "Client Change",
+ [SND_SEQ_EVENT_PORT_START]= "Port Start",
+ [SND_SEQ_EVENT_PORT_EXIT]= "Port Exit",
+ [SND_SEQ_EVENT_PORT_CHANGE]= "Port Change",
+ [SND_SEQ_EVENT_PORT_SUBSCRIBED]= "Port Subscribed",
+ [SND_SEQ_EVENT_PORT_UNSUBSCRIBED]= "Port Unsubscribed",
+#if 0
+ [SND_SEQ_EVENT_SAMPLE]= "Sample",
+ [SND_SEQ_EVENT_SAMPLE_CLUSTER]= "Sample Cluster",
+ [SND_SEQ_EVENT_SAMPLE_START]= "Sample Start",
+ [SND_SEQ_EVENT_SAMPLE_STOP]= "Sample Stop",
+ [SND_SEQ_EVENT_SAMPLE_FREQ]= "Sample Freq",
+ [SND_SEQ_EVENT_SAMPLE_VOLUME]= "Sample Volume",
+ [SND_SEQ_EVENT_SAMPLE_LOOP]= "Sample Loop",
+ [SND_SEQ_EVENT_SAMPLE_POSITION]= "Sample Position",
+ [SND_SEQ_EVENT_SAMPLE_PRIVATE1]= "Sample Private1",
+#endif
+ [SND_SEQ_EVENT_USR0]= "User 0",
+ [SND_SEQ_EVENT_USR1]= "User 1",
+ [SND_SEQ_EVENT_USR2]= "User 2",
+ [SND_SEQ_EVENT_USR3]= "User 3",
+ [SND_SEQ_EVENT_USR4]= "User 4",
+ [SND_SEQ_EVENT_USR5]= "User 5",
+ [SND_SEQ_EVENT_USR6]= "User 6",
+ [SND_SEQ_EVENT_USR7]= "User 7",
+ [SND_SEQ_EVENT_USR8]= "User 8",
+ [SND_SEQ_EVENT_USR9]= "User 9",
+#if 0
+ [SND_SEQ_EVENT_INSTR_BEGIN]= "Instr Begin",
+ [SND_SEQ_EVENT_INSTR_END]= "Instr End",
+ [SND_SEQ_EVENT_INSTR_INFO]= "Instr Info",
+ [SND_SEQ_EVENT_INSTR_INFO_RESULT]= "Instr Info Result",
+ [SND_SEQ_EVENT_INSTR_FINFO]= "Instr Font Info",
+ [SND_SEQ_EVENT_INSTR_FINFO_RESULT]= "Instr Font Info Result",
+ [SND_SEQ_EVENT_INSTR_RESET]= "Instr Reset",
+ [SND_SEQ_EVENT_INSTR_STATUS]= "Instr Status",
+ [SND_SEQ_EVENT_INSTR_STATUS_RESULT]= "Instr Status Result",
+ [SND_SEQ_EVENT_INSTR_PUT]= "Instr Put",
+ [SND_SEQ_EVENT_INSTR_GET]= "Instr Get",
+ [SND_SEQ_EVENT_INSTR_GET_RESULT]= "Instr Get Result",
+ [SND_SEQ_EVENT_INSTR_FREE]= "Instr Free",
+ [SND_SEQ_EVENT_INSTR_LIST]= "Instr List",
+ [SND_SEQ_EVENT_INSTR_LIST_RESULT]= "Instr List Result",
+ [SND_SEQ_EVENT_INSTR_CLUSTER]= "Instr Cluster",
+ [SND_SEQ_EVENT_INSTR_CLUSTER_GET]= "Instr Cluster Get",
+ [SND_SEQ_EVENT_INSTR_CLUSTER_RESULT]= "Instr Cluster Result",
+ [SND_SEQ_EVENT_INSTR_CHANGE]= "Instr Change",
+#endif
+ [SND_SEQ_EVENT_SYSEX]= "Sysex",
+ [SND_SEQ_EVENT_BOUNCE]= "Bounce",
+ [SND_SEQ_EVENT_USR_VAR0]= "User Var0",
+ [SND_SEQ_EVENT_USR_VAR1]= "User Var1",
+ [SND_SEQ_EVENT_USR_VAR2]= "User Var2",
+ [SND_SEQ_EVENT_USR_VAR3]= "User Var3",
+ [SND_SEQ_EVENT_USR_VAR4]= "User Var4",
+#if 0
+ [SND_SEQ_EVENT_IPCSHM]= "IPC Shm",
+ [SND_SEQ_EVENT_USR_VARIPC0]= "User IPC0",
+ [SND_SEQ_EVENT_USR_VARIPC1]= "User IPC1",
+ [SND_SEQ_EVENT_USR_VARIPC2]= "User IPC2",
+ [SND_SEQ_EVENT_USR_VARIPC3]= "User IPC3",
+ [SND_SEQ_EVENT_USR_VARIPC4]= "User IPC4",
+#endif
+ [SND_SEQ_EVENT_NONE]= "None",
+};
+
+int decode_event(snd_seq_event_t * ev)
+{
+ char *space = " ";
+
+ printf("EVENT>>> Type = %d, flags = 0x%x", ev->type, ev->flags);
+ switch (ev->flags & SND_SEQ_TIME_STAMP_MASK) {
+ case SND_SEQ_TIME_STAMP_TICK:
+ printf(", time = %d ticks",
+ ev->time.tick);
+ break;
+ case SND_SEQ_TIME_STAMP_REAL:
+ printf(", time = %d.%09d",
+ (int)ev->time.time.tv_sec,
+ (int)ev->time.time.tv_nsec);
+ break;
+ }
+ printf("\n%sSource = %d.%d, dest = %d.%d, queue = %d\n",
+ space,
+ ev->source.client,
+ ev->source.port,
+ ev->dest.client,
+ ev->dest.port,
+ ev->queue);
+
+ if (event_names[ev->type])
+ printf("%sEvent = %s", space, event_names[ev->type]);
+ else
+ printf("%sEvent = Reserved %d\n", space, ev->type);
+ /* decode the actual event data... */
+ switch (ev->type) {
+ case SND_SEQ_EVENT_NOTE:
+ printf("; ch=%d, note=%d, velocity=%d, off_velocity=%d, duration=%d\n",
+ ev->data.note.channel,
+ ev->data.note.note,
+ ev->data.note.velocity,
+ ev->data.note.off_velocity,
+ ev->data.note.duration);
+ break;
+
+ case SND_SEQ_EVENT_NOTEON:
+ case SND_SEQ_EVENT_NOTEOFF:
+ case SND_SEQ_EVENT_KEYPRESS:
+ printf("; ch=%d, note=%d, velocity=%d\n",
+ ev->data.note.channel,
+ ev->data.note.note,
+ ev->data.note.velocity);
+ break;
+
+ case SND_SEQ_EVENT_CONTROLLER:
+ printf("; ch=%d, param=%i, value=%i\n",
+ ev->data.control.channel,
+ ev->data.control.param,
+ ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_PGMCHANGE:
+ printf("; ch=%d, program=%i\n",
+ ev->data.control.channel,
+ ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_CHANPRESS:
+ case SND_SEQ_EVENT_PITCHBEND:
+ printf("; ch=%d, value=%i\n",
+ ev->data.control.channel,
+ ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_SYSEX:
+ {
+ unsigned char *sysex = (unsigned char *) ev + sizeof(snd_seq_event_t);
+ unsigned int c;
+
+ printf("; len=%d [", ev->data.ext.len);
+
+ for (c = 0; c < ev->data.ext.len; c++) {
+ printf("%02x%s", sysex[c], c < ev->data.ext.len - 1 ? ":" : "");
+ }
+ printf("]\n");
+ }
+ break;
+
+ case SND_SEQ_EVENT_QFRAME:
+ printf("; frame=0x%02x\n", ev->data.control.value);
+ break;
+
+ case SND_SEQ_EVENT_CLOCK:
+ case SND_SEQ_EVENT_START:
+ case SND_SEQ_EVENT_CONTINUE:
+ case SND_SEQ_EVENT_STOP:
+ printf("; queue = %i\n", ev->data.queue.queue);
+ break;
+
+ case SND_SEQ_EVENT_SENSING:
+ printf("\n");
+ break;
+
+ case SND_SEQ_EVENT_ECHO:
+ {
+ int i;
+
+ printf("; ");
+ for (i = 0; i < 8; i++) {
+ printf("%02i%s", ev->data.raw8.d[i], i < 7 ? ":" : "\n");
+ }
+ }
+ break;
+
+ case SND_SEQ_EVENT_CLIENT_START:
+ case SND_SEQ_EVENT_CLIENT_EXIT:
+ case SND_SEQ_EVENT_CLIENT_CHANGE:
+ printf("; client=%i\n", ev->data.addr.client);
+ break;
+
+ case SND_SEQ_EVENT_PORT_START:
+ case SND_SEQ_EVENT_PORT_EXIT:
+ case SND_SEQ_EVENT_PORT_CHANGE:
+ printf("; client=%i, port = %i\n", ev->data.addr.client, ev->data.addr.port);
+ break;
+
+ case SND_SEQ_EVENT_PORT_SUBSCRIBED:
+ case SND_SEQ_EVENT_PORT_UNSUBSCRIBED:
+ printf("; %i:%i -> %i:%i\n",
+ ev->data.connect.sender.client, ev->data.connect.sender.port,
+ ev->data.connect.dest.client, ev->data.connect.dest.port);
+ break;
+
+ default:
+ printf("; not implemented\n");
+ }
+
+
+ switch (ev->flags & SND_SEQ_EVENT_LENGTH_MASK) {
+ case SND_SEQ_EVENT_LENGTH_FIXED:
+ return sizeof(snd_seq_event_t);
+
+ case SND_SEQ_EVENT_LENGTH_VARIABLE:
+ return sizeof(snd_seq_event_t) + ev->data.ext.len;
+ }
+
+ return 0;
+}
+
+void event_decoder_start_timer(snd_seq_t *handle, int queue,
+ int client ATTRIBUTE_UNUSED,
+ int port ATTRIBUTE_UNUSED)
+{
+ int err;
+
+ if ((err = snd_seq_start_queue(handle, queue, NULL))<0)
+ fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err));
+ while (snd_seq_drain_output(handle)>0)
+ sleep(1);
+}
+
+void event_decoder(snd_seq_t *handle, int argc, char *argv[])
+{
+ snd_seq_event_t *ev;
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_subscribe_t *sub;
+ snd_seq_addr_t addr;
+ int client, port, queue, max, err, v1, v2;
+ char *ptr;
+ struct pollfd *pfds;
+
+ if ((client = snd_seq_client_id(handle))<0) {
+ fprintf(stderr, "Cannot determine client number: %s\n", snd_strerror(client));
+ return;
+ }
+ printf("Client ID = %i\n", client);
+ if ((queue = snd_seq_alloc_queue(handle))<0) {
+ fprintf(stderr, "Cannot allocate queue: %s\n", snd_strerror(queue));
+ return;
+ }
+ printf("Queue ID = %i\n", queue);
+ if ((err = snd_seq_nonblock(handle, 1))<0)
+ fprintf(stderr, "Cannot set nonblock mode: %s\n", snd_strerror(err));
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_port_info_set_name(pinfo, "Input");
+ snd_seq_port_info_set_type(pinfo, SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+ snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_WRITE);
+ if ((err = snd_seq_create_port(handle, pinfo)) < 0) {
+ fprintf(stderr, "Cannot create input port: %s\n", snd_strerror(err));
+ return;
+ }
+ port = snd_seq_port_info_get_port(pinfo);
+ event_decoder_start_timer(handle, queue, client, port);
+
+ snd_seq_port_subscribe_alloca(&sub);
+ addr.client = SND_SEQ_CLIENT_SYSTEM;
+ addr.port = SND_SEQ_PORT_SYSTEM_ANNOUNCE;
+ snd_seq_port_subscribe_set_sender(sub, &addr);
+ addr.client = client;
+ addr.port = port;
+ snd_seq_port_subscribe_set_dest(sub, &addr);
+ snd_seq_port_subscribe_set_queue(sub, queue);
+ snd_seq_port_subscribe_set_time_update(sub, 1);
+ snd_seq_port_subscribe_set_time_real(sub, 1);
+ if ((err = snd_seq_subscribe_port(handle, sub))<0) {
+ fprintf(stderr, "Cannot subscribe announce port: %s\n", snd_strerror(err));
+ return;
+ }
+
+ addr.client = SND_SEQ_CLIENT_SYSTEM;
+ addr.port = SND_SEQ_PORT_SYSTEM_TIMER;
+ snd_seq_port_subscribe_set_sender(sub, &addr);
+ if ((err = snd_seq_subscribe_port(handle, sub))<0) {
+ fprintf(stderr, "Cannot subscribe timer port: %s\n", snd_strerror(err));
+ return;
+ }
+
+ for (max = 0; max < argc; max++) {
+ ptr = argv[max];
+ if (!ptr)
+ continue;
+ snd_seq_port_subscribe_set_time_real(sub, 0);
+ if (tolower(*ptr) == 'r') {
+ snd_seq_port_subscribe_set_time_real(sub, 1);
+ ptr++;
+ }
+ if (sscanf(ptr, "%i.%i", &v1, &v2) != 2) {
+ fprintf(stderr, "Wrong argument '%s'...\n", argv[max]);
+ return;
+ }
+ addr.client = v1;
+ addr.port = v2;
+ snd_seq_port_subscribe_set_sender(sub, &addr);
+ if ((err = snd_seq_subscribe_port(handle, sub))<0) {
+ fprintf(stderr, "Cannot subscribe port %i from client %i: %s\n", v2, v1, snd_strerror(err));
+ return;
+ }
+ }
+
+ max = snd_seq_poll_descriptors_count(handle, POLLIN);
+ pfds = alloca(sizeof(*pfds) * max);
+ while (1) {
+ snd_seq_poll_descriptors(handle, pfds, max, POLLIN);
+ if (poll(pfds, max, -1) < 0)
+ break;
+ do {
+ if ((err = snd_seq_event_input(handle, &ev))<0)
+ break;
+ if (!ev)
+ continue;
+ decode_event(ev);
+ snd_seq_free_event(ev);
+ } while (err > 0);
+ }
+}
diff --git a/alsa-lib/test/seq-sender.c b/alsa-lib/test/seq-sender.c
new file mode 100644
index 0000000..5d8ac92
--- /dev/null
+++ b/alsa-lib/test/seq-sender.c
@@ -0,0 +1,272 @@
+
+#ifdef USE_PCM // XXX not yet
+/*
+ * PCM timer layer
+ */
+
+int pcard = 0;
+int pdevice = 0;
+int period_size = 1024;
+
+void set_hwparams(snd_pcm_t *phandle)
+{
+ int err;
+ snd_pcm_hw_params_t *params;
+
+ err = snd_output_stdio_attach(&log, stderr, 0);
+ if (err < 0) {
+ fprintf(stderr, "cannot attach output stdio\n");
+ exit(0);
+ }
+
+ snd_pcm_hw_params_alloca(&params);
+ err = snd_pcm_hw_params_any(phandle, params);
+ if (err < 0) {
+ fprintf(stderr, "Broken configuration for this PCM: no configurations available\n");
+ exit(0);
+ }
+
+ err = snd_pcm_hw_params_set_access(phandle, params,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (err < 0) {
+ fprintf(stderr, "Access type not available\n");
+ exit(0);
+ }
+ err = snd_pcm_hw_params_set_format(phandle, params, SND_PCM_FORMAT_S16_LE);
+ if (err < 0) {
+ fprintf(stderr, "cannot set format\n");
+ exit(0);
+ }
+ err = snd_pcm_hw_params_set_channels(phandle, params, 2);
+ if (err < 0) {
+ fprintf(stderr, "cannot set channels 2\n");
+ exit(0);
+ }
+ err = snd_pcm_hw_params_set_rate_near(phandle, params, 44100, 0);
+ if (err < 0) {
+ fprintf(stderr, "cannot set rate\n");
+ exit(0);
+ }
+ err = snd_pcm_hw_params_set_period_size_near(phandle, params, period_size);
+ if (err < 0) {
+ fprintf(stderr, "cannot set period size\n");
+ exit(0);
+ }
+ err = snd_pcm_hw_params(phandle, params);
+ if (err < 0) {
+ fprintf(stderr, "Unable to install hw params:\n");
+ exit(0);
+ }
+ snd_pcm_hw_params_dump(params, log);
+}
+
+#endif
+/*
+ * Simple event sender
+ */
+
+void event_sender_start_timer(snd_seq_t *handle,
+ int client ATTRIBUTE_UNUSED,
+ int queue,
+ snd_pcm_t *phandle ATTRIBUTE_UNUSED)
+{
+ int err;
+
+#ifdef USE_PCM
+ if (phandle) {
+ snd_pcm_playback_info_t pinfo;
+ snd_seq_queue_timer_t qtimer;
+
+ if ((err = snd_pcm_playback_info(phandle, &pinfo)) < 0) {
+ fprintf(stderr, "Playback info error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ bzero(&qtimer, sizeof(qtimer));
+ qtimer.type = SND_SEQ_TIMER_MASTER;
+ /* note: last bit from the subdevices specifies playback */
+ /* or capture direction for the timer specification */
+ qtimer.number = SND_TIMER_PCM(pcard, pdevice, pinfo.subdevice << 1);
+ if ((err = snd_seq_set_queue_timer(handle, queue, &qtimer)) < 0) {
+ fprintf(stderr, "Sequencer PCM timer setup failed: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ }
+#endif
+ if ((err = snd_seq_start_queue(handle, queue, NULL))<0)
+ fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err));
+ snd_seq_drain_output(handle);
+}
+
+void event_sender_filter(snd_seq_t *handle)
+{
+ int err;
+
+ if ((err = snd_seq_set_client_event_filter(handle, SND_SEQ_EVENT_ECHO)) < 0) {
+ fprintf(stderr, "Unable to set client info: %s\n", snd_strerror(err));
+ return;
+ }
+}
+
+void send_event(snd_seq_t *handle, int queue, int client, int port,
+ snd_seq_addr_t *dest, int *time)
+{
+ int err;
+ snd_seq_event_t ev;
+
+ bzero(&ev, sizeof(ev));
+ ev.queue = queue;
+ ev.source.client = ev.dest.client = client;
+ ev.source.port = ev.dest.port = port;
+ ev.flags = SND_SEQ_TIME_STAMP_REAL | SND_SEQ_TIME_MODE_ABS;
+ ev.time.time.tv_sec = *time; (*time)++;
+ ev.type = SND_SEQ_EVENT_ECHO;
+ if ((err = snd_seq_event_output(handle, &ev))<0)
+ fprintf(stderr, "Event output error: %s\n", snd_strerror(err));
+ ev.dest = *dest;
+ ev.type = SND_SEQ_EVENT_PGMCHANGE;
+ ev.data.control.channel = 0;
+ ev.data.control.value = 16;
+ if ((err = snd_seq_event_output(handle, &ev))<0)
+ fprintf(stderr, "Event output error: %s\n", snd_strerror(err));
+ ev.type = SND_SEQ_EVENT_NOTE;
+ ev.data.note.channel = 0;
+ ev.data.note.note = 64 + (queue*2);
+ ev.data.note.velocity = 127;
+ ev.data.note.off_velocity = 127;
+ ev.data.note.duration = 500; /* 0.5sec */
+ if ((err = snd_seq_event_output(handle, &ev))<0)
+ fprintf(stderr, "Event output error: %s\n", snd_strerror(err));
+ if ((err = snd_seq_drain_output(handle))<0)
+ fprintf(stderr, "Event drain error: %s\n", snd_strerror(err));
+}
+
+void event_sender(snd_seq_t *handle, int argc, char *argv[])
+{
+ snd_seq_event_t *ev;
+ snd_seq_port_info_t *pinfo;
+ snd_seq_port_subscribe_t *sub;
+ snd_seq_addr_t addr;
+ struct pollfd *pfds;
+ int client, port, queue, max, err, v1, v2, time = 0, pcm_flag = 0;
+ char *ptr;
+ snd_pcm_t *phandle = NULL;
+
+ if (argc < 1) {
+ fprintf(stderr, "Invalid destination...\n");
+ return;
+ }
+
+ if ((client = snd_seq_client_id(handle))<0) {
+ fprintf(stderr, "Cannot determine client number: %s\n", snd_strerror(client));
+ return;
+ }
+ printf("Client ID = %i\n", client);
+ if ((queue = snd_seq_alloc_queue(handle))<0) {
+ fprintf(stderr, "Cannot allocate queue: %s\n", snd_strerror(queue));
+ return;
+ }
+ printf("Queue ID = %i\n", queue);
+ event_sender_filter(handle);
+ if ((err = snd_seq_nonblock(handle, 1))<0)
+ fprintf(stderr, "Cannot set nonblock mode: %s\n", snd_strerror(err));
+
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_READ);
+ snd_seq_port_info_set_name(pinfo, "Output");
+ if ((err = snd_seq_create_port(handle, pinfo)) < 0) {
+ fprintf(stderr, "Cannot create output port: %s\n", snd_strerror(err));
+ return;
+ }
+ port = snd_seq_port_info_get_port(pinfo);
+
+ snd_seq_port_subscribe_alloca(&sub);
+ addr.client = client;
+ addr.port = port;
+ snd_seq_port_subscribe_set_sender(sub, &addr);
+
+ for (max = 0; max < argc; max++) {
+ ptr = argv[max];
+ if (!ptr)
+ continue;
+ if (!strcmp(ptr, "pcm")) {
+ pcm_flag = 1;
+ continue;
+ }
+ if (sscanf(ptr, "%i.%i", &v1, &v2) != 2) {
+ fprintf(stderr, "Wrong argument '%s'...\n", argv[max]);
+ return;
+ }
+ addr.client = v1;
+ addr.port = v2;
+ snd_seq_port_subscribe_set_dest(sub, &addr);
+ if ((err = snd_seq_subscribe_port(handle, sub))<0) {
+ fprintf(stderr, "Cannot subscribe port %i from client %i: %s\n", v2, v1, snd_strerror(err));
+ return;
+ }
+ }
+
+ printf("Destination client = %i, port = %i\n", addr.client, addr.port);
+
+#ifdef USE_PCM
+ if (pcm_flag) {
+ if ((err = snd_pcm_open(&phandle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+ fprintf(stderr, "Playback open error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ set_hwparams(phandle);
+ pbuf = calloc(1, period_size * 4);
+ if (pbuf == NULL) {
+ fprintf(stderr, "No enough memory...\n");
+ exit(0);
+ }
+ }
+#endif
+ event_sender_start_timer(handle, client, queue, phandle);
+
+ /* send the first event */
+ send_event(handle, queue, client, port, &addr, &time);
+#ifdef USE_PCM
+ if (phandle)
+ max += snd_pcm_poll_descriptors_count(phandle);
+#endif
+ pfds = alloca(sizeof(*pfds) * max);
+ while (1) {
+ int nseqs = snd_seq_poll_descriptors_count(handle, POLLOUT|POLLIN);
+ if (snd_seq_event_output_pending(handle))
+ snd_seq_poll_descriptors(handle, pfds, nseqs, POLLOUT|POLLIN);
+ else
+ snd_seq_poll_descriptors(handle, pfds, nseqs, POLLIN);
+ max = nseqs;
+#ifdef USE_PCM
+ if (phandle) {
+ int pmax = snd_pcm_poll_descriptors_count(phandle);
+ snd_seq_poll_descriptors(phandle, pfds + max, pmax);
+ max += pmax;
+ }
+#endif
+ if (poll(pfds, max, -1) < 0)
+ break;
+#ifdef USE_PCM
+ if (phandle && (pfds[nseqs].revents & POLLOUT)) {
+ if (snd_pcm_writei(phandle, pbuf, period_size) != period_size) {
+ fprintf(stderr, "Playback write error!!\n");
+ exit(0);
+ }
+ }
+#endif
+ if (pfds[0].revents & POLLOUT)
+ snd_seq_drain_output(handle);
+ if (pfds[0].revents & POLLIN) {
+ do {
+ if ((err = snd_seq_event_input(handle, &ev))<0)
+ break;
+ if (!ev)
+ continue;
+ if (ev->type == SND_SEQ_EVENT_ECHO)
+ send_event(handle, queue, client, port, &addr, &time);
+ decode_event(ev);
+ snd_seq_free_event(ev);
+ } while (err > 0);
+ }
+ }
+}
diff --git a/alsa-lib/test/seq.c b/alsa-lib/test/seq.c
new file mode 100644
index 0000000..34b000f
--- /dev/null
+++ b/alsa-lib/test/seq.c
@@ -0,0 +1,233 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <getopt.h>
+#include "../include/asoundlib.h"
+
+#include "seq-decoder.c"
+#include "seq-sender.c"
+
+#define SEQ_VERSION "0.0.1"
+
+#define HELPID_HELP 1000
+#define HELPID_DEBUG 1001
+#define HELPID_VERBOSE 1002
+#define HELPID_VERSION 1003
+
+int max_clients;
+int max_ports;
+int max_queues;
+int debug = 0;
+int verbose = 0;
+
+void set_name(snd_seq_t *handle)
+{
+ int err;
+ char name[64];
+
+ sprintf(name, "SeqUtil - %i", getpid());
+ if ((err = snd_seq_set_client_name(handle, name)) < 0) {
+ fprintf(stderr, "Set client info error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+}
+
+void system_info(snd_seq_t *handle)
+{
+ int err;
+ snd_seq_system_info_t *sysinfo;
+
+ snd_seq_system_info_alloca(&sysinfo);
+ if ((err = snd_seq_system_info(handle, sysinfo))<0) {
+ fprintf(stderr, "System info error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ max_clients = snd_seq_system_info_get_clients(sysinfo);
+ max_ports = snd_seq_system_info_get_ports(sysinfo);
+ max_queues = snd_seq_system_info_get_ports(sysinfo);
+}
+
+void show_system_info(snd_seq_t *handle ATTRIBUTE_UNUSED)
+{
+ printf("System info\n");
+ printf(" Max queues : %i\n", max_queues);
+ printf(" Max clients : %i\n", max_clients);
+ printf(" Max ports : %i\n", max_ports);
+}
+
+void show_queue_status(snd_seq_t *handle, int queue)
+{
+ int err, idx, min, max;
+ snd_seq_queue_status_t *status;
+
+ snd_seq_queue_status_alloca(&status);
+ min = queue < 0 ? 0 : queue;
+ max = queue < 0 ? max_queues : queue + 1;
+ for (idx = min; idx < max; idx++) {
+ if ((err = snd_seq_get_queue_status(handle, idx, status))<0) {
+ if (err == -ENOENT)
+ continue;
+ fprintf(stderr, "Client %i info error: %s\n", idx, snd_strerror(err));
+ exit(0);
+ }
+ printf("Queue %i info\n", snd_seq_queue_status_get_queue(status));
+ printf(" Tick : %u\n", snd_seq_queue_status_get_tick_time(status));
+ printf(" Realtime : %i.%i\n",
+ snd_seq_queue_status_get_real_time(status)->tv_sec,
+ snd_seq_queue_status_get_real_time(status)->tv_nsec);
+ printf(" Flags : 0x%x\n", snd_seq_queue_status_get_status(status));
+ }
+}
+
+void show_port_info(snd_seq_t *handle, int client, int port)
+{
+ int err, idx, min, max;
+ snd_seq_port_info_t *info;
+
+ snd_seq_port_info_alloca(&info);
+ min = port < 0 ? 0 : port;
+ max = port < 0 ? max_ports : port + 1;
+ for (idx = min; idx < max; idx++) {
+ if ((err = snd_seq_get_any_port_info(handle, client, idx, info))<0) {
+ if (err == -ENOENT)
+ continue;
+ fprintf(stderr, "Port %i/%i info error: %s\n", client, idx, snd_strerror(err));
+ exit(0);
+ }
+ printf(" Port %i info\n", idx);
+ printf(" Client : %i\n", snd_seq_port_info_get_client(info));
+ printf(" Port : %i\n", snd_seq_port_info_get_port(info));
+ printf(" Name : %s\n", snd_seq_port_info_get_name(info));
+ printf(" Capability : 0x%x\n", snd_seq_port_info_get_capability(info));
+ printf(" Type : 0x%x\n", snd_seq_port_info_get_type(info));
+ //printf(" Midi channels : %i\n", info.midi_channels);
+ //printf(" Synth voices : %i\n", info.synth_voices);
+ printf(" Output subs : %i\n", snd_seq_port_info_get_write_use(info));
+ printf(" Input subs : %i\n", snd_seq_port_info_get_read_use(info));
+ }
+}
+
+void show_client_info(snd_seq_t *handle, int client)
+{
+ int err, idx, min, max;
+ snd_seq_client_info_t *info;
+
+ snd_seq_client_info_alloca(&info);
+ min = client < 0 ? 0 : client;
+ max = client < 0 ? max_clients : client + 1;
+ for (idx = min; idx < max; idx++) {
+ if ((err = snd_seq_get_any_client_info(handle, idx, info))<0) {
+ if (err == -ENOENT)
+ continue;
+ fprintf(stderr, "Client %i info error: %s\n", idx, snd_strerror(err));
+ exit(0);
+ }
+ printf("Client %i info\n", idx);
+ if (verbose)
+ printf(" Client : %i\n", snd_seq_client_info_get_client(info));
+ printf(" Type : %s\n", snd_seq_client_info_get_type(info) == SND_SEQ_KERNEL_CLIENT ? "kernel" : "user");
+ printf(" Name : %s\n", snd_seq_client_info_get_name(info));
+ }
+}
+
+static void help(void)
+{
+ printf("Usage: seq <options> command\n");
+ printf("\nAvailable options:\n");
+ printf(" -h,--help this help\n");
+ printf(" -d,--debug debug mode\n");
+ printf(" -v,--verbose verbose mode\n");
+ printf(" -V,--version print version of this program\n");
+ printf("\nAvailable commands:\n");
+ printf(" system show basic sequencer info\n");
+ printf(" queue [#] show all queues or specified queue\n");
+ printf(" client [#] show all clients or specified client\n");
+ printf(" port <client> [#] show all ports or specified port for specified client\n");
+ printf(" decoder event decoder\n");
+ printf(" sender <client.port> [<client.port>] ... event sender\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int morehelp, err, arg, arg1;
+ snd_seq_t *handle;
+ static struct option long_option[] =
+ {
+ {"help", 0, NULL, HELPID_HELP},
+ {"debug", 0, NULL, HELPID_DEBUG},
+ {"verbose", 0, NULL, HELPID_VERBOSE},
+ {"version", 0, NULL, HELPID_VERSION},
+ {NULL, 0, NULL, 0},
+ };
+
+ morehelp = 0;
+
+ while (1) {
+ int c;
+
+ if ((c = getopt_long(argc, argv, "hdvV", long_option, NULL)) < 0)
+ break;
+ switch (c) {
+ case 'h':
+ case HELPID_HELP:
+ morehelp++;
+ break;
+ case 'd':
+ case HELPID_DEBUG:
+ debug = 1;
+ break;
+ case 'v':
+ case HELPID_VERBOSE:
+ verbose = 1;
+ break;
+ case 'V':
+ case HELPID_VERSION:
+ printf("alsactl version " SEQ_VERSION "\n");
+ return 1;
+ default:
+ fprintf(stderr, "\07Invalid switch or option needs an argument.\n");
+ morehelp++;
+ }
+ }
+ if (morehelp) {
+ help();
+ return 1;
+ }
+ if (argc - optind <= 0) {
+ fprintf(stderr, "seq: Specify command...\n");
+ return 0;
+ }
+ if ((err = snd_seq_open(&handle, "hw", SND_SEQ_OPEN_DUPLEX, 0))<0) {
+ fprintf(stderr, "Open error: %s\n", snd_strerror(err));
+ exit(0);
+ }
+ set_name(handle);
+ system_info(handle);
+
+ if (!strcmp(argv[optind], "system")) {
+ show_system_info(handle);
+ } else if (!strcmp(argv[optind], "queue")) {
+ arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1;
+ show_queue_status(handle, arg);
+ } else if (!strcmp(argv[optind], "client")) {
+ arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1;
+ show_client_info(handle, arg);
+ } else if (!strcmp(argv[optind], "port")) {
+ arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1;
+ if (arg < 0) {
+ fprintf(stderr, "Specify port...\n");
+ exit(0);
+ }
+ arg1 = argc - optind > 2 ? atoi(argv[optind + 2]) : -1;
+ show_port_info(handle, arg, arg1);
+ } else if (!strcmp(argv[optind], "decoder")) {
+ event_decoder(handle, argc - optind - 1, argv + optind + 1);
+ } else if (!strcmp(argv[optind], "sender")) {
+ event_sender(handle, argc - optind - 1, argv + optind + 1);
+ } else {
+ help();
+ }
+ exit(1);
+}
diff --git a/alsa-lib/test/timer.c b/alsa-lib/test/timer.c
new file mode 100644
index 0000000..b05eb2f
--- /dev/null
+++ b/alsa-lib/test/timer.c
@@ -0,0 +1,193 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include "../include/asoundlib.h"
+
+void show_status(void *handle)
+{
+ int err;
+ snd_timer_status_t *status;
+
+ snd_timer_status_alloca(&status);
+ if ((err = snd_timer_status(handle, status)) < 0) {
+ fprintf(stderr, "timer status %i (%s)\n", err, snd_strerror(err));
+ return;
+ }
+ printf("STATUS:\n");
+ printf(" resolution = %li\n", snd_timer_status_get_resolution(status));
+ printf(" lost = %li\n", snd_timer_status_get_lost(status));
+ printf(" overrun = %li\n", snd_timer_status_get_overrun(status));
+ printf(" queue = %li\n", snd_timer_status_get_queue(status));
+}
+
+void read_loop(void *handle, int master_ticks, int timeout)
+{
+ int count, err;
+ struct pollfd *fds;
+ snd_timer_read_t tr;
+
+ count = snd_timer_poll_descriptors_count(handle);
+ fds = calloc(count, sizeof(struct pollfd));
+ if (fds == NULL) {
+ fprintf(stderr, "malloc error\n");
+ exit(EXIT_FAILURE);
+ }
+ while (master_ticks-- > 0) {
+ if ((err = snd_timer_poll_descriptors(handle, fds, count)) < 0) {
+ fprintf(stderr, "snd_timer_poll_descriptors error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if ((err = poll(fds, count, timeout)) < 0) {
+ fprintf(stderr, "poll error %i (%s)\n", err, strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if (err == 0) {
+ fprintf(stderr, "timer time out!!\n");
+ exit(EXIT_FAILURE);
+ }
+ while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) {
+ printf("TIMER: resolution = %uns, ticks = %u\n",
+ tr.resolution, tr.ticks);
+ }
+ }
+ free(fds);
+}
+
+static void async_callback(snd_async_handler_t *ahandler)
+{
+ snd_timer_t *handle = snd_async_handler_get_timer(ahandler);
+ int *acount = snd_async_handler_get_callback_private(ahandler);
+ snd_timer_read_t tr;
+
+ while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) {
+ printf("TIMER: resolution = %uns, ticks = %u\n",
+ tr.resolution, tr.ticks);
+ }
+ (*acount)++;
+}
+
+int main(int argc, char *argv[])
+{
+ int idx, err;
+ int class = SND_TIMER_CLASS_GLOBAL;
+ int sclass = SND_TIMER_CLASS_NONE;
+ int card = 0;
+ int device = SND_TIMER_GLOBAL_SYSTEM;
+ int subdevice = 0;
+ int list = 0;
+ int async = 0;
+ int acount = 0;
+ snd_timer_t *handle;
+ snd_timer_id_t *id;
+ snd_timer_info_t *info;
+ snd_timer_params_t *params;
+ char timername[64];
+ snd_async_handler_t *ahandler;
+
+ snd_timer_id_alloca(&id);
+ snd_timer_info_alloca(&info);
+ snd_timer_params_alloca(&params);
+
+ idx = 1;
+ while (idx < argc) {
+ if (!strncmp(argv[idx], "class=", 5)) {
+ class = atoi(argv[idx]+6);
+ } else if (!strncmp(argv[idx], "sclass=", 6)) {
+ sclass = atoi(argv[idx]+7);
+ } else if (!strncmp(argv[idx], "card=", 5)) {
+ card = atoi(argv[idx]+5);
+ } else if (!strncmp(argv[idx], "device=", 7)) {
+ device = atoi(argv[idx]+7);
+ } else if (!strncmp(argv[idx], "subdevice=", 10)) {
+ subdevice = atoi(argv[idx]+10);
+ } else if (!strcmp(argv[idx], "list")) {
+ list = 1;
+ } else if (!strcmp(argv[idx], "async")) {
+ async = 1;
+ }
+ idx++;
+ }
+ if (class == SND_TIMER_CLASS_SLAVE && sclass == SND_TIMER_SCLASS_NONE) {
+ fprintf(stderr, "slave class is not set\n");
+ exit(EXIT_FAILURE);
+ }
+ if (list) {
+ snd_timer_query_t *qhandle;
+ if ((err = snd_timer_query_open(&qhandle, "hw", 0)) < 0) {
+ fprintf(stderr, "snd_timer_query_open error: %s\n", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ snd_timer_id_set_class(id, SND_TIMER_CLASS_NONE);
+ while (1) {
+ if ((err = snd_timer_query_next_device(qhandle, id)) < 0) {
+ fprintf(stderr, "timer next device error: %s\n", snd_strerror(err));
+ break;
+ }
+ if (snd_timer_id_get_class(id) < 0)
+ break;
+ printf("Timer device: class %i, sclass %i, card %i, device %i, subdevice %i\n",
+ snd_timer_id_get_class(id),
+ snd_timer_id_get_sclass(id),
+ snd_timer_id_get_card(id),
+ snd_timer_id_get_device(id),
+ snd_timer_id_get_subdevice(id));
+ }
+ snd_timer_query_close(qhandle);
+ exit(EXIT_SUCCESS);
+ }
+ sprintf(timername, "hw:CLASS=%i,SCLASS=%i,CARD=%i,DEV=%i,SUBDEV=%i", class, sclass, card, device, subdevice);
+ if ((err = snd_timer_open(&handle, timername, SND_TIMER_OPEN_NONBLOCK))<0) {
+ fprintf(stderr, "timer open %i (%s)\n", err, snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ printf("Using timer class %i, slave class %i, card %i, device %i, subdevice %i\n", class, sclass, card, device, subdevice);
+ if ((err = snd_timer_info(handle, info)) < 0) {
+ fprintf(stderr, "timer info %i (%s)\n", err, snd_strerror(err));
+ exit(0);
+ }
+ printf("Timer info:\n");
+ printf(" slave = %s\n", snd_timer_info_is_slave(info) ? "yes" : "no");
+ printf(" card = %i\n", snd_timer_info_get_card(info));
+ printf(" id = '%s'\n", snd_timer_info_get_id(info));
+ printf(" name = '%s'\n", snd_timer_info_get_name(info));
+ printf(" average resolution = %li\n", snd_timer_info_get_resolution(info));
+ snd_timer_params_set_auto_start(params, 1);
+ if (!snd_timer_info_is_slave(info)) {
+ snd_timer_params_set_ticks(params, (1000000000 / snd_timer_info_get_resolution(info)) / 50); /* 50Hz */
+ if (snd_timer_params_get_ticks(params) < 1)
+ snd_timer_params_set_ticks(params, 1);
+ printf("Using %li tick(s)\n", snd_timer_params_get_ticks(params));
+ } else {
+ snd_timer_params_set_ticks(params, 1);
+ }
+ if ((err = snd_timer_params(handle, params)) < 0) {
+ fprintf(stderr, "timer params %i (%s)\n", err, snd_strerror(err));
+ exit(0);
+ }
+ show_status(handle);
+ if (async) {
+ err = snd_async_add_timer_handler(&ahandler, handle, async_callback, &acount);
+ if (err < 0) {
+ fprintf(stderr, "unable to add async handler %i (%s)\n", err, snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ }
+ if ((err = snd_timer_start(handle)) < 0) {
+ fprintf(stderr, "timer start %i (%s)\n", err, snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ if (async) {
+ /* because all other work is done in the signal handler,
+ suspend the process */
+ while (acount < 25)
+ sleep(1);
+ snd_timer_stop(handle);
+ } else {
+ read_loop(handle, 25, snd_timer_info_is_slave(info) ? 10000 : 25);
+ }
+ show_status(handle);
+ snd_timer_close(handle);
+ printf("Done\n");
+ return EXIT_SUCCESS;
+}
diff --git a/alsa-lib/utils/Makefile.am b/alsa-lib/utils/Makefile.am
new file mode 100644
index 0000000..ee60f6c
--- /dev/null
+++ b/alsa-lib/utils/Makefile.am
@@ -0,0 +1,13 @@
+if INSTALL_M4
+aclocaldir=$(datadir)/aclocal
+aclocal_DATA=alsa.m4
+endif
+EXTRA_DIST=alsa.m4 buildrpm alsa.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = alsa.pc
+
+rpm: buildrpm alsa-lib.spec
+ VERSION=$(VERSION) $(srcdir)/buildrpm
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-lib/utils/Makefile.in b/alsa-lib/utils/Makefile.in
new file mode 100644
index 0000000..4436ef5
--- /dev/null
+++ b/alsa-lib/utils/Makefile.in
@@ -0,0 +1,480 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = utils
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/alsa-lib.spec.in $(srcdir)/alsa.pc.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES = alsa-lib.spec alsa.pc
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(aclocaldir)" \
+ "$(DESTDIR)$(pkgconfigdir)"
+aclocalDATA_INSTALL = $(INSTALL_DATA)
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(aclocal_DATA) $(pkgconfig_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@
+ALSA_DEPLIBS = @ALSA_DEPLIBS@
+ALSA_HSEARCH_R_FALSE = @ALSA_HSEARCH_R_FALSE@
+ALSA_HSEARCH_R_TRUE = @ALSA_HSEARCH_R_TRUE@
+ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ALISP_FALSE = @BUILD_ALISP_FALSE@
+BUILD_ALISP_TRUE = @BUILD_ALISP_TRUE@
+BUILD_CTL_PLUGIN_EXT_FALSE = @BUILD_CTL_PLUGIN_EXT_FALSE@
+BUILD_CTL_PLUGIN_EXT_TRUE = @BUILD_CTL_PLUGIN_EXT_TRUE@
+BUILD_CTL_PLUGIN_FALSE = @BUILD_CTL_PLUGIN_FALSE@
+BUILD_CTL_PLUGIN_SHM_FALSE = @BUILD_CTL_PLUGIN_SHM_FALSE@
+BUILD_CTL_PLUGIN_SHM_TRUE = @BUILD_CTL_PLUGIN_SHM_TRUE@
+BUILD_CTL_PLUGIN_TRUE = @BUILD_CTL_PLUGIN_TRUE@
+BUILD_HWDEP_FALSE = @BUILD_HWDEP_FALSE@
+BUILD_HWDEP_TRUE = @BUILD_HWDEP_TRUE@
+BUILD_MIXER_FALSE = @BUILD_MIXER_FALSE@
+BUILD_MIXER_TRUE = @BUILD_MIXER_TRUE@
+BUILD_MODULES_FALSE = @BUILD_MODULES_FALSE@
+BUILD_MODULES_TRUE = @BUILD_MODULES_TRUE@
+BUILD_PCM_FALSE = @BUILD_PCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_FALSE = @BUILD_PCM_PLUGIN_ADPCM_FALSE@
+BUILD_PCM_PLUGIN_ADPCM_TRUE = @BUILD_PCM_PLUGIN_ADPCM_TRUE@
+BUILD_PCM_PLUGIN_ALAW_FALSE = @BUILD_PCM_PLUGIN_ALAW_FALSE@
+BUILD_PCM_PLUGIN_ALAW_TRUE = @BUILD_PCM_PLUGIN_ALAW_TRUE@
+BUILD_PCM_PLUGIN_ASYM_FALSE = @BUILD_PCM_PLUGIN_ASYM_FALSE@
+BUILD_PCM_PLUGIN_ASYM_TRUE = @BUILD_PCM_PLUGIN_ASYM_TRUE@
+BUILD_PCM_PLUGIN_COPY_FALSE = @BUILD_PCM_PLUGIN_COPY_FALSE@
+BUILD_PCM_PLUGIN_COPY_TRUE = @BUILD_PCM_PLUGIN_COPY_TRUE@
+BUILD_PCM_PLUGIN_DMIX_FALSE = @BUILD_PCM_PLUGIN_DMIX_FALSE@
+BUILD_PCM_PLUGIN_DMIX_TRUE = @BUILD_PCM_PLUGIN_DMIX_TRUE@
+BUILD_PCM_PLUGIN_DSHARE_FALSE = @BUILD_PCM_PLUGIN_DSHARE_FALSE@
+BUILD_PCM_PLUGIN_DSHARE_TRUE = @BUILD_PCM_PLUGIN_DSHARE_TRUE@
+BUILD_PCM_PLUGIN_DSNOOP_FALSE = @BUILD_PCM_PLUGIN_DSNOOP_FALSE@
+BUILD_PCM_PLUGIN_DSNOOP_TRUE = @BUILD_PCM_PLUGIN_DSNOOP_TRUE@
+BUILD_PCM_PLUGIN_EMPTY_FALSE = @BUILD_PCM_PLUGIN_EMPTY_FALSE@
+BUILD_PCM_PLUGIN_EMPTY_TRUE = @BUILD_PCM_PLUGIN_EMPTY_TRUE@
+BUILD_PCM_PLUGIN_EXTPLUG_FALSE = @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@
+BUILD_PCM_PLUGIN_EXTPLUG_TRUE = @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@
+BUILD_PCM_PLUGIN_FALSE = @BUILD_PCM_PLUGIN_FALSE@
+BUILD_PCM_PLUGIN_FILE_FALSE = @BUILD_PCM_PLUGIN_FILE_FALSE@
+BUILD_PCM_PLUGIN_FILE_TRUE = @BUILD_PCM_PLUGIN_FILE_TRUE@
+BUILD_PCM_PLUGIN_HOOKS_FALSE = @BUILD_PCM_PLUGIN_HOOKS_FALSE@
+BUILD_PCM_PLUGIN_HOOKS_TRUE = @BUILD_PCM_PLUGIN_HOOKS_TRUE@
+BUILD_PCM_PLUGIN_IEC958_FALSE = @BUILD_PCM_PLUGIN_IEC958_FALSE@
+BUILD_PCM_PLUGIN_IEC958_TRUE = @BUILD_PCM_PLUGIN_IEC958_TRUE@
+BUILD_PCM_PLUGIN_IOPLUG_FALSE = @BUILD_PCM_PLUGIN_IOPLUG_FALSE@
+BUILD_PCM_PLUGIN_IOPLUG_TRUE = @BUILD_PCM_PLUGIN_IOPLUG_TRUE@
+BUILD_PCM_PLUGIN_LADSPA_FALSE = @BUILD_PCM_PLUGIN_LADSPA_FALSE@
+BUILD_PCM_PLUGIN_LADSPA_TRUE = @BUILD_PCM_PLUGIN_LADSPA_TRUE@
+BUILD_PCM_PLUGIN_LFLOAT_FALSE = @BUILD_PCM_PLUGIN_LFLOAT_FALSE@
+BUILD_PCM_PLUGIN_LFLOAT_TRUE = @BUILD_PCM_PLUGIN_LFLOAT_TRUE@
+BUILD_PCM_PLUGIN_LINEAR_FALSE = @BUILD_PCM_PLUGIN_LINEAR_FALSE@
+BUILD_PCM_PLUGIN_LINEAR_TRUE = @BUILD_PCM_PLUGIN_LINEAR_TRUE@
+BUILD_PCM_PLUGIN_METER_FALSE = @BUILD_PCM_PLUGIN_METER_FALSE@
+BUILD_PCM_PLUGIN_METER_TRUE = @BUILD_PCM_PLUGIN_METER_TRUE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE = @BUILD_PCM_PLUGIN_MMAP_EMUL_FALSE@
+BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE = @BUILD_PCM_PLUGIN_MMAP_EMUL_TRUE@
+BUILD_PCM_PLUGIN_MULAW_FALSE = @BUILD_PCM_PLUGIN_MULAW_FALSE@
+BUILD_PCM_PLUGIN_MULAW_TRUE = @BUILD_PCM_PLUGIN_MULAW_TRUE@
+BUILD_PCM_PLUGIN_MULTI_FALSE = @BUILD_PCM_PLUGIN_MULTI_FALSE@
+BUILD_PCM_PLUGIN_MULTI_TRUE = @BUILD_PCM_PLUGIN_MULTI_TRUE@
+BUILD_PCM_PLUGIN_NULL_FALSE = @BUILD_PCM_PLUGIN_NULL_FALSE@
+BUILD_PCM_PLUGIN_NULL_TRUE = @BUILD_PCM_PLUGIN_NULL_TRUE@
+BUILD_PCM_PLUGIN_PLUG_FALSE = @BUILD_PCM_PLUGIN_PLUG_FALSE@
+BUILD_PCM_PLUGIN_PLUG_TRUE = @BUILD_PCM_PLUGIN_PLUG_TRUE@
+BUILD_PCM_PLUGIN_RATE_FALSE = @BUILD_PCM_PLUGIN_RATE_FALSE@
+BUILD_PCM_PLUGIN_RATE_TRUE = @BUILD_PCM_PLUGIN_RATE_TRUE@
+BUILD_PCM_PLUGIN_ROUTE_FALSE = @BUILD_PCM_PLUGIN_ROUTE_FALSE@
+BUILD_PCM_PLUGIN_ROUTE_TRUE = @BUILD_PCM_PLUGIN_ROUTE_TRUE@
+BUILD_PCM_PLUGIN_SHARE_FALSE = @BUILD_PCM_PLUGIN_SHARE_FALSE@
+BUILD_PCM_PLUGIN_SHARE_TRUE = @BUILD_PCM_PLUGIN_SHARE_TRUE@
+BUILD_PCM_PLUGIN_SHM_FALSE = @BUILD_PCM_PLUGIN_SHM_FALSE@
+BUILD_PCM_PLUGIN_SHM_TRUE = @BUILD_PCM_PLUGIN_SHM_TRUE@
+BUILD_PCM_PLUGIN_SOFTVOL_FALSE = @BUILD_PCM_PLUGIN_SOFTVOL_FALSE@
+BUILD_PCM_PLUGIN_SOFTVOL_TRUE = @BUILD_PCM_PLUGIN_SOFTVOL_TRUE@
+BUILD_PCM_PLUGIN_TRUE = @BUILD_PCM_PLUGIN_TRUE@
+BUILD_PCM_TRUE = @BUILD_PCM_TRUE@
+BUILD_PYTHON_FALSE = @BUILD_PYTHON_FALSE@
+BUILD_PYTHON_TRUE = @BUILD_PYTHON_TRUE@
+BUILD_RAWMIDI_FALSE = @BUILD_RAWMIDI_FALSE@
+BUILD_RAWMIDI_TRUE = @BUILD_RAWMIDI_TRUE@
+BUILD_SEQ_FALSE = @BUILD_SEQ_FALSE@
+BUILD_SEQ_TRUE = @BUILD_SEQ_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
+INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KEEP_OLD_SYMBOLS_FALSE = @KEEP_OLD_SYMBOLS_FALSE@
+KEEP_OLD_SYMBOLS_TRUE = @KEEP_OLD_SYMBOLS_TRUE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@
+SND_LIB_MAJOR = @SND_LIB_MAJOR@
+SND_LIB_MINOR = @SND_LIB_MINOR@
+SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@
+SND_LIB_VERSION = @SND_LIB_VERSION@
+STRIP = @STRIP@
+SYMBOLIC_FUNCTIONS_FALSE = @SYMBOLIC_FUNCTIONS_FALSE@
+SYMBOLIC_FUNCTIONS_TRUE = @SYMBOLIC_FUNCTIONS_TRUE@
+SYMBOL_PREFIX = @SYMBOL_PREFIX@
+VERSION = @VERSION@
+VERSIONED_SYMBOLS_FALSE = @VERSIONED_SYMBOLS_FALSE@
+VERSIONED_SYMBOLS_TRUE = @VERSIONED_SYMBOLS_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@INSTALL_M4_TRUE@aclocaldir = $(datadir)/aclocal
+@INSTALL_M4_TRUE@aclocal_DATA = alsa.m4
+EXTRA_DIST = alsa.m4 buildrpm alsa.pc.in
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = alsa.pc
+INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign utils/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+alsa-lib.spec: $(top_builddir)/config.status $(srcdir)/alsa-lib.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+alsa.pc: $(top_builddir)/config.status $(srcdir)/alsa.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-aclocalDATA: $(aclocal_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(aclocaldir)" || $(mkdir_p) "$(DESTDIR)$(aclocaldir)"
+ @list='$(aclocal_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(aclocalDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(aclocaldir)/$$f'"; \
+ $(aclocalDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(aclocaldir)/$$f"; \
+ done
+
+uninstall-aclocalDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(aclocal_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(aclocaldir)/$$f'"; \
+ rm -f "$(DESTDIR)$(aclocaldir)/$$f"; \
+ done
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(aclocaldir)" "$(DESTDIR)$(pkgconfigdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-aclocalDATA install-pkgconfigDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-aclocalDATA uninstall-info-am \
+ uninstall-pkgconfigDATA
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-aclocalDATA \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-pkgconfigDATA install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall \
+ uninstall-aclocalDATA uninstall-am uninstall-info-am \
+ uninstall-pkgconfigDATA
+
+
+rpm: buildrpm alsa-lib.spec
+ VERSION=$(VERSION) $(srcdir)/buildrpm
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-lib/utils/alsa-lib.spec.in b/alsa-lib/utils/alsa-lib.spec.in
new file mode 100644
index 0000000..021cc75
--- /dev/null
+++ b/alsa-lib/utils/alsa-lib.spec.in
@@ -0,0 +1,75 @@
+%define ver @SND_LIB_VERSION@
+%define rel 1
+
+Summary: Advanced Linux Sound Architecture (ALSA) - Library
+Name: alsa-lib
+Version: %ver
+Release: %rel
+License: LGPL
+Group: System/Libraries
+Source: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{ver}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+URL: http://www.alsa-project.org
+
+%description
+
+Advanced Linux Sound Architecture (ALSA) - Library
+
+%package -n alsa-lib-devel
+Summary: ALSA Libraries Development Files
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description -n alsa-lib-devel
+Development files for building applications which use the ALSA libraries.
+
+%changelog
+* Sat Feb 22 2003 Ronny V. Vindenes <sublett@dc-s.com>
+- split alsa-lib into alsa-lib and alsa-lib-devel
+- changed which files are installed (now includes alsa.pc)
+- use standard rpm macros for build and install
+- changed BuildRoot from /var/tmp to %{_tmppath}
+
+* Tue Nov 20 2001 Jaroslav Kysela <perex@perex.cz>
+
+- changed BuildRoot from /tmp to /var/tmp
+- use the standard RPM macros for prefix and paths
+- added DESTDIR for make install
+
+* Sun Nov 11 2001 Miroslav Benes <mbenes@tenez.cz>
+
+- dangerous command "rpm -rf $RPM_BUILD_ROOT" checks $RPM_BUILD_ROOT variable
+- unset key "Docdir" - on some new systems are documentation in /usr/share/doc
+
+* Mon May 28 1998 Helge Jensen <slog@slog.dk>
+
+- Made SPEC file
+
+%prep
+%setup
+%build
+%configure
+make
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+%makeinstall
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+%{_bindir}/*
+%{_libdir}/*.so.*
+%{_datadir}/alsa
+%doc doc/*.txt
+
+%files -n alsa-lib-devel
+%defattr(-,root,root)
+%{_includedir}/alsa
+%{_includedir}/sys/*
+%{_libdir}/*.la
+%{_libdir}/*.so
+%{_datadir}/aclocal/*
+%{_libdir}/pkgconfig/*
diff --git a/alsa-lib/utils/alsa.m4 b/alsa-lib/utils/alsa.m4
new file mode 100644
index 0000000..79a24ef
--- /dev/null
+++ b/alsa-lib/utils/alsa.m4
@@ -0,0 +1,141 @@
+dnl Configure Paths for Alsa
+dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
+dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
+dnl Jaroslav Kysela <perex@perex.cz>
+dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $
+dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
+dnl enables arguments --with-alsa-prefix=
+dnl --with-alsa-enc-prefix=
+dnl --disable-alsatest
+dnl
+dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
+dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
+dnl
+AC_DEFUN([AM_PATH_ALSA],
+[dnl Save the original CFLAGS, LDFLAGS, and LIBS
+alsa_save_CFLAGS="$CFLAGS"
+alsa_save_LDFLAGS="$LDFLAGS"
+alsa_save_LIBS="$LIBS"
+alsa_found=yes
+
+dnl
+dnl Get the cflags and libraries for alsa
+dnl
+AC_ARG_WITH(alsa-prefix,
+[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
+[alsa_prefix="$withval"], [alsa_prefix=""])
+
+AC_ARG_WITH(alsa-inc-prefix,
+[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
+[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
+
+dnl FIXME: this is not yet implemented
+AC_ARG_ENABLE(alsatest,
+[ --disable-alsatest Do not try to compile and run a test Alsa program],
+[enable_alsatest="$enableval"],
+[enable_alsatest=yes])
+
+dnl Add any special include directories
+AC_MSG_CHECKING(for ALSA CFLAGS)
+if test "$alsa_inc_prefix" != "" ; then
+ ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
+ CFLAGS="$CFLAGS -I$alsa_inc_prefix"
+fi
+AC_MSG_RESULT($ALSA_CFLAGS)
+
+dnl add any special lib dirs
+AC_MSG_CHECKING(for ALSA LDFLAGS)
+if test "$alsa_prefix" != "" ; then
+ ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
+ LDFLAGS="$LDFLAGS $ALSA_LIBS"
+fi
+
+dnl add the alsa library
+ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
+LIBS="$ALSA_LIBS $LIBS"
+AC_MSG_RESULT($ALSA_LIBS)
+
+dnl Check for a working version of libasound that is of the right version.
+min_alsa_version=ifelse([$1], ,0.1.1,$1)
+AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
+no_alsa=""
+ alsa_min_major_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ alsa_min_minor_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ alsa_min_micro_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_COMPILE([
+#include <alsa/asoundlib.h>
+], [
+/* ensure backward compatibility */
+#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
+#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
+#endif
+#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
+#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
+#endif
+#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
+#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
+#endif
+
+# if(SND_LIB_MAJOR > $alsa_min_major_version)
+ exit(0);
+# else
+# if(SND_LIB_MAJOR < $alsa_min_major_version)
+# error not present
+# endif
+
+# if(SND_LIB_MINOR > $alsa_min_minor_version)
+ exit(0);
+# else
+# if(SND_LIB_MINOR < $alsa_min_minor_version)
+# error not present
+# endif
+
+# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
+# error not present
+# endif
+# endif
+# endif
+exit(0);
+],
+ [AC_MSG_RESULT(found.)],
+ [AC_MSG_RESULT(not present.)
+ ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
+ alsa_found=no]
+)
+AC_LANG_RESTORE
+
+dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
+if test "x$enable_alsatest" = "xyes"; then
+AC_CHECK_LIB([asound], [snd_ctl_open],,
+ [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
+ alsa_found=no]
+)
+fi
+
+if test "x$alsa_found" = "xyes" ; then
+ ifelse([$2], , :, [$2])
+ LIBS=`echo $LIBS | sed 's/-lasound//g'`
+ LIBS=`echo $LIBS | sed 's/ //'`
+ LIBS="-lasound $LIBS"
+fi
+if test "x$alsa_found" = "xno" ; then
+ ifelse([$3], , :, [$3])
+ CFLAGS="$alsa_save_CFLAGS"
+ LDFLAGS="$alsa_save_LDFLAGS"
+ LIBS="$alsa_save_LIBS"
+ ALSA_CFLAGS=""
+ ALSA_LIBS=""
+fi
+
+dnl That should be it. Now just export out symbols:
+AC_SUBST(ALSA_CFLAGS)
+AC_SUBST(ALSA_LIBS)
+])
+
diff --git a/alsa-lib/utils/alsa.pc.in b/alsa-lib/utils/alsa.pc.in
new file mode 100644
index 0000000..8de9859
--- /dev/null
+++ b/alsa-lib/utils/alsa.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: alsa
+Description: Advanced Linux Sound Architecture (ALSA) - Library
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -lasound
+Libs.private: @ALSA_DEPLIBS@
+# -I${includedir}/alsa below is just for backward compatibility
+# (it was set so mistakely in the older version)
+Cflags: -I${includedir} -I${includedir}/alsa
diff --git a/alsa-lib/utils/buildrpm b/alsa-lib/utils/buildrpm
new file mode 100644
index 0000000..e6f44ba
--- /dev/null
+++ b/alsa-lib/utils/buildrpm
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+source=.
+version=`cat $source/../version`
+package=$source/../../alsa-lib-$version.tar.bz2
+packagedir=/usr/src/redhat
+xrpmbuild=rpm
+rpmbuild --usage 2> /dev/null > /dev/null && xrpmbuild=rpmbuild
+
+if [ -d /usr/src/packages ]; then
+ packagedir=/usr/src/packages
+fi
+
+make -C .. clean
+make -C .. dist
+
+if [ ! -r $package ]; then
+ package=$source/../alsa-lib-$version.tar.bz2
+ if [ ! -r $package ]; then
+ echo "Error: wrong package: $package"
+ exit 1
+ fi
+fi
+
+cp -fv $package ${packagedir}/SOURCES
+
+if [ ! -r $source/buildrpm ]; then
+ echo "Error: invalid directory: $source"
+ exit 1
+fi
+
+if [ ! -d ${packagedir} ]; then
+ echo "Error: ${packagedir} directory not found"
+ exit 1
+fi
+
+if [ ! -r $source/alsa-lib.spec ]; then
+ cd $source/..
+ ./configure
+ cd utils
+fi
+
+cp -fv $source/alsa-lib.spec ${packagedir}/SPECS
+cd ${packagedir}/SPECS
+$xrpmbuild -ba alsa-lib.spec
+cd ${packagedir}
diff --git a/alsa-lib/version b/alsa-lib/version
new file mode 100644
index 0000000..140333f
--- /dev/null
+++ b/alsa-lib/version
@@ -0,0 +1 @@
+1.0.19
diff --git a/alsa-utils/ABOUT-NLS b/alsa-utils/ABOUT-NLS
new file mode 100644
index 0000000..3575535
--- /dev/null
+++ b/alsa-utils/ABOUT-NLS
@@ -0,0 +1,1111 @@
+1 Notes on the Free Translation Project
+***************************************
+
+Free software is going international! The Free Translation Project is
+a way to get maintainers of free software, translators, and users all
+together, so that free software will gradually become able to speak many
+languages. A few packages already provide translations for their
+messages.
+
+ If you found this `ABOUT-NLS' file inside a distribution, you may
+assume that the distributed package does use GNU `gettext' internally,
+itself available at your nearest GNU archive site. But you do _not_
+need to install GNU `gettext' prior to configuring, installing or using
+this package with messages translated.
+
+ Installers will find here some useful hints. These notes also
+explain how users should proceed for getting the programs to use the
+available translations. They tell how people wanting to contribute and
+work on translations can contact the appropriate team.
+
+ When reporting bugs in the `intl/' directory or bugs which may be
+related to internationalization, you should tell about the version of
+`gettext' which is used. The information can be found in the
+`intl/VERSION' file, in internationalized packages.
+
+1.1 Quick configuration advice
+==============================
+
+If you want to exploit the full power of internationalization, you
+should configure it using
+
+ ./configure --with-included-gettext
+
+to force usage of internationalizing routines provided within this
+package, despite the existence of internationalizing capabilities in the
+operating system where this package is being installed. So far, only
+the `gettext' implementation in the GNU C library version 2 provides as
+many features (such as locale alias, message inheritance, automatic
+charset conversion or plural form handling) as the implementation here.
+It is also not possible to offer this additional functionality on top
+of a `catgets' implementation. Future versions of GNU `gettext' will
+very likely convey even more functionality. So it might be a good idea
+to change to GNU `gettext' as soon as possible.
+
+ So you need _not_ provide this option if you are using GNU libc 2 or
+you have installed a recent copy of the GNU gettext package with the
+included `libintl'.
+
+1.2 INSTALL Matters
+===================
+
+Some packages are "localizable" when properly installed; the programs
+they contain can be made to speak your own native language. Most such
+packages use GNU `gettext'. Other packages have their own ways to
+internationalization, predating GNU `gettext'.
+
+ By default, this package will be installed to allow translation of
+messages. It will automatically detect whether the system already
+provides the GNU `gettext' functions. If not, the included GNU
+`gettext' library will be used. This library is wholly contained
+within this package, usually in the `intl/' subdirectory, so prior
+installation of the GNU `gettext' package is _not_ required.
+Installers may use special options at configuration time for changing
+the default behaviour. The commands:
+
+ ./configure --with-included-gettext
+ ./configure --disable-nls
+
+will, respectively, bypass any pre-existing `gettext' to use the
+internationalizing routines provided within this package, or else,
+_totally_ disable translation of messages.
+
+ When you already have GNU `gettext' installed on your system and run
+configure without an option for your new package, `configure' will
+probably detect the previously built and installed `libintl.a' file and
+will decide to use this. This might not be desirable. You should use
+the more recent version of the GNU `gettext' library. I.e. if the file
+`intl/VERSION' shows that the library which comes with this package is
+more recent, you should use
+
+ ./configure --with-included-gettext
+
+to prevent auto-detection.
+
+ The configuration process will not test for the `catgets' function
+and therefore it will not be used. The reason is that even an
+emulation of `gettext' on top of `catgets' could not provide all the
+extensions of the GNU `gettext' library.
+
+ Internationalized packages usually have many `po/LL.po' files, where
+LL gives an ISO 639 two-letter code identifying the language. Unless
+translations have been forbidden at `configure' time by using the
+`--disable-nls' switch, all available translations are installed
+together with the package. However, the environment variable `LINGUAS'
+may be set, prior to configuration, to limit the installed set.
+`LINGUAS' should then contain a space separated list of two-letter
+codes, stating which languages are allowed.
+
+1.3 Using This Package
+======================
+
+As a user, if your language has been installed for this package, you
+only have to set the `LANG' environment variable to the appropriate
+`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code,
+and `CC' is an ISO 3166 two-letter country code. For example, let's
+suppose that you speak German and live in Germany. At the shell
+prompt, merely execute `setenv LANG de_DE' (in `csh'),
+`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
+This can be done from your `.login' or `.profile' file, once and for
+all.
+
+ You might think that the country code specification is redundant.
+But in fact, some languages have dialects in different countries. For
+example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The
+country code serves to distinguish the dialects.
+
+ The locale naming convention of `LL_CC', with `LL' denoting the
+language and `CC' denoting the country, is the one use on systems based
+on GNU libc. On other systems, some variations of this scheme are
+used, such as `LL' or `LL_CC.ENCODING'. You can get the list of
+locales supported by your system for your language by running the
+command `locale -a | grep '^LL''.
+
+ Not all programs have translations for all languages. By default, an
+English message is shown in place of a nonexistent translation. If you
+understand other languages, you can set up a priority list of languages.
+This is done through a different environment variable, called
+`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG'
+for the purpose of message handling, but you still need to have `LANG'
+set to the primary language; this is required by other parts of the
+system libraries. For example, some Swedish users who would rather
+read translations in German than English for when Swedish is not
+available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
+
+ Special advice for Norwegian users: The language code for Norwegian
+bokma*l changed from `no' to `nb' recently (in 2003). During the
+transition period, while some message catalogs for this language are
+installed under `nb' and some older ones under `no', it's recommended
+for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
+older translations are used.
+
+ In the `LANGUAGE' environment variable, but not in the `LANG'
+environment variable, `LL_CC' combinations can be abbreviated as `LL'
+to denote the language's main dialect. For example, `de' is equivalent
+to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
+(Portuguese as spoken in Portugal) in this context.
+
+1.4 Translating Teams
+=====================
+
+For the Free Translation Project to be a success, we need interested
+people who like their own language and write it well, and who are also
+able to synergize with other translators speaking the same language.
+Each translation team has its own mailing list. The up-to-date list of
+teams can be found at the Free Translation Project's homepage,
+`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
+area.
+
+ If you'd like to volunteer to _work_ at translating messages, you
+should become a member of the translating team for your own language.
+The subscribing address is _not_ the same as the list itself, it has
+`-request' appended. For example, speakers of Swedish can send a
+message to `sv-request@li.org', having this message body:
+
+ subscribe
+
+ Keep in mind that team members are expected to participate
+_actively_ in translations, or at solving translational difficulties,
+rather than merely lurking around. If your team does not exist yet and
+you want to start one, or if you are unsure about what to do or how to
+get started, please write to `translation@iro.umontreal.ca' to reach the
+coordinator for all translator teams.
+
+ The English team is special. It works at improving and uniformizing
+the terminology in use. Proven linguistic skill are praised more than
+programming skill, here.
+
+1.5 Available Packages
+======================
+
+Languages are not equally supported in all packages. The following
+matrix shows the current state of internationalization, as of July
+2006. The matrix shows, in regard of each package, for which languages
+PO files have been submitted to translation coordination, with a
+translation percentage of at least 50%.
+
+ Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo
+ +----------------------------------------------------+
+ GNUnet | [] |
+ a2ps | [] [] [] [] [] |
+ aegis | () |
+ ant-phone | () |
+ anubis | [] |
+ ap-utils | |
+ aspell | [] [] [] [] |
+ bash | [] [] [] |
+ batchelor | [] |
+ bfd | |
+ bibshelf | [] |
+ binutils | [] |
+ bison | [] [] |
+ bison-runtime | [] |
+ bluez-pin | [] [] [] [] [] |
+ cflow | [] |
+ clisp | [] [] |
+ console-tools | [] [] |
+ coreutils | [] [] [] [] |
+ cpio | |
+ cpplib | [] [] [] |
+ cryptonit | [] |
+ darkstat | [] () [] |
+ dialog | [] [] [] [] [] [] |
+ diffutils | [] [] [] [] [] [] |
+ doodle | [] |
+ e2fsprogs | [] [] |
+ enscript | [] [] [] [] |
+ error | [] [] [] [] |
+ fetchmail | [] [] () [] |
+ fileutils | [] [] |
+ findutils | [] [] [] |
+ flex | [] [] [] |
+ fslint | [] |
+ gas | |
+ gawk | [] [] [] |
+ gbiff | [] |
+ gcal | [] |
+ gcc | [] |
+ gettext-examples | [] [] [] [] [] |
+ gettext-runtime | [] [] [] [] [] |
+ gettext-tools | [] [] |
+ gimp-print | [] [] [] [] |
+ gip | [] |
+ gliv | [] |
+ glunarclock | [] |
+ gmult | [] [] |
+ gnubiff | () |
+ gnucash | () () [] |
+ gnucash-glossary | [] () |
+ gnuedu | |
+ gnulib | [] [] [] [] [] [] |
+ gnunet-gtk | |
+ gnutls | |
+ gpe-aerial | [] [] |
+ gpe-beam | [] [] |
+ gpe-calendar | [] [] |
+ gpe-clock | [] [] |
+ gpe-conf | [] [] |
+ gpe-contacts | |
+ gpe-edit | [] |
+ gpe-filemanager | |
+ gpe-go | [] |
+ gpe-login | [] [] |
+ gpe-ownerinfo | [] [] |
+ gpe-package | |
+ gpe-sketchbook | [] [] |
+ gpe-su | [] [] |
+ gpe-taskmanager | [] [] |
+ gpe-timesheet | [] |
+ gpe-today | [] [] |
+ gpe-todo | |
+ gphoto2 | [] [] [] [] |
+ gprof | [] [] |
+ gpsdrive | () () |
+ gramadoir | [] [] |
+ grep | [] [] [] [] [] [] |
+ gretl | |
+ gsasl | |
+ gss | |
+ gst-plugins | [] [] [] [] |
+ gst-plugins-base | [] [] [] |
+ gst-plugins-good | [] [] [] [] [] [] [] |
+ gstreamer | [] [] [] [] [] [] [] |
+ gtick | [] () |
+ gtkam | [] [] [] |
+ gtkorphan | [] [] |
+ gtkspell | [] [] [] [] |
+ gutenprint | [] |
+ hello | [] [] [] [] [] |
+ id-utils | [] [] |
+ impost | |
+ indent | [] [] [] |
+ iso_3166 | [] [] |
+ iso_3166_1 | [] [] [] [] [] |
+ iso_3166_2 | |
+ iso_3166_3 | [] |
+ iso_4217 | [] |
+ iso_639 | [] [] |
+ jpilot | [] |
+ jtag | |
+ jwhois | |
+ kbd | [] [] [] [] |
+ keytouch | |
+ keytouch-editor | |
+ keytouch-keyboa... | |
+ latrine | () |
+ ld | [] |
+ leafpad | [] [] [] [] [] |
+ libc | [] [] [] [] [] |
+ libexif | [] |
+ libextractor | [] |
+ libgpewidget | [] [] [] |
+ libgpg-error | [] |
+ libgphoto2 | [] [] |
+ libgphoto2_port | [] [] |
+ libgsasl | |
+ libiconv | [] [] |
+ libidn | [] [] |
+ lifelines | [] () |
+ lilypond | [] |
+ lingoteach | |
+ lynx | [] [] [] [] |
+ m4 | [] [] [] [] |
+ mailutils | [] |
+ make | [] [] |
+ man-db | [] () [] [] |
+ minicom | [] [] [] |
+ mysecretdiary | [] [] |
+ nano | [] [] () [] |
+ nano_1_0 | [] () [] [] |
+ opcodes | [] |
+ parted | |
+ pilot-qof | [] |
+ psmisc | [] |
+ pwdutils | |
+ python | |
+ qof | |
+ radius | [] |
+ recode | [] [] [] [] [] [] |
+ rpm | [] [] |
+ screem | |
+ scrollkeeper | [] [] [] [] [] [] [] [] |
+ sed | [] [] [] |
+ sh-utils | [] [] |
+ shared-mime-info | [] [] [] |
+ sharutils | [] [] [] [] [] [] |
+ shishi | |
+ silky | |
+ skencil | [] () |
+ sketch | [] () |
+ solfege | |
+ soundtracker | [] [] |
+ sp | [] |
+ stardict | [] |
+ system-tools-ba... | [] [] [] [] [] [] [] [] [] |
+ tar | [] |
+ texinfo | [] [] [] |
+ textutils | [] [] [] |
+ tin | () () |
+ tp-robot | [] |
+ tuxpaint | [] [] [] [] [] |
+ unicode-han-tra... | |
+ unicode-transla... | |
+ util-linux | [] [] [] [] |
+ vorbis-tools | [] [] [] [] |
+ wastesedge | () |
+ wdiff | [] [] [] [] |
+ wget | [] [] |
+ xchat | [] [] [] [] [] |
+ xkeyboard-config | |
+ xpad | [] [] |
+ +----------------------------------------------------+
+ af am ar az be bg bs ca cs cy da de el en en_GB eo
+ 11 0 1 2 8 21 1 42 43 2 62 99 18 1 16 16
+
+ es et eu fa fi fr ga gl gu he hi hr hu id is it
+ +--------------------------------------------------+
+ GNUnet | |
+ a2ps | [] [] [] () |
+ aegis | |
+ ant-phone | [] |
+ anubis | [] |
+ ap-utils | [] [] |
+ aspell | [] [] [] |
+ bash | [] [] [] |
+ batchelor | [] [] |
+ bfd | [] |
+ bibshelf | [] [] [] |
+ binutils | [] [] [] |
+ bison | [] [] [] [] [] [] |
+ bison-runtime | [] [] [] [] [] |
+ bluez-pin | [] [] [] [] [] |
+ cflow | |
+ clisp | [] [] |
+ console-tools | |
+ coreutils | [] [] [] [] [] [] |
+ cpio | [] [] [] |
+ cpplib | [] [] |
+ cryptonit | [] |
+ darkstat | [] () [] [] [] |
+ dialog | [] [] [] [] [] [] [] [] |
+ diffutils | [] [] [] [] [] [] [] [] [] |
+ doodle | [] [] |
+ e2fsprogs | [] [] [] |
+ enscript | [] [] [] |
+ error | [] [] [] [] [] |
+ fetchmail | [] |
+ fileutils | [] [] [] [] [] [] |
+ findutils | [] [] [] [] |
+ flex | [] [] [] |
+ fslint | [] |
+ gas | [] [] |
+ gawk | [] [] [] [] |
+ gbiff | [] |
+ gcal | [] [] |
+ gcc | [] |
+ gettext-examples | [] [] [] [] [] |
+ gettext-runtime | [] [] [] [] [] [] |
+ gettext-tools | [] [] [] |
+ gimp-print | [] [] |
+ gip | [] [] [] |
+ gliv | () |
+ glunarclock | [] [] [] |
+ gmult | [] [] [] |
+ gnubiff | () () |
+ gnucash | () () () |
+ gnucash-glossary | [] [] |
+ gnuedu | [] |
+ gnulib | [] [] [] [] [] [] [] [] |
+ gnunet-gtk | |
+ gnutls | |
+ gpe-aerial | [] [] |
+ gpe-beam | [] [] |
+ gpe-calendar | [] [] [] [] |
+ gpe-clock | [] [] [] [] |
+ gpe-conf | [] |
+ gpe-contacts | [] [] |
+ gpe-edit | [] [] [] [] |
+ gpe-filemanager | [] |
+ gpe-go | [] [] [] |
+ gpe-login | [] [] [] |
+ gpe-ownerinfo | [] [] [] [] [] |
+ gpe-package | [] |
+ gpe-sketchbook | [] [] |
+ gpe-su | [] [] [] [] |
+ gpe-taskmanager | [] [] [] |
+ gpe-timesheet | [] [] [] [] |
+ gpe-today | [] [] [] [] |
+ gpe-todo | [] |
+ gphoto2 | [] [] [] [] [] |
+ gprof | [] [] [] [] |
+ gpsdrive | () () [] () |
+ gramadoir | [] [] |
+ grep | [] [] [] [] [] [] [] [] [] [] [] [] |
+ gretl | [] [] [] |
+ gsasl | [] |
+ gss | [] |
+ gst-plugins | [] [] [] |
+ gst-plugins-base | [] [] |
+ gst-plugins-good | [] [] [] |
+ gstreamer | [] [] [] |
+ gtick | [] [] [] [] [] |
+ gtkam | [] [] [] [] |
+ gtkorphan | [] [] |
+ gtkspell | [] [] [] [] [] [] |
+ gutenprint | [] |
+ hello | [] [] [] [] [] [] [] [] [] [] [] [] [] |
+ id-utils | [] [] [] [] [] |
+ impost | [] [] |
+ indent | [] [] [] [] [] [] [] [] [] [] |
+ iso_3166 | [] [] [] |
+ iso_3166_1 | [] [] [] [] [] [] [] |
+ iso_3166_2 | [] |
+ iso_3166_3 | [] |
+ iso_4217 | [] [] [] [] |
+ iso_639 | [] [] [] [] [] |
+ jpilot | [] [] |
+ jtag | [] |
+ jwhois | [] [] [] [] [] |
+ kbd | [] [] |
+ keytouch | [] |
+ keytouch-editor | [] |
+ keytouch-keyboa... | [] |
+ latrine | [] [] [] |
+ ld | [] [] |
+ leafpad | [] [] [] [] [] [] |
+ libc | [] [] [] [] [] |
+ libexif | [] |
+ libextractor | [] |
+ libgpewidget | [] [] [] [] [] |
+ libgpg-error | |
+ libgphoto2 | [] [] [] |
+ libgphoto2_port | [] [] |
+ libgsasl | [] [] |
+ libiconv | [] |
+ libidn | [] [] |
+ lifelines | () |
+ lilypond | [] |
+ lingoteach | [] [] [] |
+ lynx | [] [] [] |
+ m4 | [] [] [] [] |
+ mailutils | [] [] |
+ make | [] [] [] [] [] [] [] [] |
+ man-db | () |
+ minicom | [] [] [] [] |
+ mysecretdiary | [] [] [] |
+ nano | [] () [] [] [] [] |
+ nano_1_0 | [] [] [] [] [] |
+ opcodes | [] [] [] [] |
+ parted | [] [] [] [] |
+ pilot-qof | |
+ psmisc | [] [] [] |
+ pwdutils | |
+ python | |
+ qof | |
+ radius | [] [] |
+ recode | [] [] [] [] [] [] [] [] |
+ rpm | [] [] |
+ screem | |
+ scrollkeeper | [] [] [] |
+ sed | [] [] [] [] [] |
+ sh-utils | [] [] [] [] [] [] [] |
+ shared-mime-info | [] [] [] [] [] [] |
+ sharutils | [] [] [] [] [] [] [] [] |
+ shishi | |
+ silky | [] |
+ skencil | [] [] |
+ sketch | [] [] |
+ solfege | [] |
+ soundtracker | [] [] [] |
+ sp | [] |
+ stardict | [] |
+ system-tools-ba... | [] [] [] [] [] [] [] [] |
+ tar | [] [] [] [] [] [] |
+ texinfo | [] [] |
+ textutils | [] [] [] [] [] |
+ tin | [] () |
+ tp-robot | [] [] [] [] |
+ tuxpaint | [] [] |
+ unicode-han-tra... | |
+ unicode-transla... | [] [] |
+ util-linux | [] [] [] [] [] [] [] |
+ vorbis-tools | [] [] |
+ wastesedge | () |
+ wdiff | [] [] [] [] [] [] [] [] |
+ wget | [] [] [] [] [] [] [] [] |
+ xchat | [] [] [] [] [] [] [] [] |
+ xkeyboard-config | [] [] [] [] |
+ xpad | [] [] [] |
+ +--------------------------------------------------+
+ es et eu fa fi fr ga gl gu he hi hr hu id is it
+ 89 21 16 2 41 119 61 14 1 8 1 6 61 30 0 53
+
+ ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
+ +--------------------------------------------------+
+ GNUnet | |
+ a2ps | () [] [] () |
+ aegis | () |
+ ant-phone | [] |
+ anubis | [] [] [] |
+ ap-utils | [] |
+ aspell | [] [] |
+ bash | [] |
+ batchelor | [] [] |
+ bfd | |
+ bibshelf | [] |
+ binutils | |
+ bison | [] [] [] |
+ bison-runtime | [] [] [] |
+ bluez-pin | [] [] [] |
+ cflow | |
+ clisp | [] |
+ console-tools | |
+ coreutils | [] |
+ cpio | |
+ cpplib | [] |
+ cryptonit | [] |
+ darkstat | [] [] |
+ dialog | [] [] |
+ diffutils | [] [] [] |
+ doodle | |
+ e2fsprogs | [] |
+ enscript | [] |
+ error | [] |
+ fetchmail | [] [] |
+ fileutils | [] [] |
+ findutils | [] |
+ flex | [] [] |
+ fslint | [] [] |
+ gas | |
+ gawk | [] [] |
+ gbiff | [] |
+ gcal | |
+ gcc | |
+ gettext-examples | [] [] |
+ gettext-runtime | [] [] [] |
+ gettext-tools | [] [] |
+ gimp-print | [] [] |
+ gip | [] [] |
+ gliv | [] |
+ glunarclock | [] [] |
+ gmult | [] [] |
+ gnubiff | |
+ gnucash | () () |
+ gnucash-glossary | [] |
+ gnuedu | |
+ gnulib | [] [] [] [] |
+ gnunet-gtk | |
+ gnutls | |
+ gpe-aerial | [] |
+ gpe-beam | [] |
+ gpe-calendar | [] |
+ gpe-clock | [] [] |
+ gpe-conf | [] [] |
+ gpe-contacts | [] |
+ gpe-edit | [] [] |
+ gpe-filemanager | [] |
+ gpe-go | [] [] |
+ gpe-login | [] [] |
+ gpe-ownerinfo | [] |
+ gpe-package | [] |
+ gpe-sketchbook | [] [] |
+ gpe-su | [] [] |
+ gpe-taskmanager | [] [] [] |
+ gpe-timesheet | [] |
+ gpe-today | [] |
+ gpe-todo | |
+ gphoto2 | [] [] |
+ gprof | |
+ gpsdrive | () () () |
+ gramadoir | () |
+ grep | [] [] [] |
+ gretl | |
+ gsasl | [] |
+ gss | |
+ gst-plugins | [] |
+ gst-plugins-base | |
+ gst-plugins-good | [] |
+ gstreamer | [] |
+ gtick | [] |
+ gtkam | [] |
+ gtkorphan | [] |
+ gtkspell | [] [] |
+ gutenprint | |
+ hello | [] [] [] [] [] [] [] [] |
+ id-utils | [] |
+ impost | |
+ indent | [] [] |
+ iso_3166 | [] |
+ iso_3166_1 | [] [] |
+ iso_3166_2 | [] |
+ iso_3166_3 | [] |
+ iso_4217 | [] [] [] |
+ iso_639 | [] [] |
+ jpilot | () () () |
+ jtag | |
+ jwhois | [] |
+ kbd | [] |
+ keytouch | [] |
+ keytouch-editor | |
+ keytouch-keyboa... | |
+ latrine | [] |
+ ld | |
+ leafpad | [] [] |
+ libc | [] [] [] [] [] |
+ libexif | |
+ libextractor | |
+ libgpewidget | [] |
+ libgpg-error | |
+ libgphoto2 | [] |
+ libgphoto2_port | [] |
+ libgsasl | [] |
+ libiconv | |
+ libidn | [] [] |
+ lifelines | [] |
+ lilypond | |
+ lingoteach | [] |
+ lynx | [] [] |
+ m4 | [] [] |
+ mailutils | |
+ make | [] [] [] |
+ man-db | () |
+ minicom | [] |
+ mysecretdiary | [] |
+ nano | [] [] [] |
+ nano_1_0 | [] [] [] |
+ opcodes | [] |
+ parted | [] [] |
+ pilot-qof | |
+ psmisc | [] [] [] |
+ pwdutils | |
+ python | |
+ qof | |
+ radius | |
+ recode | [] |
+ rpm | [] [] |
+ screem | [] |
+ scrollkeeper | [] [] [] [] |
+ sed | [] [] |
+ sh-utils | [] [] |
+ shared-mime-info | [] [] [] [] [] |
+ sharutils | [] [] |
+ shishi | |
+ silky | [] |
+ skencil | |
+ sketch | |
+ solfege | |
+ soundtracker | |
+ sp | () |
+ stardict | [] [] |
+ system-tools-ba... | [] [] [] [] |
+ tar | [] [] [] |
+ texinfo | [] [] [] |
+ textutils | [] [] [] |
+ tin | |
+ tp-robot | [] |
+ tuxpaint | [] |
+ unicode-han-tra... | |
+ unicode-transla... | |
+ util-linux | [] [] |
+ vorbis-tools | [] |
+ wastesedge | [] |
+ wdiff | [] [] |
+ wget | [] [] |
+ xchat | [] [] [] [] |
+ xkeyboard-config | [] |
+ xpad | [] [] [] |
+ +--------------------------------------------------+
+ ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no
+ 40 24 2 1 1 3 1 2 3 21 0 15 1 101 5 3
+
+ nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
+ +------------------------------------------------------+
+ GNUnet | |
+ a2ps | () [] [] [] [] [] [] |
+ aegis | () () |
+ ant-phone | [] [] |
+ anubis | [] [] [] |
+ ap-utils | () |
+ aspell | [] [] |
+ bash | [] [] [] |
+ batchelor | [] [] |
+ bfd | |
+ bibshelf | [] |
+ binutils | [] [] |
+ bison | [] [] [] [] [] |
+ bison-runtime | [] [] [] [] |
+ bluez-pin | [] [] [] [] [] [] [] [] [] |
+ cflow | [] |
+ clisp | [] |
+ console-tools | [] |
+ coreutils | [] [] [] [] |
+ cpio | [] [] [] |
+ cpplib | [] |
+ cryptonit | [] [] |
+ darkstat | [] [] [] [] [] [] |
+ dialog | [] [] [] [] [] [] [] [] [] |
+ diffutils | [] [] [] [] [] [] |
+ doodle | [] [] |
+ e2fsprogs | [] [] |
+ enscript | [] [] [] [] [] |
+ error | [] [] [] [] |
+ fetchmail | [] [] [] |
+ fileutils | [] [] [] [] [] |
+ findutils | [] [] [] [] [] [] |
+ flex | [] [] [] [] [] |
+ fslint | [] [] [] [] |
+ gas | |
+ gawk | [] [] [] [] |
+ gbiff | [] |
+ gcal | [] |
+ gcc | [] |
+ gettext-examples | [] [] [] [] [] [] [] [] |
+ gettext-runtime | [] [] [] [] [] [] [] [] |
+ gettext-tools | [] [] [] [] [] [] [] |
+ gimp-print | [] [] |
+ gip | [] [] [] [] |
+ gliv | [] [] [] [] |
+ glunarclock | [] [] [] [] [] [] |
+ gmult | [] [] [] [] |
+ gnubiff | () |
+ gnucash | () [] |
+ gnucash-glossary | [] [] [] |
+ gnuedu | |
+ gnulib | [] [] [] [] [] |
+ gnunet-gtk | [] |
+ gnutls | [] [] |
+ gpe-aerial | [] [] [] [] [] [] [] |
+ gpe-beam | [] [] [] [] [] [] [] |
+ gpe-calendar | [] [] [] [] [] [] [] [] |
+ gpe-clock | [] [] [] [] [] [] [] [] |
+ gpe-conf | [] [] [] [] [] [] [] |
+ gpe-contacts | [] [] [] [] [] |
+ gpe-edit | [] [] [] [] [] [] [] [] |
+ gpe-filemanager | [] [] |
+ gpe-go | [] [] [] [] [] [] |
+ gpe-login | [] [] [] [] [] [] [] [] |
+ gpe-ownerinfo | [] [] [] [] [] [] [] [] |
+ gpe-package | [] [] |
+ gpe-sketchbook | [] [] [] [] [] [] [] [] |
+ gpe-su | [] [] [] [] [] [] [] [] |
+ gpe-taskmanager | [] [] [] [] [] [] [] [] |
+ gpe-timesheet | [] [] [] [] [] [] [] [] |
+ gpe-today | [] [] [] [] [] [] [] [] |
+ gpe-todo | [] [] [] [] |
+ gphoto2 | [] [] [] [] [] |
+ gprof | [] [] [] |
+ gpsdrive | [] [] [] |
+ gramadoir | [] [] |
+ grep | [] [] [] [] [] [] [] [] |
+ gretl | [] |
+ gsasl | [] [] |
+ gss | [] [] [] |
+ gst-plugins | [] [] [] [] |
+ gst-plugins-base | [] |
+ gst-plugins-good | [] [] [] [] |
+ gstreamer | [] [] [] |
+ gtick | [] [] [] |
+ gtkam | [] [] [] [] |
+ gtkorphan | [] |
+ gtkspell | [] [] [] [] [] [] [] [] |
+ gutenprint | [] |
+ hello | [] [] [] [] [] [] [] [] |
+ id-utils | [] [] [] [] |
+ impost | [] |
+ indent | [] [] [] [] [] [] |
+ iso_3166 | [] [] [] [] [] [] |
+ iso_3166_1 | [] [] [] [] |
+ iso_3166_2 | |
+ iso_3166_3 | [] [] [] [] |
+ iso_4217 | [] [] [] [] |
+ iso_639 | [] [] [] [] |
+ jpilot | |
+ jtag | [] |
+ jwhois | [] [] [] [] |
+ kbd | [] [] [] |
+ keytouch | [] |
+ keytouch-editor | [] |
+ keytouch-keyboa... | [] |
+ latrine | [] [] |
+ ld | [] |
+ leafpad | [] [] [] [] [] [] |
+ libc | [] [] [] [] [] |
+ libexif | [] |
+ libextractor | [] [] |
+ libgpewidget | [] [] [] [] [] [] [] |
+ libgpg-error | [] [] |
+ libgphoto2 | [] |
+ libgphoto2_port | [] [] [] |
+ libgsasl | [] [] [] [] |
+ libiconv | |
+ libidn | [] [] () |
+ lifelines | [] [] |
+ lilypond | |
+ lingoteach | [] |
+ lynx | [] [] [] |
+ m4 | [] [] [] [] [] |
+ mailutils | [] [] [] [] |
+ make | [] [] [] [] |
+ man-db | [] [] |
+ minicom | [] [] [] [] [] |
+ mysecretdiary | [] [] [] [] |
+ nano | [] [] |
+ nano_1_0 | [] [] [] [] |
+ opcodes | [] [] |
+ parted | [] |
+ pilot-qof | [] |
+ psmisc | [] [] |
+ pwdutils | [] [] |
+ python | |
+ qof | [] |
+ radius | [] [] |
+ recode | [] [] [] [] [] [] [] |
+ rpm | [] [] [] [] |
+ screem | |
+ scrollkeeper | [] [] [] [] [] [] [] |
+ sed | [] [] [] [] [] [] [] [] [] |
+ sh-utils | [] [] [] |
+ shared-mime-info | [] [] [] [] [] |
+ sharutils | [] [] [] [] |
+ shishi | [] |
+ silky | [] |
+ skencil | [] [] [] |
+ sketch | [] [] [] |
+ solfege | [] |
+ soundtracker | [] [] |
+ sp | |
+ stardict | [] [] [] |
+ system-tools-ba... | [] [] [] [] [] [] [] [] [] |
+ tar | [] [] [] [] [] |
+ texinfo | [] [] [] [] |
+ textutils | [] [] [] |
+ tin | () |
+ tp-robot | [] |
+ tuxpaint | [] [] [] [] [] |
+ unicode-han-tra... | |
+ unicode-transla... | |
+ util-linux | [] [] [] [] |
+ vorbis-tools | [] [] |
+ wastesedge | |
+ wdiff | [] [] [] [] [] [] |
+ wget | [] [] [] [] |
+ xchat | [] [] [] [] [] [] [] |
+ xkeyboard-config | [] [] |
+ xpad | [] [] [] |
+ +------------------------------------------------------+
+ nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta
+ 0 2 3 58 31 53 5 76 72 5 42 48 12 51 130 2
+
+ tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
+ +---------------------------------------------------+
+ GNUnet | [] | 2
+ a2ps | [] [] [] | 19
+ aegis | | 0
+ ant-phone | [] [] | 6
+ anubis | [] [] [] | 11
+ ap-utils | () [] | 4
+ aspell | [] [] [] | 14
+ bash | [] | 11
+ batchelor | [] [] | 9
+ bfd | | 1
+ bibshelf | [] | 7
+ binutils | [] [] [] | 9
+ bison | [] [] [] | 19
+ bison-runtime | [] [] [] | 16
+ bluez-pin | [] [] [] [] [] [] | 28
+ cflow | [] [] | 4
+ clisp | | 6
+ console-tools | [] [] | 5
+ coreutils | [] [] | 17
+ cpio | [] [] [] | 9
+ cpplib | [] [] [] [] | 11
+ cryptonit | | 5
+ darkstat | [] () () | 15
+ dialog | [] [] [] [] [] | 30
+ diffutils | [] [] [] [] | 28
+ doodle | [] | 6
+ e2fsprogs | [] [] | 10
+ enscript | [] [] [] | 16
+ error | [] [] [] [] | 18
+ fetchmail | [] [] | 12
+ fileutils | [] [] [] | 18
+ findutils | [] [] [] | 17
+ flex | [] [] | 15
+ fslint | [] | 9
+ gas | [] | 3
+ gawk | [] [] | 15
+ gbiff | [] | 5
+ gcal | [] | 5
+ gcc | [] [] [] | 6
+ gettext-examples | [] [] [] [] [] [] | 26
+ gettext-runtime | [] [] [] [] [] [] | 28
+ gettext-tools | [] [] [] [] [] | 19
+ gimp-print | [] [] | 12
+ gip | [] [] | 12
+ gliv | [] [] | 8
+ glunarclock | [] [] [] | 15
+ gmult | [] [] [] [] | 15
+ gnubiff | [] | 1
+ gnucash | () | 2
+ gnucash-glossary | [] [] | 9
+ gnuedu | [] | 2
+ gnulib | [] [] [] [] [] | 28
+ gnunet-gtk | | 1
+ gnutls | | 2
+ gpe-aerial | [] [] | 14
+ gpe-beam | [] [] | 14
+ gpe-calendar | [] [] [] [] | 19
+ gpe-clock | [] [] [] [] | 20
+ gpe-conf | [] [] | 14
+ gpe-contacts | [] [] | 10
+ gpe-edit | [] [] [] [] | 19
+ gpe-filemanager | [] | 5
+ gpe-go | [] [] | 14
+ gpe-login | [] [] [] [] [] | 20
+ gpe-ownerinfo | [] [] [] [] | 20
+ gpe-package | [] | 5
+ gpe-sketchbook | [] [] | 16
+ gpe-su | [] [] [] | 19
+ gpe-taskmanager | [] [] [] | 19
+ gpe-timesheet | [] [] [] [] | 18
+ gpe-today | [] [] [] [] [] | 20
+ gpe-todo | [] | 6
+ gphoto2 | [] [] [] [] | 20
+ gprof | [] [] | 11
+ gpsdrive | | 4
+ gramadoir | [] | 7
+ grep | [] [] [] [] | 33
+ gretl | | 4
+ gsasl | [] [] | 6
+ gss | [] | 5
+ gst-plugins | [] [] [] | 15
+ gst-plugins-base | [] [] [] | 9
+ gst-plugins-good | [] [] [] | 18
+ gstreamer | [] [] [] | 17
+ gtick | [] | 11
+ gtkam | [] | 13
+ gtkorphan | [] | 7
+ gtkspell | [] [] [] [] [] [] | 26
+ gutenprint | | 3
+ hello | [] [] [] [] [] | 39
+ id-utils | [] [] | 14
+ impost | [] | 4
+ indent | [] [] [] [] | 25
+ iso_3166 | [] [] [] | 15
+ iso_3166_1 | [] [] | 20
+ iso_3166_2 | | 2
+ iso_3166_3 | [] [] | 9
+ iso_4217 | [] [] | 14
+ iso_639 | [] | 14
+ jpilot | [] [] [] [] | 7
+ jtag | [] | 3
+ jwhois | [] [] [] | 13
+ kbd | [] [] | 12
+ keytouch | [] | 4
+ keytouch-editor | | 2
+ keytouch-keyboa... | | 2
+ latrine | [] [] | 8
+ ld | [] [] [] [] | 8
+ leafpad | [] [] [] [] | 23
+ libc | [] [] [] | 23
+ libexif | [] | 4
+ libextractor | [] | 5
+ libgpewidget | [] [] [] | 19
+ libgpg-error | [] | 4
+ libgphoto2 | [] | 8
+ libgphoto2_port | [] [] [] | 11
+ libgsasl | [] | 8
+ libiconv | [] | 4
+ libidn | [] [] | 10
+ lifelines | | 4
+ lilypond | | 2
+ lingoteach | [] | 6
+ lynx | [] [] [] | 15
+ m4 | [] [] [] | 18
+ mailutils | [] | 8
+ make | [] [] [] | 20
+ man-db | [] | 6
+ minicom | [] | 14
+ mysecretdiary | [] [] | 12
+ nano | [] [] | 15
+ nano_1_0 | [] [] [] | 18
+ opcodes | [] [] | 10
+ parted | [] [] [] | 10
+ pilot-qof | [] | 3
+ psmisc | [] | 10
+ pwdutils | [] | 3
+ python | | 0
+ qof | [] | 2
+ radius | [] | 6
+ recode | [] [] [] | 25
+ rpm | [] [] [] [] | 14
+ screem | [] | 2
+ scrollkeeper | [] [] [] [] | 26
+ sed | [] [] [] | 22
+ sh-utils | [] | 15
+ shared-mime-info | [] [] [] [] | 23
+ sharutils | [] [] [] | 23
+ shishi | | 1
+ silky | [] | 4
+ skencil | [] | 7
+ sketch | | 6
+ solfege | | 2
+ soundtracker | [] [] | 9
+ sp | [] | 3
+ stardict | [] [] [] [] | 11
+ system-tools-ba... | [] [] [] [] [] [] [] | 37
+ tar | [] [] [] [] | 19
+ texinfo | [] [] [] | 15
+ textutils | [] [] [] | 17
+ tin | | 1
+ tp-robot | [] [] [] | 10
+ tuxpaint | [] [] [] | 16
+ unicode-han-tra... | | 0
+ unicode-transla... | | 2
+ util-linux | [] [] [] | 20
+ vorbis-tools | [] [] | 11
+ wastesedge | | 1
+ wdiff | [] [] | 22
+ wget | [] [] [] | 19
+ xchat | [] [] [] [] | 28
+ xkeyboard-config | [] [] [] [] | 11
+ xpad | [] [] [] | 14
+ +---------------------------------------------------+
+ 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu
+ 172 domains 0 1 1 78 39 0 135 13 1 50 3 54 0 2054
+
+ Some counters in the preceding matrix are higher than the number of
+visible blocks let us expect. This is because a few extra PO files are
+used for implementing regional variants of languages, or language
+dialects.
+
+ For a PO file in the matrix above to be effective, the package to
+which it applies should also have been internationalized and
+distributed as such by its maintainer. There might be an observable
+lag between the mere existence a PO file and its wide availability in a
+distribution.
+
+ If July 2006 seems to be old, you may fetch a more recent copy of
+this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date
+matrix with full percentage details can be found at
+`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
+
+1.6 Using `gettext' in new packages
+===================================
+
+If you are writing a freely available program and want to
+internationalize it you are welcome to use GNU `gettext' in your
+package. Of course you have to respect the GNU Library General Public
+License which covers the use of the GNU `gettext' library. This means
+in particular that even non-free programs can use `libintl' as a shared
+library, whereas only free software can use `libintl' as a static
+library or use modified versions of `libintl'.
+
+ Once the sources are changed appropriately and the setup can handle
+the use of `gettext' the only thing missing are the translations. The
+Free Translation Project is also available for packages which are not
+developed inside the GNU project. Therefore the information given above
+applies also for every other Free Software Project. Contact
+`translation@iro.umontreal.ca' to make the `.pot' files available to
+the translation teams.
+
diff --git a/alsa-utils/Android.mk b/alsa-utils/Android.mk
new file mode 100644
index 0000000..54e055e
--- /dev/null
+++ b/alsa-utils/Android.mk
@@ -0,0 +1,98 @@
+
+ifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),true)
+ifeq ($(strip $(BUILD_WITH_ALSA_UTILS)),true)
+
+LOCAL_PATH:= $(call my-dir)
+
+#
+# Build aplay command
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS := \
+ -fPIC -D_POSIX_SOURCE \
+ -DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
+ -DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
+ -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/android \
+ external/alsa-lib/include
+
+LOCAL_SRC_FILES := \
+ aplay/aplay.c
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := alsa_aplay
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudio \
+ libc
+
+include $(BUILD_EXECUTABLE)
+
+#
+# Build alsactl command
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS := \
+ -fPIC -D_POSIX_SOURCE \
+ -DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
+ -DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
+ -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/android \
+ external/alsa-lib/include
+
+LOCAL_SRC_FILES := \
+ alsactl/alsactl.c \
+ alsactl/init_parse.c \
+ alsactl/state.c \
+ alsactl/utils.c
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := alsa_ctl
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudio \
+ libc
+
+include $(BUILD_EXECUTABLE)
+
+#
+# Build amixer command
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS := \
+ -fPIC -D_POSIX_SOURCE \
+ -DALSA_CONFIG_DIR=\"/system/usr/share/alsa\" \
+ -DALSA_PLUGIN_DIR=\"/system/usr/lib/alsa-lib\" \
+ -DALSA_DEVICE_DIRECTORY=\"/dev/snd/\"
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/android \
+ external/alsa-lib/include
+
+LOCAL_SRC_FILES := \
+ amixer/amixer.c
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := alsa_amixer
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudio \
+ libc
+
+include $(BUILD_EXECUTABLE)
+
+endif
+endif
diff --git a/alsa-utils/COPYING b/alsa-utils/COPYING
new file mode 100644
index 0000000..5b6e7c6
--- /dev/null
+++ b/alsa-utils/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/alsa-utils/ChangeLog b/alsa-utils/ChangeLog
new file mode 100644
index 0000000..06849ec
--- /dev/null
+++ b/alsa-utils/ChangeLog
@@ -0,0 +1,43 @@
+2005-08-13 gettextize <bug-gnu-gettext@gnu.org>
+
+ * Makefile.am (EXTRA_DIST): Add config.rpath, mkinstalldirs.
+ * configure.in (AM_GNU_GETTEXT_VERSION): Bump to 0.14.4.
+
+0.0.7 -> 0.2.0
+
+* removed error message from alsamixer
+* fixes in alsactl program
+* version is now compatible with driver
+
+0.0.6 -> 0.0.7
+
+* added alsactl control program
+* updated alsamixer by Carl van Schaik <carl@dreamcoat.che.uct.ac.za>
+ - stereo record source select
+ - left/right route support
+
+0.0.5 -> 0.0.6
+
+* updates for new alsa-lib
+* fixed compilation problems with config.h header file
+* updated output 'aplay -l'
+
+0.0.3 -> 0.0.4
+
+* added check for alsa-lib package
+* added spec file for RPM
+
+0.0.2 -> 0.0.3
+
+* included great ncurses alsamixer from Tim Janik <timj@gtk.org>
+* enhanced Mixer from Andy Lo A Foe <arloafoe@cs.vu.nl> renamed to amixer
+
+0.0.1 -> 0.0.2
+
+* fixed small bug in aplay in command line parsing
+* fixed fragment size allocation for low rate files in aplay
+* a little bit corrected output from Mixer
+
+0.0.1
+
+* initial release (aplay, broken Mixer)
diff --git a/alsa-utils/INSTALL b/alsa-utils/INSTALL
new file mode 100644
index 0000000..202c491
--- /dev/null
+++ b/alsa-utils/INSTALL
@@ -0,0 +1,46 @@
+
+ ALSA utils installation
+ =======================
+
+Requirements
+------------
+
+alsamixer requires the ncurses library. Some systems need to install
+the develop package additionally to link with this library.
+
+alsaconf requires dialog or whiptail program to run properly.
+
+Installation
+------------
+
+For installation you can use these commands:
+
+ ./configure
+ make install
+
+If ./configure command complain that alsa-lib package isn't installed,
+please, check if --prefix option is same for alsa-lib and alsa-utils
+package. The configure script from alsa-utils package probably cannot find
+header file asoundlib.h in $prefix/include/alsa directory (usually in
+/usr/include/alsa directory).
+
+Compilation from HG sources
+---------------------------
+
+You need also GNU packages autoconf and automake installed in your system
+to compile HG (Mercurial) sources of alsa-utils package.
+
+For compilation you can use these commands:
+
+ aclocal
+ gettextize
+ autoheader
+ automake --foreign --copy --add-missing
+ autoconf
+ ./configure
+ make
+
+The included hgcompile script does this job for you.
+
+Note: Some automake packages have missing aclocal program. Use newer version
+ in the case.
diff --git a/alsa-utils/Makefile.am b/alsa-utils/Makefile.am
new file mode 100644
index 0000000..d28422a
--- /dev/null
+++ b/alsa-utils/Makefile.am
@@ -0,0 +1,27 @@
+INCLUDES=-I$(top_srcdir)/include
+if ALSAMIXER
+ALSAMIXER_DIR=alsamixer
+else
+ALSAMIXER_DIR=
+endif
+if ALSACONF
+ALSACONF_DIR=alsaconf
+else
+ALSACONF_DIR=
+endif
+SUBDIRS= include alsactl $(ALSACONF_DIR) $(ALSAMIXER_DIR) amidi amixer \
+ aplay iecset seq speaker-test utils m4 po
+EXTRA_DIST= config.rpath TODO gitcompile
+AUTOMAKE_OPTIONS=foreign
+ACLOCAL_AMFLAGS = -I m4
+
+rpm: dist
+ $(MAKE) -C $@
+
+dist-hook:
+ -chmod -R a+r $(distdir)
+ @if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ else \
+ $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ fi
diff --git a/alsa-utils/Makefile.in b/alsa-utils/Makefile.in
new file mode 100644
index 0000000..c8ec583
--- /dev/null
+++ b/alsa-utils/Makefile.in
@@ -0,0 +1,638 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/alsaconf/po/Makefile.in \
+ $(top_srcdir)/configure ABOUT-NLS COPYING ChangeLog INSTALL \
+ TODO config.guess config.rpath config.sub depcomp install-sh \
+ missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES = alsaconf/po/Makefile
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = include alsactl alsaconf alsamixer amidi amixer aplay \
+ iecset seq speaker-test utils m4 po
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+@ALSAMIXER_FALSE@ALSAMIXER_DIR =
+@ALSAMIXER_TRUE@ALSAMIXER_DIR = alsamixer
+@ALSACONF_FALSE@ALSACONF_DIR =
+@ALSACONF_TRUE@ALSACONF_DIR = alsaconf
+SUBDIRS = include alsactl $(ALSACONF_DIR) $(ALSAMIXER_DIR) amidi amixer \
+ aplay iecset seq speaker-test utils m4 po
+
+EXTRA_DIST = config.rpath TODO gitcompile
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+alsaconf/po/Makefile: $(top_builddir)/config.status $(top_srcdir)/alsaconf/po/Makefile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/alsaconf $(distdir)/alsaconf/po $(distdir)/m4 $(distdir)/po $(distdir)/utils
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
+ dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-generic distclean-recursive distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am
+
+
+rpm: dist
+ $(MAKE) -C $@
+
+dist-hook:
+ -chmod -R a+r $(distdir)
+ @if ! test -z "$(AMTAR)"; then \
+ $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ else \
+ $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
+ fi
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/README b/alsa-utils/README
new file mode 100644
index 0000000..c7e0681
--- /dev/null
+++ b/alsa-utils/README
@@ -0,0 +1,20 @@
+
+ Advanced Linux Sound Architecture - Utilities
+ =============================================
+
+This package contains the command line utilities for the ALSA project.
+The package can be compiled only with the installed ALSA driver and
+the ALSA C library.
+
+alsaconf - the ALSA driver configurator script
+alsactl - an utility for soundcard settings management
+aplay/arecord - an utility for the playback / capture of .wav,.voc,.au files
+amixer - a command line mixer
+alsamixer - a ncurses mixer
+amidi - a utility to send/receive sysex dumps or other MIDI data
+iecset - a utility to show/set the IEC958 status bits
+
+You may give a look for more information about the ALSA project to URL
+http://www.alsa-project.org.
+
+ Jaroslav Kysela <perex@perex.cz>
diff --git a/alsa-utils/TODO b/alsa-utils/TODO
new file mode 100644
index 0000000..a1d880f
--- /dev/null
+++ b/alsa-utils/TODO
@@ -0,0 +1,4 @@
+H add options to aplay to avoid xrun using arecord | aplay
+M Rewrite aplay/arecord tool and separate the experimental stuff
+M Write a *good* mixer
+L Add support for OSS setups to alsactl
diff --git a/alsa-utils/acinclude.m4 b/alsa-utils/acinclude.m4
new file mode 100644
index 0000000..49550f1
--- /dev/null
+++ b/alsa-utils/acinclude.m4
@@ -0,0 +1,12 @@
+AC_DEFUN([SAVE_UTIL_VERSION], [
+SND_UTIL_VERSION=$VERSION
+echo $VERSION > $srcdir/version
+AC_DEFINE_UNQUOTED(VERSION, "$SND_UTIL_VERSION", [ALSA util version])
+AC_SUBST(SND_UTIL_VERSION)
+SND_UTIL_MAJOR=`echo $VERSION | cut -d . -f 1`
+AC_SUBST(SND_UTIL_MAJOR)
+SND_UTIL_MINOR=`echo $VERSION | cut -d . -f 2`
+AC_SUBST(SND_UTIL_MINOR)
+SND_UTIL_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/pre[[0-9]]*//g'`
+AC_SUBST(SND_UTIL_SUBMINOR)
+])
diff --git a/alsa-utils/aclocal.m4 b/alsa-utils/aclocal.m4
new file mode 100644
index 0000000..36ac191
--- /dev/null
+++ b/alsa-utils/aclocal.m4
@@ -0,0 +1,1013 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+dnl Configure Paths for Alsa
+dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
+dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
+dnl Jaroslav Kysela <perex@perex.cz>
+dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $
+dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate.
+dnl enables arguments --with-alsa-prefix=
+dnl --with-alsa-enc-prefix=
+dnl --disable-alsatest
+dnl
+dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
+dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result.
+dnl
+AC_DEFUN([AM_PATH_ALSA],
+[dnl Save the original CFLAGS, LDFLAGS, and LIBS
+alsa_save_CFLAGS="$CFLAGS"
+alsa_save_LDFLAGS="$LDFLAGS"
+alsa_save_LIBS="$LIBS"
+alsa_found=yes
+
+dnl
+dnl Get the cflags and libraries for alsa
+dnl
+AC_ARG_WITH(alsa-prefix,
+[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)],
+[alsa_prefix="$withval"], [alsa_prefix=""])
+
+AC_ARG_WITH(alsa-inc-prefix,
+[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)],
+[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""])
+
+dnl FIXME: this is not yet implemented
+AC_ARG_ENABLE(alsatest,
+[ --disable-alsatest Do not try to compile and run a test Alsa program],
+[enable_alsatest="$enableval"],
+[enable_alsatest=yes])
+
+dnl Add any special include directories
+AC_MSG_CHECKING(for ALSA CFLAGS)
+if test "$alsa_inc_prefix" != "" ; then
+ ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
+ CFLAGS="$CFLAGS -I$alsa_inc_prefix"
+fi
+AC_MSG_RESULT($ALSA_CFLAGS)
+
+dnl add any special lib dirs
+AC_MSG_CHECKING(for ALSA LDFLAGS)
+if test "$alsa_prefix" != "" ; then
+ ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
+ LDFLAGS="$LDFLAGS $ALSA_LIBS"
+fi
+
+dnl add the alsa library
+ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
+LIBS="$ALSA_LIBS $LIBS"
+AC_MSG_RESULT($ALSA_LIBS)
+
+dnl Check for a working version of libasound that is of the right version.
+min_alsa_version=ifelse([$1], ,0.1.1,$1)
+AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version)
+no_alsa=""
+ alsa_min_major_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ alsa_min_minor_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ alsa_min_micro_version=`echo $min_alsa_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_COMPILE([
+#include <alsa/asoundlib.h>
+], [
+/* ensure backward compatibility */
+#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
+#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
+#endif
+#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
+#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
+#endif
+#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
+#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
+#endif
+
+# if(SND_LIB_MAJOR > $alsa_min_major_version)
+ exit(0);
+# else
+# if(SND_LIB_MAJOR < $alsa_min_major_version)
+# error not present
+# endif
+
+# if(SND_LIB_MINOR > $alsa_min_minor_version)
+ exit(0);
+# else
+# if(SND_LIB_MINOR < $alsa_min_minor_version)
+# error not present
+# endif
+
+# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
+# error not present
+# endif
+# endif
+# endif
+exit(0);
+],
+ [AC_MSG_RESULT(found.)],
+ [AC_MSG_RESULT(not present.)
+ ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)])
+ alsa_found=no]
+)
+AC_LANG_RESTORE
+
+dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
+if test "x$enable_alsatest" = "xyes"; then
+AC_CHECK_LIB([asound], [snd_ctl_open],,
+ [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)])
+ alsa_found=no]
+)
+fi
+
+if test "x$alsa_found" = "xyes" ; then
+ ifelse([$2], , :, [$2])
+ LIBS=`echo $LIBS | sed 's/-lasound//g'`
+ LIBS=`echo $LIBS | sed 's/ //'`
+ LIBS="-lasound $LIBS"
+fi
+if test "x$alsa_found" = "xno" ; then
+ ifelse([$3], , :, [$3])
+ CFLAGS="$alsa_save_CFLAGS"
+ LDFLAGS="$alsa_save_LDFLAGS"
+ LIBS="$alsa_save_LIBS"
+ ALSA_CFLAGS=""
+ ALSA_LIBS=""
+fi
+
+dnl That should be it. Now just export out symbols:
+AC_SUBST(ALSA_CFLAGS)
+AC_SUBST(ALSA_LIBS)
+])
+
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/gettext.m4])
+m4_include([m4/iconv.m4])
+m4_include([m4/lib-ld.m4])
+m4_include([m4/lib-link.m4])
+m4_include([m4/lib-prefix.m4])
+m4_include([m4/nls.m4])
+m4_include([m4/po.m4])
+m4_include([m4/progtest.m4])
+m4_include([acinclude.m4])
diff --git a/alsa-utils/alsaconf/Makefile.am b/alsa-utils/alsaconf/Makefile.am
new file mode 100644
index 0000000..a11ecc5
--- /dev/null
+++ b/alsa-utils/alsaconf/Makefile.am
@@ -0,0 +1,37 @@
+sbin_SCRIPTS = alsaconf
+man_MANS = alsaconf.8 alsaconf.fr.8
+EXTRA_DIST = $(man_MANS)
+SUBDIRS = po
+
+install-man8:
+ @for i in $(man_MANS); do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[^.]*$$//'`; \
+ case $$inst in \
+ *.[a-za-z]*)\
+ loc=`echo $$inst | sed -e 's/^.*\\.//'`; \
+ loc="/$$loc"; \
+ inst=`echo $$inst | sed -e 's/\\.[^.]*$$//'`;; \
+ *)\
+ loc="";; \
+ esac; \
+ $(mkinstalldirs) $(DESTDIR)$(mandir)$$loc/man$$ext; \
+ echo " $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
+ done
+
+uninstall-man8:
+ @for i in $(man_MANS); do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[^.]*$$//'`; \
+ case $$inst in \
+ *.[a-za-z]*)\
+ loc=`echo $$inst | sed -e 's/^.*\\.//'`; \
+ loc="/$$loc"; \
+ inst=`echo $$inst | sed -e 's/\\.[^.]*$$//'`;; \
+ *)\
+ loc="";; \
+ esac; \
+ echo " rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
+ rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
+ done
diff --git a/alsa-utils/alsaconf/Makefile.in b/alsa-utils/alsaconf/Makefile.in
new file mode 100644
index 0000000..7d0b63c
--- /dev/null
+++ b/alsa-utils/alsaconf/Makefile.in
@@ -0,0 +1,557 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = alsaconf
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/alsaconf.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES = alsaconf
+am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"
+sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(sbin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+sbin_SCRIPTS = alsaconf
+man_MANS = alsaconf.8 alsaconf.fr.8
+EXTRA_DIST = $(man_MANS)
+SUBDIRS = po
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsaconf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign alsaconf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+alsaconf: $(top_builddir)/config.status $(srcdir)/alsaconf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-sbinSCRIPTS: $(sbin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
+ @list='$(sbin_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+ $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-sbinSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+ done
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(SCRIPTS) $(MANS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-sbinSCRIPTS
+
+install-info: install-info-recursive
+
+install-man: install-man8
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man uninstall-sbinSCRIPTS
+
+uninstall-info: uninstall-info-recursive
+
+uninstall-man: uninstall-man8
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-recursive ctags ctags-recursive \
+ distclean distclean-generic distclean-recursive distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-man8 install-sbinSCRIPTS install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-am uninstall-man uninstall-man8 \
+ uninstall-sbinSCRIPTS
+
+
+install-man8:
+ @for i in $(man_MANS); do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[^.]*$$//'`; \
+ case $$inst in \
+ *.[a-za-z]*)\
+ loc=`echo $$inst | sed -e 's/^.*\\.//'`; \
+ loc="/$$loc"; \
+ inst=`echo $$inst | sed -e 's/\\.[^.]*$$//'`;; \
+ *)\
+ loc="";; \
+ esac; \
+ $(mkinstalldirs) $(DESTDIR)$(mandir)$$loc/man$$ext; \
+ echo " $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
+ $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
+ done
+
+uninstall-man8:
+ @for i in $(man_MANS); do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[^.]*$$//'`; \
+ case $$inst in \
+ *.[a-za-z]*)\
+ loc=`echo $$inst | sed -e 's/^.*\\.//'`; \
+ loc="/$$loc"; \
+ inst=`echo $$inst | sed -e 's/\\.[^.]*$$//'`;; \
+ *)\
+ loc="";; \
+ esac; \
+ echo " rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
+ rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
+ done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/alsaconf/alsaconf.8 b/alsa-utils/alsaconf/alsaconf.8
new file mode 100644
index 0000000..a3e1296
--- /dev/null
+++ b/alsa-utils/alsaconf/alsaconf.8
@@ -0,0 +1,102 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" alsaconf.8 is copyright 2003 by Jordi Mallach <jordi@debian.org>
+.\"
+.\" This is free documentation, see the latest version of the GNU
+.\" General Public License for copying conditions. There is NO warranty.
+.TH ALSACONF 8 "February 23, 2003"
+
+.SH NAME
+alsaconf \- configuration tool for the Advanced Linux Sound Architecture
+
+.SH SYNOPSIS
+.B alsaconf
+.RI [ options ]
+
+.SH DESCRIPTION
+This manual page documents briefly the
+.B alsaconf
+command.
+This manual page was written for the Debian distribution because the
+original program does not have a manual page.
+.PP
+\fBAlsaconf\fP is a simple shell script which tries to detect the sound cards
+on your system and writes a suitable configuration file for ALSA. It will try
+to guess what GNU/Linux distribution you're running, and will act accordingly
+to the standards of that distribution, if specific support is available.
+.PP
+Alsaconf will write a module-init-tools (or modutils) snippet which can be then used by module-init-tools (or modutils)
+to load the correct parameters for your sound card.
+
+.SH OPTIONS
+Alsaconf accepts the following options:
+.TP
+.B \-c, \-\-config file
+Specify the module config file.
+As default,
+.B alsaconf
+probes the available config file automatically.
+.TP
+.B \-d, \-\-devmode mode
+Set the device mode for the ALSA devices (default = 0666).
+This option is obsolete in the recent ALSA version.
+.TP
+.B \-g, \-\-gid gid
+Set the gid for the ALSA devices (default = 0).
+This option is obsolete in the recent ALSA version.
+.TP
+.B \-h, \-\-help
+Displays this help text.
+.TP
+.B \-L, \-\-log file
+Logging on the given file. The log is appended to the file.
+This option is for debugging purpose only.
+.TP
+.B \-l, \-\-legacy
+Check only for legacy non-isapnp cards.
+.TP
+.B \-m, \-\-modinfo
+Read module descriptions instead of reading a card database.
+.TP
+.B \-P, \-\-listprobe
+List the supported legacy card modules.
+.TP
+.B \-p, \-\-probe card-name
+Probe a legacy non-isapnp card and print module options.
+.TP
+.B \-r, \-\-strict
+Set strict device mode (equiv. with \-g 17 \-d 0660).
+This option is obsolete in the recent ALSA version.
+.TP
+.B \-s, \-\-sound\-wav\-file
+Use the specified wav file as a test sound.
+.TP
+.B \-u, \-\-uid uid
+Set the uid for the ALSA devices (default = 0).
+This option is obsolete in the recent ALSA version.
+
+.SH DEBIAN SPECIFIC
+In Debian, the default gid of the device files is 29 (corresponding to the
+audio group) and the default device mode is 0660.
+
+For the ALSA base package, see also
+.I /usr/share/doc/alsa\-base/
+
+.SH SEE ALSO
+\fB
+alsamixer(1),
+amixer(1),
+aplay(1),
+arecord(1)
+\fP
+
+.SH HOMEPAGE
+http://www.alsa\-project.org/
+
+.SH AUTHOR
+The alsaconf script was written by
+Takashi Iwai <tiwai@suse.de>,
+Bernd Kaindl <bk@suse.de> and
+Jan Ondrej (SAL) <ondrejj@salstar.sk>
+
+This manual page was written by Jordi Mallach <jordi@debian.org>,
+for the Debian system (but may be used by others).
diff --git a/alsa-utils/alsaconf/alsaconf.fr.8 b/alsa-utils/alsaconf/alsaconf.fr.8
new file mode 100644
index 0000000..14bbea8
--- /dev/null
+++ b/alsa-utils/alsaconf/alsaconf.fr.8
@@ -0,0 +1,111 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" alsaconf.8 is copyright 2003 by Jordi Mallach <jordi@debian.org>
+.\"
+.\" This is free documentation, see the latest version of the GNU
+.\" General Public License for copying conditions. There is NO warranty.
+.TH ALSACONF 8 "15 mars 2005"
+
+.SH NOM
+alsaconf \- outil de configuration pour ALSA (architecture de son avancée de Linux)
+.\" configuration tool for the Advanced Linux Sound Architecture
+
+.SH SYNOPSIS
+.B alsaconf
+.RI [ options ]
+
+.SH DESCRIPTION
+Cette page de manuel documente brièvement la commande
+.B alsaconf.
+
+.PP
+\fBAlsaconf\fP
+est un simple script shell qui essaye de détecter les cartes son sur votre
+système et écrit un fichier de configuration adéquat pour ALSA. Il va
+essayer de deviner quelle distribution GNU/Linux vous utilisez, et agira
+conformément aux standards de cette distribution, si un support spécifique
+est disponible.
+
+.PP
+Alsaconf va écrire un fragment de code modutils qui peut être ensuite
+utilisé par modutils pour charger les paramètres corrects de votre carte
+son.
+
+.SH OPTIONS
+Alsaconf accepte les options suivantes\ :
+
+.TP
+.B \-l, \-\-legacy
+Cherche seulement les anciennes cartes non-isapnp
+
+.TP
+.B \-m, \-\-modinfo
+Lit les descriptions de modules au lieu de lire une base de données de
+carte
+
+.TP
+.B \-s, \-\-sound\-wav\-file
+Utilise le fichier wav spécifié comme son de test
+
+.TP
+.B \-u, \-\-uid uid
+Choisit l'uid pour les périphériques ALSA (valeur par défaut\ = 0)
+
+.TP
+.B \-g, \-\-gid gid
+Choisit le gid pour les périphériques ALSA (valeur par défaut\ = 0)
+
+.TP
+.B \-d, \-\-devmode mode
+Choisit le mode du périphérique pour les périphériques ALSA (valeur par
+défaut\ : 0666)
+
+.TP
+.B \-r, \-\-strict
+Choisit le mode de périphérique strict (équivaut à -g\ 17 -d\ 0660)
+
+.TP
+.B \-L, \-\-log
+Mise en journal dans /tmp/alsaconf.log
+
+.TP
+.B \-p, \-\-probe card-name
+Teste une ancienne carte non-isapnp et affiche les options du module
+
+.TP
+.B \-h, \-\-help
+Affiche ce message d'aide
+
+
+.SH POUR DEBIAN EXCLUSIVEMENT
+Sous Debian, le gid par défaut des fichiers de périphériques est 29 (qui
+correspond au groupe audio) et le mode par défaut des périphériques est
+0660.
+
+Pour le paquetage de base ALSA, voir aussi
+.I /usr/share/doc/alsa-base/
+
+.SH VOIR AUSSI
+\fB
+alsamixer(1),
+amixer(1),
+aplay(1),
+arecord(1)
+\fP
+
+.SH PAGE D'ACCUEIL
+http://www.alsa-project.org/
+
+.SH AUTEUR
+Le script alsaconf fut écrit par
+Takashi Iwai <tiwai@suse.de>,
+Bernd Kaindl <bk@suse.de> et
+Jan Ondrej (SAL) <ondrejj@salstar.sk>
+
+Cette page de manuel fut écrite par Jordi Mallach <jordi@debian.org>, pour
+le système Debian (mais elle peut être utilisée par d'autres).
+
+.SH TRADUCTION
+Baptiste Mélès 2005.
+
+N'hésitez pas à signaler à l'auteur ou au traducteur, selon le cas, toute
+erreur dans cette page de manuel.
diff --git a/alsa-utils/alsaconf/alsaconf.in b/alsa-utils/alsaconf/alsaconf.in
new file mode 100644
index 0000000..6e9ff75
--- /dev/null
+++ b/alsa-utils/alsaconf/alsaconf.in
@@ -0,0 +1,1435 @@
+#!/bin/bash
+#
+# ALSA Configurator
+#
+# Copyright (c) 1999-2002 SuSE GmbH
+# Jan ONDREJ
+#
+# written by Takashi Iwai <tiwai@suse.de>
+# Bernd Kaindl <bk@suse.de>
+# Jan ONDREJ (SAL) <ondrejj@salstar.sk>
+#
+# based on the original version of Jan ONDREJ's alsaconf for ALSA 0.4.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+export TEXTDOMAIN=alsaconf
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+sbindir=@sbindir@
+version=@VERSION@
+USE_NLS=@USE_NLS@
+
+# Useful for debugging
+PROCFS="/proc"
+SYSFS="/sys"
+
+# i18n stuff
+if test "$USE_NLS" = "yes" && type -p gettext > /dev/null; then
+ xecho() {
+ gettext -s "$*"
+ }
+else
+ xecho() {
+ echo "$*"
+ }
+ gettext() {
+ echo -n "$*"
+ }
+fi
+xmsg() {
+ msg=$(gettext "$1")
+ shift
+ printf "$msg" $*
+}
+
+# Check for GNU/Linux distributions
+if [ -f /etc/SuSE-release ]; then
+ distribution="suse"
+ suse_version=$(grep 'VERSION = ' /etc/SuSE-release | sed -e s/'VERSION = '//)
+elif [ -f /etc/UnitedLinux-release ]; then
+ distribution="suse"
+elif [ -f /etc/gentoo-release ]; then
+ distribution="gentoo"
+elif [ -f /etc/debian_version ]; then
+ distribution="debian"
+elif [ -f /etc/mandrake-release ]; then
+ distribution="mandrake"
+elif test -f /etc/redhat-release && grep -q "Red Hat" /etc/redhat-release; then
+ distribution="redhat"
+elif test -f /etc/fedora-release && grep -q "Fedora" /etc/fedora-release; then
+ distribution="fedora"
+elif [ -f /etc/slackware-version -o -f /etc/slamd64-version ]; then
+ distribution="slackware"
+else
+ distribution="unknown"
+fi
+
+for prog in lspci lsmod; do
+ for path in /sbin /usr/sbin /bin /usr/bin;do
+ test -x $path/$prog && eval $prog=$path/$prog
+ done
+done
+unset prog path
+
+usage() {
+ xecho "ALSA configurator"
+ echo " version $version"
+ xecho "usage: alsaconf [options]
+ -l|--legacy check only legacy non-isapnp cards
+ -m|--modinfo read module descriptions instead of reading card db
+ -s|--sound wav-file
+ use the specified wav file as a test sound
+ -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted]
+ -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted]
+ -d|--devmode mode
+ set the permission for ALSA devices (default = 0666) [obs.]
+ -r|--strict set strict device mode (equiv. with -g 17 -d 0660) [obsoleted]
+ -L|--log file logging on the specified file (for debugging purpose only)
+ -p|--probe card-name
+ probe a legacy non-isapnp card and print module options
+ -P|--listprobe list the supported legacy card modules
+ -c|--config file
+ specify the module config file
+ -R|--resources list available DMA and IRQ resources with debug for legacy
+ -h|--help what you're reading"
+}
+
+OPTS=`getopt -o lmL:hp:Pu:g:d:rs:c:R --long legacy,modinfo,log:,help,probe:,listprobe,uid:,gid:,devmode:,strict,sound:,config:,resources -n alsaconf -- "$@"` || exit 1
+eval set -- "$OPTS"
+
+do_legacy_only=0
+use_modinfo_db=0
+alsa_uid=0
+alsa_gid=0
+alsa_mode=0666
+legacy_probe_card=""
+LOGFILE=""
+TESTSOUND="@TESTSOUND@"
+try_all_combination=0
+resources="false"
+
+# legacy support
+LEGACY_CARDS="opl3sa2 cs4236 cs4232 cs4231 es18xx es1688 sb16 sb8"
+
+while true ; do
+ case "$1" in
+ -l|--legacy)
+ do_legacy_only=1; shift ;;
+ -m|--modinfo)
+ use_modinfo_db=1; shift ;;
+ -s|--sound)
+ TESTSOUND=$2; shift 2;;
+ -h|--help)
+ usage; exit 0 ;;
+ -L|--log)
+ LOGFILE="$2"; shift 2;;
+ -p|--probe)
+ legacy_probe_card="$2"; shift 2;;
+ -P|--listprobe)
+ echo "$LEGACY_CARDS"; exit 0;;
+ -u|--uid)
+ alsa_uid="$2"; shift 2;;
+ -g|--gid)
+ alsa_gid="$2"; shift 2;;
+ -d|--devmode)
+ alsa_mode="$2"; shift 2;;
+ -r|--strict)
+ alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;;
+ -c|--config)
+ cfgfile="$2"; shift 2;;
+ -R|--resources)
+ resources="true"; shift;;
+ --) shift ; break ;;
+ *) usage ; exit 1 ;;
+ esac
+done
+
+#
+# probe legacy ISA cards
+#
+
+check_dma_avail () {
+ list=""
+ if [ -d $SYSFS/bus/pnp/devices ]; then
+ for dma in $*; do
+ ok="true"
+ for i in $SYSFS/bus/pnp/devices/??:* ; do
+ if grep -q "state = active" $i/resources ; then
+ if grep -q '^dma '$dma'$' $i/resources; then
+ ok="false"
+ fi
+ fi
+ done
+ if [ -r $PROCFS/dma ]; then
+ if grep -q '^ *'$dma': ' $PROCFS/dma ; then
+ ok="false"
+ fi
+ fi
+ if [ "$ok" = "true" ]; then
+ list="$list $dma"
+ fi
+ done
+ else
+ if [ -r $PROCFS/dma ]; then
+ for dma in $*; do
+ grep -q '^ *'$dma': ' $PROCFS/dma || list="$list $dma"
+ done
+ fi
+ fi
+ if [ ! -z "$list" ]; then
+ echo $list
+ fi
+}
+
+check_irq_avail () {
+ list=""
+ if [ -d $SYSFS/bus/pnp/devices ]; then
+ for irq in $*; do
+ ok="true"
+ for i in $SYSFS/bus/pnp/devices/??:* ; do
+ if grep -q "state = active" $i/resources ; then
+ if grep -q '^irq '$irq'$' $i/resources; then
+ ok="false"
+ fi
+ fi
+ done
+ if [ -r $PROCFS/interrupts ]; then
+ if grep -q '^ *'$irq': ' $PROCFS/interrupts ; then
+ ok="false"
+ fi
+ fi
+ if [ "$ok" = "true" ]; then
+ list="$list $irq"
+ fi
+ done
+ else
+ if [ -r $PROCFS/interrupts ]; then
+ for irq in $*; do
+ grep -q '^ *'$irq': ' $PROCFS/interrupts || list="$list $irq"
+ done
+ fi
+ fi
+ if [ ! -z "$list" ]; then
+ echo $list
+ fi
+}
+
+#
+#
+#
+
+if [ "$resources" = "true" ]; then
+ if [ -d $SYSFS/bus/pnp/devices ]; then
+ for i in $SYSFS/bus/pnp/devices/??:* ; do
+ if [ "$resources" = "true" ]; then
+ echo ">>>>> PnP file: $i/resources"
+ cat $i/resources
+ fi
+ done
+ fi
+ if [ -r $PROCFS/dma ]; then
+ echo ">>>>> Allocated dma channels:"
+ cat $PROCFS/dma
+ fi
+ if [ -r $PROCFS/interrupts ]; then
+ echo ">>>>> Allocated interrupt channels:"
+ cat $PROCFS/interrupts
+ fi
+ echo -n "Valid DMA channels: "
+ check_dma_avail 0 1 2 3 4 5 6 7
+ echo -n "Valid IRQ channels: "
+ check_irq_avail 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ exit 0
+fi
+
+# Check for root privileges
+if [ `id -u` -ne 0 ]; then
+ xecho "You must be root to use this script."
+ exit 1
+fi
+
+#
+# check the snd_ prefix for ALSA module options
+# snd_ prefix is obsoleted since 0.9.0rc4.
+#
+if /sbin/modinfo -p snd | grep -q snd_ ; then
+ mpfx="snd_"
+else
+ mpfx=""
+fi
+
+alsa_device_opts=""
+if /sbin/modinfo -p snd | grep -q uid ; then
+ if [ x"$alsa_uid" != x0 ]; then
+ alsa_device_opts="$alsa_device_opts ${mpfx}device_uid=$alsa_uid"
+ fi
+ if [ x"$alsa_gid" != x0 ]; then
+ alsa_device_opts="$alsa_device_opts ${mpfx}device_gid=$alsa_gid"
+ fi
+fi
+if /sbin/modinfo -p snd | grep -q device_mode ; then
+ if [ x"$alsa_mode" != x0 ]; then
+ alsa_device_opts="$alsa_device_opts ${mpfx}device_mode=$alsa_mode"
+ fi
+fi
+
+case `uname -r` in
+2.6.*)
+ kernel="new"
+ ;;
+*)
+ kernel="old"
+ ;;
+esac
+
+# cfgfile = base config file to remove/update the sound setting
+# cfgout = new config file to write the sound setting (if different from $cfgfile)
+if [ -n "$cfgfile" ]; then
+ if [ ! -r "$cfgfile" ]; then
+ xecho "ERROR: The config file doesn't exist: "
+ echo $cfgfile
+ exit 1
+ fi
+else
+if [ "$distribution" = "gentoo" ]; then
+ cfgfile="/etc/modules.d/alsa"
+elif [ "$kernel" = "new" ]; then
+ if [ -d /etc/modprobe.d ]; then
+ cfgout="/etc/modprobe.d/sound"
+ fi
+ cfgfile="/etc/modprobe.conf"
+elif [ "$distribution" = "debian" ]; then
+ cfgfile="/etc/modutils/sound"
+elif [ -e /etc/modules.conf ]; then
+ cfgfile="/etc/modules.conf"
+elif [ -e /etc/conf.modules ]; then
+ cfgfile="/etc/conf.modules"
+else
+ cfgfile="/etc/modules.conf"
+ touch /etc/modules.conf
+fi
+fi
+
+# Check for dialog, whiptail, gdialog, awk, ... ?
+if type -p dialog > /dev/null; then
+ DIALOG=dialog
+else
+ if type -p whiptail > /dev/null; then
+ whiptail_wrapper() {
+ X1="$1"
+ X2="$2"
+ if [ $1 = --yesno ]; then
+ X3=`expr $3 + 2`
+ else
+ X3=$3
+ fi
+ shift 3
+ whiptail "$X1" "$X2" $X3 "$@"
+ }
+ DIALOG=whiptail_wrapper
+ else
+ xecho "Error, dialog or whiptail not found."
+ exit 1
+ fi
+fi
+if type -p awk > /dev/null; then :
+else
+ xecho "Error, awk not found. Can't continue."
+ exit 1
+fi
+
+#
+# remove entries by yast2 sound configurator
+#
+remove_y2_block() {
+ awk '
+ /^alias sound-slot-[0-9]/ { next }
+ /^alias char-major-116 / { next }
+ /^alias char-major-14 / { next }
+ /^alias snd-card-[0-9] / { next }
+ /^options snd / { next }
+ /^options snd-/ { next }
+ /^options off / { next }
+ /^alias sound-service-[0-9]/ { next }
+ /^# YaST2: sound / { next }
+ { print }'
+}
+
+#
+# remove entries by sndconfig sound configurator
+#
+# found strings to search for in WriteConfModules,
+# from sndconfig 0.68-4 (rawhide version)
+
+remove_sndconfig_block() {
+ awk '
+ /^alias sound-slot-0/ { modulename = $3 ; next }
+ /^alias sound-slot-[0-9]/ { next }
+ /^post-install sound-slot-[0-9] / { next }
+ /^pre-remove sound-slot-[0-9] / { next }
+ /^options sound / { next }
+ /^alias synth0 opl3/ { next }
+ /^options opl3 / { next }
+ /^alias midi / { mididev = $3 ; next }
+ /^options / { if ($2 == mididev) next }
+ /^pre-install / { if ($2 == mididev) next }
+ /^alias synth0 / { synth = $3 ; next }
+ /^post-install / { if ($2 == synth) next }
+ /^options sb / { next }
+ /^post-install .+ \/bin\/modprobe "aci"/ { if ($2 == modulename) next }
+ /^options adlib_card / { next }
+ /^options .+ isapnp=1/ { if ($2 == modulename) next }
+ /^options i810_audio / { next }
+ /^options / {if ($2 == modulename) next }
+ { print }'
+}
+
+#
+# remove the previous configuration by alsaconf
+#
+remove_ac_block() {
+ awk '/^'"$ACB"'$/,/^'"$ACE"'$/ { next } { print }'
+}
+
+#
+# set default mixer volumes
+#
+set_mixers() {
+ amixer -s -q <<EOF
+set Master 75% unmute
+set Master -12dB
+set 'Master Mono' 75% unmute
+set 'Master Mono' -12dB
+set Front 75% unmute
+set Front -12dB
+set PCM 90% unmute
+set PCM 0dB
+mixer Synth 90% unmute
+mixer Synth 0dB
+mixer CD 90% unmute
+mixer CD 0dB
+# mute mic
+set Mic 0% mute
+# ESS 1969 chipset has 2 PCM channels
+set PCM,1 90% unmute
+set PCM,1 0dB
+# Trident/YMFPCI/emu10k1
+set Wave 100% unmute
+set Music 100% unmute
+set AC97 100% unmute
+# CS4237B chipset:
+set 'Master Digital' 75% unmute
+# Envy24 chips with analog outs
+set DAC 90% unmute
+set DAC -12dB
+set DAC,0 90% unmute
+set DAC,0 -12dB
+set DAC,1 90% unmute
+set DAC,1 -12dB
+# some notebooks use headphone instead of master
+set Headphone 75% unmute
+set Headphone -12dB
+set Playback 100% unmute
+# turn off digital switches
+set "SB Live Analog/Digital Output Jack" off
+set "Audigy Analog/Digital Output Jack" off
+EOF
+}
+
+
+# INTRO
+intro() {
+ local msg=$(xmsg "
+ ALSA CONFIGURATOR
+ version %s
+
+ This script is a configurator for
+ Advanced Linux Sound Architecture (ALSA) driver.
+
+
+ If ALSA is already running, you should close all sound
+ apps now and stop the sound driver.
+ alsaconf will try to do this, but it's not 100%% sure." $version)
+ $DIALOG --msgbox "$msg" 20 63 || acex 0
+}
+
+# FAREWELL
+farewell() {
+ local msg=$(gettext "
+
+ OK, sound driver is configured.
+
+ ALSA CONFIGURATOR
+
+ will prepare the card for playing now.
+
+ Now I'll run alsasound init script, then I'll use
+ amixer to raise the default volumes.
+ You can change the volume later via a mixer
+ program such as alsamixer or gamix.
+
+ ")
+ $DIALOG --msgbox "$msg" 17 60 || acex 0
+}
+
+# Exit function
+acex() {
+ cleanup
+ clear
+ exit $1
+}
+
+#
+# search for alsasound init script
+#
+
+if [ "$distribution" = "debian" ]; then
+ rcalsasound=/etc/init.d/alsa
+elif [ -x /etc/rc.d/rc.alsa ]; then
+ rcalsasound=/etc/rc.d/rc.alsa
+elif [ -x /etc/init.d/alsasound ]; then
+ rcalsasound=/etc/init.d/alsasound
+elif [ -x /usr/sbin/rcalsasound ]; then
+ rcalsasound=/usr/sbin/rcalsasound
+elif [ -x /sbin/rcalsasound ]; then
+ rcalsasound=/sbin/rcalsasound
+elif [ -x /etc/rc.d/init.d/alsasound ]; then
+ rcalsasound=/etc/rc.d/init.d/alsasound
+elif [ -x /etc/init.d/alsa ]; then
+ rcalsasound=/etc/init.d/alsa
+else
+ rcalsasound=rcalsasound
+fi
+
+
+# MAIN
+if [ -d $PROCFS/asound ]; then
+ $rcalsasound stop >/dev/null 2>&1
+ $rcalsasound unload >/dev/null 2>&1
+ /sbin/rmmod dmasound dmasound_awacs 2>/dev/null
+fi
+
+
+cleanup () {
+ killall -9 aplay arecord >/dev/null 2>&1
+ /sbin/modprobe -r isapnp >/dev/null 2>&1
+ /sbin/modprobe -r isa-pnp >/dev/null 2>&1
+ rm -f "$TMP" "$addcfg" "$FOUND" "$DUMP"
+}
+trap cleanup 0
+
+TMP=`mktemp -q /tmp/alsaconf.XXXXXX`
+if [ $? -ne 0 ]; then
+ xecho "Can't create temp file, exiting..."
+ exit 1
+fi
+addcfg=`mktemp -q /tmp/alsaconf.XXXXXX`
+if [ $? -ne 0 ]; then
+ xecho "Can't create temp file, exiting..."
+ exit 1
+fi
+FOUND=`mktemp -q /tmp/alsaconf.XXXXXX`
+if [ $? -ne 0 ]; then
+ xecho "Can't create temp file, exiting..."
+ exit 1
+fi
+DUMP=`mktemp -q /tmp/alsaconf.XXXXXX`
+if [ $? -ne 0 ]; then
+ xecho "Can't create temp file, exiting..."
+ exit 1
+fi
+
+# convert ISA PnP id number to string 'ABC'
+convert_isapnp_id () {
+ if [ -z "$1" ]; then
+ echo "XXXX"
+ return
+ fi
+ let a='('$1'>>2) & 0x3f'
+ let b='(('$1' & 0x03) << 3) | (('$1' >> 13) & 0x07)'
+ let c='('$1'>> 8) & 0x1f'
+ strs='@ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ echo ${strs:$a:1}${strs:$b:1}${strs:$c:1}
+}
+
+# swap high & low bytes
+swap_number () {
+ if [ -z "$1" ]; then
+ echo "0000"
+ return
+ fi
+ let v='(('$1'>>8)&0xff)|(('$1'&0xff)<<8)'
+ printf "%04x" $v
+}
+
+# build card database
+# build_card_db filename
+build_card_db () {
+ MODDIR=/lib/modules/`uname -r`
+ last_driver=""
+ echo -n > $1
+
+ # list pci cards
+ while read driver vendor device dummy; do
+ if expr $driver : 'snd-.*' >/dev/null ; then
+ if [ "$last_driver" != "$driver" ]; then
+ echo $driver.o
+ last_driver=$driver
+ fi
+ id1=`printf '0x%04x' $vendor`
+ id2=`printf '0x%04x' $device`
+ echo "PCI: $id1=$id2"
+ fi
+ done < $MODDIR/modules.pcimap >> $1
+
+ # list isapnp cards
+ while read driver cardvendor carddevice data vendor func; do
+ if expr $driver : 'snd-.*' >/dev/null ; then
+ if [ "$last_driver" != "$driver" ]; then
+ echo $driver.o
+ last_driver=$driver
+ fi
+ id1=`convert_isapnp_id $cardvendor`
+ dev1=`swap_number $carddevice`
+ id2=`convert_isapnp_id $vendor`
+ dev2=`swap_number $func`
+ echo "ISAPNP: $id1$dev1=$id2$dev2"
+ fi
+ done < $MODDIR/modules.isapnpmap >> $1
+}
+
+#
+# probe cards
+#
+probe_cards () {
+ found="0"
+ test -r $PROCFS/isapnp || /sbin/modprobe isapnp >/dev/null 2>&1
+ test -r $PROCFS/isapnp || /sbin/modprobe isa-pnp >/dev/null 2>&1
+ if [ -r $PROCFS/isapnp ]; then
+ cat $PROCFS/isapnp >"$DUMP"
+ found="1"
+ elif [ -d $SYSFS/bus/pnp/devices ]; then
+ # use 2.6 kernel's sysfs output
+ # fake the isapnp dump
+ index=0
+ bindex=0
+ for d1 in $SYSFS/devices/pnp* ; do
+ for d2 in $d1/*:* ; do
+ if [ -r $d2/card_id ]; then
+ id=`cat $d2/card_id`
+ name=`cat $d2/name`
+ echo "Card $index '$id:$name' " >> "$DUMP"
+ index=$[$index+1]
+ found="1"
+ else if [ -r $d2/id ]; then
+ # FIXME: multiple id might be present (separated with new-line)
+ id=`head -n 1 $d2/id`
+ echo "BIOS $bindex '$id' " >> "$DUMP"
+ bindex=$[$bindex+1]
+ found="1"
+ fi
+ fi
+ done
+ done
+ fi
+ if [ "$found" = "0" ]; then
+ echo -n >"$DUMP"
+ fi
+ CARDID_DB=/var/tmp/alsaconf.cards
+ if [ ! -r $CARDID_DB ]; then
+ use_modinfo_db=1
+ fi
+ if [ $use_modinfo_db != 1 ]; then
+ if [ $CARDID_DB -ot /lib/modules/`uname -r`/modules.dep ]; then
+ use_modinfo_db=1
+ fi
+ fi
+ if [ $use_modinfo_db = 1 ]; then
+ xecho "Building card database.."
+ build_card_db $CARDID_DB
+ fi
+ if [ ! -r $CARDID_DB ]; then
+ xecho "No card database is found.."
+ exit 1
+ fi
+ ncards=`grep '^snd-.*\.o$' $CARDID_DB | wc -w`
+
+ msg=$(gettext "Searching sound cards")
+ awk '
+BEGIN {
+ format="%-40s %s\n";
+ ncards='"$ncards"';
+ idx=0;
+}
+/^snd-.*\.o$/{
+ sub(/.o$/, "");
+ driver=$0;
+ perc=(idx * 100) / (ncards + 1);
+ print int(perc);
+ idx++;
+}
+/^[<literal space><literal tab>]*PCI: /{
+ gsub(/0x/, "");
+ gsub(/=/, ":");
+ x = sprintf ("'$lspci' -n 2>/dev/null| grep '"' 04..: '"' | grep %s", $2);
+ if (system (x) == 0)
+ printf "%s %s\n", $2, driver >>"'"$FOUND"'"
+}
+/^[<literal space><literal tab>]*ISAPNP: /{
+ id2 = substr($0, index($0, "=")+1);
+ gsub(/=.*/, "");
+ x = sprintf ("grep '\''^Card [0-9] .%s:'\'' '"$DUMP"'", $2);
+ if (system (x) == 0)
+ printf "%s %s\n", $2, driver >>"'"$FOUND"'"
+ else if (index($2, "ffff") > 0) {
+ x = sprintf ("grep '\''^BIOS [0-9]* .%s.'\'' '"$DUMP"'", id2);
+ if (system (x) == 0)
+ printf "%s %s\n", id2, driver >>"'"$FOUND"'"
+ }
+}' < $CARDID_DB |\
+ $DIALOG --gauge "$msg" 6 40 0
+
+ #
+ # PowerMac
+ #
+ if grep -q MacRISC $PROCFS/cpuinfo; then
+ MODDIR=/lib/modules/`uname -r`
+ find $MODDIR -name 'snd-powermac*' -print | \
+ while read i; do
+ i=${i##*/}
+ i=${i%%.o}
+ i=${i%%.ko}
+ echo "PowerMac $i" >> $FOUND
+ done
+ fi
+
+ #
+ # Sparc
+ #
+ if grep -q Sparc $PROCFS/cpuinfo; then
+ test -r $PROCFS/openprom/name || /bin/mount -t openpromfs none $PROCFS/openprom >/dev/null 2>&1
+ # Check for an "audio" device
+ audio=
+ compat=
+ if test -r $PROCFS/openprom; then
+ audio=`find $PROCFS/openprom -follow -type d -name "audio*" -print`
+ fi
+ if test -n "$audio"; then
+ compat=`cat $audio/compatible`
+ compat=${compat#\'}
+ compat=${compat%\'}
+ compat=${compat#SUNW,}
+ fi
+ # Go through all cards we have
+ MODDIR=/lib/modules/`uname -r`
+ find $MODDIR -name 'snd-sun-*' -print | \
+ while read i; do
+ i=${i##*/}
+ i=${i%%.o}
+ i=${i%%.ko}
+ sdev=`echo ${i#snd-sun-} | tr "[a-z]" "[A-Z]"`
+
+ if test "$sdev" = "$compat"; then
+ echo "$sdev $i" >> $FOUND
+ elif test -r $PROCFS/openprom; then
+ find $PROCFS/openprom -follow -type d -name "SUNW,${sdev}*" \
+ -exec echo "$sdev $i" \; 2>/dev/null >> $FOUND
+ else
+ echo "$sdev $i" >> $FOUND
+ fi
+ done
+ fi
+}
+
+#
+# look for a descriptive device name from the given device id
+#
+find_device_name () {
+ if expr "$1" : '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then
+ $lspci -d $1 2>/dev/null| sed -e 's/^.*:..\.. [^:]*: //g'
+ return
+ elif expr "$1" : '[A-Z@][A-Z@][A-Z@][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then
+ cardname=`grep '^Card [0-9]\+ .'$1':' $DUMP | head -n 1 | sed -e 's/^Card [0-9]\+ '\''.*:\(.*\)'\'' .*$/\1/'`
+ echo $cardname
+ else
+ echo $1
+ fi
+}
+
+# get hwcfg file type from the given driver name
+get_hwcfg_type () {
+ while read dev driver; do
+ if [ "$driver" = "$1" ]; then
+ case "$dev" in
+ *:*)
+ # FIXME: need to look around /sys/bus/pci/* (or use vpid-* ?)
+ devid=`$lspci -d "$dev" | head -n 1 | sed -e 's/ .*$//'`
+ case "$devid" in
+ *:*:*.*) ;;
+ *) devid="0000:$devid" ;;
+ esac
+ echo bus-pci-$devid
+ ;;
+ *)
+ echo $driver
+ ;;
+ esac
+ break
+ fi
+ done
+}
+
+# clean up all hwcfg-* files containing ALSA modules
+# alsaconf sets up exclusively
+cleanup_hwcfg () {
+ for i in /etc/sysconfig/hardware/hwcfg-*; do
+ grep -q "MODULE='snd-" $i && rm -f $i
+ done
+}
+
+#
+# set up /etc/sysconfig/hardware/hwcfg-* stuff
+#
+setup_hwcfg () {
+ card=$1
+ cleanup_hwcfg
+ cfg=`echo "$devs_olist" | get_hwcfg_type $card`
+ echo "MODULE='$card'" > /etc/sysconfig/hardware/hwcfg-$cfg
+ echo "STARTMODE='auto'" >> /etc/sysconfig/hardware/hwcfg-$cfg
+}
+
+
+#
+# configure and try test sound
+#
+ac_config_card () {
+
+ CARD_DRIVER=snd-$1
+ CARD_OPTS="${*:2}"
+
+ if [ -n "$cfgout" ]; then
+ msg=$(xmsg "
+Configuring %s
+Do you want to modify %s (and %s if present)?" $CARD_DRIVER $cfgout $cfgfile)
+ $DIALOG --yesno "$msg" 8 50 || acex 0
+ else
+ msg=$(xmsg "
+Configuring %s
+Do you want to modify %s?" $CARD_DRIVER $cfgfile)
+ $DIALOG --yesno "$msg" 8 50 || acex 0
+ fi
+ clear
+
+ # Copy conf.modules and make changes.
+ ACB="# --- BEGIN: Generated by ALSACONF, do not edit. ---"
+ ACE="# --- END: Generated by ALSACONF, do not edit. ---"
+
+ # Detect 2.2.X kernel
+ KVER=`uname -r | tr ".-" " "`
+ KVER1=`echo $KVER | cut -d" " -f1`
+ KVER2=`echo $KVER | cut -d" " -f2`
+ if [ $KVER1 -ge 2 ] && [ $KVER2 -ge 2 ]; then
+ SOUND_CORE="soundcore"
+ else
+ SOUND_CORE="snd"
+ fi
+
+ if [ -r $cfgfile ] ; then
+ if [ "$distribution" = "redhat" -o "$distribution" = "fedora" ] ; then
+ remove_ac_block < $cfgfile | remove_sndconfig_block | uniq > $TMP
+ else
+ remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
+ fi
+ fi
+
+ if [ -z "$have_alias" -a "$kernel" = "new" ]; then
+ if grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then
+ have_alias="yes"
+ fi
+ fi
+ if [ -z "$have_alias" ]; then
+echo "alias char-major-116 snd
+alias char-major-14 $SOUND_CORE
+alias sound-service-0-0 snd-mixer-oss
+alias sound-service-0-1 snd-seq-oss
+alias sound-service-0-3 snd-pcm-oss
+alias sound-service-0-8 snd-seq-oss
+alias sound-service-0-12 snd-pcm-oss" >> $addcfg
+ fi
+ if [ -n "$alsa_device_opts" ]; then
+ echo "options snd $alsa_device_opts" >> $addcfg
+ fi
+echo "alias snd-card-0 $CARD_DRIVER
+alias sound-slot-0 $CARD_DRIVER" >> $addcfg
+ if [ -n "$CARD_OPTS" ]; then
+ echo "options $CARD_DRIVER $CARD_OPTS" >> $addcfg
+ fi
+
+ if [ -n "$cfgout" ]; then
+ [ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile"
+ cmp -s "$addcfg" "$cfgout" || cat "$addcfg" > "$cfgout"
+ else
+ echo "$ACB
+# --- ALSACONF version $version ---" >> $TMP
+ cat "$addcfg" >> "$TMP"
+ echo "$ACE
+" >> $TMP
+ cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile"
+ fi
+
+ /sbin/depmod -a 2>/dev/null
+
+ # remove yast2 entries (- only for suse distro)
+ if [ -f /var/lib/YaST/unique.inf ]; then
+ awk '
+BEGIN { in_sound=0; }
+/^\[sound\]$/ { print; in_sound=1; next; }
+/^\[.+\]$/ { print; in_sound=0; next; }
+{ if (in_sound == 0) { print; } }
+' < /var/lib/YaST/unique.inf > $TMP
+ cp -f $TMP /var/lib/YaST/unique.inf
+ fi
+
+ # set up /etc/sysconfig/hardware/*
+ if [ "$distribution" = "suse" ]; then
+ case "$suse_version" in
+ 10.[012]*|10)
+ setup_hwcfg $CARD_DRIVER
+ ;;
+ esac
+ fi
+
+ farewell
+ clear
+ case "$distribution" in
+ gentoo | debian)
+ xecho "Running update-modules..."
+ update-modules
+ ;;
+ esac
+ if [ -x $rcalsasound ] ; then
+ echo Loading driver...
+ $rcalsasound restart
+ fi
+ echo Setting default volumes...
+ if [ -x $bindir/set_default_volume ]; then
+ $bindir/set_default_volume -f
+ else
+ set_mixers
+ fi
+ if [ -f $TESTSOUND ]; then
+ msg=$(gettext "
+ The mixer is set up now for for playing.
+ Shall I try to play a sound sample now?
+
+ NOTE:
+If you have a big amplifier, lower your volumes or say no.
+ Otherwise check that your speaker volume is open,
+ and look if you can hear test sound.
+")
+ if $DIALOG --yesno "$msg" 13 65
+ then
+ clear
+ echo
+ aplay -N $TESTSOUND
+ fi
+ fi
+ if [ ! -r /etc/asound.state ]; then
+ xecho "Saving the mixer setup used for this in /etc/asound.state."
+ $sbindir/alsactl store
+ fi
+ clear
+ xecho "
+===============================================================================
+
+ Now ALSA is ready to use.
+ For adjustment of volumes, use your favorite mixer.
+
+ Have a lot of fun!
+
+"
+}
+
+# check playback
+# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
+ac_try_load () {
+ test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"
+ /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1
+ if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then
+ : ;
+ else
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
+ return 1
+ fi
+
+ # mute mixers
+ amixer set Master 0% mute >/dev/null 2>&1
+ amixer set PCM 0% mute >/dev/null 2>&1
+
+ # output 0.5 sec
+ head -c 4000 < /dev/zero | aplay -N -r8000 -fS16_LE -traw -c1 > /dev/null 2>&1 &
+ # remember pid
+ pp=$!
+ # sleep for 2 seconds (to be sure -- 1 sec would be enough)
+ sleep 2
+ # kill the child process if still exists.
+ kill -9 $pp > /dev/null 2>&1
+ st=$?
+ ac_cardname=`head -n 1 $PROCFS/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'`
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
+ if [ $st = 0 ]; then
+ # irq problem?
+ test -n "$LOGFILE" && echo "no playback return" >> "$LOGFILE"
+ return 2
+ else
+ # seems ok!
+ test -n "$LOGFILE" && echo "playback OK" >> "$LOGFILE"
+ return 0
+ fi
+}
+
+# check capture
+# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
+# ac_try_capture card duplex opts
+ac_try_capture () {
+ test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"
+ /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1
+ if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then
+ : ;
+ else
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
+ return 1
+ fi
+
+ # mute mixers
+ amixer set Master 0% mute >/dev/null 2>&1
+ amixer set PCM 0% mute >/dev/null 2>&1
+
+ play_pid=0
+ if [ $2 = yes ]; then
+ # try duplex - start dummy playing
+ aplay -N -r8000 -fS16_LE -traw -c1 < /dev/zero > /dev/null 2>&1 &
+ play_pid=$!
+ fi
+ # record 1sec
+ arecord -N -d1 > /dev/null 2>&1 &
+ # remember pid
+ pp=$!
+ # sleep for 2 seconds
+ sleep 2
+ # kill the child process if still exists.
+ kill -9 $pp > /dev/null 2>&1
+ st=$?
+ # kill playback process if any
+ test $play_pid != 0 && kill -9 $play_pid
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
+ if [ $st = 0 ]; then
+ test -n "$LOGFILE" && echo "capture no return" >> "$LOGFILE"
+ return 2
+ else
+ test -n "$LOGFILE" && echo "capture OK" >> "$LOGFILE"
+ return 0
+ fi
+}
+
+get_dma_pair () {
+ case $1 in
+ 0)
+ echo 1 3 5;;
+ 1)
+ echo 0 3 5;;
+ 3)
+ echo 1 0 5;;
+ 5)
+ echo 3 1 0;;
+ esac
+}
+
+#
+# check playback on specified irqs
+#
+# ac_try_irq card opts irqs...
+# return 0 - OK, 1 - NG, 2 - not working (dma problem?)
+#
+ac_try_irq () {
+ card=$1
+ opts="$2 ${mpfx}irq=$3"
+ ac_try_load $card $opts >/dev/null 2>&1
+ result=$?
+ case $result in
+ 0)
+ ac_opts="$opts"
+ return 0
+ ;;
+ 2)
+ for irq in ${*:4}; do
+ opts="$2 ${mpfx}irq=$irq"
+ ac_try_load $card $opts >/dev/null 2>&1
+ if [ $? = 0 ]; then
+ ac_opts="$opts"
+ return 0
+ fi
+ done
+ return 2
+ ;;
+ esac
+ return 1
+}
+
+#
+# check playback/capture on dma1 & dma2 & specified irqs
+#
+# ac_try_dmas card opts irqs...
+# return 0 - OK, 1 - NG
+#
+ac_try_dmas () {
+ dma_list=`check_dma_avail 1 0 3 5`
+ for irq in ${*:3}; do
+ for dma1 in $dma_list; do
+ for dma2 in `get_dma_pair $dma1`; do
+ opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq"
+ ac_try_load $1 $opts >/dev/null 2>&1
+ result=$?
+ if [ $result = 1 ]; then
+ if [ $try_all_combination = 1 ]; then
+ continue
+ else
+ return 1
+ fi
+ elif [ $result = 0 ]; then
+ test -n "$LOGFILE" && echo "Now checking capture..." >> "$LOGFILE"
+ ac_opts="$opts"
+ ac_try_capture $1 yes $opts >/dev/null 2>&1 && return 0
+ for d in yes no; do
+ for dma2 in $dma_list; do
+ if [ $dma1 != $dma2 ]; then
+ opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq"
+ ac_opts="$opts"
+ ac_try_capture $1 $d $opts >/dev/null 2>&1 && return 0
+ fi
+ done
+ done
+ return 0
+ fi
+ done
+ done
+ done
+ return 1
+}
+
+# check if the option $2 exists in card $1: set value $3
+ac_check_option () {
+ if /sbin/modinfo -p snd-$1 | grep -q $2; then
+ echo "$2=$3"
+ fi
+}
+
+ac_try_card_sb8 () {
+ card=sb8
+ irq_list=`check_irq_avail 5 3 9 10 7`
+ for dma8 in `check_dma_avail 1 3`; do
+ opts="${mpfx}dma8=$dma8"
+ ac_try_irq $card "$opts" $irq_list && return 0
+ done
+ return 1
+}
+
+ac_try_card_sb16 () {
+ card=sb16
+ isapnp=`ac_check_option $card ${mpfx}isapnp 0`
+ opts="$isapnp"
+ irq_list=`check_irq_avail 5 9 10 7 3`
+ dma_list=`check_dma_avail 0 1 3`
+ dma16_list=`check_dma_avail 5 6 7`
+ # at first try auto-probing by driver itself
+ ac_try_load $card $opts >/dev/null 2>&1
+ result=$?
+ case $result in
+ 0)
+ ac_opts="$opts"
+ ac_try_capture $card yes $opts >/dev/null 2>&1 && return 0
+ for d in yes no; do
+ for dma8 in $dma_list; do
+ for irq in $irq_list; do
+ opts="${mpfx}dma8=$dma8 ${mpfx}irq=$irq $isapnp"
+ ac_try_capture $card $d $opts >/dev/null 2>&1 && return 0
+ done
+ done
+ done
+ return 0
+ ;;
+ 2)
+ for dma16 in $dma16_list; do
+ opts="${mpfx}dma16=$dma16 $isapnp"
+ if ac_try_irq $card "$opts" $irq_list ; then
+ ac_try_capture $card yes $ac_opts >/dev/null 2>&1 && return 0
+ ac_opts_saved="$ac_opts"
+ for d in yes no; do
+ for dma8 in $dma_list; do
+ ac_opts="$ac_opts_saved ${mpfx}dma8=$dma8"
+ ac_try_capture $card $d $ac_opts >/dev/null 2>&1 && return 0
+ done
+ done
+ # return anyway here..
+ return 0
+ fi
+ done
+ ;;
+ esac
+ return 1
+}
+
+ac_try_card_es1688 () {
+ card=es1688
+ opts=""
+ irq_list=`check_irq_avail 5 9 10 7`
+ for dma8 in `check_dma_avail 1 3 0`; do
+ opts="${mpfx}dma8=$dma8 ${mpfx}mpu_irq=-1"
+ ac_try_irq $card "$opts" $irq_list && return 0
+ done
+ return 1
+}
+
+ac_try_card_es18xx () {
+ card=es18xx
+ opts=`ac_check_option $card ${mpfx}isapnp 0`
+ ac_try_dmas $card "$opts" `check_irq_avail 5 9 10 7` && return 0
+ return 1
+}
+
+ac_try_card_cs4236 () {
+ card=cs4236
+ irq_list=`check_irq_avail 5 7 9 11 12 15`
+ isapnp=`ac_check_option $card ${mpfx}isapnp 0`
+ for cport in 0x538 0x210 0xf00; do
+ for port in 0x530 0x534; do
+ opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp"
+ ac_try_dmas $card "$opts" $irq_list && return 0
+ done
+ done
+ return 1
+}
+
+ac_try_card_cs4232 () {
+ card=cs4232
+ irq_list=`check_irq_avail 5 7 9 11 12 15`
+ isapnp=`ac_check_option $card ${mpfx}isapnp 0`
+ for cport in 0x538 0x210 0xf00; do
+ for port in 0x530 0x534; do
+ opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp"
+ ac_try_dmas $card "$opts" $irq_list && return 0
+ done
+ done
+ return 1
+}
+
+ac_try_card_cs4231 () {
+ card=cs4231
+ irq_list=`check_irq_avail 5 7 9 11 12 15`
+ for port in 0x530 0x534; do
+ opts="${mpfx}port=$port"
+ ac_try_dmas $card "$opts" $irq_list && return 0
+ done
+ return 1
+}
+
+ac_try_card_opl3sa2 () {
+ card=opl3sa2
+ irq_list=`check_irq_avail 5 9 3 1 11 12 15 0`
+ isapnp=`ac_check_option $card ${mpfx}isapnp 0`
+ for port in 0x370 0x538 0xf86 0x100; do
+ for wss_port in 0x530 0xe80 0xf40 0x604; do
+ opts="${mpfx}fm_port=-1 ${mpfx}midi_port=-1 ${mpfx}port=$port ${mpfx}wss_port=$wss_port $isapnp"
+ ac_try_dmas $card "$opts" $irq_list && return 0
+ done
+ done
+ return 1
+}
+
+ac_config_legacy () {
+ title=$(gettext "WARNING")
+ msg=$(gettext "
+ Probing legacy ISA cards might make
+ your system unstable.
+
+ Do you want to proceed?
+
+")
+ $DIALOG --title "$title" --yesno "$msg" 10 50 || acex 0
+
+ if [ x"$1" = x ]; then
+ probe_list="$LEGACY_CARDS"
+ else
+ probe_list=$*
+ fi
+ menu_args=()
+
+ for card in $probe_list; do
+ cardname=`/sbin/modinfo -d snd-$card | sed -e 's/^\"\(.*\)\"$/\1/g'`
+ if [ x"$cardname" != x ]; then
+ menu_args=("${menu_args[@]}" "$card" "$cardname" "on")
+ fi
+ done
+ if [ x$menu_args = x ]; then
+ msg=$(gettext "No legacy drivers are available
+ for your machine")
+ $DIALOG --msgbox "$msg" 5 50
+ return 1
+ fi
+ title=$(gettext "Driver Selection")
+ msg=$(gettext " Probing legacy ISA cards
+
+ Please select the drivers to probe:")
+ $DIALOG --title "$title" --checklist "$msg" \
+ 17 64 8 "${menu_args[@]}" 2> $FOUND || acex 0
+
+ if [ $try_all_combination != 1 ]; then
+ msg=$(gettext "
+ Shall I try all possible DMA and IRQ combinations?
+ With this option, some unconventional configuration
+ might be found, but it will take much longer time.")
+ if $DIALOG --yesno "$msg" 10 60
+ then
+ try_all_combination=1
+ fi
+ fi
+
+ xecho "Probing legacy cards.. This may take a few minutes.."
+ echo -n $(gettext "Probing: ")
+ cards=`cat $FOUND | tr -d \"`
+ for card in $cards; do
+ echo -n " $card"
+ ac_opts=""
+ if eval ac_try_card_$card ; then
+ xecho " : FOUND!!"
+ ac_config_card $card $ac_opts
+ return 0
+ fi
+ done
+ echo
+ title=$(gettext "Result")
+ msg=$(gettext "No legacy cards found")
+ $DIALOG --title "$title" --msgbox "$msg" 5 50
+ return 1
+}
+
+#
+# main part continued..
+#
+
+if test -n "$LOGFILE" ; then
+ touch "$LOGFILE"
+ echo -n "Starting alsaconf: " >> "$LOGFILE"
+ date >> "$LOGFILE"
+fi
+
+if [ x"$legacy_probe_card" != x ]; then
+ ac_opts=""
+ if eval ac_try_card_$legacy_probe_card >/dev/null 2>&1; then
+ echo "$ac_opts"
+ echo "$ac_cardname"
+ exit 0
+ else
+ echo "FAILED"
+ exit 1
+ fi
+fi
+
+intro
+
+if [ $do_legacy_only = 1 ]; then
+ ac_config_legacy
+ exit 0
+fi
+
+probe_cards
+
+devs_found=()
+devs_olist=""
+
+if [ -s "$FOUND" ]; then
+ while read dev card ; do
+ MODDIR=/lib/modules/`uname -r`
+ find $MODDIR -type f | grep -q -E $card'\.(o|ko)' || continue
+ cardname=`find_device_name $dev | cut -c 1-64`
+ if [ -z "$cardname" ]; then
+ cardname="$card"
+ fi
+ card=${card##snd-}
+ devs_found=("${devs_found[@]}" "$card" "$cardname")
+ devs_devs=("${devs_devs[@]}" "$card" "$dev")
+ done <"$FOUND"
+ devs_olist=`cat $FOUND`
+fi
+if [ x$devs_found != x ]; then
+ #
+ # check for TP600E
+ #
+ if [ ${devs_found[0]} = cs46xx ]; then
+ if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then
+ msg=$(gettext "
+ Looks like you having a Thinkpad 600E or 770 notebook.
+ On this notebook, CS4236 driver should be used
+ although CS46xx chip is detected.
+
+ Shall I try to snd-cs4236 driver and probe
+ the legacy ISA configuration?")
+ if $DIALOG --yesno "$msg" 13 60
+ then
+ try_all_combination=1
+ ac_config_legacy cs4236
+ exit 0
+ fi
+ elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then
+ msg=$(gettext "
+ Looks like you having a Dell Dimension machine.
+ On this machine, CS4232 driver should be used
+ although CS46xx chip is detected.
+
+ Shall I try to snd-cs4232 driver and probe
+ the legacy ISA configuration?")
+ if $DIALOG --yesno "$msg" 13 60
+ then
+ try_all_combination=1
+ ac_config_legacy cs4232
+ exit 0
+ fi
+ fi
+ fi
+
+ devs_found=("${devs_found[@]}" "legacy" "Probe legacy ISA (non-PnP) chips")
+ title=$(gettext "Soundcard Selection")
+ msg=$(gettext "
+ Following card(s) are found on your system.
+ Choose a soundcard to configure:
+")
+ $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" --output-fd 3 3> $FOUND || acex 0
+ card=`head -n 1 $FOUND`
+ if [ "$card" = "legacy" ]; then
+ ac_config_legacy
+ else
+ ac_config_card "$card"
+ fi
+ exit 0
+else
+ msg=$(gettext "
+ No supported PnP or PCI card found.
+
+ Would you like to probe legacy ISA sound cards/chips?
+
+")
+ if $DIALOG --yesno "$msg" 9 60 ; then
+ ac_config_legacy
+ exit 0
+ fi
+fi
+
+rm -f "$FOUND" "$DUMP"
+exit 0
diff --git a/alsa-utils/alsaconf/po/Makefile.in b/alsa-utils/alsaconf/po/Makefile.in
new file mode 100644
index 0000000..f1fa9aa
--- /dev/null
+++ b/alsa-utils/alsaconf/po/Makefile.in
@@ -0,0 +1,91 @@
+POFILES = ja.po ru.po
+
+DOMAIN = alsaconf
+GETTEXT_SRC = ../alsaconf.in
+
+XGETTEXT_OPTIONS = -kxmsg -kxecho
+
+top_builddir = ../..
+
+srcdir = @srcdir@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+prefix = @prefix@
+localedir = $(datadir)/locale
+
+USE_NLS = @USE_NLS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+# mkdir_p = @mkdir_p@
+mkdir_p = mkdir -p --
+XGETTEXT = @XGETTEXT@
+MSGFMT = @MSGFMT@
+GMSGFMT = @GMSGFMT@
+MSGMERGE = @MSGMERGE@
+MSGMERGE_UPDATE = @MSGMERGE@ --update
+
+DISTFILES = $(POFILES) Makefile.in
+CATALOGS = $(POFILES:.po=.gmo)
+
+all: all-@USE_NLS@
+
+all-yes: $(CATALOGS)
+all-no:
+
+.SUFFIXES: .po .gmo .mo
+
+%.mo : $(srcdir)/%.po
+ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+%.gmo : $(srcdir)/%.po
+ @lang=`echo $(srcdir)/$* | sed -e 's,.*/,,'`; \
+ rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+$(DOMAIN).pot: $(GETTEXT_SRC)
+ $(XGETTEXT) -o$@ --default-domain=$(DOMAIN) \
+ --add-comments=TRANSLATORS: --language=Shell \
+ $(XGETTEXT_OPTIONS) $<
+
+check check_recursive:
+
+clean:
+ rm -f $(CATALOGS) $(POFILES:.po=.mo) $(DOMAIN).pot
+
+update-po: $(DOMAIN).pot
+ @for po in $(POFILES); do \
+ $(MSGMERGE_UPDATE) $(srcdir)/$$po $(DOMAIN).pot; \
+ done
+
+install-data-no:
+install-data-yes: all
+ $(mkdir_p) $(DESTDIR)$(datadir)
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+ done
+
+install-data: install-data-@USE_NLS@
+install: install-data
+
+uninstall-data-no:
+uninstall-data-yes:
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
+ done
+
+uninstall-data: uninstall-data-@USE_NLS@
+uninstall: uninstall-data
+
+dist distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ cp -p $$file $(distdir); \
+ done
+
+distclean: clean
+ rm -f Makefile *~
diff --git a/alsa-utils/alsaconf/po/ja.po b/alsa-utils/alsaconf/po/ja.po
new file mode 100644
index 0000000..170f708
--- /dev/null
+++ b/alsa-utils/alsaconf/po/ja.po
@@ -0,0 +1,362 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: alsaconf\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-12-02 12:37+0100\n"
+"PO-Revision-Date: 2005-12-02 12:39+0100\n"
+"Last-Translator: Takashi Iwai <tiwai@suse.de>\n"
+"Language-Team: Japanese <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../alsaconf.in:36
+msgid "-s"
+msgstr ""
+
+#: ../alsaconf.in:80
+msgid "ALSA configurator"
+msgstr "ALSA 設定ツール"
+
+#: ../alsaconf.in:82
+msgid ""
+"usage: alsaconf [options]\n"
+" -l|--legacy check only legacy non-isapnp cards\n"
+" -m|--modinfo read module descriptions instead of reading card db\n"
+" -s|--sound wav-file\n"
+" use the specified wav file as a test sound\n"
+" -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted]\n"
+" -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted]\n"
+" -d|--devmode mode\n"
+" set the permission for ALSA devices (default = 0666) "
+"[obs.]\n"
+" -r|--strict set strict device mode (equiv. with -g 17 -d 0660) "
+"[obsoleted]\n"
+" -L|--log file logging on the specified file (for debugging purpose only)\n"
+" -p|--probe card-name\n"
+" probe a legacy non-isapnp card and print module options\n"
+" -P|--listprobe list the supported legacy card modules\n"
+" -c|--config file\n"
+" specify the module config file\n"
+" -R|--resources list available DMA and IRQ resources with debug for legacy\n"
+" -h|--help what you're reading"
+msgstr ""
+"使用法: alsaconf [オプション]\n"
+" -l|--legacy éž ISAPnP カードã®ã¿ãƒã‚§ãƒƒã‚¯ã™ã‚‹\n"
+" -m|--modinfo カード DB を読む代ã‚りã«ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«è¨˜è¿°ã‚’読ã¿è¾¼ã¿\n"
+" -s|--sound WAVファイル\n"
+" 指定㮠WAV ファイルをテスト音ã¨ã—ã¦ç”¨ã„ã‚‹\n"
+" -u|--uid uid ALSA デãƒã‚¤ã‚¹ã® uid (デフォルト = 0) [旧オプション・無視ã•れã¾ã™]\n"
+" -g|--gid gid ALSA デãƒã‚¤ã‚¹ã® gid (デフォルト = 0) [æ—§]\\n\"\n"
+" -d|--devmode モード\n"
+" ALSA デãƒã‚¤ã‚¹ã®ãƒ‘ーミッション(デフォルト = 0666) [æ—§]\n"
+" -r|--strict 厳格ãªãƒ¢ãƒ¼ãƒ‰ (-g 17 -d 0660 ã¨åŒç­‰) [æ—§]\n"
+" -L|--log file 指定ã®ãƒ•ァイルã«ãƒ­ã‚°ã‚’記録ã™ã‚‹ (デãƒãƒƒã‚°ç”¨é€”)\n"
+" -p|--probe カードå\n"
+" 指定㮠éžIsaPnP カードを検索ã—モジュールオプションを表示ã™ã‚‹\n"
+" -P|--listprobe サãƒãƒ¼ãƒˆã•れã¦ã„ã‚‹æ—§å¼ã®(éžisapnp)カードã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ä¸€è¦§è¡¨ç¤º\n"
+" -c|--config ファイル\n"
+" 指定ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«è¨­å®šãƒ•ァイルを用ã„ã‚‹\n"
+" -R|--resources レガシーデãƒã‚¤ã‚¹ã®ãƒ‡ãƒãƒƒã‚°ç”¨: å¯èƒ½ãª DMA 㨠IRQ を表示ã™ã‚‹\n"
+" -h|--help 今見ã¦ã„ã¾ã™"
+
+#: ../alsaconf.in:252
+msgid "You must be root to use this script."
+msgstr "ルートã®ã¿å®Ÿè¡Œå¯èƒ½ã§ã™"
+
+#: ../alsaconf.in:294
+msgid "ERROR: The config file doesn't exist: "
+msgstr "エラー: 設定ファイルãŒå­˜åœ¨ã—ã¾ã›ã‚“: "
+
+#: ../alsaconf.in:336
+msgid "Error, dialog or whiptail not found."
+msgstr "エラー: dialog ã¾ãŸã¯ whiptail ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“"
+
+#: ../alsaconf.in:342
+msgid "Error, awk not found. Can't continue."
+msgstr "エラー: awk ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“"
+
+#: ../alsaconf.in:439
+msgid ""
+"\n"
+" ALSA CONFIGURATOR\n"
+" version %s\n"
+"\n"
+" This script is a configurator for\n"
+" Advanced Linux Sound Architecture (ALSA) driver.\n"
+"\n"
+"\n"
+" If ALSA is already running, you should close all sound\n"
+" apps now and stop the sound driver.\n"
+" alsaconf will try to do this, but it's not 100%% sure."
+msgstr ""
+"\n"
+" ALSA 設定ツール\n"
+" ãƒãƒ¼ã‚¸ãƒ§ãƒ³ %s\n"
+"\n"
+" ã“ã®ã‚¹ã‚¯ãƒªãƒ—トã¯ã€Advanced Linux Sound Architecture\n"
+" (ALSA) ドライãƒã®è¨­å®šã‚’行ã†ãƒ„ールã§ã™ã€‚\n"
+"\n"
+"\n"
+" ã‚‚ã—æ—¢ã« ALSA ãŒèµ·å‹•ã—ã¦ã„ã‚‹å ´åˆã¯ã€å®Ÿè¡Œå‰ã«\n"
+" å…¨ã¦ã®ã‚µã‚¦ãƒ³ãƒ‰ã‚¢ãƒ—リケーションを閉ã˜ã¦ã€ã‚µã‚¦ãƒ³ãƒ‰\n"
+" ドライãƒã‚’åœæ­¢ã—ã¦ãã ã•ã„。\n"
+" alsaconf ã®å‹•作㯠100%% ä¿è¨¼ã§ãã¾ã›ã‚“。"
+
+#: ../alsaconf.in:455
+msgid ""
+"\n"
+"\n"
+" OK, sound driver is configured.\n"
+"\n"
+" ALSA CONFIGURATOR\n"
+"\n"
+" will prepare the card for playing now.\n"
+"\n"
+" Now I'll run alsasound init script, then I'll use\n"
+" amixer to raise the default volumes.\n"
+" You can change the volume later via a mixer\n"
+" program such as alsamixer or gamix.\n"
+" \n"
+" "
+msgstr ""
+"\n"
+"\n"
+" サウンドドライãƒãŒè¨­å®šã•れã¾ã—ãŸã€‚\n"
+"\n"
+" ã“れã‹ã‚‰ã‚«ãƒ¼ãƒ‰ã®å†ç”Ÿã®æº–備を行ã„ã¾ã™ã€‚\n"
+"\n"
+"\n"
+" alsasound スクリプトを実行ã—ã€ãã®å¾Œ amixer ã§\n"
+" デフォルトã®éŸ³é‡ã«è¨­å®šã—ã¾ã™ã€‚\n"
+" 後ã§ã€alsamixer ã‚„ gamix ãªã©ã®ãƒŸã‚­ã‚µãƒ¼ãƒ—ログラム\n"
+" を用ã„ã¦ã€éŸ³é‡ã‚’変更ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã€‚\n"
+" "
+
+#: ../alsaconf.in:518 ../alsaconf.in:523 ../alsaconf.in:528 ../alsaconf.in:533
+msgid "Can't create temp file, exiting..."
+msgstr "一時ファイルを作æˆã§ãã¾ã›ã‚“ã§ã—ãŸã€‚中止ã—ã¾ã™..."
+
+#: ../alsaconf.in:643
+msgid "Building card database.."
+msgstr "カードデータベースを作æˆä¸­..."
+
+#: ../alsaconf.in:647
+msgid "No card database is found.."
+msgstr "カードãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸ..."
+
+#: ../alsaconf.in:652
+msgid "Searching sound cards"
+msgstr "サウンドカードを検索中"
+
+#: ../alsaconf.in:806
+msgid ""
+"\n"
+"Configuring %s\n"
+"Do you want to modify %s (and %s if present)?"
+msgstr ""
+"\n"
+"%s を設定ã—ã¾ã™\n"
+"%s (ãŠã‚ˆã³ %s) を変更ã—ã¾ã™ã‹ï¼Ÿ"
+
+#: ../alsaconf.in:811
+msgid ""
+"\n"
+"Configuring %s\n"
+"Do you want to modify %s?"
+msgstr ""
+"\n"
+"%s を設定ã—ã¾ã™\n"
+"%s を変更ã—ã¾ã™ã‹ï¼Ÿ"
+
+#: ../alsaconf.in:900
+msgid "Running modules-update..."
+msgstr "modules-update を実行中..."
+
+#: ../alsaconf.in:903
+msgid "Running update-modules..."
+msgstr "update-modules を実行中..."
+
+#: ../alsaconf.in:915
+msgid ""
+"\n"
+" The mixer is set up now for for playing.\n"
+" Shall I try to play a sound sample now?\n"
+"\n"
+" NOTE:\n"
+"If you have a big amplifier, lower your volumes or say no.\n"
+" Otherwise check that your speaker volume is open,\n"
+" and look if you can hear test sound.\n"
+msgstr ""
+"\n"
+" 音é‡ã‚’å†ç”Ÿç”¨ã«æº–å‚™ã—終ãˆã¾ã—ãŸã€‚\n"
+" サンプルã®ã‚µã‚¦ãƒ³ãƒ‰ã‚’å†ç”Ÿã—ã¾ã™ã‹ï¼Ÿ\n"
+"\n"
+" 注æ„:\n"
+" 大容é‡ã‚¢ãƒ³ãƒ—ã®å ´åˆã¯ã€éŸ³é‡ã‚’下ã’ã¦ãŠãã‹ã€ã“ã“ã§ã€Œã„ã„ãˆã€\n"
+" ã‚’é¸æŠžã—ã¦ãã ã•ã„。スピーカーã®éŸ³é‡ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ã€\n"
+" テスト音ãŒèžã“ãˆã‚‹ã‹ã©ã†ã‹ç¢ºèªã—ã¦ãã ã•ã„。\n"
+
+#: ../alsaconf.in:932
+msgid "Saving the mixer setup used for this in /etc/asound.state."
+msgstr "ミキサーã®è¨­å®šã‚’ /etc/asound.state ã«ä¿å­˜ã—ã¾ã™"
+
+#: ../alsaconf.in:936
+msgid ""
+"\n"
+"===============================================================================\n"
+"\n"
+" Now ALSA is ready to use.\n"
+" For adjustment of volumes, use your favorite mixer.\n"
+"\n"
+" Have a lot of fun!\n"
+"\n"
+msgstr ""
+"\n"
+"===============================================================================\n"
+"\n"
+" ã“れ㧠ALSA ãŒä½¿ç”¨å¯èƒ½ã«ãªã‚Šã¾ã—ãŸã€‚\n"
+" 音é‡ã®èª¿æ•´ã«ã¯ã€ãƒŸã‚­ã‚µãƒ¼ãƒ—ログラムをã”使用下ã•ã„。\n"
+"\n"
+
+#: ../alsaconf.in:1244
+msgid "WARNING"
+msgstr "注æ„"
+
+#: ../alsaconf.in:1245
+msgid ""
+"\n"
+" Probing legacy ISA cards might make\n"
+" your system unstable.\n"
+"\n"
+" Do you want to proceed?\n"
+"\n"
+msgstr ""
+"\n"
+" æ—§å¼ã® ISA ã‚«ãƒ¼ãƒ‰ã®æ¤œç´¢ã‚’行ã†ã¨\n"
+" システムãŒä¸å®‰å®šã«ãªã‚‹å ´åˆãŒã‚りã¾ã™ã€‚\n"
+"\n"
+" ã“ã®ã¾ã¾ç¶šã‘ã¾ã™ã‹ï¼Ÿ\n"
+"\n"
+
+#: ../alsaconf.in:1268
+msgid ""
+"No legacy drivers are available\n"
+" for your machine"
+msgstr ""
+"æ—§å¼ã® ISA カードã¯\n"
+"検出ã•れã¾ã›ã‚“ã§ã—ãŸ"
+
+#: ../alsaconf.in:1273
+msgid "Driver Selection"
+msgstr "ドライãƒã®é¸æŠž"
+
+#: ../alsaconf.in:1274
+msgid ""
+" Probing legacy ISA cards\n"
+"\n"
+" Please select the drivers to probe:"
+msgstr ""
+" æ—§å¼ã® ISA ã‚«ãƒ¼ãƒ‰ã®æ¤œå‡º\n"
+"\n"
+" 検出ã™ã‚‹ãƒ‰ãƒ©ã‚¤ãƒã‚’é¸æŠžã—ã¦ãã ã•ã„:"
+
+#: ../alsaconf.in:1281
+msgid ""
+"\n"
+" Shall I try all possible DMA and IRQ combinations?\n"
+" With this option, some unconventional configuration\n"
+" might be found, but it will take much longer time."
+msgstr ""
+"\n"
+" å¯èƒ½ãª DMA 㨠IRQ ã®å…¨ã¦ã®çµ„åˆã›ã‚’試ã¿ã¾ã™ã‹ï¼Ÿ\n"
+" ã“ã®ã‚ªãƒ—ションã§ã¯ã€ã¾ã‚Œãªè¨­å®šã‚‚検出ã•れるã“ã¨ãŒ\n"
+" å¯èƒ½ã§ã™ãŒã€ã‚ˆã‚Šé•·ã„時間ãŒã‹ã‹ã‚Šã¾ã™ã€‚"
+
+#: ../alsaconf.in:1291
+msgid "Probing legacy cards.. This may take a few minutes.."
+msgstr "æ—§å¼ã‚«ãƒ¼ãƒ‰ã®æ¤œå‡ºä¸­... 長時間ãŒã‹ã‹ã‚‹ã“ã¨ãŒã‚りã¾ã™..."
+
+#: ../alsaconf.in:1292
+msgid "Probing: "
+msgstr "検出中: "
+
+#: ../alsaconf.in:1298
+msgid " : FOUND!!"
+msgstr " : 発見!!"
+
+#: ../alsaconf.in:1304
+msgid "Result"
+msgstr "çµæžœ"
+
+#: ../alsaconf.in:1305
+msgid "No legacy cards found"
+msgstr "æ—§å¼ã‚«ãƒ¼ãƒ‰ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸ"
+
+#: ../alsaconf.in:1364
+msgid ""
+"\n"
+" Looks like you having a Thinkpad 600E or 770 notebook.\n"
+" On this notebook, CS4236 driver should be used\n"
+" although CS46xx chip is detected.\n"
+"\n"
+" Shall I try to snd-cs4236 driver and probe\n"
+" the legacy ISA configuration?"
+msgstr ""
+"\n"
+" Thinkpad 600E ã¾ãŸã¯ 770 ã‚’ã”使用ã®ã‚ˆã†ã§ã™ã€‚\n"
+" ã“ã®ãƒžã‚·ãƒ³ã§ã¯ã€CS46xx ãƒãƒƒãƒ—ãŒæ¤œå‡ºã•れã¾ã™ãŒ\n"
+" CS4236 ドライãƒã‚’用ã„ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚\n"
+"\n"
+" snd-cs4236 ドライãƒã‚’試用ã—ã¦ã€æ—§å¼ã® ISA 設定\n"
+" ã®æ¤œå‡ºã‚’行ã„ã¾ã™ã‹ï¼Ÿ"
+
+#: ../alsaconf.in:1378
+msgid ""
+"\n"
+" Looks like you having a Dell Dimension machine.\n"
+" On this machine, CS4232 driver should be used\n"
+" although CS46xx chip is detected.\n"
+"\n"
+" Shall I try to snd-cs4232 driver and probe\n"
+" the legacy ISA configuration?"
+msgstr ""
+"\n"
+" Dell Dimension マシンをã”使用ã®ã‚ˆã†ã§ã™ã€‚\n"
+" ã“ã®ãƒžã‚·ãƒ³ã§ã¯ã€CS46xx ãƒãƒƒãƒ—ãŒæ¤œå‡ºã•れã¾ã™ãŒ\n"
+" CS4232 ドライãƒã‚’用ã„ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚\n"
+"\n"
+" snd-cs4232 ドライãƒã‚’試用ã—ã¦ã€æ—§å¼ã® ISA 設定\n"
+" ã®æ¤œå‡ºã‚’行ã„ã¾ã™ã‹ï¼Ÿ"
+
+#: ../alsaconf.in:1395
+msgid "Soundcard Selection"
+msgstr "サウンドカードã®é¸æŠž"
+
+#: ../alsaconf.in:1396
+msgid ""
+"\n"
+" Following card(s) are found on your system.\n"
+" Choose a soundcard to configure:\n"
+msgstr ""
+"\n"
+" 以下ã®ã‚«ãƒ¼ãƒ‰ãŒã‚·ã‚¹ãƒ†ãƒ ã‹ã‚‰æ¤œå‡ºã•れã¾ã—ãŸã€‚\n"
+" 設定ã™ã‚‹ã‚«ãƒ¼ãƒ‰ã‚’é¸æŠžã—ã¦ãã ã•ã„:\n"
+
+#: ../alsaconf.in:1409
+msgid ""
+"\n"
+" No supported PnP or PCI card found.\n"
+"\n"
+" Would you like to probe legacy ISA sound cards/chips?\n"
+"\n"
+msgstr ""
+"\n"
+" PnP ã¾ãŸã¯ PCI ã‚«ãƒ¼ãƒ‰ãŒæ¤œå‡ºã•れã¾ã›ã‚“ã§ã—ãŸã€‚\n"
+"\n"
+" æ—§å¼ã® ISA ã‚µã‚¦ãƒ³ãƒ‰ã‚«ãƒ¼ãƒ‰ã®æ¤œå‡ºã‚’行ã„ã¾ã™ã‹ï¼Ÿ\n"
diff --git a/alsa-utils/alsaconf/po/ru.po b/alsa-utils/alsaconf/po/ru.po
new file mode 100644
index 0000000..af4fa0d
--- /dev/null
+++ b/alsa-utils/alsaconf/po/ru.po
@@ -0,0 +1,373 @@
+# Russian translations for alsa-utils package
+# ÐнглийÑкие переводы Ð´Ð»Ñ Ð¿Ð°ÐºÐµÑ‚Ð° alsa-utils.
+# Copyright (C) 2005 THE alsa-utils'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the alsa-utils package.
+# <dushistov@mail.ru>, 2005.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: alsa-utils 1.0.9rc4a\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-12-02 12:37+0100\n"
+"PO-Revision-Date: 2005-12-02 12:39+0100\n"
+"Last-Translator: <dushistov@mail.ru>\n"
+"Language-Team: Russian <ru@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
+"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: ../alsaconf.in:36
+msgid "-s"
+msgstr ""
+
+#: ../alsaconf.in:80
+msgid "ALSA configurator"
+msgstr "ÐайÑтройщик ALSA"
+
+#: ../alsaconf.in:82
+#, fuzzy
+msgid ""
+"usage: alsaconf [options]\n"
+" -l|--legacy check only legacy non-isapnp cards\n"
+" -m|--modinfo read module descriptions instead of reading card db\n"
+" -s|--sound wav-file\n"
+" use the specified wav file as a test sound\n"
+" -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted]\n"
+" -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted]\n"
+" -d|--devmode mode\n"
+" set the permission for ALSA devices (default = 0666) "
+"[obs.]\n"
+" -r|--strict set strict device mode (equiv. with -g 17 -d 0660) "
+"[obsoleted]\n"
+" -L|--log file logging on the specified file (for debugging purpose only)\n"
+" -p|--probe card-name\n"
+" probe a legacy non-isapnp card and print module options\n"
+" -P|--listprobe list the supported legacy card modules\n"
+" -c|--config file\n"
+" specify the module config file\n"
+" -R|--resources list available DMA and IRQ resources with debug for legacy\n"
+" -h|--help what you're reading"
+msgstr ""
+"иÑпользование: alsaconf [опции]\n"
+" -l|--legacy проверÑть только не ISAPnP карты\n"
+" -m|--modinfo читать опиÑание модулей вмеÑто Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð±Ñ‹Ð·Ñ‹ данных карт\n"
+" -s|--sound WAV файл\n"
+" иÑпользовать указанный WAV файл в качеÑтве теÑтового\n"
+" -u|--uid uid уÑтанавливает uid Ð´Ð»Ñ ALSA(по умолчанию = 0) [уÑтарело]\n"
+" -g|--gid gid уÑтанавливает gid Ð´Ð»Ñ ALSA(по умолчанию = 0) [уÑтарело]\n"
+" -d|--devmode режим\n"
+" уÑтанавливает права доÑтупа Ð´Ð»Ñ ALSA (по умолчанию = 0666) "
+"[уÑÑ‚.]\n"
+" -r|--strict уÑтанавливает Ñтрогие права Ð´Ð»Ñ ALSA (Ñкв. -g 17 -d 0660) "
+"[уÑÑ‚.]\n"
+" -L|--log файл запиÑывать ÑÐ¾Ð±Ñ‹Ñ‚Ð¸Ñ Ð² определенный файл (в целÑÑ… отладки)\n"
+" -p|--probe Ð¸Ð¼Ñ Ð·Ð²ÑƒÐºÐ¾Ð²Ð¾Ð¹ карты\n"
+" проверить обычную не IsaPnP карту и вывеÑти опции модулÑ\n"
+" -P|--listprobe вывеÑти ÑпиÑок поддерживаемых не IsaPnP карт\n"
+" -c|--config файл\n"
+" указывает файл Ñ Ð½Ð°Ñтройками модулÑ\n"
+" -h|--help вывеÑти Ñто Ñообщение"
+
+#: ../alsaconf.in:252
+msgid "You must be root to use this script."
+msgstr "Ð’Ñ‹ должны быть Ñуперпользователем, чтобы иÑпользовать Ñтот Ñкрипт."
+
+#: ../alsaconf.in:294
+msgid "ERROR: The config file doesn't exist: "
+msgstr "ОШИБКÐ: Файл Ñ Ð½Ð°Ñтройками не ÑущеÑтвует: "
+
+#: ../alsaconf.in:336
+msgid "Error, dialog or whiptail not found."
+msgstr "Ошибка, dialog или whiptail не найдены."
+
+#: ../alsaconf.in:342
+msgid "Error, awk not found. Can't continue."
+msgstr "Ошибка, awk не найден. Ðе могу продолжить работу."
+
+#: ../alsaconf.in:439
+msgid ""
+"\n"
+" ALSA CONFIGURATOR\n"
+" version %s\n"
+"\n"
+" This script is a configurator for\n"
+" Advanced Linux Sound Architecture (ALSA) driver.\n"
+"\n"
+"\n"
+" If ALSA is already running, you should close all sound\n"
+" apps now and stop the sound driver.\n"
+" alsaconf will try to do this, but it's not 100%% sure."
+msgstr ""
+"\n"
+" ÐаÑтройщик ALSA\n"
+" верÑÐ¸Ñ %s\n"
+"\n"
+" Этот Ñкрипт наÑтраивает Advanced Linux Sound Architecture\n"
+"\n"
+"\n"
+" ЕÑли какие-нибудь Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²Ñ…Ð¾Ð´Ñщие в пакет ALSA уже запущены,\n"
+" вы должны закрыть вÑе Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ð°ÑŽÑ‰Ð¸Ðµ Ñо звуком\n"
+" и оÑтановаить звуковой драйвер.\n"
+" alsaconf попытаетÑÑ Ñто Ñделать, но результат не гарантируетÑÑ Ð½Ð° вÑе 100%"
+"%."
+
+#: ../alsaconf.in:455
+msgid ""
+"\n"
+"\n"
+" OK, sound driver is configured.\n"
+"\n"
+" ALSA CONFIGURATOR\n"
+"\n"
+" will prepare the card for playing now.\n"
+"\n"
+" Now I'll run alsasound init script, then I'll use\n"
+" amixer to raise the default volumes.\n"
+" You can change the volume later via a mixer\n"
+" program such as alsamixer or gamix.\n"
+" \n"
+" "
+msgstr ""
+"\n"
+"\n"
+" Хорошо, драйвер звуковой карты наÑтроен.\n"
+"\n"
+" Ð¡ÐµÐ¹Ñ‡Ð°Ñ ÐаÑтройщик ALSA\n"
+"\n"
+" подготовит звуковую карту Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð¸Ð³Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ.\n"
+"\n"
+" Ð¡ÐµÐ¹Ñ‡Ð°Ñ Ñ Ð·Ð°Ð¿ÑƒÑ‰Ñƒ Ñкрипт, инициализирующий alsasound, потом иÑпользую "
+"amixer\n"
+" Ð´Ð»Ñ ÑƒÐ²ÐµÐ»Ð¸Ñ‡ÐµÐ½Ð¸Ñ ÑƒÑ€Ð¾Ð²Ð½Ñ Ð³Ñ€Ð¾Ð¼ÐºÐ¾Ñти по умолчаниÑ.\n"
+" Ð’Ñ‹ можете изменить уровень громкоÑти по ÑƒÐ¼Ð¾Ð»Ñ‡Ð°Ð½Ð¸Ñ Ð¿Ð¾Ð·Ð¶Ðµ\n"
+" Ñ Ð¿Ð¾Ð¼Ð¾Ñ‰ÑŒÑŽ таких программ как alsamixer или gamix.\n"
+" "
+
+#: ../alsaconf.in:518 ../alsaconf.in:523 ../alsaconf.in:528 ../alsaconf.in:533
+msgid "Can't create temp file, exiting..."
+msgstr "Ðе могу Ñоздать временный файл, прекращаю работу..."
+
+#: ../alsaconf.in:643
+msgid "Building card database.."
+msgstr "Создаю базу данных Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸ÐµÐ¹ о звуковых карточках.."
+
+#: ../alsaconf.in:647
+msgid "No card database is found.."
+msgstr "База данных, ÑÐ¾Ð´ÐµÑ€Ð¶Ð°Ñ‰Ð°Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸ÑŽ о звуковых карточках, не найдена.."
+
+#: ../alsaconf.in:652
+msgid "Searching sound cards"
+msgstr "Ищем звуковые карточки"
+
+#: ../alsaconf.in:806
+msgid ""
+"\n"
+"Configuring %s\n"
+"Do you want to modify %s (and %s if present)?"
+msgstr ""
+"\n"
+"ÐаÑтраиваем %s\n"
+"Ð’Ñ‹ хотите изменить %s (и %s, еÑли ÑущеÑтвует)?"
+
+#: ../alsaconf.in:811
+msgid ""
+"\n"
+"Configuring %s\n"
+"Do you want to modify %s?"
+msgstr ""
+"\n"
+"ÐаÑтраиваем %s\n"
+"Вы хотите изменить %s?"
+
+#: ../alsaconf.in:900
+msgid "Running modules-update..."
+msgstr "ЗапуÑкаем modules-update..."
+
+#: ../alsaconf.in:903
+msgid "Running update-modules..."
+msgstr "ЗапуÑкаем update-modules..."
+
+#: ../alsaconf.in:915
+msgid ""
+"\n"
+" The mixer is set up now for for playing.\n"
+" Shall I try to play a sound sample now?\n"
+"\n"
+" NOTE:\n"
+"If you have a big amplifier, lower your volumes or say no.\n"
+" Otherwise check that your speaker volume is open,\n"
+" and look if you can hear test sound.\n"
+msgstr ""
+"\n"
+" Микшер наÑтроен Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð¸Ð³Ñ€Ð¾Ð²Ð¾Ð²Ð°Ð½Ð¸Ñ.\n"
+" Проиграть теÑтовый пример?\n"
+"\n"
+" Примечание:\n"
+" ЕÑли у Ð²Ð°Ñ Ð±Ð¾Ð»ÑŒÑˆÐ¾Ð¹ уÑилитель, уменьшите уровень громкоÑти или Ñкажите "
+"нет.\n"
+" Ð’ противном Ñлучае проверьте, что ваши колонки включены,\n"
+" и удоÑтоверьтеÑÑŒ что вы Ñлышите теÑтовый пример.\n"
+
+#: ../alsaconf.in:932
+msgid "Saving the mixer setup used for this in /etc/asound.state."
+msgstr "СохранÑем наÑтройки микшера в /etc/asound.state."
+
+#: ../alsaconf.in:936
+msgid ""
+"\n"
+"===============================================================================\n"
+"\n"
+" Now ALSA is ready to use.\n"
+" For adjustment of volumes, use your favorite mixer.\n"
+"\n"
+" Have a lot of fun!\n"
+"\n"
+msgstr ""
+"\n"
+"===============================================================================\n"
+"\n"
+" Теперь ALSA готова к иÑпользованию.\n"
+" Ð”Ð»Ñ Ñ€ÐµÐ³ÑƒÐ»Ð¸Ñ€Ð¾Ð²ÐºÐ¸ ÑƒÑ€Ð¾Ð²Ð½Ñ Ð³Ñ€Ð¾Ð¼ÐºÐ¾Ñти, иÑпользуйте ваш любимый микшер.\n"
+"\n"
+" ОторвиÑÑŒ по полной!\n"
+"\n"
+
+#: ../alsaconf.in:1244
+msgid "WARNING"
+msgstr "ПРЕДУПРЕЖДЕÐИЕ"
+
+#: ../alsaconf.in:1245
+msgid ""
+"\n"
+" Probing legacy ISA cards might make\n"
+" your system unstable.\n"
+"\n"
+" Do you want to proceed?\n"
+"\n"
+msgstr ""
+"\n"
+" ПоиÑк ISA звуковых карточек может Ñделать\n"
+" вашу ÑиÑтему неÑтабильной.\n"
+"\n"
+" Вы уверены?\n"
+"\n"
+
+#: ../alsaconf.in:1268
+msgid ""
+"No legacy drivers are available\n"
+" for your machine"
+msgstr ""
+"Ðету подходÑшего драйвера длÑ\n"
+" вашей машины"
+
+#: ../alsaconf.in:1273
+msgid "Driver Selection"
+msgstr "Выбор Драйвера"
+
+#: ../alsaconf.in:1274
+msgid ""
+" Probing legacy ISA cards\n"
+"\n"
+" Please select the drivers to probe:"
+msgstr ""
+" ПоиÑк ISA звуковых карт\n"
+"\n"
+" ПожалуйÑта, выберите драйверы Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÐ¸:"
+
+#: ../alsaconf.in:1281
+msgid ""
+"\n"
+" Shall I try all possible DMA and IRQ combinations?\n"
+" With this option, some unconventional configuration\n"
+" might be found, but it will take much longer time."
+msgstr ""
+"\n"
+" Попробовать вÑе доÑтупные DMA и IRQ комбинации?\n"
+" С Ñтой опцией, могут быть найдены некоторые неÑтандартные\n"
+" конфигураии, но Ñто займет намного больше времени."
+
+#: ../alsaconf.in:1291
+msgid "Probing legacy cards.. This may take a few minutes.."
+msgstr "ПоиÑк звуковых карточек.. Это может занÑть неÑколько минут.."
+
+#: ../alsaconf.in:1292
+msgid "Probing: "
+msgstr "Проверка: "
+
+#: ../alsaconf.in:1298
+msgid " : FOUND!!"
+msgstr " : ÐÐШЕЛ!!"
+
+#: ../alsaconf.in:1304
+msgid "Result"
+msgstr "Результат"
+
+#: ../alsaconf.in:1305
+msgid "No legacy cards found"
+msgstr "Звуковых карточек не найдено"
+
+#: ../alsaconf.in:1364
+msgid ""
+"\n"
+" Looks like you having a Thinkpad 600E or 770 notebook.\n"
+" On this notebook, CS4236 driver should be used\n"
+" although CS46xx chip is detected.\n"
+"\n"
+" Shall I try to snd-cs4236 driver and probe\n"
+" the legacy ISA configuration?"
+msgstr ""
+"\n"
+" КажетÑÑ, мы имеем дело Ñ Ð½Ð¾ÑƒÑ‚Ð±ÑƒÐºÐ¾Ð¼ Thinkpad 600E или 770.\n"
+" Ðа Ñтом ноутбуке, драйвер CS4236 должен иÑпользоватьÑÑ\n"
+" Ñ…Ð¾Ñ‚Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÑетÑÑ CS46xx\n"
+"\n"
+" ИÑпользовать snd-cs4236 и проверить правильноÑть ISA\n"
+" конфигурации?"
+
+#: ../alsaconf.in:1378
+msgid ""
+"\n"
+" Looks like you having a Dell Dimension machine.\n"
+" On this machine, CS4232 driver should be used\n"
+" although CS46xx chip is detected.\n"
+"\n"
+" Shall I try to snd-cs4232 driver and probe\n"
+" the legacy ISA configuration?"
+msgstr ""
+"\n"
+" Похоже что вы имеем дело Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð¾Ð¹ Dell Dimension.\n"
+" Ðа Ñтой машине CS4232 драйвер должен иÑползьовать, ãƒãƒƒãƒ—ãŒæ¤œå‡ºã•れã¾ã™ãŒ\n"
+" Ñ…Ð¾Ñ‚Ñ Ñ‡Ð¸Ð¿ звуковой карты определÑетÑÑ ÐºÐ°Ðº CS46xx.\n"
+"\n"
+" ИÑпользовать snd-cs4232 и проверить ISA валидноÑть\n"
+" Ñтой конфигурации?"
+
+#: ../alsaconf.in:1395
+msgid "Soundcard Selection"
+msgstr "Выбор Звуковой карты"
+
+#: ../alsaconf.in:1396
+msgid ""
+"\n"
+" Following card(s) are found on your system.\n"
+" Choose a soundcard to configure:\n"
+msgstr ""
+"\n"
+" Следущее звуковаÑ(ые) карта(Ñ‹) найдены в вашей ÑиÑтеме.\n"
+" Выберите звуковую карту Ð´Ð»Ñ Ð½Ð°Ñтройки:\n"
+
+#: ../alsaconf.in:1409
+msgid ""
+"\n"
+" No supported PnP or PCI card found.\n"
+"\n"
+" Would you like to probe legacy ISA sound cards/chips?\n"
+"\n"
+msgstr ""
+"\n"
+" Ðайдена не Ð¿Ð¾Ð´Ð´ÐµÑ€Ð¶Ð¸Ð²Ð°ÐµÐ¼Ð°Ñ PnP или PCI карта.\n"
+"\n"
+" Желаете проверить ISA звуковые карты/чипы?\n"
+"\n"
diff --git a/alsa-utils/alsactl/Makefile.am b/alsa-utils/alsactl/Makefile.am
new file mode 100644
index 0000000..359f73a
--- /dev/null
+++ b/alsa-utils/alsactl/Makefile.am
@@ -0,0 +1,14 @@
+SUBDIRS = init
+
+sbin_PROGRAMS=alsactl
+man_MANS=alsactl.1
+if USE_XMLTO
+man_MANS += alsactl_init.7
+endif
+EXTRA_DIST=alsactl.1 alsactl_init.xml
+
+alsactl_SOURCES=alsactl.c state.c utils.c init_parse.c
+noinst_HEADERS=alsactl.h list.h init_sysdeps.c init_utils_string.c init_utils_run.c init_sysfs.c
+
+%.7: %.xml
+ xmlto man $?
diff --git a/alsa-utils/alsactl/Makefile.in b/alsa-utils/alsactl/Makefile.in
new file mode 100644
index 0000000..2d8fe45
--- /dev/null
+++ b/alsa-utils/alsactl/Makefile.in
@@ -0,0 +1,670 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+sbin_PROGRAMS = alsactl$(EXEEXT)
+@USE_XMLTO_TRUE@am__append_1 = alsactl_init.7
+subdir = alsactl
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" \
+ "$(DESTDIR)$(man7dir)"
+sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(sbin_PROGRAMS)
+am_alsactl_OBJECTS = alsactl.$(OBJEXT) state.$(OBJEXT) utils.$(OBJEXT) \
+ init_parse.$(OBJEXT)
+alsactl_OBJECTS = $(am_alsactl_OBJECTS)
+alsactl_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(alsactl_SOURCES)
+DIST_SOURCES = $(alsactl_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+man1dir = $(mandir)/man1
+man7dir = $(mandir)/man7
+NROFF = nroff
+MANS = $(man_MANS)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+SUBDIRS = init
+man_MANS = alsactl.1 $(am__append_1)
+EXTRA_DIST = alsactl.1 alsactl_init.xml
+alsactl_SOURCES = alsactl.c state.c utils.c init_parse.c
+noinst_HEADERS = alsactl.h list.h init_sysdeps.c init_utils_string.c init_utils_run.c init_sysfs.c
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsactl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign alsactl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+ done
+
+clean-sbinPROGRAMS:
+ -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
+alsactl$(EXEEXT): $(alsactl_OBJECTS) $(alsactl_DEPENDENCIES)
+ @rm -f alsactl$(EXEEXT)
+ $(LINK) $(alsactl_LDFLAGS) $(alsactl_OBJECTS) $(alsactl_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsactl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init_parse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man7: $(man7_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man7dir)" || $(mkdir_p) "$(DESTDIR)$(man7dir)"
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+uninstall-man7:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.7*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 7*) ;; \
+ *) ext='7' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man7dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-sbinPROGRAMS
+
+install-info: install-info-recursive
+
+install-man: install-man1 install-man7
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man uninstall-sbinPROGRAMS
+
+uninstall-info: uninstall-info-recursive
+
+uninstall-man: uninstall-man1 uninstall-man7
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-recursive clean-sbinPROGRAMS ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-man1 install-man7 \
+ install-sbinPROGRAMS install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am uninstall-man \
+ uninstall-man1 uninstall-man7 uninstall-sbinPROGRAMS
+
+
+%.7: %.xml
+ xmlto man $?
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/alsactl/alsactl.1 b/alsa-utils/alsactl/alsactl.1
new file mode 100644
index 0000000..eb3cbd1
--- /dev/null
+++ b/alsa-utils/alsactl/alsactl.1
@@ -0,0 +1,118 @@
+.TH ALSACTL 1 "15 May 2001"
+.SH NAME
+alsactl \- advanced controls for ALSA soundcard driver
+
+.SH SYNOPSIS
+
+\fBalsactl\fP [\fIoptions\fP] [\fIstore\fP|\fIrestore\fP|\fIinit\fP] <card # or id or device>
+
+.SH DESCRIPTION
+\fBalsactl\fP is used to control advanced settings for the ALSA
+soundcard drivers. It supports multiple soundcards. If your card has
+features that you can't seem to control from a mixer application,
+you have come to the right place.
+
+.SH COMMANDS
+
+\fIstore\fP saves the current driver state for the selected soundcard
+to the configuration file.
+
+\fIrestore\fP loads driver state for the selected soundcard from the
+configuration file. If restoring fails (eventually partly), the init
+action is called.
+
+\fIinit\fP tries to initialize all devices to a default state. If device
+is not known, error code 99 is returned.
+
+If no soundcards are specified, setup for all cards will be saved or
+loaded.
+
+.SH OPTIONS
+
+.TP
+\fI\-h, \-\-help\fP
+Help: show available flags and commands.
+
+.TP
+\fI\-d, \-\-debug\fP
+Use debug mode: a bit more verbose.
+
+.TP
+\fI\-v, \-\-version\fP
+Print alsactl version number.
+
+.TP
+\fI\-f, \-\-file\fP
+Select the configuration file to use. The default is /etc/asound.state.
+
+.TP
+\fI\-F, \-\-force\fP
+Used with restore command. Try to restore the matching control elements
+as much as possible. This option is set as default now.
+
+.TP
+\fI\-g, \-\-ignore\fP
+Used with store and restore commands. Do not show 'No soundcards found'
+and do not set an error exit code when soundcards are not installed.
+
+.TP
+\fI\-P, \-\-pedantic\fP
+Used with restore command. Don't restore mismatching control elements.
+This option was the old default behavior.
+
+.TP
+\fI\-I, \-\-no\-init\-fallback\fP
+Don't initialize cards if restore fails. Since version 1.0.18,
+\fBalsactl\fP tries to initialize the card with the restore operation
+as default. But this can cause incompatibility with the older version.
+The caller may expect that the state won't be touched if no state file
+exists. This option takes the restore behavior back to the older
+version by suppressing the initialization.
+
+.TP
+\fI\-r, \-\-runstate\fP
+Save restore and init state to this file. The file will contain only errors.
+Errors are appended with the soundcard id to the end of file.
+
+.TP
+\fI\-R, \-\-remove\fP
+Remove runstate file at first.
+
+.TP
+\fI\-E, \-\-env\fP #=#
+Set environment variable (useful for init action or you may override
+ALSA_CONFIG_PATH to read different or optimized configuration - may be
+useful for "boot" scripts).
+
+.TP
+\fI\-i, \-\-initfile\fP #=#
+The configuration file for init. By default, PREFIX/share/alsa/init/00main
+is used.
+
+.SH FILES
+\fI/etc/asound.state\fP (or whatever file you specify with the
+\fB\-f\fP flag) is used to store current settings for your
+soundcards. The settings include all the usual soundcard mixer
+settings. More importantly, alsactl is
+capable of controlling other card-specific features that mixer apps
+usually don't know about.
+
+The configuration file is generated automatically by running
+\fBalsactl store\fP. Editing the configuration file by hand may be
+necessary for some soundcard features (e.g. enabling/disabling
+automatic mic gain, digital output, joystick/game ports, some future MIDI
+routing options, etc).
+
+.SH SEE ALSO
+\fB
+amixer(1),
+alsamixer(1),
+aplay(1)
+\fP
+
+.SH BUGS
+None known.
+
+.SH AUTHOR
+\fBalsactl\fP is by Jaroslav Kysela <perex@perex.cz> and Abramo Bagnara
+<abramo@alsa\-project.org>. This document is by Paul Winkler <zarmzarm@erols.com>.
diff --git a/alsa-utils/alsactl/alsactl.c b/alsa-utils/alsactl/alsactl.c
new file mode 100644
index 0000000..e0bc276
--- /dev/null
+++ b/alsa-utils/alsactl/alsactl.c
@@ -0,0 +1,192 @@
+/*
+ * Advanced Linux Sound Architecture Control Program
+ * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org>
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "aconfig.h"
+#include "version.h"
+#include <getopt.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <alsa/asoundlib.h>
+#include "alsactl.h"
+
+#define SYS_ASOUNDRC "/etc/asound.state"
+
+int debugflag = 0;
+int force_restore = 1;
+int ignore_nocards = 0;
+char *command;
+char *statefile = NULL;
+
+static void help(void)
+{
+ printf("Usage: alsactl <options> command\n");
+ printf("\nAvailable global options:\n");
+ printf(" -h,--help this help\n");
+ printf(" -d,--debug debug mode\n");
+ printf(" -v,--version print version of this program\n");
+ printf("\nAvailable state options:\n");
+ printf(" -f,--file # configuration file (default " SYS_ASOUNDRC ")\n");
+ printf(" -F,--force try to restore the matching controls as much as possible\n");
+ printf(" (default mode)\n");
+ printf(" -g,--ignore ignore 'No soundcards found' error\n");
+ printf(" -P,--pedantic do not restore mismatching controls (old default)\n");
+ printf(" -I,--no-init-fallback\n"
+ " don't initialize even if restore fails\n");
+ printf(" -r,--runstate # save restore and init state to this file (only errors)\n");
+ printf(" default settings is 'no file set'\n");
+ printf(" -R,--remove remove runstate file at first, otherwise append errors\n");
+ printf("\nAvailable init options:\n");
+ printf(" -E,--env #=# set environment variable for init phase (NAME=VALUE)\n");
+ printf(" -i,--initfile # main configuation file for init phase (default " DATADIR "/init/00main)\n");
+ printf("\n");
+ printf("\nAvailable commands:\n");
+ printf(" store <card #> save current driver setup for one or each soundcards\n");
+ printf(" to configuration file\n");
+ printf(" restore <card #> load current driver setup for one or each soundcards\n");
+ printf(" from configuration file\n");
+ printf(" init <card #> initialize driver to a default state\n");
+ printf(" names <card #> dump information about all the known present (sub-)devices\n");
+ printf(" into configuration file (DEPRECATED)\n");
+}
+
+int main(int argc, char *argv[])
+{
+ static const struct option long_option[] =
+ {
+ {"help", 0, NULL, 'h'},
+ {"file", 1, NULL, 'f'},
+ {"env", 1, NULL, 'E'},
+ {"initfile", 1, NULL, 'i'},
+ {"no-init-fallback", 0, NULL, 'I'},
+ {"force", 0, NULL, 'F'},
+ {"ignore", 0, NULL, 'g'},
+ {"pedantic", 0, NULL, 'P'},
+ {"runstate", 0, NULL, 'r'},
+ {"remove", 0, NULL, 'R'},
+ {"debug", 0, NULL, 'd'},
+ {"version", 0, NULL, 'v'},
+ {NULL, 0, NULL, 0},
+ };
+ static const char *const devfiles[] = {
+ "/dev/snd/controlC",
+ "/dev/snd/pcmC",
+ "/dev/snd/midiC",
+ "/dev/snd/hwC",
+ NULL
+ };
+ char *cfgfile = SYS_ASOUNDRC;
+ char *initfile = DATADIR "/init/00main";
+ char *cardname, **tmp, ncardname[16];
+ int removestate = 0;
+ int init_fallback = 1; /* new default behavior */
+ int res;
+
+ command = argv[0];
+ while (1) {
+ int c;
+
+ if ((c = getopt_long(argc, argv, "hdvf:FgE:i:Pr:R", long_option, NULL)) < 0)
+ break;
+ switch (c) {
+ case 'h':
+ help();
+ return EXIT_SUCCESS;
+ case 'f':
+ cfgfile = optarg;
+ break;
+ case 'F':
+ force_restore = 1;
+ break;
+ case 'g':
+ ignore_nocards = 1;
+ break;
+ case 'E':
+ if (putenv(optarg)) {
+ fprintf(stderr, "environment string '%s' is wrong\n", optarg);
+ return EXIT_FAILURE;
+ }
+ break;
+ case 'i':
+ initfile = optarg;
+ break;
+ case 'I':
+ init_fallback = 0;
+ break;
+ case 'r':
+ statefile = optarg;
+ break;
+ case 'R':
+ removestate = 1;
+ break;
+ case 'P':
+ force_restore = 0;
+ break;
+ case 'd':
+ debugflag = 1;
+ break;
+ case 'v':
+ printf("alsactl version " SND_UTIL_VERSION_STR "\n");
+ return EXIT_SUCCESS;
+ case '?': // error msg already printed
+ help();
+ return EXIT_FAILURE;
+ break;
+ default: // should never happen
+ fprintf(stderr,
+ "Invalid option '%c' (%d) not handled??\n", c, c);
+ }
+ }
+ if (argc - optind <= 0) {
+ fprintf(stderr, "alsactl: Specify command...\n");
+ return 0;
+ }
+
+ cardname = argc - optind > 1 ? argv[optind + 1] : NULL;
+ for (tmp = devfiles; cardname != NULL && *tmp != NULL; tmp++) {
+ int len = strlen(*tmp);
+ if (!strncmp(cardname, *tmp, len)) {
+ long l = strtol(cardname + len, NULL, 0);
+ sprintf(ncardname, "%li", l);
+ cardname = ncardname;
+ break;
+ }
+ }
+
+ if (!strcmp(argv[optind], "init")) {
+ res = init(initfile, cardname);
+ } else if (!strcmp(argv[optind], "store")) {
+ res = save_state(cfgfile, cardname);
+ } else if (!strcmp(argv[optind], "restore")) {
+ if (removestate)
+ remove(statefile);
+ res = load_state(cfgfile, initfile, cardname, init_fallback);
+ } else {
+ fprintf(stderr, "alsactl: Unknown command '%s'...\n",
+ argv[optind]);
+ res = -ENODEV;
+ }
+
+ snd_config_update_free_global();
+ return res < 0 ? res : 0;
+}
diff --git a/alsa-utils/alsactl/alsactl.h b/alsa-utils/alsactl/alsactl.h
new file mode 100644
index 0000000..89ad295
--- /dev/null
+++ b/alsa-utils/alsactl/alsactl.h
@@ -0,0 +1,94 @@
+extern int debugflag;
+extern int force_restore;
+extern int ignore_nocards;
+extern char *command;
+extern char *statefile;
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define info(...) do {\
+ fprintf(stdout, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stdout, __VA_ARGS__); \
+ putc('\n', stdout); \
+} while (0)
+#else
+#define info(args...) do {\
+ fprintf(stdout, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##args); \
+ putc('\n', stdout); \
+} while (0)
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define error(...) do {\
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ putc('\n', stderr); \
+} while (0)
+#else
+#define error(args...) do {\
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##args); \
+ putc('\n', stderr); \
+} while (0)
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define cerror(cond, ...) do {\
+ if (cond) { \
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ putc('\n', stderr); \
+ } \
+} while (0)
+#else
+#define cerror(cond, args...) do {\
+ if (cond) { \
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##args); \
+ putc('\n', stderr); \
+ } \
+} while (0)
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define dbg(...) do {\
+ if (!debugflag) break; \
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ putc('\n', stderr); \
+} while (0)
+#else
+#define dbg(args...) do {\
+ if (!debugflag) break; \
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##args); \
+ putc('\n', stderr); \
+} while (0)
+#endif
+
+int init(const char *file, const char *cardname);
+int save_state(const char *file, const char *cardname);
+int load_state(const char *file, const char *initfile, const char *cardname,
+ int do_init);
+int power(const char *argv[], int argc);
+int generate_names(const char *cfgfile);
+
+/* utils */
+
+int file_map(const char *filename, char **buf, size_t *bufsize);
+void file_unmap(void *buf, size_t bufsize);
+size_t line_width(const char *buf, size_t bufsize, size_t pos);
+void initfailed(int cardnumber, const char *reason);
+
+static inline int hextodigit(int c)
+{
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else if (c >= 'a' && c <= 'f')
+ c = c - 'a' + 10;
+ else if (c >= 'A' && c <= 'F')
+ c = c - 'A' + 10;
+ else
+ return -1;
+ return c;
+}
diff --git a/alsa-utils/alsactl/alsactl_init.xml b/alsa-utils/alsactl/alsactl_init.xml
new file mode 100644
index 0000000..0e0d46b
--- /dev/null
+++ b/alsa-utils/alsactl/alsactl_init.xml
@@ -0,0 +1,590 @@
+<?xml version='1.0'?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<article>
+ <section>
+ <title>alsactl init</title>
+ <refentry>
+ <refentryinfo>
+ <title>alsactl init</title>
+ <date>July 2008</date>
+ <productname>alsactl</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>alsactl_init</refentrytitle>
+ <manvolnum>7</manvolnum>
+ <refmiscinfo class="version"></refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>alsactl init</refname>
+ <refpurpose>alsa control management - initialization</refpurpose>
+ </refnamediv>
+
+ <refsect1><title>DESCRIPTION</title>
+ <para>"alsactl init" provides soundcard specific initialization.</para>
+ </refsect1>
+
+ <refsect1><title>CONFIGURATION</title>
+ <para>All "alsactl init" configuration files are placed in
+ <filename>/usr/share/alsa/init/</filename> directory. The top level
+ configuration file is <filename>/usr/share/alsa/init/00main</filename>.
+ The default top-level file can be also specified using -i or
+ --initfile parameter for the alsactl tool.
+ Every file consists of a set of lines of text. All empty lines or
+ lines beginning with '#' will be ignored.</para>
+
+ <refsect2><title>Rules files</title>
+ <para>The "alsactl init" rules are read from the files located
+ in the <filename>/usr/share/alsa/init/*</filename>. The top
+ level configuration file is <filename>/usr/share/alsa/init/00main</filename>.
+ Every line in the rules file contains at least one key value pair.
+ There are two kind of keys, match and assignment keys. If all match
+ keys are matching against its value, the rule gets applied and the
+ assign keys get the specified value assigned.</para>
+
+ <para>A rule may consists of a list of one or more key value pairs
+ separated by a comma. Each key has a distinct operation, depending
+ on the used operator. Valid operators are:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>==</option></term>
+ <listitem>
+ <para>Compare for equality.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>!=</option></term>
+ <listitem>
+ <para>Compare for non-equality.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>=</option></term>
+ <listitem>
+ <para>Assign a value to a key. Keys that represent a list,
+ are reset and only this single value is assigned.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>+=</option></term>
+ <listitem>
+ <para>Add the value to a key that holds a list
+ of entries.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>:=</option></term>
+ <listitem>
+ <para>Assign a value to a key finally; disallow any
+ later changes, which may be used to prevent changes by
+ any later rules.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The following key names can be used to match against device
+ properties:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>CARDINDEX</option></term>
+ <listitem>
+ <para>Match the card index of the ALSA driver.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>CTL{<replaceable>attribute</replaceable>}</option></term>
+ <listitem>
+ <para>Set or test universal control attribute. Possible
+ attributes:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>numid</option></term>
+ <listitem>
+ <para>Numeric control identification.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>iface</option>, <option>interface</option></term>
+ <listitem>
+ <para>Control interface name (CARD, HWEDEP, MIXER, PCM, RAWMIDI, TIMER, SEQUENCER)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>subdev</option>, <option>subdevice</option></term>
+ <listitem>
+ <para>Subdevice number.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>name</option></term>
+ <listitem>
+ <para>Control name</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>index</option></term>
+ <listitem>
+ <para>Control index</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>type</option></term>
+ <listitem>
+ <para>Control type (BOOLEAN, INTEGER, INTEGER64, ENUMERATED, BYTES, IEC958)</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>attr</option>, <option>attribute</option></term>
+ <listitem>
+ <para>Attributes (stored in a string - use match characters * and ?):</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>r</option></term>
+ <listitem>
+ <para>control is readable</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>w</option></term>
+ <listitem>
+ <para>control is writable</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>v</option></term>
+ <listitem>
+ <para>control is volatile</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>i</option></term>
+ <listitem>
+ <para>control is inactive</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>l</option></term>
+ <listitem>
+ <para>control is locked</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>R</option></term>
+ <listitem>
+ <para>control is TLV readable</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>W</option></term>
+ <listitem>
+ <para>control is TLV writable</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>C</option></term>
+ <listitem>
+ <para>control is TLV commandable</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>o</option></term>
+ <listitem>
+ <para>process is owner of this control</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>u</option></term>
+ <listitem>
+ <para>control created in user space</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>owner</option></term>
+ <listitem>
+ <para>Control owner process PID number</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>count</option></term>
+ <listitem>
+ <para>Control count of values</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>min</option></term>
+ <listitem>
+ <para>Value range - minimum value</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>max</option></term>
+ <listitem>
+ <para>Value range - maximum value</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>step</option></term>
+ <listitem>
+ <para>Value range - step value</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>dBmin</option></term>
+ <listitem>
+ <para>Value range - minimum dB value</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>dBmax</option></term>
+ <listitem>
+ <para>Value range - maximum dB value</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>items</option></term>
+ <listitem>
+ <para>Enumerated value - number of text items</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>enums</option></term>
+ <listitem>
+ <para>Enumerated value - list of text names stored between '|' character</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>value</option></term>
+ <listitem>
+ <para>Value of control stored to a string delimited by
+ comma (,).</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>CONFIG{sysfs_device}</option></term>
+ <listitem>
+ <para>The relative path to sysfs subsystem specifying
+ the root directory of a soundcard device. Usually,
+ it should be set to "/class/sound/controlC$cardinfo{card}/device".
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>ATTR{<replaceable>filename</replaceable>}</option></term>
+ <listitem>
+ <para>Match sysfs attribute values of the soundcard device.
+ The relative path to sysfs tree must be defined by
+ CONFIG{sysfs_device} key. Trailing whitespace in the attribute
+ values is ignored, if the specified match value does
+ not contain trailing whitespace itself. Depending on
+ the type of operator, this key is also used to set
+ the value of a sysfs attribute.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>ENV{<replaceable>key</replaceable>}</option></term>
+ <listitem>
+ <para>Match against the value of an environment variable. Up
+ to five <option>ENV</option> keys can be specified per rule.
+ Depending on the type of operator, this key is also used
+ to export a variable to the environment.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>PROGRAM</option></term>
+ <listitem>
+ <para>Execute external program. The key is true, if
+ the program returns without exit code zero. The whole event
+ environment is available to the executed program. The
+ program's output printed to stdout is available for
+ the RESULT key.</para>
+ <para>Several buildin commands are available:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>__ctl_search</option></term>
+ <listitem>
+ <para>Search for a control. The CTL{name} key might
+ contain match characters * and ?. An control index
+ might be specified as first argument starting from
+ zero (e.g. PROGRAM="__ctl_search 2").</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>__ctl_count</option></term>
+ <listitem>
+ <para>Search for a controls and return total count
+ of matched ones. The CTL{name} key might contain match
+ characters * and ?.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>RESULT</option></term>
+ <listitem>
+ <para>Match the returned string of the last PROGRAM call.
+ This key can be used in the same or in any later rule
+ after a PROGRAM call.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>Most of the fields support a shell style pattern matching.
+ The following pattern characters are supported:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>*</option></term>
+ <listitem>
+ <para>Matches zero, or any number of characters.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>?</option></term>
+ <listitem>
+ <para>Matches any single character.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>[]</option></term>
+ <listitem>
+ <para>Matches any single character specified within
+ the brackets. For example, the pattern string 'tty[SR]'
+ would match either 'ttyS' or 'ttyR'. Ranges are also
+ supported within this match with the '-' character.
+ For example, to match on the range of all digits,
+ the pattern [0-9] would be used. If the first character
+ following the '[' is a '!', any characters
+ not enclosed are matched.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The following keys can get values assigned:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>CTL{numid}</option>, <option>CTL{iface}</option>,
+ <option>CTL{device}</option>, <option>CTL{subdev}</option>,
+ <option>CTL{name}</option>, <option>CTL{index}</option>,
+ </term>
+ <listitem>
+ <para>Select universal control element.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>CTL{value}</option></term>
+ <listitem>
+ <para>Value is set (written) also to soundcard's control
+ device and RESULT key is set to errno code. The result of
+ set operation is always true (it means continue with
+ next key on line).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>CTL{values}</option></term>
+ <listitem>
+ <para>Value is set (written) also to soundcard's control
+ device (all control values are set to specified value) and
+ RESULT key is set to errno code. The result of
+ set operation is always true (it means continue with
+ next key on line).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>ENV{<replaceable>key</replaceable>}</option></term>
+ <listitem>
+ <para>Export a variable to the environment. Depending on the type of operator,
+ this key is also to match against an environment variable.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>RESULT</option></term>
+ <listitem>
+ <para>Set RESULT variable. Note that PROGRAM also sets
+ this variable, but setting this variable manually
+ might be useful to change code execution order (included
+ files).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>LABEL</option></term>
+ <listitem>
+ <para>Named label where a GOTO can jump to.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>GOTO</option></term>
+ <listitem>
+ <para>Jumps to the next LABEL with a matching name</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>INCLUDE</option></term>
+ <listitem>
+ <para>Include specified filename or all files in specified directory</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>ACCESS</option></term>
+ <listitem>
+ <para>Check if specified file or directory exists</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>CONFIG{sysfs_device}</option></term>
+ <listitem>
+ <para>The relative path to sysfs subsystem specifying
+ the root directory of a soundcard device. Usually,
+ it should be set to "/class/sound/controlC$cardinfo{card}/device".
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>PRINT</option></term>
+ <listitem>
+ <para>PRINT value to stdout.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>ERROR</option></term>
+ <listitem>
+ <para>PRINT value to stderr.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>EXIT</option></term>
+ <listitem>
+ <para>Exit immediately and set program exit code to value
+ (should be integer). If value is "return" string,
+ parser leaves current included file and returns to parent
+ configuration file.</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <para>The <option>PROGRAM</option>, <option>RESULT</option>,
+ <option>CTL{value}</option>,
+ <option>PRINT</option>, <option>ERROR</option>,
+ <option>EXIT</option>, <option>CONFIG{}</option>
+ fields support simple printf-like string substitutions.
+ It allows the use of the complete environment set by earlier matching
+ rules. For all other fields, substitutions are applied while the individual rule is
+ being processed. The available substitutions are:</para>
+ <variablelist>
+ <varlistentry>
+ <term><option>$cardinfo{<replaceable>attribute</replaceable>}</option>, <option>%i{<replaceable>attribute</replaceable>}</option></term>
+ <listitem>
+ <para>See CARDINFO{} for more details.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$ctl{<replaceable>attribute</replaceable>}</option>, <option>%C{<replaceable>attribute</replaceable>}</option></term>
+ <listitem>
+ <para>See CTL{} for more details.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$attr{<replaceable>file</replaceable>}</option>, <option>%s{<replaceable>file</replaceable>}</option></term>
+ <listitem>
+ <para>The value of a sysfs attribute found at the device, where
+ all keys of the rule have matched.
+ If the attribute is a symlink, the last element of the symlink target is
+ returned as the value.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$env{<replaceable>key</replaceable>}</option>, <option>%E{<replaceable>key</replaceable>}</option></term>
+ <listitem>
+ <para>The value of an environment variable.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$result</option>, <option>%c</option></term>
+ <listitem>
+ <para>The string returned by the external program requested with PROGRAM.
+ A single part of the string, separated by a space character may be selected
+ by specifying the part number as an attribute: <option>%c{N}</option>.
+ If the number is followed by the '+' char this part plus all remaining parts
+ of the result string are substituted: <option>%c{N+}</option></para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$sysfsroot</option>, <option>%r</option></term>
+ <listitem>
+ <para>Root directory where sysfs file-system is mounted.
+ Ususally, this value is just "/sys".</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>%%</option></term>
+ <listitem>
+ <para>The '%' character itself.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>$$</option></term>
+ <listitem>
+ <para>The '$' character itself.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>The count of characters to be substituted may be limited
+ by specifying the format length value. For example, '%3s{file}'
+ will only insert the first three characters of the sysfs
+ attribute</para>
+ </refsect2>
+ </refsect1>
+
+ <refsect1><title>AUTHOR</title>
+ <para>Written by Jaroslav Kysela <email>perex@perex.cz</email></para>
+ <para>Some portions are written by Greg Kroah-Hartman <email>greg@kroah.com</email> and
+ Kay Sievers <email>kay.sievers@vrfy.org</email>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para><citerefentry>
+ <refentrytitle>alsactl</refentrytitle><manvolnum>1</manvolnum>
+ </citerefentry></para>
+ </refsect1>
+ </refentry>
+ </section>
+</article>
diff --git a/alsa-utils/alsactl/init/00main b/alsa-utils/alsactl/init/00main
new file mode 100644
index 0000000..942f386
--- /dev/null
+++ b/alsa-utils/alsactl/init/00main
@@ -0,0 +1,46 @@
+# This is toplevel configuration for for 'alsactl init'.
+# See 'man alsactl_init' for syntax.
+
+# set root device directory in sysfs for soundcard for ATTR{} command
+CONFIG{sysfs_device}="/class/sound/controlC$cardinfo{card}/device"
+
+# test for extra commands
+ENV{CMD}=="help", INCLUDE="help", GOTO="00main_end"
+ENV{CMD}=="info", INCLUDE="info", GOTO="00main_end"
+ENV{CMD}=="default", INCLUDE="default", GOTO="00main_end"
+ENV{CMD}=="test", INCLUDE="test", GOTO="00main_end"
+ENV{CMD}=="*", ERROR="Unknown command '$env{CMD}'\n", GOTO="00main_end"
+
+# include files with real configuration
+#
+# steps are:
+# 1) look for preinit subdirectory and parse all files in it
+# 2) if RESULT=="skip", skip ALSA standard configuration files
+# 3) do ALSA standard configuration
+# 4) look for postinit subdirectory and parse all files in it
+# 5) if RESULT!="true", initialize hardware using a guess method,
+# print an error message and return with exit code 99
+# 6) return with exit code 0 (success)
+#
+
+RESULT="unknown"
+ACCESS=="preinit", INCLUDE="preinit"
+RESULT=="skip", GOTO="init_end"
+
+# real ALSA configuration database
+CARDINFO{driver}=="HDA-Intel", INCLUDE="hda", GOTO="init_end"
+CARDINFO{driver}=="Test", INCLUDE="test", GOTO="init_end"
+
+LABEL="init_end"
+ACCESS=="postinit", INCLUDE="postinit"
+RESULT=="true", GOTO="00_mainend"
+ERROR="Unknown hardware: \"$cardinfo{driver}\" \"$cardinfo{mixername}\" \"$cardinfo{components}\" \"$attr{subsystem_vendor}\" \"$attr{subsystem_device}\"\n"
+ERROR="Hardware is initialized using a guess method\n"
+INCLUDE="default"
+EXIT="99"
+
+#
+# label identifying end of main file
+#
+
+LABEL="00main_end"
diff --git a/alsa-utils/alsactl/init/Makefile.am b/alsa-utils/alsactl/init/Makefile.am
new file mode 100644
index 0000000..9e2b83d
--- /dev/null
+++ b/alsa-utils/alsactl/init/Makefile.am
@@ -0,0 +1,7 @@
+
+init_files = \
+ 00main default help info test \
+ hda
+EXTRA_DIST = $(init_files)
+alsainitdir = $(datadir)/alsa/init
+alsainit_DATA = $(init_files)
diff --git a/alsa-utils/alsactl/init/Makefile.in b/alsa-utils/alsactl/init/Makefile.in
new file mode 100644
index 0000000..1cabfb4
--- /dev/null
+++ b/alsa-utils/alsactl/init/Makefile.in
@@ -0,0 +1,366 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = alsactl/init
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsainitdir)"
+alsainitDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(alsainit_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+init_files = \
+ 00main default help info test \
+ hda
+
+EXTRA_DIST = $(init_files)
+alsainitdir = $(datadir)/alsa/init
+alsainit_DATA = $(init_files)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsactl/init/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign alsactl/init/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-alsainitDATA: $(alsainit_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsainitdir)" || $(mkdir_p) "$(DESTDIR)$(alsainitdir)"
+ @list='$(alsainit_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsainitDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(alsainitdir)/$$f'"; \
+ $(alsainitDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(alsainitdir)/$$f"; \
+ done
+
+uninstall-alsainitDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsainit_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsainitdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsainitdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(alsainitdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-alsainitDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-alsainitDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-alsainitDATA install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-alsainitDATA uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/alsactl/init/default b/alsa-utils/alsactl/init/default
new file mode 100644
index 0000000..66692b3
--- /dev/null
+++ b/alsa-utils/alsactl/init/default
@@ -0,0 +1,145 @@
+#
+# Default ALSA volume levels and setting when initialization database fails.
+#
+# Basic rules are:
+# - keep volumes at minimal level, but sound should be hearable
+# - enable just main speakers for playback and main microphone for recording
+#
+
+# **************************************************************************
+# playback
+# **************************************************************************
+
+ENV{volume}:="-20dB"
+
+CTL{reset}="mixer"
+CTL{name}="Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Master Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Master Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Master Digital Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Master Digital Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Front Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Front Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Headphone Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Headphone Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Speaker Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Speaker Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="PC Speaker Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="PC Speaker Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="PCM Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="PCM Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="PCM Playback Volume",CTL{index}="1",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="PCM Playback Switch",CTL{index}="1",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="DAC Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="DAC Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Synth Playback Volume",,PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Synth Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Wave Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="100%"
+CTL{name}="Wave Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Music Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="100%"
+CTL{name}="Music Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="CD Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="CD Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Mono Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Mono Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="Master Mono Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Master Mono Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{reset}="mixer"
+CTL{name}="AC97 Playback Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="100%"
+CTL{name}="AC97 Playback Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+#
+# Powermacs
+#
+
+CTL{reset}="mixer"
+CTL{name}="DRC Range",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+
+# **************************************************************************
+# capture
+# **************************************************************************
+
+ENV{volume}:="20dB"
+
+CTL{reset}="mixer"
+CTL{name}="Capture Volume",PROGRAM=="__ctl_search", \
+ CTL{values}="$env{volume}",RESULT!="0",CTL{values}="75%"
+CTL{name}="Capture Switch",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
+
+CTL{name}="Input Source",PROGRAM=="__ctl_search", \
+ CTL{enums}=="*|Internal Mic|*",CTL{values}="Internal Mic", \
+ GOTO="end_input_source"
+CTL{name}="Input Source",PROGRAM=="__ctl_search", \
+ CTL{enums}=="*|Mic|*",CTL{values}="Mic"
+LABEL="end_input_source"
+
+CTL{name}="Internal Mic Boost",PROGRAM=="__ctl_search", \
+ CTL{values}="on"
diff --git a/alsa-utils/alsactl/init/hda b/alsa-utils/alsactl/init/hda
new file mode 100644
index 0000000..43dfec2
--- /dev/null
+++ b/alsa-utils/alsactl/init/hda
@@ -0,0 +1,34 @@
+# Configuration for HDA Intel driver (High Definition Audio - Azalia)
+
+CARDINFO{mixername}=="Realtek ALC880", \
+ ATTR{subsystem_vendor}=="0x1025", ATTR{subsystem_device}=="0x0070", \
+ GOTO="Acer Travelmate 8100"
+CARDINFO{mixername}=="Analog Devices AD1984", \
+ ATTR{subsystem_vendor}=="0x17aa", ATTR{subsystem_device}=="0x20ac", \
+ GOTO="Lenovo T61"
+RESULT="false", EXIT="return"
+
+LABEL="Acer Travelmate 8100"
+# playback
+CTL{reset}="mixer"
+CTL{name}="Headphone Playback Switch", CTL{value}="on,on"
+CTL{name}="Front Playback Volume", CTL{value}="-29dB,-29dB"
+CTL{name}="Front Playback Switch", CTL{value}="on,on"
+CTL{name}="PCM Playback Volume", CTL{value}="-21dB,-21dB"
+# capture
+CTL{name}="Input Source", CTL{value}="Mic"
+CTL{name}="Capture Volume", CTL{value}="20dB,20dB"
+CTL{name}="Capture Switch", CTL{value}="on,on"
+RESULT="true", EXIT="return"
+
+LABEL="Lenovo T61"
+# playback
+CTL{reset}="mixer"
+CTL{name}="Headphone Playback Switch", CTL{value}="on,on"
+CTL{name}="PCM Playback Volume", CTL{value}="-13.5dB,-13.5dB"
+# capture
+CTL{name}="Input Source", CTL{value}="Internal Mic"
+CTL{name}="Internal Mic Boost", CTL{value}="1"
+CTL{name}="Capture Volume", CTL{value}="9dB,9dB"
+CTL{name}="Capture Switch", CTL{value}="on,on"
+RESULT="true", EXIT="return"
diff --git a/alsa-utils/alsactl/init/help b/alsa-utils/alsactl/init/help
new file mode 100644
index 0000000..4f0ba70
--- /dev/null
+++ b/alsa-utils/alsactl/init/help
@@ -0,0 +1,8 @@
+# help page
+
+PRINT="Available commands (identified by the environment variable CMD):\n\n"
+PRINT=" (not set) Do a soundcard initialization\n"
+PRINT=" default Do a default (guess method) initialization\n"
+PRINT=" help Show this information\n"
+PRINT=" info Print all available hardware identification\n"
+PRINT=" test Do alsactl utility parser tests\n"
diff --git a/alsa-utils/alsactl/init/info b/alsa-utils/alsactl/init/info
new file mode 100644
index 0000000..a4fea19
--- /dev/null
+++ b/alsa-utils/alsactl/init/info
@@ -0,0 +1,22 @@
+# show information about card
+
+PRINT="CARDINFO:\n"
+PRINT=" CARDINFO{id}=\"$CARDINFO{id}\"\n"
+PRINT=" CARDINFO{card}=\"$CARDINFO{card}\"\n"
+PRINT=" CARDINFO{driver}=\"$CARDINFO{driver}\"\n"
+PRINT=" CARDINFO{name}=\"$CARDINFO{name}\"\n"
+PRINT=" CARDINFO{longname}=\"$CARDINFO{longname}\"\n"
+PRINT=" CARDINFO{mixername}=\"$CARDINFO{mixername}\"\n"
+PRINT=" CARDINFO{components}=\"$CARDINFO{components}\"\n"
+
+# sysfs stuff
+PRINT="sysfs:\n"
+ATTR{bus}=="*", PRINT=" ATTR{bus}=\"$ATTR{bus}\"\n"
+ATTR{class}=="*", PRINT=" ATTR{class}=\"$ATTR{class}\"\n"
+ATTR{driver}=="*", PRINT=" ATTR{driver}=\"$ATTR{driver}\"\n"
+ATTR{vendor}=="*", PRINT=" ATTR{vendor}=\"$ATTR{vendor}\"\n"
+ATTR{device}=="*", PRINT=" ATTR{device}=\"$ATTR{device}\"\n"
+ATTR{subsystem_vendor}=="*", \
+ PRINT=" ATTR{subsystem_vendor}=\"$ATTR{subsystem_vendor}\"\n"
+ATTR{subsystem_device}=="*", \
+ PRINT=" ATTR{subsystem_device}=\"$ATTR{subsystem_device}\"\n"
diff --git a/alsa-utils/alsactl/init/test b/alsa-utils/alsactl/init/test
new file mode 100644
index 0000000..26db2a3
--- /dev/null
+++ b/alsa-utils/alsactl/init/test
@@ -0,0 +1,270 @@
+# Test code
+# Just for debugging purposes
+
+PRINT="Default CTL:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+
+CTL{reset}="mixer"
+
+PRINT="After CTL{reset}=\"mixer\":\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+
+CTL{numid}="987"
+CTL{iface}="sequencer"
+CTL{device}="10"
+CTL{subdevice}="20"
+CTL{name}="Just Test"
+CTL{index}="999"
+
+PRINT="After test sequence:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+
+ERROR="Ignore following error:\n "
+PROGRAM="__just_test"
+
+PRINT="__ctl_count test:\n"
+CTL{search}="mixer", CTL{name}="*Switch*", PROGRAM="__ctl_count", \
+ PRINT=" *Switch* count result: $result\n"
+
+PRINT="__ctl_search test:\n"
+CTL{search}="mixer", CTL{name}="*Switch*", PROGRAM!="__ctl_search", GOTO="skip_switch_search"
+PRINT=" *Switch 0* search result: $result\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+CTL{search}="mixer", CTL{name}="*Switch*", PROGRAM!="__ctl_search 1", GOTO="skip_switch_search"
+PRINT=" *Switch 1* search result: $result\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+
+PRINT="First ten elements:\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 0", GOTO="skip_first_ten_search"
+PRINT=" Element #0:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 1", GOTO="skip_first_ten_search"
+PRINT=" Element #1:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 2", GOTO="skip_first_ten_search"
+PRINT=" Element #2:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 3", GOTO="skip_first_ten_search"
+PRINT=" Element #3:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 4", GOTO="skip_first_ten_search"
+PRINT=" Element #4:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 5", GOTO="skip_first_ten_search"
+PRINT=" Element #5:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 6", GOTO="skip_first_ten_search"
+PRINT=" Element #6:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 7", GOTO="skip_first_ten_search"
+PRINT=" Element #7:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 8", GOTO="skip_first_ten_search"
+PRINT=" Element #8:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+CTL{search}="mixer", CTL{name}="*", PROGRAM!="__ctl_search 9", GOTO="skip_first_ten_search"
+PRINT=" Element #9:\n"
+PRINT=" CTL{numid}=\"$ctl{numid}\"\n"
+PRINT=" CTL{iface}=\"$ctl{iface}\"\n"
+PRINT=" CTL{device}=\"$ctl{device}\"\n"
+PRINT=" CTL{subdevice}=\"$ctl{subdevice}\"\n"
+PRINT=" CTL{name}=\"$ctl{name}\"\n"
+PRINT=" CTL{index}=\"$ctl{index}\"\n"
+PRINT=" CTL{type}=\"$ctl{type}\"\n"
+PRINT=" CTL{attr}=\"$ctl{attr}\"\n"
+PRINT=" CTL{owner}=\"$ctl{owner}\"\n"
+PRINT=" CTL{count}=\"$ctl{count}\"\n"
+PRINT=" CTL{min}=\"$ctl{min}\"\n"
+PRINT=" CTL{max}=\"$ctl{max}\"\n"
+PRINT=" CTL{step}=\"$ctl{step}\"\n"
+PRINT=" CTL{dBmin}=\"$ctl{dBmin}\"\n"
+PRINT=" CTL{dBmax}=\"$ctl{dBmax}\"\n"
+PRINT=" CTL{items}=\"$ctl{items}\"\n"
+PRINT=" CTL{value}=\"$ctl{value}\"\n"
+LABEL="skip_first_ten_search"
+
+PRINT="Elements write test #1:\n", \
+ CTL{search}="mixer", CTL{name}="Front Playback Switch", \
+ PROGRAM="__ctl_search", CTL{value}="on,on", \
+ PRINT=" result=$result\n"
+PRINT="Elements write test #2:\n", \
+ CTL{search}="mixer", CTL{name}="Front Playback Volume", \
+ PROGRAM="__ctl_search", CTL{value}="32,32", \
+ PRINT=" result=$result\n"
+PRINT="Elements write test #3:\n", \
+ CTL{search}="mixer", CTL{name}="Front Playback Volume Error", \
+ PROGRAM="__ctl_search"
+PRINT=" result=$result\n"
+
+#CTL{reset}="mixer", CTL{name}="Input Source", PRINT="***$ctl{enums}\n"
+
+PRINT="\nAll tests done..\n"
diff --git a/alsa-utils/alsactl/init_parse.c b/alsa-utils/alsactl/init_parse.c
new file mode 100644
index 0000000..c82797e
--- /dev/null
+++ b/alsa-utils/alsactl/init_parse.c
@@ -0,0 +1,1739 @@
+/*
+ * Advanced Linux Sound Architecture Control Program - Parse initialization files
+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
+ * Greg Kroah-Hartman <greg@kroah.com>,
+ * Kay Sievers <kay.sievers@vrfy.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fnmatch.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <sys/select.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <math.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "alsactl.h"
+#include "list.h"
+
+#define PATH_SIZE 512
+#define NAME_SIZE 128
+#define EJUSTRETURN 0x7fffffff
+
+enum key_op {
+ KEY_OP_UNSET,
+ KEY_OP_MATCH,
+ KEY_OP_NOMATCH,
+ KEY_OP_ADD,
+ KEY_OP_ASSIGN,
+ KEY_OP_ASSIGN_FINAL
+};
+
+struct pair {
+ char *key;
+ char *value;
+ struct pair *next;
+};
+
+struct space {
+ struct pair *pairs;
+ char *rootdir;
+ char *go_to;
+ char *program_result;
+ const char *filename;
+ int linenum;
+ int log_run;
+ int exit_code;
+ int quit;
+ unsigned int ctl_id_changed;
+ snd_hctl_t *ctl_handle;
+ snd_ctl_card_info_t *ctl_card_info;
+ snd_ctl_elem_id_t *ctl_id;
+ snd_ctl_elem_info_t *ctl_info;
+ snd_ctl_elem_value_t *ctl_value;
+};
+
+static void Perror(struct space *space, const char *fmt, ...)
+{
+ va_list arg;
+ va_start(arg, fmt);
+ fprintf(stderr, "%s:%i: ", space->filename, space->linenum);
+ vfprintf(stderr, fmt, arg);
+ putc('\n', stderr);
+ va_end(arg);
+}
+
+#include "init_sysdeps.c"
+#include "init_utils_string.c"
+#include "init_utils_run.c"
+#include "init_sysfs.c"
+
+static void free_space(struct space *space)
+{
+ struct pair *pair = space->pairs;
+ struct pair *next = pair;
+
+ while (next) {
+ pair = next;
+ next = pair->next;
+ free(pair->value);
+ free(pair->key);
+ free(pair);
+ }
+ space->pairs = NULL;
+ if (space->ctl_value) {
+ snd_ctl_elem_value_free(space->ctl_value);
+ space->ctl_value = NULL;
+ }
+ if (space->ctl_info) {
+ snd_ctl_elem_info_free(space->ctl_info);
+ space->ctl_info = NULL;
+ }
+ if (space->ctl_id) {
+ snd_ctl_elem_id_free(space->ctl_id);
+ space->ctl_id = NULL;
+ }
+ if (space->ctl_card_info) {
+ snd_ctl_card_info_free(space->ctl_card_info);
+ space->ctl_card_info = NULL;
+ }
+ if (space->ctl_handle) {
+ snd_hctl_close(space->ctl_handle);
+ space->ctl_handle = NULL;
+ }
+ if (space->rootdir)
+ free(space->rootdir);
+ if (space->program_result)
+ free(space->program_result);
+ if (space->go_to)
+ free(space->go_to);
+ free(space);
+}
+
+static struct pair *value_find(struct space *space, const char *key)
+{
+ struct pair *pair = space->pairs;
+
+ while (pair && strcmp(pair->key, key) != 0)
+ pair = pair->next;
+ return pair;
+}
+
+static int value_set(struct space *space, const char *key, const char *value)
+{
+ struct pair *pair;
+
+ pair = value_find(space, key);
+ if (pair) {
+ free(pair->value);
+ pair->value = strdup(value);
+ if (pair->value == NULL)
+ return -ENOMEM;
+ } else {
+ pair = malloc(sizeof(struct pair));
+ if (pair == NULL)
+ return -ENOMEM;
+ pair->key = strdup(key);
+ if (pair->key == NULL) {
+ free(pair);
+ return -ENOMEM;
+ }
+ pair->value = strdup(value);
+ if (pair->value == NULL) {
+ free(pair->key);
+ free(pair);
+ return -ENOMEM;
+ }
+ pair->next = space->pairs;
+ space->pairs = pair;
+ }
+ return 0;
+}
+
+static int init_space(struct space **space, int card)
+{
+ struct space *res;
+ char device[16];
+ int err;
+
+ res = calloc(1, sizeof(struct space));
+ if (res == NULL)
+ return -ENOMEM;
+ res->ctl_id_changed = ~0;
+ res->linenum = -1;
+ sprintf(device, "hw:%u", card);
+ err = snd_hctl_open(&res->ctl_handle, device, 0);
+ if (err < 0)
+ goto error;
+ err = snd_hctl_load(res->ctl_handle);
+ if (err < 0)
+ goto error;
+ err = snd_ctl_card_info_malloc(&res->ctl_card_info);
+ if (err < 0)
+ goto error;
+ err = snd_ctl_card_info(snd_hctl_ctl(res->ctl_handle), res->ctl_card_info);
+ if (err < 0)
+ goto error;
+ err = snd_ctl_elem_id_malloc(&res->ctl_id);
+ if (err < 0)
+ goto error;
+ err = snd_ctl_elem_info_malloc(&res->ctl_info);
+ if (err < 0)
+ goto error;
+ err = snd_ctl_elem_value_malloc(&res->ctl_value);
+ if (err < 0)
+ goto error;
+ *space = res;
+ return 0;
+ error:
+ free_space(res);
+ return err;
+}
+
+static const char *cardinfo_get(struct space *space, const char *attr)
+{
+ if (strncasecmp(attr, "CARD", 4) == 0) {
+ static char res[16];
+ sprintf(res, "%u", snd_ctl_card_info_get_card(space->ctl_card_info));
+ return res;
+ }
+ if (strncasecmp(attr, "ID", 2) == 0)
+ return snd_ctl_card_info_get_id(space->ctl_card_info);
+ if (strncasecmp(attr, "DRIVER", 6) == 0)
+ return snd_ctl_card_info_get_driver(space->ctl_card_info);
+ if (strncasecmp(attr, "NAME", 4) == 0)
+ return snd_ctl_card_info_get_name(space->ctl_card_info);
+ if (strncasecmp(attr, "LONGNAME", 8) == 0)
+ return snd_ctl_card_info_get_longname(space->ctl_card_info);
+ if (strncasecmp(attr, "MIXERNAME", 9) == 0)
+ return snd_ctl_card_info_get_mixername(space->ctl_card_info);
+ if (strncasecmp(attr, "COMPONENTS", 10) == 0)
+ return snd_ctl_card_info_get_components(space->ctl_card_info);
+ Perror(space, "unknown cardinfo{} attribute '%s'", attr);
+ return NULL;
+}
+
+static int check_id_changed(struct space *space, unsigned int what)
+{
+ snd_hctl_elem_t *elem;
+ int err;
+
+ if ((space->ctl_id_changed & what & 1) != 0) {
+ snd_ctl_elem_id_set_numid(space->ctl_id, 0);
+ elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id);
+ if (!elem)
+ return -ENOENT;
+ err = snd_hctl_elem_info(elem, space->ctl_info);
+ if (err == 0)
+ space->ctl_id_changed &= ~1;
+ return err;
+ }
+ if ((space->ctl_id_changed & what & 2) != 0) {
+ snd_ctl_elem_id_set_numid(space->ctl_id, 0);
+ elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id);
+ if (!elem)
+ return -ENOENT;
+ err = snd_hctl_elem_read(elem, space->ctl_value);
+ if (err == 0)
+ space->ctl_id_changed &= ~2;
+ return err;
+ }
+ return 0;
+}
+
+static const char *get_ctl_value(struct space *space)
+{
+ snd_ctl_elem_type_t type;
+ unsigned int idx, count;
+ static char res[1024], tmp[16];
+ static const char hex[] = "0123456789abcdef";
+ char *pos;
+ const char *pos1;
+
+ type = snd_ctl_elem_info_get_type(space->ctl_info);
+ count = snd_ctl_elem_info_get_count(space->ctl_info);
+ res[0] = '\0';
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ for (idx = 0; idx < count; idx++) {
+ if (idx > 0)
+ strlcat(res, ",", sizeof(res));
+ strlcat(res, snd_ctl_elem_value_get_boolean(space->ctl_value, idx) ? "on" : "off", sizeof(res));
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ for (idx = 0; idx < count; idx++) {
+ if (idx > 0)
+ strlcat(res, ",", sizeof(res));
+ snprintf(tmp, sizeof(tmp), "%li", snd_ctl_elem_value_get_integer(space->ctl_value, idx));
+ strlcat(res, tmp, sizeof(res));
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ for (idx = 0; idx < count; idx++) {
+ if (idx > 0)
+ strlcat(res, ",", sizeof(res));
+ snprintf(tmp, sizeof(tmp), "%lli", snd_ctl_elem_value_get_integer64(space->ctl_value, idx));
+ strlcat(res, tmp, sizeof(res));
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ for (idx = 0; idx < count; idx++) {
+ if (idx > 0)
+ strlcat(res, ",", sizeof(res));
+ snprintf(tmp, sizeof(tmp), "%u", snd_ctl_elem_value_get_enumerated(space->ctl_value, idx));
+ strlcat(res, tmp, sizeof(res));
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ if (type == SND_CTL_ELEM_TYPE_IEC958)
+ count = sizeof(snd_aes_iec958_t);
+ if (count > (sizeof(res)-1)/2)
+ count = (sizeof(res)-1/2);
+ pos = res;
+ pos1 = snd_ctl_elem_value_get_bytes(space->ctl_value);
+ while (count > 0) {
+ idx = *pos1++;
+ *pos++ = hex[idx >> 4];
+ *pos++ = hex[idx & 0x0f];
+ count++;
+ }
+ *pos++ = '\0';
+ break;
+ default:
+ Perror(space, "unknown element type '%i'", type);
+ return NULL;
+ }
+ return res;
+}
+
+/* Function to convert from percentage to volume. val = percentage */
+#define convert_prange1(val, min, max) \
+ ceil((val) * ((max) - (min)) * 0.01 + (min))
+
+static int set_ctl_value(struct space *space, const char *value, int all)
+{
+ snd_ctl_elem_type_t type;
+ unsigned int idx, idx2, count, items;
+ const char *pos, *pos2;
+ snd_hctl_elem_t *elem;
+ int val;
+ long lval;
+
+ type = snd_ctl_elem_info_get_type(space->ctl_info);
+ count = snd_ctl_elem_info_get_count(space->ctl_info);
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ for (idx = 0; idx < count; idx++) {
+ while (*value == ' ')
+ value++;
+ if (*value == '\0')
+ goto missing;
+ val = strncasecmp(value, "true", 4) == 0 ||
+ strncasecmp(value, "yes", 3) == 0 ||
+ strncasecmp(value, "on", 2) == 0 ||
+ strncasecmp(value, "1", 1) == 0;
+ snd_ctl_elem_value_set_boolean(space->ctl_value, idx, val);
+ if (all)
+ continue;
+ pos = strchr(value, ',');
+ value = pos ? pos + 1 : value + strlen(value) - 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ for (idx = 0; idx < count; idx++) {
+ while (*value == ' ')
+ value++;
+ pos = strchr(value, ',');
+ if (pos)
+ *(char *)pos = '\0';
+ remove_trailing_chars((char *)value, ' ');
+ items = pos ? pos - value : strlen(value);
+ if (items > 1 && value[items-1] == '%') {
+ val = convert_prange1(strtol(value, NULL, 0), snd_ctl_elem_info_get_min(space->ctl_info), snd_ctl_elem_info_get_max(space->ctl_info));
+ snd_ctl_elem_value_set_integer(space->ctl_value, idx, val);
+ } else if (items > 2 && value[items-2] == 'd' && value[items-1] == 'B') {
+ val = strtol(value, NULL, 0) * 100;
+ if ((pos2 = index(value, '.')) != NULL) {
+ if (isdigit(*(pos2-1)) && isdigit(*(pos2-2))) {
+ if (val < 0)
+ val -= strtol(pos2 + 1, NULL, 0);
+ else
+ val += strtol(pos2 + 1, NULL, 0);
+ } else if (isdigit(*(pos2-1))) {
+ if (val < 0)
+ val -= strtol(pos2 + 1, NULL, 0) * 10;
+ else
+ val += strtol(pos2 + 1, NULL, 0) * 10;
+ }
+ }
+ val = snd_ctl_convert_from_dB(snd_hctl_ctl(space->ctl_handle), space->ctl_id, val, &lval, -1);
+ if (val < 0) {
+ Perror(space, "unable to convert dB value '%s' to internal integer range", value);
+ return val;
+ }
+ snd_ctl_elem_value_set_integer(space->ctl_value, idx, lval);
+ } else {
+ snd_ctl_elem_value_set_integer(space->ctl_value, idx, strtol(value, NULL, 0));
+ }
+ if (all)
+ continue;
+ value = pos ? pos + 1 : value + strlen(value) - 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ for (idx = 0; idx < count; idx++) {
+ while (*value == ' ')
+ value++;
+ snd_ctl_elem_value_set_integer64(space->ctl_value, idx, strtoll(value, NULL, 0));
+ if (all)
+ continue;
+ pos = strchr(value, ',');
+ value = pos ? pos + 1 : value + strlen(value) - 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ for (idx = 0; idx < count; idx++) {
+ while (*value == ' ')
+ value++;
+ pos = strchr(value, ',');
+ if (isdigit(value[0]) || value[0] == '-') {
+ snd_ctl_elem_value_set_enumerated(space->ctl_value, idx, strtol(value, NULL, 0));
+ } else {
+ if (pos)
+ *(char *)pos = '\0';
+ remove_trailing_chars((char *)value, ' ');
+ items = snd_ctl_elem_info_get_items(space->ctl_info);
+ for (idx2 = 0; idx2 < items; idx2++) {
+ snd_ctl_elem_info_set_item(space->ctl_info, idx2);
+ elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id);
+ if (elem == NULL)
+ return -ENOENT;
+ val = snd_hctl_elem_info(elem, space->ctl_info);
+ if (val < 0)
+ return val;
+ if (strcasecmp(snd_ctl_elem_info_get_item_name(space->ctl_info), value) == 0) {
+ snd_ctl_elem_value_set_enumerated(space->ctl_value, idx, idx2);
+ break;
+ }
+ }
+ if (idx2 >= items) {
+ Perror(space, "wrong enum identifier '%s'", value);
+ return -EINVAL;
+ }
+ }
+ if (all)
+ continue;
+ value = pos ? pos + 1 : value + strlen(value) - 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ if (type == SND_CTL_ELEM_TYPE_IEC958)
+ count = sizeof(snd_aes_iec958_t);
+ while (*value == ' ')
+ value++;
+ if (strlen(value) != count * 2) {
+ Perror(space, "bad ctl value hexa length (should be %u bytes)", count);
+ return -EINVAL;
+ }
+ for (idx = 0; idx < count; idx += 2) {
+ val = hextodigit(*(value++)) << 4;
+ val |= hextodigit(*(value++));
+ if (val > 255) {
+ Perror(space, "bad ctl hexa value");
+ return -EINVAL;
+ }
+ snd_ctl_elem_value_set_byte(space->ctl_value, idx, val);
+ }
+ break;
+ default:
+ Perror(space, "unknown element type '%i'", type);
+ return -EINVAL;
+ }
+ return 0;
+ missing:
+ printf("%i %i\n", type, count);
+ Perror(space, "missing some ctl values (line %i)", space->linenum);
+ return -EINVAL;
+}
+
+static const char *elemid_get(struct space *space, const char *attr)
+{
+ long long val;
+ snd_ctl_elem_type_t type;
+ static char res[256];
+
+ if (strncasecmp(attr, "numid", 5) == 0) {
+ val = snd_ctl_elem_id_get_numid(space->ctl_id);
+ goto value;
+ }
+ if (strncasecmp(attr, "iface", 5) == 0 ||
+ strncasecmp(attr, "interface", 9) == 0)
+ return snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(space->ctl_id));
+ if (strncasecmp(attr, "device", 6) == 0) {
+ val = snd_ctl_elem_id_get_device(space->ctl_id);
+ goto value;
+ }
+ if (strncasecmp(attr, "subdev", 6) == 0) {
+ val = snd_ctl_elem_id_get_subdevice(space->ctl_id);
+ goto value;
+ }
+ if (strncasecmp(attr, "name", 4) == 0)
+ return snd_ctl_elem_id_get_name(space->ctl_id);
+ if (strncasecmp(attr, "index", 5) == 0) {
+ val = snd_ctl_elem_id_get_index(space->ctl_id);
+ goto value;
+ }
+ if (strncasecmp(attr, "type", 4) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ return snd_ctl_elem_type_name(snd_ctl_elem_info_get_type(space->ctl_info));
+ }
+ if (strncasecmp(attr, "attr", 4) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ res[0] = '\0';
+ if (snd_ctl_elem_info_is_readable(space->ctl_info))
+ strcat(res, "r");
+ if (snd_ctl_elem_info_is_writable(space->ctl_info))
+ strcat(res, "w");
+ if (snd_ctl_elem_info_is_volatile(space->ctl_info))
+ strcat(res, "v");
+ if (snd_ctl_elem_info_is_inactive(space->ctl_info))
+ strcat(res, "i");
+ if (snd_ctl_elem_info_is_locked(space->ctl_info))
+ strcat(res, "l");
+ if (snd_ctl_elem_info_is_tlv_readable(space->ctl_info))
+ strcat(res, "R");
+ if (snd_ctl_elem_info_is_tlv_writable(space->ctl_info))
+ strcat(res, "W");
+ if (snd_ctl_elem_info_is_tlv_commandable(space->ctl_info))
+ strcat(res, "C");
+ if (snd_ctl_elem_info_is_owner(space->ctl_info))
+ strcat(res, "o");
+ if (snd_ctl_elem_info_is_user(space->ctl_info))
+ strcat(res, "u");
+ return res;
+ }
+ if (strncasecmp(attr, "owner", 5) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ val = snd_ctl_elem_info_get_owner(space->ctl_info);
+ goto value;
+ }
+ if (strncasecmp(attr, "count", 5) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ val = snd_ctl_elem_info_get_count(space->ctl_info);
+ goto value;
+ }
+ if (strncasecmp(attr, "min", 3) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ type = snd_ctl_elem_info_get_type(space->ctl_info);
+ if (type == SND_CTL_ELEM_TYPE_INTEGER64)
+ val = snd_ctl_elem_info_get_min64(space->ctl_info);
+ else if (type == SND_CTL_ELEM_TYPE_INTEGER)
+ val = snd_ctl_elem_info_get_min(space->ctl_info);
+ else
+ goto empty;
+ goto value;
+ }
+ if (strncasecmp(attr, "max", 3) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ type = snd_ctl_elem_info_get_type(space->ctl_info);
+ if (type == SND_CTL_ELEM_TYPE_INTEGER64)
+ val = snd_ctl_elem_info_get_max64(space->ctl_info);
+ else if (type == SND_CTL_ELEM_TYPE_INTEGER)
+ val = snd_ctl_elem_info_get_max(space->ctl_info);
+ else
+ goto empty;
+ goto value;
+ }
+ if (strncasecmp(attr, "step", 3) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ type = snd_ctl_elem_info_get_type(space->ctl_info);
+ if (type == SND_CTL_ELEM_TYPE_INTEGER64)
+ val = snd_ctl_elem_info_get_step64(space->ctl_info);
+ else if (type == SND_CTL_ELEM_TYPE_INTEGER)
+ val = snd_ctl_elem_info_get_step(space->ctl_info);
+ else
+ goto empty;
+ goto value;
+ }
+ if (strncasecmp(attr, "items", 5) == 0) {
+ if (check_id_changed(space, 1))
+ return NULL;
+ if (snd_ctl_elem_info_get_type(space->ctl_info) == SND_CTL_ELEM_TYPE_ENUMERATED)
+ val = snd_ctl_elem_info_get_items(space->ctl_info);
+ else {
+ empty:
+ res[0] = '\0';
+ return res;
+ }
+ goto value;
+ }
+ if (strncasecmp(attr, "value", 5) == 0) {
+ if (check_id_changed(space, 3))
+ return NULL;
+ return get_ctl_value(space);
+ }
+ if (strncasecmp(attr, "dBmin", 5) == 0) {
+ long min, max;
+ if (check_id_changed(space, 1))
+ return NULL;
+ if (snd_ctl_get_dB_range(snd_hctl_ctl(space->ctl_handle), space->ctl_id, &min, &max) < 0)
+ goto empty;
+ val = min;
+dbvalue:
+ sprintf(res, "%li.%02idB", (long)(val / 100), (int)abs(val % 100));
+ return res;
+ }
+ if (strncasecmp(attr, "dBmax", 5) == 0) {
+ long min, max;
+ if (check_id_changed(space, 1))
+ return NULL;
+ if (snd_ctl_get_dB_range(snd_hctl_ctl(space->ctl_handle), space->ctl_id, &min, &max) < 0)
+ goto empty;
+ val = max;
+ goto dbvalue;
+ }
+ if (strncasecmp(attr, "enums", 5) == 0) {
+ unsigned int idx, items;
+ snd_hctl_elem_t *elem;
+ if (check_id_changed(space, 1))
+ return NULL;
+ if (snd_ctl_elem_info_get_type(space->ctl_info) != SND_CTL_ELEM_TYPE_ENUMERATED)
+ goto empty;
+ items = snd_ctl_elem_info_get_items(space->ctl_info);
+ strcpy(res, "|");
+ for (idx = 0; idx < items; idx++) {
+ snd_ctl_elem_info_set_item(space->ctl_info, idx);
+ elem = snd_hctl_find_elem(space->ctl_handle, space->ctl_id);
+ if (elem == NULL)
+ break;
+ if (snd_hctl_elem_info(elem, space->ctl_info) < 0)
+ break;
+ strlcat(res, snd_ctl_elem_info_get_item_name(space->ctl_info), sizeof(res));
+ strlcat(res, "|", sizeof(res));
+ }
+ return res;
+ }
+ Perror(space, "unknown ctl{} attribute '%s'", attr);
+ return NULL;
+ value:
+ sprintf(res, "%lli", val);
+ return res;
+}
+
+static int elemid_set(struct space *space, const char *attr, const char *value)
+{
+ unsigned int val;
+ void (*fcn)(snd_ctl_elem_id_t *, unsigned int);
+ snd_ctl_elem_iface_t iface;
+ int err;
+
+ if (strncasecmp(attr, "numid", 5) == 0) {
+ fcn = snd_ctl_elem_id_set_numid;
+ goto value;
+ }
+ if (strncasecmp(attr, "iface", 5) == 0 ||
+ strncasecmp(attr, "interface", 9) == 0 ||
+ strncasecmp(attr, "reset", 5) == 0 ||
+ strncasecmp(attr, "search", 6) == 0) {
+ if (strlen(value) == 0 && strncasecmp(attr, "search", 6) == 0) {
+ iface = 0;
+ goto search;
+ }
+ for (iface = 0; iface <= SND_CTL_ELEM_IFACE_LAST; iface++) {
+ if (strcasecmp(value, snd_ctl_elem_iface_name(iface)) == 0) {
+ if (strncasecmp(attr, "reset", 5) == 0)
+ snd_ctl_elem_id_clear(space->ctl_id);
+ if (strncasecmp(attr, "search", 5) == 0) {
+ search:
+ snd_ctl_elem_id_clear(space->ctl_id);
+ /* -1 means all */
+ snd_ctl_elem_id_set_interface(space->ctl_id, -1);
+ snd_ctl_elem_id_set_device(space->ctl_id, -1);
+ snd_ctl_elem_id_set_subdevice(space->ctl_id, -1);
+ snd_ctl_elem_id_set_name(space->ctl_id, "*");
+ snd_ctl_elem_id_set_index(space->ctl_id, -1);
+ if (strlen(value) == 0)
+ return 0;
+ }
+ snd_ctl_elem_id_set_interface(space->ctl_id, iface);
+ space->ctl_id_changed = ~0;
+ return 0;
+ }
+ }
+ Perror(space, "unknown control interface name '%s'", value);
+ return -EINVAL;
+ }
+ if (strncasecmp(attr, "device", 6) == 0) {
+ fcn = snd_ctl_elem_id_set_device;
+ goto value;
+ }
+ if (strncasecmp(attr, "subdev", 6) == 0) {
+ fcn = snd_ctl_elem_id_set_subdevice;
+ goto value;
+ }
+ if (strncasecmp(attr, "name", 4) == 0) {
+ snd_ctl_elem_id_set_name(space->ctl_id, value);
+ space->ctl_id_changed = ~0;
+ return 0;
+ }
+ if (strncasecmp(attr, "index", 5) == 0) {
+ fcn = snd_ctl_elem_id_set_index;
+ goto value;
+ }
+ if (strncasecmp(attr, "values", 6) == 0 ||
+ strncasecmp(attr, "value", 5) == 0) {
+ err = check_id_changed(space, 1);
+ if (err < 0) {
+ Perror(space, "control element not found");
+ return err;
+ }
+ err = set_ctl_value(space, value, strncasecmp(attr, "values", 6) == 0);
+ if (err < 0) {
+ space->ctl_id_changed |= 2;
+ } else {
+ space->ctl_id_changed &= ~2;
+ snd_ctl_elem_value_set_id(space->ctl_value, space->ctl_id);
+ err = snd_ctl_elem_write(snd_hctl_ctl(space->ctl_handle), space->ctl_value);
+ if (err < 0) {
+ Perror(space, "value write error: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ return err;
+ }
+ Perror(space, "unknown CTL{} attribute '%s'", attr);
+ return -EINVAL;
+ value:
+ val = (unsigned int)strtol(value, NULL, 0);
+ fcn(space->ctl_id, val);
+ space->ctl_id_changed = ~0;
+ return 0;
+}
+
+static int get_key(char **line, char **key, enum key_op *op, char **value)
+{
+ char *linepos;
+ char *temp;
+
+ linepos = *line;
+ if (linepos == NULL && linepos[0] == '\0')
+ return -EINVAL;
+
+ /* skip whitespace */
+ while (isspace(linepos[0]) || linepos[0] == ',')
+ linepos++;
+
+ /* get the key */
+ if (linepos[0] == '\0')
+ return -EINVAL;
+ *key = linepos;
+
+ while (1) {
+ linepos++;
+ if (linepos[0] == '\0')
+ return -1;
+ if (isspace(linepos[0]))
+ break;
+ if (linepos[0] == '=')
+ break;
+ if (linepos[0] == '+')
+ break;
+ if (linepos[0] == '!')
+ break;
+ if (linepos[0] == ':')
+ break;
+ }
+
+ /* remember end of key */
+ temp = linepos;
+
+ /* skip whitespace after key */
+ while (isspace(linepos[0]))
+ linepos++;
+ if (linepos[0] == '\0')
+ return -EINVAL;
+
+ /* get operation type */
+ if (linepos[0] == '=' && linepos[1] == '=') {
+ *op = KEY_OP_MATCH;
+ linepos += 2;
+ dbg("operator=match");
+ } else if (linepos[0] == '!' && linepos[1] == '=') {
+ *op = KEY_OP_NOMATCH;
+ linepos += 2;
+ dbg("operator=nomatch");
+ } else if (linepos[0] == '+' && linepos[1] == '=') {
+ *op = KEY_OP_ADD;
+ linepos += 2;
+ dbg("operator=add");
+ } else if (linepos[0] == '=') {
+ *op = KEY_OP_ASSIGN;
+ linepos++;
+ dbg("operator=assign");
+ } else if (linepos[0] == ':' && linepos[1] == '=') {
+ *op = KEY_OP_ASSIGN_FINAL;
+ linepos += 2;
+ dbg("operator=assign_final");
+ } else
+ return -EINVAL;
+
+ /* terminate key */
+ temp[0] = '\0';
+ dbg("key='%s'", *key);
+
+ /* skip whitespace after operator */
+ while (isspace(linepos[0]))
+ linepos++;
+ if (linepos[0] == '\0')
+ return -EINVAL;
+
+ /* get the value*/
+ if (linepos[0] != '"')
+ return -EINVAL;
+ linepos++;
+ *value = linepos;
+
+ while (1) {
+ temp = strchr(linepos, '"');
+ if (temp && temp[-1] == '\\') {
+ linepos = temp + 1;
+ continue;
+ }
+ break;
+ }
+ if (!temp)
+ return -EINVAL;
+ temp[0] = '\0';
+ temp++;
+ dbg("value='%s'", *value);
+
+ /* move line to next key */
+ *line = temp;
+
+ return 0;
+}
+
+/* extract possible KEY{attr} */
+static char *get_key_attribute(struct space *space, char *str, char *res, size_t ressize)
+{
+ char *pos;
+ char *attr;
+
+ attr = strchr(str, '{');
+ if (attr != NULL) {
+ attr++;
+ pos = strchr(attr, '}');
+ if (pos == NULL) {
+ Perror(space, "missing closing brace for format");
+ return NULL;
+ }
+ pos[0] = '\0';
+ strlcpy(res, attr, ressize);
+ pos[0] = '}';
+ dbg("attribute='%s'", res);
+ return res;
+ }
+
+ return NULL;
+}
+
+/* extract possible {attr} and move str behind it */
+static char *get_format_attribute(struct space *space, char **str)
+{
+ char *pos;
+ char *attr = NULL;
+
+ if (*str[0] == '{') {
+ pos = strchr(*str, '}');
+ if (pos == NULL) {
+ Perror(space, "missing closing brace for format");
+ return NULL;
+ }
+ pos[0] = '\0';
+ attr = *str+1;
+ *str = pos+1;
+ dbg("attribute='%s', str='%s'", attr, *str);
+ }
+ return attr;
+}
+
+/* extract possible format length and move str behind it*/
+static int get_format_len(struct space *space, char **str)
+{
+ int num;
+ char *tail;
+
+ if (isdigit(*str[0])) {
+ num = (int) strtoul(*str, &tail, 10);
+ if (num > 0) {
+ *str = tail;
+ dbg("format length=%i", num);
+ return num;
+ } else {
+ Perror(space, "format parsing error '%s'", *str);
+ }
+ }
+ return -1;
+}
+
+static void apply_format(struct space *space, char *string, size_t maxsize)
+{
+ char temp[PATH_SIZE];
+ char temp2[PATH_SIZE];
+ char *head, *tail, *pos, *cpos, *attr, *rest;
+ struct pair *pair;
+ int len;
+ int i;
+ int count;
+ enum subst_type {
+ SUBST_UNKNOWN,
+ SUBST_CARDINFO,
+ SUBST_CTL,
+ SUBST_RESULT,
+ SUBST_ATTR,
+ SUBST_SYSFSROOT,
+ SUBST_ENV,
+ };
+ static const struct subst_map {
+ char *name;
+ char fmt;
+ enum subst_type type;
+ } map[] = {
+ { .name = "cardinfo", .fmt = 'i', .type = SUBST_CARDINFO },
+ { .name = "ctl", .fmt = 'C', .type = SUBST_CTL },
+ { .name = "result", .fmt = 'c', .type = SUBST_RESULT },
+ { .name = "attr", .fmt = 's', .type = SUBST_ATTR },
+ { .name = "sysfsroot", .fmt = 'r', .type = SUBST_SYSFSROOT },
+ { .name = "env", .fmt = 'E', .type = SUBST_ENV },
+ { NULL, '\0', 0 }
+ };
+ enum subst_type type;
+ const struct subst_map *subst;
+
+ head = string;
+ while (1) {
+ len = -1;
+ while (head[0] != '\0') {
+ if (head[0] == '$') {
+ /* substitute named variable */
+ if (head[1] == '\0')
+ break;
+ if (head[1] == '$') {
+ strlcpy(temp, head+2, sizeof(temp));
+ strlcpy(head+1, temp, maxsize);
+ head++;
+ continue;
+ }
+ head[0] = '\0';
+ for (subst = map; subst->name; subst++) {
+ if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) {
+ type = subst->type;
+ tail = head + strlen(subst->name)+1;
+ dbg("will substitute format name '%s'", subst->name);
+ goto found;
+ }
+ }
+ } else if (head[0] == '%') {
+ /* substitute format char */
+ if (head[1] == '\0')
+ break;
+ if (head[1] == '%') {
+ strlcpy(temp, head+2, sizeof(temp));
+ strlcpy(head+1, temp, maxsize);
+ head++;
+ continue;
+ }
+ head[0] = '\0';
+ tail = head+1;
+ len = get_format_len(space, &tail);
+ for (subst = map; subst->name; subst++) {
+ if (tail[0] == subst->fmt) {
+ type = subst->type;
+ tail++;
+ dbg("will substitute format char '%c'", subst->fmt);
+ goto found;
+ }
+ }
+ }
+ head++;
+ }
+ break;
+found:
+ attr = get_format_attribute(space, &tail);
+ strlcpy(temp, tail, sizeof(temp));
+ dbg("format=%i, string='%s', tail='%s'", type ,string, tail);
+
+ switch (type) {
+ case SUBST_CARDINFO:
+ if (attr == NULL)
+ Perror(space, "missing identification parametr for cardinfo");
+ else {
+ const char *value = cardinfo_get(space, attr);
+ if (value == NULL)
+ break;
+ strlcat(string, value, maxsize);
+ dbg("substitute cardinfo{%s} '%s'", attr, value);
+ }
+ break;
+ case SUBST_CTL:
+ if (attr == NULL)
+ Perror(space, "missing identification parametr for ctl");
+ else {
+ const char *value = elemid_get(space, attr);
+ if (value == NULL)
+ break;
+ strlcat(string, value, maxsize);
+ dbg("substitute ctl{%s} '%s'", attr, value);
+ }
+ break;
+ case SUBST_RESULT:
+ if (space->program_result == NULL)
+ break;
+ /* get part part of the result string */
+ i = 0;
+ if (attr != NULL)
+ i = strtoul(attr, &rest, 10);
+ if (i > 0) {
+ dbg("request part #%d of result string", i);
+ cpos = space->program_result;
+ while (--i) {
+ while (cpos[0] != '\0' && !isspace(cpos[0]))
+ cpos++;
+ while (isspace(cpos[0]))
+ cpos++;
+ }
+ if (i > 0) {
+ Perror(space, "requested part of result string not found");
+ break;
+ }
+ strlcpy(temp2, cpos, sizeof(temp2));
+ /* %{2+}c copies the whole string from the second part on */
+ if (rest[0] != '+') {
+ cpos = strchr(temp2, ' ');
+ if (cpos)
+ cpos[0] = '\0';
+ }
+ strlcat(string, temp2, maxsize);
+ dbg("substitute part of result string '%s'", temp2);
+ } else {
+ strlcat(string, space->program_result, maxsize);
+ dbg("substitute result string '%s'", space->program_result);
+ }
+ break;
+ case SUBST_ATTR:
+ if (attr == NULL)
+ Perror(space, "missing file parameter for attr");
+ else {
+ const char *value = NULL;
+ size_t size;
+
+ pair = value_find(space, "sysfs_device");
+ if (pair == NULL)
+ break;
+ value = sysfs_attr_get_value(pair->value, attr);
+
+ if (value == NULL)
+ break;
+
+ /* strip trailing whitespace and replace untrusted characters of sysfs value */
+ size = strlcpy(temp2, value, sizeof(temp2));
+ if (size >= sizeof(temp2))
+ size = sizeof(temp2)-1;
+ while (size > 0 && isspace(temp2[size-1]))
+ temp2[--size] = '\0';
+ count = replace_untrusted_chars(temp2);
+ if (count > 0)
+ Perror(space, "%i untrusted character(s) replaced" , count);
+ strlcat(string, temp2, maxsize);
+ dbg("substitute sysfs value '%s'", temp2);
+ }
+ break;
+ case SUBST_SYSFSROOT:
+ strlcat(string, sysfs_path, maxsize);
+ dbg("substitute sysfs_path '%s'", sysfs_path);
+ break;
+ case SUBST_ENV:
+ if (attr == NULL) {
+ dbg("missing attribute");
+ break;
+ }
+ pos = getenv(attr);
+ if (pos == NULL) {
+ dbg("env '%s' not available", attr);
+ break;
+ }
+ dbg("substitute env '%s=%s'", attr, pos);
+ strlcat(string, pos, maxsize);
+ break;
+ default:
+ Perror(space, "unknown substitution type=%i", type);
+ break;
+ }
+ /* possibly truncate to format-char specified length */
+ if (len != -1) {
+ head[len] = '\0';
+ dbg("truncate to %i chars, subtitution string becomes '%s'", len, head);
+ }
+ strlcat(string, temp, maxsize);
+ }
+ /* unescape strings */
+ head = tail = string;
+ while (*head != '\0') {
+ if (*head == '\\') {
+ head++;
+ if (*head == '\0')
+ break;
+ switch (*head) {
+ case 'a': *tail++ = '\a'; break;
+ case 'b': *tail++ = '\b'; break;
+ case 'n': *tail++ = '\n'; break;
+ case 'r': *tail++ = '\r'; break;
+ case 't': *tail++ = '\t'; break;
+ case 'v': *tail++ = '\v'; break;
+ case '\\': *tail++ = '\\'; break;
+ default: *tail++ = *head; break;
+ }
+ head++;
+ continue;
+ }
+ if (*head)
+ *tail++ = *head++;
+ }
+ *tail = 0;
+}
+
+static int do_match(const char *key, enum key_op op,
+ const char *key_value, const char *value)
+{
+ int match;
+
+ if (value == NULL)
+ return 0;
+ dbg("match %s '%s' <-> '%s'", key, key_value, value);
+ match = fnmatch(key_value, value, 0) == 0;
+ if (match && op == KEY_OP_MATCH) {
+ dbg("%s is true (matching value)", key);
+ return 1;
+ }
+ if (!match && op == KEY_OP_NOMATCH) {
+ dbg("%s is true (non-matching value)", key);
+ return 1;
+ }
+ dbg("%s is false", key);
+ return 0;
+}
+
+static int ctl_match(snd_ctl_elem_id_t *pattern, snd_ctl_elem_id_t *id)
+{
+ if (snd_ctl_elem_id_get_interface(pattern) != -1 &&
+ snd_ctl_elem_id_get_interface(pattern) != snd_ctl_elem_id_get_interface(id))
+ return 0;
+ if (snd_ctl_elem_id_get_device(pattern) != -1 &&
+ snd_ctl_elem_id_get_device(pattern) != snd_ctl_elem_id_get_device(id))
+ return 0;
+ if (snd_ctl_elem_id_get_subdevice(pattern) != -1 &&
+ snd_ctl_elem_id_get_subdevice(pattern) != snd_ctl_elem_id_get_subdevice(id))
+ return 0;
+ if (snd_ctl_elem_id_get_index(pattern) != -1 &&
+ snd_ctl_elem_id_get_index(pattern) != snd_ctl_elem_id_get_index(id))
+ return 0;
+ if (fnmatch(snd_ctl_elem_id_get_name(pattern), snd_ctl_elem_id_get_name(id), 0) != 0)
+ return 0;
+ return 1;
+}
+
+static
+int run_program1(struct space *space,
+ const char *command0, char *result,
+ size_t ressize, size_t *reslen, int log)
+{
+ char *pos = strchr(command0, ' ');
+ int cmdlen = pos ? pos - command0 : strlen(command0);
+ int err, index;
+ snd_hctl_elem_t *elem;
+ snd_ctl_elem_id_t *id;
+
+ if (cmdlen == 12 && strncmp(command0, "__ctl_search", 12) == 0) {
+ index = 0;
+ if (pos)
+ index = strtol(pos, NULL, 0);
+ err = snd_ctl_elem_id_malloc(&id);
+ if (err < 0)
+ return EXIT_FAILURE;
+ elem = snd_hctl_first_elem(space->ctl_handle);
+ while (elem) {
+ snd_hctl_elem_get_id(elem, id);
+ if (!ctl_match(space->ctl_id, id))
+ goto next_search;
+ if (index > 0) {
+ index--;
+ goto next_search;
+ }
+ strlcpy(result, "0", ressize);
+ snd_ctl_elem_id_copy(space->ctl_id, id);
+ snd_ctl_elem_id_free(id);
+ dbg("__ctl_search found a control");
+ return EXIT_SUCCESS;
+ next_search:
+ elem = snd_hctl_elem_next(elem);
+ }
+ snd_ctl_elem_id_free(id);
+ return EXIT_FAILURE;
+ }
+ if (cmdlen == 11 && strncmp(command0, "__ctl_count", 11) == 0) {
+ index = 0;
+ err = snd_ctl_elem_id_malloc(&id);
+ if (err < 0)
+ return EXIT_FAILURE;
+ elem = snd_hctl_first_elem(space->ctl_handle);
+ while (elem) {
+ snd_hctl_elem_get_id(elem, id);
+ if (!ctl_match(space->ctl_id, id))
+ goto next_count;
+ index++;
+ next_count:
+ elem = snd_hctl_elem_next(elem);
+ }
+ snd_ctl_elem_id_free(id);
+ if (index > 0) {
+ snprintf(result, ressize, "%u", index);
+ dbg("__ctl_count found %s controls", result);
+ return EXIT_SUCCESS;
+ }
+ dbg("__ctl_count no match");
+ return EXIT_FAILURE;
+ }
+ if (cmdlen == 11 && strncmp(command0, "__ctl_write", 11) == 0) {
+ }
+ Perror(space, "unknown buildin command '%s'", command0);
+ return EXIT_FAILURE;
+}
+
+static int parse(struct space *space, const char *filename);
+
+static char *new_root_dir(const char *filename)
+{
+ char *res, *tmp;
+
+ res = strdup(filename);
+ if (res) {
+ tmp = rindex(res, '/');
+ if (tmp)
+ *tmp = '\0';
+ }
+ dbg("new_root_dir '%s' '%s'", filename, res);
+ return res;
+}
+
+static int parse_line(struct space *space, char *line, size_t linesize)
+{
+ char *linepos;
+ char *key, *value, *attr, *temp;
+ struct pair *pair;
+ enum key_op op;
+ int err = 0, count;
+ char string[PATH_SIZE];
+ char result[PATH_SIZE];
+
+ linepos = line;
+ while (*linepos != '\0') {
+ op = KEY_OP_UNSET;
+
+ err = get_key(&linepos, &key, &op, &value);
+ if (err < 0)
+ goto invalid;
+
+ if (strncasecmp(key, "LABEL", 5) == 0) {
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid LABEL operation");
+ goto invalid;
+ }
+ if (space->go_to && strcmp(space->go_to, value) == 0) {
+ free(space->go_to);
+ space->go_to = NULL;
+ }
+ continue;
+ }
+
+ if (space->go_to) {
+ dbg("skip (GOTO '%s')", space->go_to);
+ break; /* not for us */
+ }
+
+ if (strncasecmp(key, "CTL{", 4) == 0) {
+ attr = get_key_attribute(space, key + 3, string, sizeof(string));
+ if (attr == NULL) {
+ Perror(space, "error parsing CTL attribute");
+ goto invalid;
+ }
+ if (op == KEY_OP_ASSIGN) {
+ strlcpy(result, value, sizeof(result));
+ apply_format(space, result, sizeof(result));
+ dbg("ctl assign: '%s' '%s'", value, attr);
+ err = elemid_set(space, attr, result);
+ if (space->program_result) {
+ free(space->program_result);
+ space->program_result = NULL;
+ }
+ snprintf(string, sizeof(string), "%i", err);
+ space->program_result = strdup(string);
+ if (err < 0 || space->program_result == NULL) {
+ err = 0;
+ break;
+ }
+ } else if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ dbg("ctl match: '%s' '%s'", value, attr);
+ temp = (char *)elemid_get(space, attr);
+ if (!do_match(key, op, value, temp))
+ break;
+ } else {
+ Perror(space, "invalid CTL{} operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strcasecmp(key, "RESULT") == 0) {
+ if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ if (!do_match(key, op, value, space->program_result))
+ break;
+ } else if (op == KEY_OP_ASSIGN) {
+ if (space->program_result) {
+ free(space->program_result);
+ space->program_result = NULL;
+ }
+ strlcpy(string, value, sizeof(string));
+ apply_format(space, string, sizeof(string));
+ space->program_result = strdup(string);
+ if (space->program_result == NULL)
+ break;
+ } else {
+ Perror(space, "invalid RESULT operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strcasecmp(key, "PROGRAM") == 0) {
+ if (op == KEY_OP_UNSET)
+ continue;
+ strlcpy(string, value, sizeof(string));
+ apply_format(space, string, sizeof(string));
+ if (space->program_result) {
+ free(space->program_result);
+ space->program_result = NULL;
+ }
+ if (run_program(space, string, result, sizeof(result), NULL, space->log_run) != 0) {
+ dbg("PROGRAM '%s' is false", string);
+ if (op != KEY_OP_NOMATCH)
+ break;
+ } else {
+ remove_trailing_chars(result, '\n');
+ count = replace_untrusted_chars(result);
+ if (count)
+ info("%i untrusted character(s) replaced", count);
+ dbg("PROGRAM '%s' result is '%s'", string, result);
+ space->program_result = strdup(result);
+ if (space->program_result == NULL)
+ break;
+ dbg("PROGRAM returned successful");
+ if (op == KEY_OP_NOMATCH)
+ break;
+ }
+ dbg("PROGRAM key is true");
+ continue;
+ }
+ if (strncasecmp(key, "CARDINFO{", 9) == 0) {
+ attr = get_key_attribute(space, key + 8, string, sizeof(string));
+ if (attr == NULL) {
+ Perror(space, "error parsing CARDINFO attribute");
+ goto invalid;
+ }
+ if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ dbg("cardinfo: '%s' '%s'", value, attr);
+ temp = (char *)cardinfo_get(space, attr);
+ if (!do_match(key, op, value, temp))
+ break;
+ } else {
+ Perror(space, "invalid CARDINFO{} operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strncasecmp(key, "ATTR{", 5) == 0) {
+ attr = get_key_attribute(space, key + 4, string, sizeof(string));
+ if (attr == NULL) {
+ Perror(space, "error parsing ATTR attribute");
+ goto invalid;
+ }
+ if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ pair = value_find(space, "sysfs_device");
+ if (pair == NULL)
+ break;
+ dbg("sysfs_attr: '%s' '%s'", pair->value, attr);
+ temp = sysfs_attr_get_value(pair->value, attr);
+ if (!do_match(key, op, value, temp))
+ break;
+ } else {
+ Perror(space, "invalid ATTR{} operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strncasecmp(key, "ENV{", 4) == 0) {
+ attr = get_key_attribute(space, key + 3, string, sizeof(string));
+ if (attr == NULL) {
+ Perror(space, "error parsing ENV attribute");
+ goto invalid;
+ }
+ if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ temp = getenv(attr);
+ dbg("env: '%s' '%s'", attr, temp);
+ if (!do_match(key, op, value, temp))
+ break;
+ } else if (op == KEY_OP_ASSIGN ||
+ op == KEY_OP_ASSIGN_FINAL) {
+ strlcpy(result, value, sizeof(result));
+ apply_format(space, result, sizeof(result));
+ dbg("env set: '%s' '%s'", attr, result);
+ if (setenv(attr, result, op == KEY_OP_ASSIGN_FINAL))
+ break;
+ } else {
+ Perror(space, "invalid ENV{} operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strcasecmp(key, "GOTO") == 0) {
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid GOTO operation");
+ goto invalid;
+ }
+ space->go_to = strdup(value);
+ if (space->go_to == NULL) {
+ err = -ENOMEM;
+ break;
+ }
+ continue;
+ }
+ if (strcasecmp(key, "INCLUDE") == 0) {
+ char *rootdir, *go_to;
+ const char *filename;
+ struct dirent *dirent;
+ DIR *dir;
+ int linenum;
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid INCLUDE operation");
+ goto invalid;
+ }
+ if (value[0] == '/')
+ strlcpy(string, value, sizeof(string));
+ else {
+ strlcpy(string, space->rootdir, sizeof(string));
+ strlcat(string, "/", sizeof(string));
+ strlcat(string, value, sizeof(string));
+ }
+ rootdir = space->rootdir;
+ go_to = space->go_to;
+ filename = space->filename;
+ linenum = space->linenum;
+ dir = opendir(string);
+ if (dir) {
+ count = strlen(string);
+ while ((dirent = readdir(dir)) != NULL) {
+ if (strcmp(dirent->d_name, ".") == 0 ||
+ strcmp(dirent->d_name, "..") == 0)
+ continue;
+ string[count] = '\0';
+ strlcat(string, "/", sizeof(string));
+ strlcat(string, dirent->d_name, sizeof(string));
+ space->go_to = NULL;
+ space->rootdir = new_root_dir(string);
+ if (space->rootdir) {
+ err = parse(space, string);
+ free(space->rootdir);
+ } else
+ err = -ENOMEM;
+ if (space->go_to) {
+ Perror(space, "unterminated GOTO '%s'", space->go_to);
+ free(space->go_to);
+ }
+ if (err)
+ break;
+ }
+ closedir(dir);
+ } else {
+ space->go_to = NULL;
+ space->rootdir = new_root_dir(string);
+ if (space->rootdir) {
+ err = parse(space, string);
+ free(space->rootdir);
+ } else
+ err = -ENOMEM;
+ if (space->go_to) {
+ Perror(space, "unterminated GOTO '%s'", space->go_to);
+ free(space->go_to);
+ }
+ }
+ space->go_to = go_to;
+ space->rootdir = rootdir;
+ space->filename = filename;
+ space->linenum = linenum;
+ if (space->quit)
+ break;
+ if (err)
+ break;
+ continue;
+ }
+ if (strncasecmp(key, "ACCESS", 6) == 0) {
+ if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ if (value[0] != '/') {
+ strlcpy(string, space->rootdir, sizeof(string));
+ strlcat(string, "/", sizeof(string));
+ strlcat(string, value, sizeof(string));
+ } else {
+ strlcat(string, value, sizeof(string));
+ }
+ count = access(string, F_OK);
+ dbg("access(%s) = %i", value, count);
+ if (op == KEY_OP_MATCH && count != 0)
+ break;
+ if (op == KEY_OP_NOMATCH && count == 0)
+ break;
+ } else {
+ Perror(space, "invalid ACCESS operation");
+ goto invalid;
+ }
+ continue;
+ }
+ if (strncasecmp(key, "PRINT", 5) == 0) {
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid PRINT operation");
+ goto invalid;
+ }
+ strlcpy(string, value, sizeof(string));
+ apply_format(space, string, sizeof(string));
+ fwrite(string, strlen(string), 1, stdout);
+ continue;
+ }
+ if (strncasecmp(key, "ERROR", 5) == 0) {
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid ERROR operation");
+ goto invalid;
+ }
+ strlcpy(string, value, sizeof(string));
+ apply_format(space, string, sizeof(string));
+ fwrite(string, strlen(string), 1, stderr);
+ continue;
+ }
+ if (strncasecmp(key, "EXIT", 4) == 0) {
+ if (op != KEY_OP_ASSIGN) {
+ Perror(space, "invalid EXIT operation");
+ goto invalid;
+ }
+ strlcpy(string, value, sizeof(string));
+ apply_format(space, string, sizeof(string));
+ if (strcmp(string, "return") == 0)
+ return -EJUSTRETURN;
+ space->exit_code = strtol(string, NULL, 0);
+ space->quit = 1;
+ break;
+ }
+ if (strncasecmp(key, "CONFIG{", 7) == 0) {
+ attr = get_key_attribute(space, key + 6, string, sizeof(string));
+ if (attr == NULL) {
+ Perror(space, "error parsing CONFIG attribute");
+ goto invalid;
+ }
+ strlcpy(result, value, sizeof(result));
+ apply_format(space, result, sizeof(result));
+ if (op == KEY_OP_ASSIGN) {
+ err = value_set(space, attr, result);
+ dbg("CONFIG{%s}='%s'", attr, result);
+ break;
+ } else if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) {
+ pair = value_find(space, attr);
+ if (pair == NULL)
+ break;
+ if (!do_match(key, op, result, pair->value))
+ break;
+ } else {
+ Perror(space, "invalid CONFIG{} operation");
+ goto invalid;
+ }
+ }
+
+ Perror(space, "unknown key '%s'", key);
+ }
+ return err;
+
+invalid:
+ Perror(space, "invalid rule");
+ return -EINVAL;
+}
+
+static int parse(struct space *space, const char *filename)
+{
+ char *buf, *bufline, *line;
+ size_t bufsize, pos, count, linesize;
+ unsigned int linenum, i, j, linenum_adj;
+ int err;
+
+ dbg("start of file '%s'", filename);
+
+ if (file_map(filename, &buf, &bufsize) != 0) {
+ err = errno;
+ error("Unable to open file '%s': %s", filename, strerror(err));
+ return -err;
+ }
+
+ err = 0;
+ pos = 0;
+ linenum = 0;
+ linesize = 128;
+ line = malloc(linesize);
+ if (line == NULL)
+ return -ENOMEM;
+ space->filename = filename;
+ while (!err && pos < bufsize && !space->quit) {
+ count = line_width(buf, bufsize, pos);
+ bufline = buf + pos;
+ pos += count + 1;
+ linenum++;
+
+ /* skip whitespaces */
+ while (count > 0 && isspace(bufline[0])) {
+ bufline++;
+ count--;
+ }
+ if (count == 0)
+ continue;
+
+ /* comment check */
+ if (bufline[0] == '#')
+ continue;
+
+ if (count > linesize - 1) {
+ free(line);
+ linesize = (count + 127 + 1) & ~127;
+ if (linesize > 2048) {
+ error("file %s, line %i too long", filename, linenum);
+ err = -EINVAL;
+ break;
+ }
+ line = malloc(linesize);
+ if (line == NULL) {
+ err = -EINVAL;
+ break;
+ }
+ }
+
+ /* skip backslash and newline from multiline rules */
+ linenum_adj = 0;
+ for (i = j = 0; i < count; i++) {
+ if (bufline[i] == '\\' && bufline[i+1] == '\n') {
+ linenum_adj++;
+ continue;
+ }
+ line[j++] = bufline[i];
+ }
+ line[j] = '\0';
+
+ dbg("read (%i) '%s'", linenum, line);
+ space->linenum = linenum;
+ err = parse_line(space, line, linesize);
+ if (err == -EJUSTRETURN) {
+ err = 0;
+ break;
+ }
+ linenum += linenum_adj;
+ }
+
+ free(line);
+ space->filename = NULL;
+ space->linenum = -1;
+ file_unmap(buf, bufsize);
+ dbg("end of file '%s'", filename);
+ return err ? err : -abs(space->exit_code);
+}
+
+int init(const char *filename, const char *cardname)
+{
+ struct space *space;
+ int err = 0, card, first;
+
+ sysfs_init();
+ if (!cardname) {
+ first = 1;
+ card = -1;
+ while (1) {
+ if (snd_card_next(&card) < 0)
+ break;
+ if (card < 0) {
+ if (first) {
+ error("No soundcards found...");
+ return -ENODEV;
+ }
+ break;
+ }
+ first = 0;
+ err = init_space(&space, card);
+ if (err == 0 &&
+ (space->rootdir = new_root_dir(filename)) != NULL)
+ err = parse(space, filename);
+ free_space(space);
+ if (err < 0)
+ break;
+ }
+ } else {
+ card = snd_card_get_index(cardname);
+ if (card < 0) {
+ error("Cannot find soundcard '%s'...", cardname);
+ goto error;
+ }
+ memset(&space, 0, sizeof(space));
+ err = init_space(&space, card);
+ if (err == 0 &&
+ (space->rootdir = new_root_dir(filename)) != NULL)
+ err = parse(space, filename);
+ free_space(space);
+ }
+ error:
+ sysfs_cleanup();
+ return err;
+}
diff --git a/alsa-utils/alsactl/init_sysdeps.c b/alsa-utils/alsactl/init_sysdeps.c
new file mode 100644
index 0000000..3aca1b4
--- /dev/null
+++ b/alsa-utils/alsactl/init_sysdeps.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if defined(__GLIBC__) && !(defined(__UCLIBC__) && defined(__USE_BSD))
+static size_t strlcpy(char *dst, const char *src, size_t size)
+{
+ size_t bytes = 0;
+ char *q = dst;
+ const char *p = src;
+ char ch;
+
+ while ((ch = *p++)) {
+ if (bytes+1 < size)
+ *q++ = ch;
+ bytes++;
+ }
+
+ /* If size == 0 there is no space for a final null... */
+ if (size)
+ *q = '\0';
+ return bytes;
+}
+
+static size_t strlcat(char *dst, const char *src, size_t size)
+{
+ size_t bytes = 0;
+ char *q = dst;
+ const char *p = src;
+ char ch;
+
+ while (bytes < size && *q) {
+ q++;
+ bytes++;
+ }
+ if (bytes == size)
+ return (bytes + strlen(src));
+
+ while ((ch = *p++)) {
+ if (bytes+1 < size)
+ *q++ = ch;
+ bytes++;
+ }
+
+ *q = '\0';
+ return bytes;
+}
+#endif /* __GLIBC__ */
diff --git a/alsa-utils/alsactl/init_sysfs.c b/alsa-utils/alsactl/init_sysfs.c
new file mode 100644
index 0000000..0cbada2
--- /dev/null
+++ b/alsa-utils/alsactl/init_sysfs.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
+ * 2008 Jaroslav Kysela <perex@perex.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+static char sysfs_path[PATH_SIZE];
+
+/* attribute value cache */
+static LIST_HEAD(attr_list);
+struct sysfs_attr {
+ struct list_head node;
+ char path[PATH_SIZE];
+ char *value; /* points to value_local if value is cached */
+ char value_local[NAME_SIZE];
+};
+
+static int sysfs_init(void)
+{
+ const char *env;
+ char sysfs_test[PATH_SIZE];
+
+ env = getenv("SYSFS_PATH");
+ if (env) {
+ strlcpy(sysfs_path, env, sizeof(sysfs_path));
+ remove_trailing_chars(sysfs_path, '/');
+ } else
+ strlcpy(sysfs_path, "/sys", sizeof(sysfs_path));
+ dbg("sysfs_path='%s'", sysfs_path);
+
+ strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
+ strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test));
+ if (access(sysfs_test, F_OK)) {
+ error("sysfs path '%s' is invalid\n", sysfs_path);
+ return -errno;
+ }
+
+ INIT_LIST_HEAD(&attr_list);
+ return 0;
+}
+
+static void sysfs_cleanup(void)
+{
+ struct sysfs_attr *attr_loop;
+ struct sysfs_attr *attr_temp;
+
+ list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) {
+ list_del(&attr_loop->node);
+ free(attr_loop);
+ }
+}
+
+static char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
+{
+ char path_full[PATH_SIZE];
+ const char *path;
+ char value[NAME_SIZE];
+ struct sysfs_attr *attr_loop;
+ struct sysfs_attr *attr;
+ struct stat statbuf;
+ int fd;
+ ssize_t size;
+ size_t sysfs_len;
+
+ dbg("open '%s'/'%s'", devpath, attr_name);
+ sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
+ path = &path_full[sysfs_len];
+ strlcat(path_full, devpath, sizeof(path_full));
+ strlcat(path_full, "/", sizeof(path_full));
+ strlcat(path_full, attr_name, sizeof(path_full));
+
+ /* look for attribute in cache */
+ list_for_each_entry(attr_loop, &attr_list, node) {
+ if (strcmp(attr_loop->path, path) == 0) {
+ dbg("found in cache '%s'", attr_loop->path);
+ return attr_loop->value;
+ }
+ }
+
+ /* store attribute in cache (also negatives are kept in cache) */
+ dbg("new uncached attribute '%s'", path_full);
+ attr = malloc(sizeof(struct sysfs_attr));
+ if (attr == NULL)
+ return NULL;
+ memset(attr, 0x00, sizeof(struct sysfs_attr));
+ strlcpy(attr->path, path, sizeof(attr->path));
+ dbg("add to cache '%s'", path_full);
+ list_add(&attr->node, &attr_list);
+
+ if (lstat(path_full, &statbuf) != 0) {
+ dbg("stat '%s' failed: %s", path_full, strerror(errno));
+ goto out;
+ }
+
+ if (S_ISLNK(statbuf.st_mode)) {
+ /* links return the last element of the target path */
+ char link_target[PATH_SIZE];
+ int len;
+ const char *pos;
+
+ len = readlink(path_full, link_target, sizeof(link_target));
+ if (len > 0) {
+ link_target[len] = '\0';
+ pos = strrchr(link_target, '/');
+ if (pos != NULL) {
+ dbg("cache '%s' with link value '%s'", path_full, pos+1);
+ strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local));
+ attr->value = attr->value_local;
+ }
+ }
+ goto out;
+ }
+
+ /* skip directories */
+ if (S_ISDIR(statbuf.st_mode))
+ goto out;
+
+ /* skip non-readable files */
+ if ((statbuf.st_mode & S_IRUSR) == 0)
+ goto out;
+
+ /* read attribute value */
+ fd = open(path_full, O_RDONLY);
+ if (fd < 0) {
+ dbg("attribute '%s' does not exist", path_full);
+ goto out;
+ }
+ size = read(fd, value, sizeof(value));
+ close(fd);
+ if (size < 0)
+ goto out;
+ if (size == sizeof(value))
+ goto out;
+
+ /* got a valid value, store and return it */
+ value[size] = '\0';
+ remove_trailing_chars(value, '\n');
+ dbg("cache '%s' with attribute value '%s'", path_full, value);
+ strlcpy(attr->value_local, value, sizeof(attr->value_local));
+ attr->value = attr->value_local;
+
+out:
+ return attr->value;
+}
diff --git a/alsa-utils/alsactl/init_utils_run.c b/alsa-utils/alsactl/init_utils_run.c
new file mode 100644
index 0000000..dde490b
--- /dev/null
+++ b/alsa-utils/alsactl/init_utils_run.c
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#define MY_MAX(a,b) ((a) > (b) ? (a) : (b))
+
+#define READ_END 0
+#define WRITE_END 1
+
+static
+int run_program1(struct space *space,
+ const char *command0, char *result,
+ size_t ressize, size_t *reslen, int log);
+
+static
+int run_program0(struct space *space,
+ const char *command0, char *result,
+ size_t ressize, size_t *reslen, int log)
+{
+ int retval = 0;
+ int status;
+ int outpipe[2] = {-1, -1};
+ int errpipe[2] = {-1, -1};
+ pid_t pid;
+ char arg[PATH_SIZE];
+ char program[PATH_SIZE];
+ char *argv[(sizeof(arg) / 2) + 1];
+ int devnull;
+ int i;
+
+ /* build argv from comand */
+ strlcpy(arg, command0, sizeof(arg));
+ i = 0;
+ if (strchr(arg, ' ') != NULL) {
+ char *pos = arg;
+
+ while (pos != NULL) {
+ if (pos[0] == '\'') {
+ /* don't separate if in apostrophes */
+ pos++;
+ argv[i] = strsep(&pos, "\'");
+ while (pos != NULL && pos[0] == ' ')
+ pos++;
+ } else {
+ argv[i] = strsep(&pos, " ");
+ }
+ dbg("arg[%i] '%s'", i, argv[i]);
+ i++;
+ }
+ argv[i] = NULL;
+ } else {
+ argv[0] = arg;
+ argv[1] = NULL;
+ }
+ info("'%s'", command0);
+
+ /* prepare pipes from child to parent */
+ if (result || log) {
+ if (pipe(outpipe) != 0) {
+ Perror(space, "pipe failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+ if (log) {
+ if (pipe(errpipe) != 0) {
+ Perror(space, "pipe failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+
+ /* allow programs in /lib/alsa called without the path */
+ if (strchr(argv[0], '/') == NULL) {
+ strlcpy(program, "/lib/alsa/", sizeof(program));
+ strlcat(program, argv[0], sizeof(program));
+ argv[0] = program;
+ }
+
+ pid = fork();
+ switch(pid) {
+ case 0:
+ /* child closes parent ends of pipes */
+ if (outpipe[READ_END] > 0)
+ close(outpipe[READ_END]);
+ if (errpipe[READ_END] > 0)
+ close(errpipe[READ_END]);
+
+ /* discard child output or connect to pipe */
+ devnull = open("/dev/null", O_RDWR);
+ if (devnull > 0) {
+ dup2(devnull, STDIN_FILENO);
+ if (outpipe[WRITE_END] < 0)
+ dup2(devnull, STDOUT_FILENO);
+ if (errpipe[WRITE_END] < 0)
+ dup2(devnull, STDERR_FILENO);
+ close(devnull);
+ } else
+ Perror(space, "open /dev/null failed: %s", strerror(errno));
+ if (outpipe[WRITE_END] > 0) {
+ dup2(outpipe[WRITE_END], STDOUT_FILENO);
+ close(outpipe[WRITE_END]);
+ }
+ if (errpipe[WRITE_END] > 0) {
+ dup2(errpipe[WRITE_END], STDERR_FILENO);
+ close(errpipe[WRITE_END]);
+ }
+ execv(argv[0], argv);
+
+ /* we should never reach this */
+ Perror(space, "exec of program '%s' failed", argv[0]);
+ _exit(1);
+ case -1:
+ Perror(space, "fork of '%s' failed: %s", argv[0], strerror(errno));
+ return -1;
+ default:
+ /* read from child if requested */
+ if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) {
+ ssize_t count;
+ size_t respos = 0;
+
+ /* parent closes child ends of pipes */
+ if (outpipe[WRITE_END] > 0)
+ close(outpipe[WRITE_END]);
+ if (errpipe[WRITE_END] > 0)
+ close(errpipe[WRITE_END]);
+
+ /* read child output */
+ while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) {
+ int fdcount;
+ fd_set readfds;
+
+ FD_ZERO(&readfds);
+ if (outpipe[READ_END] > 0)
+ FD_SET(outpipe[READ_END], &readfds);
+ if (errpipe[READ_END] > 0)
+ FD_SET(errpipe[READ_END], &readfds);
+ fdcount = select(MY_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL);
+ if (fdcount < 0) {
+ if (errno == EINTR)
+ continue;
+ retval = -1;
+ break;
+ }
+
+ /* get stdout */
+ if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) {
+ char inbuf[1024];
+ char *pos;
+ char *line;
+
+ count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1);
+ if (count <= 0) {
+ close(outpipe[READ_END]);
+ outpipe[READ_END] = -1;
+ if (count < 0) {
+ Perror(space, "stdin read failed: %s", strerror(errno));
+ retval = -1;
+ }
+ continue;
+ }
+ inbuf[count] = '\0';
+
+ /* store result for rule processing */
+ if (result) {
+ if (respos + count < ressize) {
+ memcpy(&result[respos], inbuf, count);
+ respos += count;
+ } else {
+ Perror(space, "ressize %ld too short", (long)ressize);
+ retval = -1;
+ }
+ }
+ pos = inbuf;
+ while ((line = strsep(&pos, "\n")))
+ if (pos || line[0] != '\0')
+ info("'%s' (stdout) '%s'", argv[0], line);
+ }
+
+ /* get stderr */
+ if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) {
+ char errbuf[1024];
+ char *pos;
+ char *line;
+
+ count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1);
+ if (count <= 0) {
+ close(errpipe[READ_END]);
+ errpipe[READ_END] = -1;
+ if (count < 0)
+ Perror(space, "stderr read failed: %s", strerror(errno));
+ continue;
+ }
+ errbuf[count] = '\0';
+ pos = errbuf;
+ while ((line = strsep(&pos, "\n")))
+ if (pos || line[0] != '\0')
+ info("'%s' (stderr) '%s'", argv[0], line);
+ }
+ }
+ if (outpipe[READ_END] > 0)
+ close(outpipe[READ_END]);
+ if (errpipe[READ_END] > 0)
+ close(errpipe[READ_END]);
+
+ /* return the childs stdout string */
+ if (result) {
+ result[respos] = '\0';
+ dbg("result='%s'", result);
+ if (reslen)
+ *reslen = respos;
+ }
+ }
+ waitpid(pid, &status, 0);
+ if (WIFEXITED(status)) {
+ info("'%s' returned with status %i", argv[0], WEXITSTATUS(status));
+ if (WEXITSTATUS(status) != 0)
+ retval = -1;
+ } else {
+ Perror(space, "'%s' abnormal exit", argv[0]);
+ retval = -1;
+ }
+ }
+
+ return retval;
+}
+
+static
+int run_program(struct space *space, const char *command0, char *result,
+ size_t ressize, size_t *reslen, int log)
+{
+ if (command0[0] == '_' && command0[1] == '_')
+ return run_program1(space, command0, result, ressize, reslen, log);
+ return run_program0(space, command0, result, ressize, reslen, log);
+}
diff --git a/alsa-utils/alsactl/init_utils_string.c b/alsa-utils/alsactl/init_utils_string.c
new file mode 100644
index 0000000..2598e9f
--- /dev/null
+++ b/alsa-utils/alsactl/init_utils_string.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+static int string_is_true(const char *str)
+{
+ if (strcasecmp(str, "true") == 0)
+ return 1;
+ if (strcasecmp(str, "yes") == 0)
+ return 1;
+ if (strcasecmp(str, "1") == 0)
+ return 1;
+ return 0;
+}
+
+static void remove_trailing_chars(char *path, char c)
+{
+ size_t len;
+
+ len = strlen(path);
+ while (len > 0 && path[len-1] == c)
+ path[--len] = '\0';
+}
+
+/* count of characters used to encode one unicode char */
+static int utf8_encoded_expected_len(const char *str)
+{
+ unsigned char c = (unsigned char)str[0];
+
+ if (c < 0x80)
+ return 1;
+ if ((c & 0xe0) == 0xc0)
+ return 2;
+ if ((c & 0xf0) == 0xe0)
+ return 3;
+ if ((c & 0xf8) == 0xf0)
+ return 4;
+ if ((c & 0xfc) == 0xf8)
+ return 5;
+ if ((c & 0xfe) == 0xfc)
+ return 6;
+ return 0;
+}
+
+/* decode one unicode char */
+static int utf8_encoded_to_unichar(const char *str)
+{
+ int unichar;
+ int len;
+ int i;
+
+ len = utf8_encoded_expected_len(str);
+ switch (len) {
+ case 1:
+ return (int)str[0];
+ case 2:
+ unichar = str[0] & 0x1f;
+ break;
+ case 3:
+ unichar = (int)str[0] & 0x0f;
+ break;
+ case 4:
+ unichar = (int)str[0] & 0x07;
+ break;
+ case 5:
+ unichar = (int)str[0] & 0x03;
+ break;
+ case 6:
+ unichar = (int)str[0] & 0x01;
+ break;
+ default:
+ return -1;
+ }
+
+ for (i = 1; i < len; i++) {
+ if (((int)str[i] & 0xc0) != 0x80)
+ return -1;
+ unichar <<= 6;
+ unichar |= (int)str[i] & 0x3f;
+ }
+
+ return unichar;
+}
+
+/* expected size used to encode one unicode char */
+static int utf8_unichar_to_encoded_len(int unichar)
+{
+ if (unichar < 0x80)
+ return 1;
+ if (unichar < 0x800)
+ return 2;
+ if (unichar < 0x10000)
+ return 3;
+ if (unichar < 0x200000)
+ return 4;
+ if (unichar < 0x4000000)
+ return 5;
+ return 6;
+}
+
+/* check if unicode char has a valid numeric range */
+static int utf8_unichar_valid_range(int unichar)
+{
+ if (unichar > 0x10ffff)
+ return 0;
+ if ((unichar & 0xfffff800) == 0xd800)
+ return 0;
+ if ((unichar > 0xfdcf) && (unichar < 0xfdf0))
+ return 0;
+ if ((unichar & 0xffff) == 0xffff)
+ return 0;
+ return 1;
+}
+
+/* validate one encoded unicode char and return its length */
+static int utf8_encoded_valid_unichar(const char *str)
+{
+ int len;
+ int unichar;
+ int i;
+
+ len = utf8_encoded_expected_len(str);
+ if (len == 0)
+ return -1;
+
+ /* ascii is valid */
+ if (len == 1)
+ return 1;
+
+ /* check if expected encoded chars are available */
+ for (i = 0; i < len; i++)
+ if ((str[i] & 0x80) != 0x80)
+ return -1;
+
+ unichar = utf8_encoded_to_unichar(str);
+
+ /* check if encoded length matches encoded value */
+ if (utf8_unichar_to_encoded_len(unichar) != len)
+ return -1;
+
+ /* check if value has valid range */
+ if (!utf8_unichar_valid_range(unichar))
+ return -1;
+
+ return len;
+}
+
+/* replace everything but whitelisted plain ascii and valid utf8 */
+static int replace_untrusted_chars(char *str)
+{
+ size_t i = 0;
+ int replaced = 0;
+
+ while (str[i] != '\0') {
+ int len;
+
+ /* valid printable ascii char */
+ if ((str[i] >= '0' && str[i] <= '9') ||
+ (str[i] >= 'A' && str[i] <= 'Z') ||
+ (str[i] >= 'a' && str[i] <= 'z') ||
+ strchr(" #$%+-./:=?@_,", str[i])) {
+ i++;
+ continue;
+ }
+ /* valid utf8 is accepted */
+ len = utf8_encoded_valid_unichar(&str[i]);
+ if (len > 1) {
+ i += len;
+ continue;
+ }
+
+ /* everything else is garbage */
+ str[i] = '_';
+ i++;
+ replaced++;
+ }
+
+ return replaced;
+}
diff --git a/alsa-utils/alsactl/list.h b/alsa-utils/alsactl/list.h
new file mode 100644
index 0000000..8626630
--- /dev/null
+++ b/alsa-utils/alsactl/list.h
@@ -0,0 +1,289 @@
+/*
+ * Copied from the Linux kernel source tree, version 2.6.0-test1.
+ *
+ * Licensed under the GPL v2 as per the whole kernel source tree.
+ *
+ */
+
+#ifndef _LIST_H
+#define _LIST_H
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ *
+ * @ptr: the pointer to the member.
+ * @type: the type of the container struct this is embedded in.
+ * @member: the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+/*
+ * These are non-NULL pointers that will result in page faults
+ * under normal circumstances, used to verify that nobody uses
+ * non-initialized list entries.
+ */
+#define LIST_POISON1 ((void *) 0x00100100)
+#define LIST_POISON2 ((void *) 0x00200200)
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+ struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+ struct list_head name = LIST_HEAD_INIT(name)
+
+#define INIT_LIST_HEAD(ptr) do { \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+} while (0)
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_add(struct list_head *new,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ next->prev = new;
+ new->next = next;
+ new->prev = prev;
+ prev->next = new;
+}
+
+/**
+ * list_add - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it after
+ *
+ * Insert a new entry after the specified head.
+ * This is good for implementing stacks.
+ */
+static inline void list_add(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head, head->next);
+}
+
+/**
+ * list_add_tail - add a new entry
+ * @new: new entry to be added
+ * @head: list head to add it before
+ *
+ * Insert a new entry before the specified head.
+ * This is useful for implementing queues.
+ */
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+/**
+ * list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ * Note: list_empty on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static inline void list_del(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ entry->next = LIST_POISON1;
+ entry->prev = LIST_POISON2;
+}
+
+/**
+ * list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static inline void list_del_init(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ INIT_LIST_HEAD(entry);
+}
+
+/**
+ * list_move - delete from one list and add as another's head
+ * @list: the entry to move
+ * @head: the head that will precede our entry
+ */
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+ __list_del(list->prev, list->next);
+ list_add(list, head);
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+ struct list_head *head)
+{
+ __list_del(list->prev, list->next);
+ list_add_tail(list, head);
+}
+
+/**
+ * list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static inline int list_empty(struct list_head *head)
+{
+ return head->next == head;
+}
+
+static inline void __list_splice(struct list_head *list,
+ struct list_head *head)
+{
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
+
+ first->prev = head;
+ head->next = first;
+
+ last->next = at;
+ at->prev = last;
+}
+
+/**
+ * list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static inline void list_splice(struct list_head *list, struct list_head *head)
+{
+ if (!list_empty(list))
+ __list_splice(list, head);
+}
+
+/**
+ * list_splice_init - join two lists and reinitialise the emptied list.
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ *
+ * The list at @list is reinitialised
+ */
+static inline void list_splice_init(struct list_head *list,
+ struct list_head *head)
+{
+ if (!list_empty(list)) {
+ __list_splice(list, head);
+ INIT_LIST_HEAD(list);
+ }
+}
+
+/**
+ * list_entry - get the struct for this entry
+ * @ptr: the &struct list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_entry(ptr, type, member) \
+ container_of(ptr, type, member)
+
+/**
+ * list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); \
+ pos = pos->next)
+
+/**
+ * __list_for_each - iterate over a list
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ *
+ * This variant differs from list_for_each() in that it's the
+ * simplest possible list iteration code.
+ * Use this for code that knows the list to be very short (empty
+ * or 1 entry) most of the time.
+ */
+#define __list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * list_for_each_prev - iterate over a list backwards
+ * @pos: the &struct list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define list_for_each_prev(pos, head) \
+ for (pos = (head)->prev; pos != (head); pos = pos->prev)
+
+/**
+ * list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct list_head to use as a loop counter.
+ * @n: another &struct list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define list_for_each_safe(pos, n, head) \
+ for (pos = (head)->next, n = pos->next; pos != (head); \
+ pos = n, n = pos->next)
+
+/**
+ * list_for_each_entry - iterate over list of given type
+ * @pos: the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_reverse - iterate backwards over list of given type.
+ * @pos: the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_reverse(pos, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos: the type * to use as a loop counter.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+#endif /* _LIST_H */
diff --git a/alsa-utils/alsactl/state.c b/alsa-utils/alsactl/state.c
new file mode 100644
index 0000000..635a999
--- /dev/null
+++ b/alsa-utils/alsactl/state.c
@@ -0,0 +1,1653 @@
+/*
+ * Advanced Linux Sound Architecture Control Program
+ * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org>
+ * Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "aconfig.h"
+#include "version.h"
+#include <getopt.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <assert.h>
+#include <errno.h>
+#include <alsa/asoundlib.h>
+#include "alsactl.h"
+
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0])
+
+
+static char *id_str(snd_ctl_elem_id_t *id)
+{
+ static char str[128];
+ assert(id);
+ sprintf(str, "%i,%i,%i,%s,%i",
+ snd_ctl_elem_id_get_interface(id),
+ snd_ctl_elem_id_get_device(id),
+ snd_ctl_elem_id_get_subdevice(id),
+ snd_ctl_elem_id_get_name(id),
+ snd_ctl_elem_id_get_index(id));
+ return str;
+}
+
+static char *num_str(long n)
+{
+ static char str[32];
+ sprintf(str, "%ld", n);
+ return str;
+}
+
+static int snd_config_integer_add(snd_config_t *father, char *id, long integer)
+{
+ int err;
+ snd_config_t *leaf;
+ err = snd_config_make_integer(&leaf, id);
+ if (err < 0)
+ return err;
+ err = snd_config_add(father, leaf);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ err = snd_config_set_integer(leaf, integer);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ return 0;
+}
+
+static int snd_config_integer64_add(snd_config_t *father, char *id, long long integer)
+{
+ int err;
+ snd_config_t *leaf;
+ err = snd_config_make_integer64(&leaf, id);
+ if (err < 0)
+ return err;
+ err = snd_config_add(father, leaf);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ err = snd_config_set_integer64(leaf, integer);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ return 0;
+}
+
+static int snd_config_string_add(snd_config_t *father, const char *id, const char *string)
+{
+ int err;
+ snd_config_t *leaf;
+ err = snd_config_make_string(&leaf, id);
+ if (err < 0)
+ return err;
+ err = snd_config_add(father, leaf);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ err = snd_config_set_string(leaf, string);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ return 0;
+}
+
+static int snd_config_compound_add(snd_config_t *father, const char *id, int join,
+ snd_config_t **node)
+{
+ int err;
+ snd_config_t *leaf;
+ err = snd_config_make_compound(&leaf, id, join);
+ if (err < 0)
+ return err;
+ err = snd_config_add(father, leaf);
+ if (err < 0) {
+ snd_config_delete(leaf);
+ return err;
+ }
+ *node = leaf;
+ return 0;
+}
+
+#define MAX_USER_TLV_SIZE 64
+
+static char *tlv_to_str(unsigned int *tlv)
+{
+ int i, len = tlv[1] / 4 + 2;
+ char *s, *p;
+
+ if (len >= MAX_USER_TLV_SIZE)
+ return NULL;
+ s = malloc(len * 8 + 1);
+ if (! s)
+ return NULL;
+ p = s;
+ for (i = 0; i < len; i++) {
+ sprintf(p, "%08x", tlv[i]);
+ p += 8;
+ }
+ return s;
+}
+
+static unsigned int *str_to_tlv(const char *s)
+{
+ int i, j, c, len;
+ unsigned int *tlv;
+
+ len = strlen(s);
+ if (len % 8) /* aligned to 4 bytes (= 8 letters) */
+ return NULL;
+ len /= 8;
+ if (len > MAX_USER_TLV_SIZE)
+ return NULL;
+ tlv = malloc(sizeof(int) * len);
+ if (! tlv)
+ return NULL;
+ for (i = 0; i < len; i++) {
+ tlv[i] = 0;
+ for (j = 0; j < 8; j++) {
+ if ((c = hextodigit(*s++)) < 0) {
+ free(tlv);
+ return NULL;
+ }
+ tlv[i] = (tlv[i] << 4) | c;
+ }
+ }
+ return tlv;
+}
+
+/*
+ * add the TLV string and dB ranges to comment fields
+ */
+static int add_tlv_comments(snd_ctl_t *handle, snd_ctl_elem_id_t *id,
+ snd_ctl_elem_info_t *info, snd_config_t *comment)
+{
+ unsigned int tlv[MAX_USER_TLV_SIZE];
+ unsigned int *db;
+ long dbmin, dbmax;
+ int err;
+
+ if (snd_ctl_elem_tlv_read(handle, id, tlv, sizeof(tlv)) < 0)
+ return 0; /* ignore error */
+
+ if (snd_ctl_elem_info_is_tlv_writable(info)) {
+ char *s = tlv_to_str(tlv);
+ if (s) {
+ err = snd_config_string_add(comment, "tlv", s);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ free(s);
+ }
+ }
+
+ err = snd_tlv_parse_dB_info(tlv, sizeof(tlv), &db);
+ if (err <= 0)
+ return 0;
+
+ snd_tlv_get_dB_range(db, snd_ctl_elem_info_get_min(info),
+ snd_ctl_elem_info_get_max(info),
+ &dbmin, &dbmax);
+ if (err < 0)
+ return err;
+ snd_config_integer_add(comment, "dbmin", dbmin);
+ snd_config_integer_add(comment, "dbmax", dbmax);
+ return 0;
+}
+
+static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *top)
+{
+ snd_ctl_elem_value_t *ctl;
+ snd_ctl_elem_info_t *info;
+ snd_config_t *control, *comment, *item, *value;
+ const char *s;
+ char buf[256];
+ unsigned int idx;
+ int err;
+ unsigned int device, subdevice, index;
+ const char *name;
+ snd_ctl_elem_type_t type;
+ unsigned int count;
+ snd_ctl_elem_value_alloca(&ctl);
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_info_set_id(info, id);
+ err = snd_ctl_elem_info(handle, info);
+ if (err < 0) {
+ error("Cannot read control info '%s': %s", id_str(id), snd_strerror(err));
+ return err;
+ }
+
+ if (snd_ctl_elem_info_is_inactive(info) ||
+ !snd_ctl_elem_info_is_readable(info))
+ return 0;
+ snd_ctl_elem_value_set_id(ctl, id);
+ err = snd_ctl_elem_read(handle, ctl);
+ if (err < 0) {
+ error("Cannot read control '%s': %s", id_str(id), snd_strerror(err));
+ return err;
+ }
+
+ err = snd_config_compound_add(top, num_str(snd_ctl_elem_info_get_numid(info)), 0, &control);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_config_compound_add(control, "comment", 1, &comment);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ return err;
+ }
+
+ buf[0] = '\0';
+ buf[1] = '\0';
+ if (snd_ctl_elem_info_is_readable(info))
+ strcat(buf, " read");
+ if (snd_ctl_elem_info_is_writable(info))
+ strcat(buf, " write");
+ if (snd_ctl_elem_info_is_inactive(info))
+ strcat(buf, " inactive");
+ if (snd_ctl_elem_info_is_volatile(info))
+ strcat(buf, " volatile");
+ if (snd_ctl_elem_info_is_locked(info))
+ strcat(buf, " locked");
+ if (snd_ctl_elem_info_is_user(info))
+ strcat(buf, " user");
+ err = snd_config_string_add(comment, "access", buf + 1);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+
+ type = snd_ctl_elem_info_get_type(info);
+ device = snd_ctl_elem_info_get_device(info);
+ subdevice = snd_ctl_elem_info_get_subdevice(info);
+ index = snd_ctl_elem_info_get_index(info);
+ name = snd_ctl_elem_info_get_name(info);
+ count = snd_ctl_elem_info_get_count(info);
+ s = snd_ctl_elem_type_name(type);
+ err = snd_config_string_add(comment, "type", s);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_config_integer_add(comment, "count", count);
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ {
+ long min = snd_ctl_elem_info_get_min(info);
+ long max = snd_ctl_elem_info_get_max(info);
+ long step = snd_ctl_elem_info_get_step(info);
+ if (step)
+ sprintf(buf, "%li - %li (step %li)", min, max, step);
+ else
+ sprintf(buf, "%li - %li", min, max);
+ err = snd_config_string_add(comment, "range", buf);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ if (snd_ctl_elem_info_is_tlv_readable(info)) {
+ err = add_tlv_comments(handle, id, info, comment);
+ if (err < 0)
+ return err;
+ }
+ break;
+ }
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ {
+ long long min = snd_ctl_elem_info_get_min64(info);
+ long long max = snd_ctl_elem_info_get_max64(info);
+ long long step = snd_ctl_elem_info_get_step64(info);
+ if (step)
+ sprintf(buf, "%Li - %Li (step %Li)", min, max, step);
+ else
+ sprintf(buf, "%Li - %Li", min, max);
+ err = snd_config_string_add(comment, "range", buf);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ break;
+ }
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ {
+ unsigned int items;
+ err = snd_config_compound_add(comment, "item", 1, &item);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ return err;
+ }
+ items = snd_ctl_elem_info_get_items(info);
+ for (idx = 0; idx < items; idx++) {
+ snd_ctl_elem_info_set_item(info, idx);
+ err = snd_ctl_elem_info(handle, info);
+ if (err < 0) {
+ error("snd_ctl_card_info: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_config_string_add(item, num_str(idx), snd_ctl_elem_info_get_item_name(info));
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ s = snd_ctl_elem_iface_name(snd_ctl_elem_info_get_interface(info));
+ err = snd_config_string_add(control, "iface", s);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ if (device != 0) {
+ err = snd_config_integer_add(control, "device", device);
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ if (subdevice != 0) {
+ err = snd_config_integer_add(control, "subdevice", subdevice);
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ err = snd_config_string_add(control, "name", name);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ if (index != 0) {
+ err = snd_config_integer_add(control, "index", index);
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ {
+ size_t size = type == SND_CTL_ELEM_TYPE_BYTES ?
+ count : sizeof(snd_aes_iec958_t);
+ char buf[size * 2 + 1];
+ char *p = buf;
+ char *hex = "0123456789abcdef";
+ const unsigned char *bytes =
+ (const unsigned char *)snd_ctl_elem_value_get_bytes(ctl);
+ for (idx = 0; idx < size; idx++) {
+ int v = bytes[idx];
+ *p++ = hex[v >> 4];
+ *p++ = hex[v & 0x0f];
+ }
+ *p = '\0';
+ err = snd_config_string_add(control, "value", buf);
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ return 0;
+ }
+ default:
+ break;
+ }
+
+ if (count == 1) {
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ err = snd_config_string_add(control, "value", snd_ctl_elem_value_get_boolean(ctl, 0) ? "true" : "false");
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ return 0;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ err = snd_config_integer_add(control, "value", snd_ctl_elem_value_get_integer(ctl, 0));
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+ return 0;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ err = snd_config_integer64_add(control, "value", snd_ctl_elem_value_get_integer64(ctl, 0));
+ if (err < 0) {
+ error("snd_config_integer64_add: %s", snd_strerror(err));
+ return err;
+ }
+ return 0;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ {
+ unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, 0);
+ snd_config_t *c;
+ err = snd_config_search(item, num_str(v), &c);
+ if (err == 0) {
+ err = snd_config_get_string(c, &s);
+ assert(err == 0);
+ err = snd_config_string_add(control, "value", s);
+ } else {
+ err = snd_config_integer_add(control, "value", v);
+ }
+ if (err < 0)
+ error("snd_config add: %s", snd_strerror(err));
+ return 0;
+ }
+ default:
+ error("Unknown control type: %d\n", type);
+ return -EINVAL;
+ }
+ }
+
+ err = snd_config_compound_add(control, "value", 1, &value);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ return err;
+ }
+
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ for (idx = 0; idx < count; idx++) {
+ err = snd_config_string_add(value, num_str(idx), snd_ctl_elem_value_get_boolean(ctl, idx) ? "true" : "false");
+ if (err < 0) {
+ error("snd_config_string_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ for (idx = 0; idx < count; idx++) {
+ err = snd_config_integer_add(value, num_str(idx), snd_ctl_elem_value_get_integer(ctl, idx));
+ if (err < 0) {
+ error("snd_config_integer_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ for (idx = 0; idx < count; idx++) {
+ err = snd_config_integer64_add(value, num_str(idx), snd_ctl_elem_value_get_integer64(ctl, idx));
+ if (err < 0) {
+ error("snd_config_integer64_add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ for (idx = 0; idx < count; idx++) {
+ unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, idx);
+ snd_config_t *c;
+ err = snd_config_search(item, num_str(v), &c);
+ if (err == 0) {
+ err = snd_config_get_string(c, &s);
+ assert(err == 0);
+ err = snd_config_string_add(value, num_str(idx), s);
+ } else {
+ err = snd_config_integer_add(value, num_str(idx), v);
+ }
+ if (err < 0) {
+ error("snd_config add: %s", snd_strerror(err));
+ return err;
+ }
+ }
+ break;
+ default:
+ error("Unknown control type: %d\n", type);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int get_controls(int cardno, snd_config_t *top)
+{
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t *info;
+ snd_config_t *state, *card, *control;
+ snd_ctl_elem_list_t *list;
+ unsigned int idx;
+ int err;
+ char name[32];
+ unsigned int count;
+ const char *id;
+ snd_ctl_card_info_alloca(&info);
+ snd_ctl_elem_list_alloca(&list);
+
+ sprintf(name, "hw:%d", cardno);
+ err = snd_ctl_open(&handle, name, SND_CTL_READONLY);
+ if (err < 0) {
+ error("snd_ctl_open error: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_ctl_card_info(handle, info);
+ if (err < 0) {
+ error("snd_ctl_card_info error: %s", snd_strerror(err));
+ goto _close;
+ }
+ id = snd_ctl_card_info_get_id(info);
+ err = snd_config_search(top, "state", &state);
+ if (err == 0 &&
+ snd_config_get_type(state) != SND_CONFIG_TYPE_COMPOUND) {
+ error("config state node is not a compound");
+ err = -EINVAL;
+ goto _close;
+ }
+ if (err < 0) {
+ err = snd_config_compound_add(top, "state", 1, &state);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ goto _close;
+ }
+ }
+ err = snd_config_search(state, id, &card);
+ if (err == 0 &&
+ snd_config_get_type(card) != SND_CONFIG_TYPE_COMPOUND) {
+ error("config state.%s node is not a compound", id);
+ err = -EINVAL;
+ goto _close;
+ }
+ if (err < 0) {
+ err = snd_config_compound_add(state, id, 0, &card);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ goto _close;
+ }
+ }
+ err = snd_config_search(card, "control", &control);
+ if (err == 0) {
+ err = snd_config_delete(control);
+ if (err < 0) {
+ error("snd_config_delete: %s", snd_strerror(err));
+ goto _close;
+ }
+ }
+ err = snd_ctl_elem_list(handle, list);
+ if (err < 0) {
+ error("Cannot determine controls: %s", snd_strerror(err));
+ goto _close;
+ }
+ count = snd_ctl_elem_list_get_count(list);
+ err = snd_config_compound_add(card, "control", count > 0, &control);
+ if (err < 0) {
+ error("snd_config_compound_add: %s", snd_strerror(err));
+ goto _close;
+ }
+ if (count == 0) {
+ err = 0;
+ goto _close;
+ }
+ snd_ctl_elem_list_set_offset(list, 0);
+ if (snd_ctl_elem_list_alloc_space(list, count) < 0) {
+ error("No enough memory...");
+ goto _close;
+ }
+ if ((err = snd_ctl_elem_list(handle, list)) < 0) {
+ error("Cannot determine controls (2): %s", snd_strerror(err));
+ goto _free;
+ }
+ for (idx = 0; idx < count; ++idx) {
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_list_get_id(list, idx, id);
+ err = get_control(handle, id, control);
+ if (err < 0)
+ goto _free;
+ }
+
+ err = 0;
+ _free:
+ snd_ctl_elem_list_free_space(list);
+ _close:
+ snd_ctl_close(handle);
+ return err;
+}
+
+static long config_iface(snd_config_t *n)
+{
+ long i;
+ long long li;
+ snd_ctl_elem_iface_t idx;
+ const char *str;
+ switch (snd_config_get_type(n)) {
+ case SND_CONFIG_TYPE_INTEGER:
+ snd_config_get_integer(n, &i);
+ return i;
+ case SND_CONFIG_TYPE_INTEGER64:
+ snd_config_get_integer64(n, &li);
+ return li;
+ case SND_CONFIG_TYPE_STRING:
+ snd_config_get_string(n, &str);
+ break;
+ default:
+ return -1;
+ }
+ for (idx = 0; idx <= SND_CTL_ELEM_IFACE_LAST; idx++) {
+ if (strcasecmp(snd_ctl_elem_iface_name(idx), str) == 0)
+ return idx;
+ }
+ return -1;
+}
+
+static int config_bool(snd_config_t *n, int doit)
+{
+ const char *str;
+ long val;
+ long long lval;
+
+ switch (snd_config_get_type(n)) {
+ case SND_CONFIG_TYPE_INTEGER:
+ snd_config_get_integer(n, &val);
+ if (val < 0 || val > 1)
+ return -1;
+ return val;
+ case SND_CONFIG_TYPE_INTEGER64:
+ snd_config_get_integer64(n, &lval);
+ if (lval < 0 || lval > 1)
+ return -1;
+ return (int) lval;
+ case SND_CONFIG_TYPE_STRING:
+ snd_config_get_string(n, &str);
+ break;
+ case SND_CONFIG_TYPE_COMPOUND:
+ if (!force_restore || !doit)
+ return -1;
+ n = snd_config_iterator_entry(snd_config_iterator_first(n));
+ return config_bool(n, doit);
+ default:
+ return -1;
+ }
+ if (strcmp(str, "on") == 0 || strcmp(str, "true") == 0)
+ return 1;
+ if (strcmp(str, "off") == 0 || strcmp(str, "false") == 0)
+ return 0;
+ return -1;
+}
+
+static int config_enumerated(snd_config_t *n, snd_ctl_t *handle,
+ snd_ctl_elem_info_t *info, int doit)
+{
+ const char *str;
+ long val;
+ long long lval;
+ unsigned int idx, items;
+
+ switch (snd_config_get_type(n)) {
+ case SND_CONFIG_TYPE_INTEGER:
+ snd_config_get_integer(n, &val);
+ return val;
+ case SND_CONFIG_TYPE_INTEGER64:
+ snd_config_get_integer64(n, &lval);
+ return (int) lval;
+ case SND_CONFIG_TYPE_STRING:
+ snd_config_get_string(n, &str);
+ break;
+ case SND_CONFIG_TYPE_COMPOUND:
+ if (!force_restore || !doit)
+ return -1;
+ n = snd_config_iterator_entry(snd_config_iterator_first(n));
+ return config_enumerated(n, handle, info, doit);
+ default:
+ return -1;
+ }
+ items = snd_ctl_elem_info_get_items(info);
+ for (idx = 0; idx < items; idx++) {
+ int err;
+ snd_ctl_elem_info_set_item(info, idx);
+ err = snd_ctl_elem_info(handle, info);
+ if (err < 0) {
+ error("snd_ctl_elem_info: %s", snd_strerror(err));
+ return err;
+ }
+ if (strcmp(str, snd_ctl_elem_info_get_item_name(info)) == 0)
+ return idx;
+ }
+ return -1;
+}
+
+static int config_integer(snd_config_t *n, long *val, int doit)
+{
+ int err = snd_config_get_integer(n, val);
+ if (err < 0 && force_restore && doit) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ return err;
+ n = snd_config_iterator_entry(snd_config_iterator_first(n));
+ return config_integer(n, val, doit);
+ }
+ return err;
+}
+
+static int config_integer64(snd_config_t *n, long long *val, int doit)
+{
+ int err = snd_config_get_integer64(n, val);
+ if (err < 0 && force_restore && doit) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ return err;
+ n = snd_config_iterator_entry(snd_config_iterator_first(n));
+ return config_integer64(n, val, doit);
+ }
+ return err;
+}
+
+static int is_user_control(snd_config_t *conf)
+{
+ snd_config_iterator_t i, next;
+
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id, *s;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "access") == 0) {
+ if (snd_config_get_string(n, &s) < 0)
+ return 0;
+ if (strstr(s, "user"))
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/*
+ * get the item type from the given comment config
+ */
+static int get_comment_type(snd_config_t *n)
+{
+ static const snd_ctl_elem_type_t types[] = {
+ SND_CTL_ELEM_TYPE_BOOLEAN,
+ SND_CTL_ELEM_TYPE_INTEGER,
+ SND_CTL_ELEM_TYPE_ENUMERATED,
+ SND_CTL_ELEM_TYPE_BYTES,
+ SND_CTL_ELEM_TYPE_IEC958,
+ SND_CTL_ELEM_TYPE_INTEGER64,
+ };
+ const char *type;
+ unsigned int i;
+
+ if (snd_config_get_string(n, &type) < 0)
+ return -EINVAL;
+ for (i = 0; i < ARRAY_SIZE(types); ++i)
+ if (strcmp(type, snd_ctl_elem_type_name(types[i])) == 0)
+ return types[i];
+ return -EINVAL;
+}
+
+/*
+ * get the value range from the given comment config
+ */
+static int get_comment_range(snd_config_t *n, int ctype,
+ long *imin, long *imax, long *istep)
+{
+ const char *s;
+ int err;
+
+ if (snd_config_get_string(n, &s) < 0)
+ return -EINVAL;
+ switch (ctype) {
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ err = sscanf(s, "%li - %li (step %li)", imin, imax, istep);
+ if (err != 3) {
+ istep = 0;
+ err = sscanf(s, "%li - %li", imin, imax);
+ if (err != 2)
+ return -EINVAL;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int add_user_control(snd_ctl_t *handle, snd_ctl_elem_info_t *info, snd_config_t *conf)
+{
+ snd_ctl_elem_id_t *id;
+ snd_config_iterator_t i, next;
+ long imin, imax, istep;
+ snd_ctl_elem_type_t ctype;
+ unsigned int count;
+ int err;
+ unsigned int *tlv;
+
+ imin = imax = istep = 0;
+ count = 0;
+ ctype = SND_CTL_ELEM_TYPE_NONE;
+ tlv = NULL;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, "type") == 0) {
+ err = get_comment_type(n);
+ if (err < 0)
+ return err;
+ ctype = err;
+ continue;
+ }
+ if (strcmp(id, "range") == 0) {
+ err = get_comment_range(n, ctype, &imin, &imax, &istep);
+ if (err < 0)
+ return err;
+ continue;
+ }
+ if (strcmp(id, "count") == 0) {
+ long v;
+ if ((err = snd_config_get_integer(n, &v)) < 0)
+ return err;
+ count = v;
+ continue;
+ }
+ if (strcmp(id, "tlv") == 0) {
+ const char *s;
+ if ((err = snd_config_get_string(n, &s)) < 0)
+ return -EINVAL;
+ if (tlv)
+ free(tlv);
+ if ((tlv = str_to_tlv(s)) == NULL)
+ return -EINVAL;
+ continue;
+ }
+ }
+
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_get_id(info, id);
+ if (count <= 0)
+ count = 1;
+ switch (ctype) {
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ if (imin > imax || istep > imax - imin)
+ return -EINVAL;
+ err = snd_ctl_elem_add_integer(handle, id, count, imin, imax, istep);
+ if (err < 0)
+ goto error;
+ if (tlv)
+ snd_ctl_elem_tlv_write(handle, id, tlv);
+ break;
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ err = snd_ctl_elem_add_boolean(handle, id, count);
+ break;
+ case SND_CTL_ELEM_TYPE_IEC958:
+ err = snd_ctl_elem_add_iec958(handle, id);
+ break;
+ default:
+ err = -EINVAL;
+ break;
+ }
+
+ error:
+ free(tlv);
+ if (err < 0)
+ return err;
+ return snd_ctl_elem_info(handle, info);
+}
+
+/*
+ * look for a config node with the given item name
+ */
+static snd_config_t *search_comment_item(snd_config_t *conf, const char *name)
+{
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, conf) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ if (strcmp(id, name) == 0)
+ return n;
+ }
+ return NULL;
+}
+
+/*
+ * check whether the config item has the same of compatible type
+ */
+static int check_comment_type(snd_config_t *conf, int type)
+{
+ snd_config_t *n = search_comment_item(conf, "type");
+ int ctype;
+
+ if (!n)
+ return 0; /* not defined */
+ ctype = get_comment_type(n);
+ if (ctype == type)
+ return 0;
+ if ((ctype == SND_CTL_ELEM_TYPE_BOOLEAN ||
+ ctype == SND_CTL_ELEM_TYPE_INTEGER ||
+ ctype == SND_CTL_ELEM_TYPE_INTEGER64 ||
+ ctype == SND_CTL_ELEM_TYPE_ENUMERATED) &&
+ (type == SND_CTL_ELEM_TYPE_BOOLEAN ||
+ type == SND_CTL_ELEM_TYPE_INTEGER ||
+ type == SND_CTL_ELEM_TYPE_INTEGER64 ||
+ type == SND_CTL_ELEM_TYPE_ENUMERATED))
+ return 0; /* OK, compatible */
+ return -EINVAL;
+}
+
+/*
+ * convert from an old value to a new value with the same dB level
+ */
+static int convert_to_new_db(snd_config_t *value, long omin, long omax,
+ long nmin, long nmax,
+ long odbmin, long odbmax,
+ long ndbmin, long ndbmax,
+ int doit)
+{
+ long val;
+ if (config_integer(value, &val, doit) < 0)
+ return -EINVAL;
+ if (val < omin || val > omax)
+ return -EINVAL;
+ val = ((val - omin) * (odbmax - odbmin)) / (omax - omin) + odbmin;
+ if (val < ndbmin)
+ val = ndbmin;
+ else if (val > ndbmax)
+ val = ndbmax;
+ val = ((val - ndbmin) * (nmax - nmin)) / (ndbmax - ndbmin) + nmin;
+ return snd_config_set_integer(value, val);
+}
+
+/*
+ * compare the current value range with the old range in comments.
+ * also, if dB information is available, try to compare them.
+ * if any change occurs, try to keep the same dB level.
+ */
+static int check_comment_range(snd_ctl_t *handle, snd_config_t *conf,
+ snd_ctl_elem_info_t *info, snd_config_t *value,
+ int doit)
+{
+ snd_config_t *n;
+ long omin, omax, ostep;
+ long nmin, nmax;
+ long odbmin, odbmax;
+ long ndbmin, ndbmax;
+ snd_ctl_elem_id_t *id;
+
+ n = search_comment_item(conf, "range");
+ if (!n)
+ return 0;
+ if (get_comment_range(n, SND_CTL_ELEM_TYPE_INTEGER,
+ &omin, &omax, &ostep) < 0)
+ return 0;
+ nmin = snd_ctl_elem_info_get_min(info);
+ nmax = snd_ctl_elem_info_get_max(info);
+ if (omin != nmin && omax != nmax) {
+ /* Hey, the range mismatches */
+ if (!force_restore || !doit)
+ return -EINVAL;
+ }
+ if (omin >= omax || nmin >= nmax)
+ return 0; /* invalid values */
+
+ n = search_comment_item(conf, "dbmin");
+ if (!n)
+ return 0;
+ if (config_integer(n, &odbmin, doit) < 0)
+ return 0;
+ n = search_comment_item(conf, "dbmax");
+ if (!n)
+ return 0;
+ if (config_integer(n, &odbmax, doit) < 0)
+ return 0;
+ if (odbmin >= odbmax)
+ return 0; /* invalid values */
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_get_id(info, id);
+ if (snd_ctl_get_dB_range(handle, id, &ndbmin, &ndbmax) < 0)
+ return 0;
+ if (ndbmin >= ndbmax)
+ return 0; /* invalid values */
+ if (omin == nmin && omax == nmax &&
+ odbmin == ndbmin && odbmax == ndbmax)
+ return 0; /* OK, identical one */
+
+ /* Let's guess the current value from dB range */
+ if (snd_config_get_type(value) == SND_CONFIG_TYPE_COMPOUND) {
+ snd_config_iterator_t i, next;
+ snd_config_for_each(i, next, value) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ convert_to_new_db(n, omin, omax, nmin, nmax,
+ odbmin, odbmax, ndbmin, ndbmax, doit);
+ }
+ } else
+ convert_to_new_db(value, omin, omax, nmin, nmax,
+ odbmin, odbmax, ndbmin, ndbmax, doit);
+ return 0;
+}
+
+static int restore_config_value(snd_ctl_t *handle, snd_ctl_elem_info_t *info,
+ snd_ctl_elem_iface_t type,
+ snd_config_t *value,
+ snd_ctl_elem_value_t *ctl, int idx,
+ int doit)
+{
+ long val;
+ long long lval;
+ int err;
+
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ val = config_bool(value, doit);
+ if (val >= 0) {
+ snd_ctl_elem_value_set_boolean(ctl, idx, val);
+ return 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ err = config_integer(value, &val, doit);
+ if (err == 0) {
+ snd_ctl_elem_value_set_integer(ctl, idx, val);
+ return 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ err = config_integer64(value, &lval, doit);
+ if (err == 0) {
+ snd_ctl_elem_value_set_integer64(ctl, idx, lval);
+ return 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ val = config_enumerated(value, handle, info, doit);
+ if (val >= 0) {
+ snd_ctl_elem_value_set_enumerated(ctl, idx, val);
+ return 1;
+ }
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ break;
+ default:
+ cerror(doit, "Unknow control type: %d", type);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int restore_config_value2(snd_ctl_t *handle, snd_ctl_elem_info_t *info,
+ snd_ctl_elem_iface_t type,
+ snd_config_t *value,
+ snd_ctl_elem_value_t *ctl, int idx,
+ unsigned int numid, int doit)
+{
+ int err = restore_config_value(handle, info, type, value, ctl, idx, doit);
+ long val;
+
+ if (err != 0)
+ return err;
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ err = snd_config_get_integer(value, &val);
+ if (err < 0 || val < 0 || val > 255) {
+ cerror(doit, "bad control.%d.value.%d content", numid, idx);
+ return force_restore && doit ? 0 : -EINVAL;
+ }
+ snd_ctl_elem_value_set_byte(ctl, idx, val);
+ return 1;
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static int set_control(snd_ctl_t *handle, snd_config_t *control,
+ int *maxnumid, int doit)
+{
+ snd_ctl_elem_value_t *ctl;
+ snd_ctl_elem_info_t *info;
+ snd_config_iterator_t i, next;
+ unsigned int numid1;
+ snd_ctl_elem_iface_t iface = -1;
+ int iface1;
+ const char *name1;
+ unsigned int numid;
+ snd_ctl_elem_type_t type;
+ unsigned int count;
+ long device = -1;
+ long device1;
+ long subdevice = -1;
+ long subdevice1;
+ const char *name = NULL;
+ long index1;
+ long index = -1;
+ snd_config_t *value = NULL;
+ snd_config_t *comment = NULL;
+ unsigned int idx;
+ int err;
+ char *set;
+ const char *id;
+ snd_ctl_elem_value_alloca(&ctl);
+ snd_ctl_elem_info_alloca(&info);
+ if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) {
+ cerror(doit, "control is not a compound");
+ return -EINVAL;
+ }
+ err = snd_config_get_id(control, &id);
+ if (err < 0) {
+ cerror(doit, "unable to get id");
+ return -EINVAL;
+ }
+ numid = atoi(id);
+ if ((int)numid > *maxnumid)
+ *maxnumid = numid;
+ snd_config_for_each(i, next, control) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *fld;
+ if (snd_config_get_id(n, &fld) < 0)
+ continue;
+ if (strcmp(fld, "comment") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ cerror(doit, "control.%d.%s is invalid", numid, fld);
+ return -EINVAL;
+ }
+ comment = n;
+ continue;
+ }
+ if (strcmp(fld, "iface") == 0) {
+ iface = (snd_ctl_elem_iface_t)config_iface(n);
+ continue;
+ }
+ if (strcmp(fld, "device") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
+ cerror(doit, "control.%d.%s is invalid", numid, fld);
+ return -EINVAL;
+ }
+ snd_config_get_integer(n, &device);
+ continue;
+ }
+ if (strcmp(fld, "subdevice") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
+ cerror(doit, "control.%d.%s is invalid", numid, fld);
+ return -EINVAL;
+ }
+ snd_config_get_integer(n, &subdevice);
+ continue;
+ }
+ if (strcmp(fld, "name") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
+ cerror(doit, "control.%d.%s is invalid", numid, fld);
+ return -EINVAL;
+ }
+ snd_config_get_string(n, &name);
+ continue;
+ }
+ if (strcmp(fld, "index") == 0) {
+ if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
+ cerror(doit, "control.%d.%s is invalid", numid, fld);
+ return -EINVAL;
+ }
+ snd_config_get_integer(n, &index);
+ continue;
+ }
+ if (strcmp(fld, "value") == 0) {
+ value = n;
+ continue;
+ }
+ cerror(doit, "unknown control.%d.%s field", numid, fld);
+ }
+ if (!value) {
+ cerror(doit, "missing control.%d.value", numid);
+ return -EINVAL;
+ }
+ if (device < 0)
+ device = 0;
+ if (subdevice < 0)
+ subdevice = 0;
+ if (index < 0)
+ index = 0;
+
+ err = -EINVAL;
+ if (!force_restore) {
+ snd_ctl_elem_info_set_numid(info, numid);
+ err = snd_ctl_elem_info(handle, info);
+ }
+ if (err < 0 && name) {
+ snd_ctl_elem_info_set_numid(info, 0);
+ snd_ctl_elem_info_set_interface(info, iface);
+ snd_ctl_elem_info_set_device(info, device);
+ snd_ctl_elem_info_set_subdevice(info, subdevice);
+ snd_ctl_elem_info_set_name(info, name);
+ snd_ctl_elem_info_set_index(info, index);
+ err = snd_ctl_elem_info(handle, info);
+ if (err < 0 && comment && is_user_control(comment)) {
+ err = add_user_control(handle, info, comment);
+ if (err < 0) {
+ cerror(doit, "failed to add user control #%d (%s)",
+ numid, snd_strerror(err));
+ return err;
+ }
+ }
+ }
+ if (err < 0) {
+ cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err));
+ return -ENOENT;
+ }
+ numid1 = snd_ctl_elem_info_get_numid(info);
+ iface1 = snd_ctl_elem_info_get_interface(info);
+ device1 = snd_ctl_elem_info_get_device(info);
+ subdevice1 = snd_ctl_elem_info_get_subdevice(info);
+ name1 = snd_ctl_elem_info_get_name(info);
+ index1 = snd_ctl_elem_info_get_index(info);
+ count = snd_ctl_elem_info_get_count(info);
+ type = snd_ctl_elem_info_get_type(info);
+ if (err |= numid != numid1 && !force_restore)
+ cerror(doit, "warning: numid mismatch (%d/%d) for control #%d",
+ numid, numid1, numid);
+ if (err |= iface != iface1)
+ cerror(doit, "warning: iface mismatch (%d/%d) for control #%d", iface, iface1, numid);
+ if (err |= device != device1)
+ cerror(doit, "warning: device mismatch (%ld/%ld) for control #%d", device, device1, numid);
+ if (err |= subdevice != subdevice1)
+ cerror(doit, "warning: subdevice mismatch (%ld/%ld) for control #%d", subdevice, subdevice1, numid);
+ if (err |= strcmp(name, name1))
+ cerror(doit, "warning: name mismatch (%s/%s) for control #%d", name, name1, numid);
+ if (err |= index != index1)
+ cerror(doit, "warning: index mismatch (%ld/%ld) for control #%d", index, index1, numid);
+ if (err < 0) {
+ cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err));
+ return -ENOENT;
+ }
+
+ if (comment) {
+ if (check_comment_type(comment, type) < 0)
+ cerror(doit, "incompatible field type for control #%d", numid);
+ if (type == SND_CTL_ELEM_TYPE_INTEGER) {
+ if (check_comment_range(handle, comment, info, value, doit) < 0) {
+ cerror(doit, "value range mismatch for control #%d",
+ numid);
+ return -EINVAL;
+ }
+ }
+ }
+
+ if (snd_ctl_elem_info_is_inactive(info) ||
+ !snd_ctl_elem_info_is_writable(info))
+ return 0;
+ snd_ctl_elem_value_set_numid(ctl, numid1);
+
+ if (count == 1) {
+ err = restore_config_value(handle, info, type, value, ctl, 0, doit);
+ if (err < 0)
+ return err;
+ if (err > 0)
+ goto _ok;
+ }
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BYTES:
+ case SND_CTL_ELEM_TYPE_IEC958:
+ {
+ const char *buf;
+ err = snd_config_get_string(value, &buf);
+ if (err >= 0) {
+ int c1 = 0;
+ int len = strlen(buf);
+ unsigned int idx = 0;
+ int size = type == SND_CTL_ELEM_TYPE_BYTES ?
+ count : sizeof(snd_aes_iec958_t);
+ if (size * 2 != len) {
+ cerror(doit, "bad control.%d.value contents\n", numid);
+ return -EINVAL;
+ }
+ while (*buf) {
+ int c = *buf++;
+ if ((c = hextodigit(c)) < 0) {
+ cerror(doit, "bad control.%d.value contents\n", numid);
+ return -EINVAL;
+ }
+ if (idx % 2 == 1)
+ snd_ctl_elem_value_set_byte(ctl, idx / 2, c1 << 4 | c);
+ else
+ c1 = c;
+ idx++;
+ }
+ goto _ok;
+ }
+ }
+ default:
+ break;
+ }
+ if (snd_config_get_type(value) != SND_CONFIG_TYPE_COMPOUND) {
+ if (!force_restore || !doit) {
+ cerror(doit, "bad control.%d.value type", numid);
+ return -EINVAL;
+ }
+ for (idx = 0; idx < count; ++idx) {
+ err = restore_config_value2(handle, info, type, value,
+ ctl, idx, numid, doit);
+ if (err < 0)
+ return err;
+ }
+ goto _ok;
+ }
+
+ set = (char*) alloca(count);
+ memset(set, 0, count);
+ snd_config_for_each(i, next, value) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ const char *id;
+ if (snd_config_get_id(n, &id) < 0)
+ continue;
+ idx = atoi(id);
+ if (idx >= count || set[idx]) {
+ cerror(doit, "bad control.%d.value index", numid);
+ if (!force_restore || !doit)
+ return -EINVAL;
+ continue;
+ }
+ err = restore_config_value2(handle, info, type, n,
+ ctl, idx, numid, doit);
+ if (err < 0)
+ return err;
+ if (err > 0)
+ set[idx] = 1;
+ }
+ for (idx = 0; idx < count; ++idx) {
+ if (!set[idx]) {
+ cerror(doit, "control.%d.value.%d is not specified", numid, idx);
+ if (!force_restore || !doit)
+ return -EINVAL;
+ }
+ }
+
+ _ok:
+ err = doit ? snd_ctl_elem_write(handle, ctl) : 0;
+ if (err < 0) {
+ error("Cannot write control '%d:%ld:%ld:%s:%ld' : %s", (int)iface, device, subdevice, name, index, snd_strerror(err));
+ return err;
+ }
+ return 0;
+}
+
+static int set_controls(int card, snd_config_t *top, int doit)
+{
+ snd_ctl_t *handle;
+ snd_ctl_card_info_t *info;
+ snd_config_t *control;
+ snd_config_iterator_t i, next;
+ int err, maxnumid = -1;
+ char name[32], tmpid[16];
+ const char *id;
+ snd_ctl_card_info_alloca(&info);
+
+ sprintf(name, "hw:%d", card);
+ err = snd_ctl_open(&handle, name, 0);
+ if (err < 0) {
+ error("snd_ctl_open error: %s", snd_strerror(err));
+ return err;
+ }
+ err = snd_ctl_card_info(handle, info);
+ if (err < 0) {
+ error("snd_ctl_card_info error: %s", snd_strerror(err));
+ goto _close;
+ }
+ id = snd_ctl_card_info_get_id(info);
+ err = snd_config_searchv(top, &control, "state", id, "control", 0);
+ if (err < 0) {
+ if (force_restore) {
+ sprintf(tmpid, "card%d", card);
+ err = snd_config_searchv(top, &control, "state", tmpid, "control", 0);
+ if (! err)
+ id = tmpid;
+ }
+ if (err < 0) {
+ fprintf(stderr, "No state is present for card %s\n", id);
+ goto _close;
+ }
+ id = tmpid;
+ }
+ if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) {
+ cerror(doit, "state.%s.control is not a compound\n", id);
+ return -EINVAL;
+ }
+ snd_config_for_each(i, next, control) {
+ snd_config_t *n = snd_config_iterator_entry(i);
+ err = set_control(handle, n, &maxnumid, doit);
+ if (err < 0 && (!force_restore || !doit))
+ goto _close;
+ }
+
+ /* check if we have additional controls in driver */
+ /* in this case we should go through init procedure */
+ if (!doit && maxnumid >= 0) {
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_info_set_numid(info, maxnumid+1);
+ if (snd_ctl_elem_info(handle, info) == 0) {
+ /* not very informative */
+ /* but value is used for check only */
+ err = -EAGAIN;
+ goto _close;
+ }
+ }
+
+ _close:
+ snd_ctl_close(handle);
+ return err;
+}
+
+int save_state(const char *file, const char *cardname)
+{
+ int err;
+ snd_config_t *config;
+ snd_input_t *in;
+ snd_output_t *out;
+ int stdio;
+
+ err = snd_config_top(&config);
+ if (err < 0) {
+ error("snd_config_top error: %s", snd_strerror(err));
+ return err;
+ }
+ stdio = !strcmp(file, "-");
+ if (!stdio && (err = snd_input_stdio_open(&in, file, "r")) >= 0) {
+ err = snd_config_load(config, in);
+ snd_input_close(in);
+#if 0
+ if (err < 0) {
+ error("snd_config_load error: %s", snd_strerror(err));
+ return err;
+ }
+#endif
+ }
+
+ if (!cardname) {
+ int card, first = 1;
+
+ card = -1;
+ /* find each installed soundcards */
+ while (1) {
+ if (snd_card_next(&card) < 0)
+ break;
+ if (card < 0) {
+ if (first) {
+ if (ignore_nocards) {
+ return 0;
+ } else {
+ error("No soundcards found...");
+ return -ENODEV;
+ }
+ }
+ break;
+ }
+ first = 0;
+ if ((err = get_controls(card, config)))
+ return err;
+ }
+ } else {
+ int cardno;
+
+ cardno = snd_card_get_index(cardname);
+ if (cardno < 0) {
+ error("Cannot find soundcard '%s'...", cardname);
+ return cardno;
+ }
+ if ((err = get_controls(cardno, config))) {
+ return err;
+ }
+ }
+
+ if (stdio)
+ err = snd_output_stdio_attach(&out, stdout, 0);
+ else
+ err = snd_output_stdio_open(&out, file, "w");
+ if (err < 0) {
+ error("Cannot open %s for writing: %s", file, snd_strerror(err));
+ return -errno;
+ }
+ err = snd_config_save(config, out);
+ snd_output_close(out);
+ if (err < 0)
+ error("snd_config_save: %s", snd_strerror(err));
+ return 0;
+}
+
+int load_state(const char *file, const char *initfile, const char *cardname,
+ int do_init)
+{
+ int err, finalerr = 0;
+ snd_config_t *config;
+ snd_input_t *in;
+ int stdio;
+
+ err = snd_config_top(&config);
+ if (err < 0) {
+ error("snd_config_top error: %s", snd_strerror(err));
+ return err;
+ }
+ stdio = !strcmp(file, "-");
+ if (stdio)
+ err = snd_input_stdio_attach(&in, stdin, 0);
+ else
+ err = snd_input_stdio_open(&in, file, "r");
+ if (err >= 0) {
+ err = snd_config_load(config, in);
+ snd_input_close(in);
+ if (err < 0) {
+ error("snd_config_load error: %s", snd_strerror(err));
+ return err;
+ }
+ } else {
+ int card, first = 1;
+ char cardname1[16];
+
+ error("Cannot open %s for reading: %s", file, snd_strerror(err));
+ finalerr = err;
+ card = -1;
+ /* find each installed soundcards */
+ while (1) {
+ if (snd_card_next(&card) < 0)
+ break;
+ if (card < 0)
+ break;
+ first = 0;
+ if (!do_init)
+ break;
+ sprintf(cardname1, "%i", card);
+ err = init(initfile, cardname1);
+ if (err < 0) {
+ finalerr = err;
+ initfailed(card, "init");
+ }
+ initfailed(card, "restore");
+ }
+ if (first)
+ finalerr = 0; /* no cards, no error code */
+ return finalerr;
+ }
+
+ if (!cardname) {
+ int card, first = 1;
+ char cardname1[16];
+
+ card = -1;
+ /* find each installed soundcards */
+ while (1) {
+ if (snd_card_next(&card) < 0)
+ break;
+ if (card < 0) {
+ if (first) {
+ if (ignore_nocards) {
+ return 0;
+ } else {
+ error("No soundcards found...");
+ return -ENODEV;
+ }
+ }
+ break;
+ }
+ first = 0;
+ /* do a check if controls matches state file */
+ if (do_init && set_controls(card, config, 0)) {
+ sprintf(cardname1, "%i", card);
+ err = init(initfile, cardname1);
+ if (err < 0) {
+ initfailed(card, "init");
+ finalerr = err;
+ }
+ }
+ if ((err = set_controls(card, config, 1))) {
+ if (!force_restore)
+ finalerr = err;
+ initfailed(card, "restore");
+ }
+ }
+ } else {
+ int cardno;
+
+ cardno = snd_card_get_index(cardname);
+ if (cardno < 0) {
+ error("Cannot find soundcard '%s'...", cardname);
+ return -ENODEV;
+ }
+ /* do a check if controls matches state file */
+ if (do_init && set_controls(cardno, config, 0)) {
+ err = init(initfile, cardname);
+ if (err < 0) {
+ initfailed(cardno, "init");
+ return err;
+ }
+ }
+ if ((err = set_controls(cardno, config, 1))) {
+ initfailed(cardno, "restore");
+ if (!force_restore)
+ return err;
+ }
+ }
+ return finalerr;
+}
diff --git a/alsa-utils/alsactl/utils.c b/alsa-utils/alsactl/utils.c
new file mode 100644
index 0000000..ab4dbd4
--- /dev/null
+++ b/alsa-utils/alsactl/utils.c
@@ -0,0 +1,98 @@
+/*
+ * Advanced Linux Sound Architecture Control Program - Support routines
+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include <alsa/asoundlib.h>
+#include "alsactl.h"
+
+int file_map(const char *filename, char **buf, size_t *bufsize)
+{
+ struct stat stats;
+ int fd;
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ return -1;
+ }
+
+ if (fstat(fd, &stats) < 0) {
+ close(fd);
+ return -1;
+ }
+
+ *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ if (*buf == MAP_FAILED) {
+ close(fd);
+ return -1;
+ }
+ *bufsize = stats.st_size;
+
+ close(fd);
+
+ return 0;
+}
+
+void file_unmap(void *buf, size_t bufsize)
+{
+ munmap(buf, bufsize);
+}
+
+size_t line_width(const char *buf, size_t bufsize, size_t pos)
+{
+ int esc = 0;
+ size_t count;
+
+ for (count = pos; count < bufsize; count++) {
+ if (!esc && buf[count] == '\n')
+ break;
+ esc = buf[count] == '\\';
+ }
+
+ return count - pos;
+}
+
+void initfailed(int cardnumber, const char *reason)
+{
+ int fp;
+ char *str;
+
+ if (statefile == NULL)
+ return;
+ if (snd_card_get_name(cardnumber, &str) < 0)
+ return;
+ fp = open(statefile, O_WRONLY|O_CREAT|O_APPEND, 0644);
+ write(fp, str, strlen(str));
+ write(fp, ":", 1);
+ write(fp, reason, strlen(reason));
+ write(fp, "\n", 1);
+ close(fp);
+ free(str);
+}
diff --git a/alsa-utils/alsamixer/Makefile.am b/alsa-utils/alsamixer/Makefile.am
new file mode 100644
index 0000000..6426193
--- /dev/null
+++ b/alsa-utils/alsamixer/Makefile.am
@@ -0,0 +1,10 @@
+AM_CFLAGS = @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
+LDADD = @CURSESLIB@
+
+bin_PROGRAMS = alsamixer
+man_MANS = alsamixer.1
+EXTRA_DIST = alsamixer.1
+alsamixer_INCLUDES = -I$(top_srcdir)/include
+
+#LDFLAGS = -static
+#CFLAGS += -g -Wall
diff --git a/alsa-utils/alsamixer/Makefile.in b/alsa-utils/alsamixer/Makefile.in
new file mode 100644
index 0000000..1332bff
--- /dev/null
+++ b/alsa-utils/alsamixer/Makefile.in
@@ -0,0 +1,504 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = alsamixer$(EXEEXT)
+subdir = alsamixer
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+alsamixer_SOURCES = alsamixer.c
+alsamixer_OBJECTS = alsamixer.$(OBJEXT)
+alsamixer_LDADD = $(LDADD)
+alsamixer_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = alsamixer.c
+DIST_SOURCES = alsamixer.c
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+AM_CFLAGS = @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
+LDADD = @CURSESLIB@
+man_MANS = alsamixer.1
+EXTRA_DIST = alsamixer.1
+alsamixer_INCLUDES = -I$(top_srcdir)/include
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign alsamixer/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign alsamixer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+alsamixer$(EXEEXT): $(alsamixer_OBJECTS) $(alsamixer_DEPENDENCIES)
+ @rm -f alsamixer$(EXEEXT)
+ $(LINK) $(alsamixer_LDFLAGS) $(alsamixer_OBJECTS) $(alsamixer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsamixer.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+
+#LDFLAGS = -static
+#CFLAGS += -g -Wall
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/alsamixer/README b/alsa-utils/alsamixer/README
new file mode 100644
index 0000000..05c6615
--- /dev/null
+++ b/alsa-utils/alsamixer/README
@@ -0,0 +1,84 @@
+Using Alsamixer
+===============
+
+Alsamixer uses an ncurses interface, which may not display properly in
+an xterm.
+
+Start it by typing "alsamixer".
+
+Optional flags:
+alsamixer -h displays the available flags.
+alsamixer -e starts in "exact" mode. See below...
+alsamixer -c N selects the soundcard to control, where N is the number of
+the card, counting from 1.
+alsamixer -m selects which mixer device to control, counting from 0. This
+is only applicable to soundcards that have more than one mixer to
+control. It is the same as the amixer -d flag.
+
+
+Keyboard commands:
+==================
+
+Left & right arrow keys are used to select the channel (or device,
+depending on your preferred terminology). You can also use n (next)
+and p (previous).
+
+Up/down arrows control the volume for the currently selected device.
+Both the left & right signals are controlled.
+You can also use "+" or "-" to turn volumes up or down.
+
+"M" toggles muting for the current channel (both left and right). You can
+mute left and right independently by using , and . respectively.
+
+SPACE toggles recording: the current channel will be added or removed from
+the sources used for recording. This only works on valid input channels,
+of course.
+
+"L" re-draws the screen.
+
+TAB does something interesting: it toggles the mode for volume display.
+This affects the numbers you see, but not the operation of the level
+controls. There seem to be two modes: one is percentages from 0-100, the
+other is called "exact mode" and varies from channel to channel. This
+shows you the settings as the soundcard understands them. All the channel
+level ranges are from 0 to a power of 2 minus one (e.g. 0-31 or 0-63).
+
+Quick Volume Changes
+--------------------
+
+PageUp increases volume by 10.
+PageDown decreases volume by 10.
+Home sets volume to 100.
+End sets volume to 0.
+
+You can also control left & right levels for the current channel
+independently,
+according to this chart:
+
+Q | W | E <-- UP
+-------------
+Z | X | C <---DOWN
+
+^ ^ ^
+| | +-- Right
+| |
+| +--- Both
+|
+Left
+
+
+If the current mixer channel is not a stereo channel, then all UP keys
+will work like W, and all DOWN keys will work like X.
+
+
+Exiting
+=======
+
+You can exit with ALT + Q, or by hitting ESC.
+
+
+-----------------------------------------------------------------
+
+Alsamixer has been written by Tim Janik <timj@gtk.org> and
+been furtherly improved by Jaroslav Kysela <perex@perex.cz>.
+This document was provided by Paul Winkler <zarmzarm@erols.com>.
diff --git a/alsa-utils/alsamixer/alsamixer.1 b/alsa-utils/alsamixer/alsamixer.1
new file mode 100644
index 0000000..47d8aed
--- /dev/null
+++ b/alsa-utils/alsamixer/alsamixer.1
@@ -0,0 +1,174 @@
+.TH ALSAMIXER 1 "15 May 2001"
+.SH NAME
+alsamixer \- soundcard mixer for ALSA soundcard driver, with ncurses interface
+.SH SYNOPSIS
+
+\fBalsamixer\fP [\fIoptions\fP]
+
+.SH DESCRIPTION
+\fBalsamixer\fP is an ncurses mixer program for use with the ALSA
+soundcard drivers. It supports multiple soundcards with multiple devices.
+
+.SH OPTIONS
+
+.TP
+\fI\-h, \-help\fP
+Help: show available flags.
+
+.TP
+\fI\-c\fP <card number or identification>
+Select the soundcard to use, if you have more than one. Cards are
+numbered from 0 (the default).
+
+.TP
+\fI\-D\fP <device identification>
+Select the mixer device to control.
+
+.TP
+\fI\-g\fP
+Toggle the using of colors.
+
+.TP
+\fI\-s\fP
+Minimize the mixer window.
+
+.TP
+\fI\-V\fP <view mode>
+Select the starting view mode, either \fIplayback\fP, \fIcapture\fP or \fIall\fP.
+
+.SH MIXER VIEWS
+
+The top-left corner of \fBalsamixer\fP is the are to show some basic
+information: the card name, the mixer chip name, the current view
+mode and the currently selected mixer item.
+When the mixer item is switched off, \fI[Off]\fP is displayed in its
+name.
+
+Volume bars are located below the basic information area. You can
+scroll left/right when all controls can't be put in a single screen.
+The name of each control is shown in the bottom below the volume bars.
+The currently selected item is drawn in red and/of emphasized.
+
+Each mixer control with volume capability shows a box and the current
+volume filled in that box. The volume percentages are displayed below
+the volume bar for left and right channels. For a mono control, only
+one value is shown there.
+
+When a mixer control is turned off, \fIM\fP (mute) appears below the
+volume bar. When it's turned on, \fIO\fP in green appears instead.
+You can toggle the switch via \fIm\fP key.
+
+When a mixer control has capture capability, the capture flag appears
+below the volume bar, too. When the capture is turned off,
+\-\-\-\-\-\- is shown. \fICAPTUR\fP in red appears when the
+capture switch is turned on. In addition, \fIL\fP and \fIR\fP letters
+appear in left and right side to indicate that left and the right
+channels are turned on.
+
+Some controls have the enumeration list, and don't show boxes but only
+texts which indicate the currently active item. You can change the
+item via up/down keys.
+
+.SH VIEW MODES
+\fBalsamixer\fP has three view modes: playback, capture and all.
+In the playback view, only the controls related with playback are shown.
+Similarly, only the controls for capture (recording) are shown in the capture
+view. The all view mode shows all controls. The current view mode is displayed
+in the top-left position together with the mixer name, etc.
+
+The default view mode is the playback view. You can change it via
+\fI-V\fP option.
+
+Each view mode can be switched via keyboard commands, too.
+See the next section.
+
+.SH KEYBOARD COMMANDS
+\fBalsamixer\fP recognizes the following keyboard commands to control the soundcard.
+Commands shown here in upper case can also be given in lower case.
+To be reminded of these keystrokes, hit the \fIh\fP key.
+
+.SS
+General Controls
+
+The \fILeft\fP and \fIright arrow\fP keys are used to select the
+channel (or device, depending on your preferred terminology). You can
+also use \fIn\fP ("next") and \fIp\fP ("previous").
+
+The \fIUp\fP and \fIDown Arrows\fP control the volume for the
+currently selected device. You can also use \fI+\fP or \fI\-\fP for the
+same purpose. Both the left and right signals are affected. For
+independent left and right control, see below.
+
+The \fIB\fP or \fI=\fP key adjusts the balance of volumes on left and
+right channels.
+
+\fIM\fP toggles muting for the current channel (both left and right).
+If the hardware supports it, you can
+mute left and right independently by using \fI,\fP (or \fI<\fP) and
+\fI.\fP (or \fI>\fP) respectively.
+
+\fISPACE\fP enables recording for the current channel. If any other
+channels have recording enabled, they will have their recording function
+disabled first. This only works for valid input channels, of course.
+
+\fIL\fP re-draws the screen.
+
+.SS
+View Mode Controls
+Function keys are used to change view modes.
+You can switch to the help mode and the proc info mode via \fIF1\fP and
+\fIF2\fP keys, respectively.
+On terminals that can't use function keys like gnome\-terminal, \fI?\fP and
+\fI/\fP keys can be used alternatively for help and proc modes.
+
+\fIF3\fP, \fIF4\fP and \fIF5\fP keys are used to switch to playback, capture
+and all view mode, respectively. \fITAB\fP key toggles the
+current view mode circularly.
+
+.SS
+Quick Volume Changes
+
+\fIPageUp\fP increases volume by 5.
+
+\fIPageDown\fP decreases volume by 5.
+
+\fIEnd\fP sets volume to 0.
+
+You can also control left & right levels for the current channel
+independently, as follows:
+
+[\fIQ\fP | \fIW\fP | \fIE\fP ] -- turn UP [ left | both | right ]
+
+[\fIZ\fP | \fIX\fP | \fIC\fP ] -- turn DOWN [ left | both | right ]
+
+If the currently selected mixer channel is not a stereo channel, then
+all UP keys will work like \fIW\fP, and all DOWN keys will work like \fIX\fP.
+
+The number keys from \fI0\fP to \fI9\fP are to change the absolute volume
+quickly. They correspond to 0 to 90% volume.
+
+.SS
+Exiting
+
+Quit the program with \fIALT Q\fP, or by hitting \fIESC\fP.
+Please note that you might need to hit \fIESC\fP twice on some terminals
+since it's regarded as a prefix key.
+
+.SH SEE ALSO
+\fB
+amixer(1),
+aplay(1),
+arecord(1)
+\fP
+
+.SH BUGS
+Some terminal emulators (e.g. \fBnxterm\fP) may not
+work quite right with ncurses, but that's their own damn
+fault. Plain old \fBxterm\fP seems to be fine.
+
+.SH AUTHOR
+.B alsamixer
+has been written by Tim Janik <timj@gtk.org> and
+been further improved by Jaroslav Kysela <perex@perex.cz>.
+
+This manual page was provided by Paul Winkler <zarmzarm@erols.com>.
diff --git a/alsa-utils/alsamixer/alsamixer.c b/alsa-utils/alsamixer/alsamixer.c
new file mode 100644
index 0000000..414033e
--- /dev/null
+++ b/alsa-utils/alsamixer/alsamixer.c
@@ -0,0 +1,2408 @@
+/* AlsaMixer - Commandline mixer for the ALSA project Copyright (C) 1998,
+ * 1999 Tim Janik <timj@gtk.org> and Jaroslav Kysela <perex@perex.cz>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * ChangeLog:
+ *
+ * Wed Feb 14 13:08:17 CET 2001 Jaroslav Kysela <perex@perex.cz>
+ *
+ * * ported to the latest mixer 0.9.x API (function based)
+ *
+ * Fri Jun 23 14:10:00 MEST 2000 Jaroslav Kysela <perex@perex.cz>
+ *
+ * * ported to new mixer 0.9.x API (simple control)
+ * * improved error handling (mixer_abort)
+ *
+ * Thu Mar 9 22:54:16 MET 2000 Takashi iwai <iwai@ww.uni-erlangen.de>
+ *
+ * * a group is split into front, rear, center and woofer elements.
+ *
+ * Mon Jan 3 23:33:42 MET 2000 Jaroslav Kysela <perex@perex.cz>
+ *
+ * * version 1.00
+ *
+ * * ported to new mixer API (scontrol control)
+ *
+ * Sun Feb 21 19:55:01 1999 Tim Janik <timj@gtk.org>
+ *
+ * * bumped version to 0.10.
+ *
+ * * added scrollable text views.
+ * we now feature an F1 Help screen and an F2 /proc info screen.
+ * the help screen does still require lots of work though.
+ *
+ * * keys are evaluated view specific now.
+ *
+ * * we feature meta-keys now, e.g. M-Tab as back-tab.
+ *
+ * * if we are already in channel view and the user still hits Return,
+ * we do a refresh nonetheless, since 'r'/'R' got removed as a redraw
+ * key (reserved for capture volumes). 'l'/'L' is still preserved though,
+ * and actually needs to be to e.g. get around the xterm bold-artefacts.
+ *
+ * * support terminals that can't write into lower right corner.
+ *
+ * * undocumented '-s' option that will keep the screen to its
+ * minimum size, usefull for debugging only.
+ *
+ * Sun Feb 21 02:23:52 1999 Tim Janik <timj@gtk.org>
+ *
+ * * don't abort if snd_mixer_* functions failed due to EINTR,
+ * we simply retry on the next cycle. hopefully asoundlib preserves
+ * errno states correctly (Jaroslav can you asure that?).
+ *
+ * * feature WINCH correctly, so we make a complete relayout on
+ * screen resizes. don't abort on too-small screen sizes anymore,
+ * but simply beep.
+ *
+ * * redid the layout algorithm to fix some bugs and to preserve
+ * space for a flag indication line. the channels are
+ * nicer spread horizontally now (i.e. we also pad on the left and
+ * right screen bounds now).
+ *
+ * * various other minor fixes.
+ *
+ * * indicate whether ExactMode is active or not.
+ *
+ * * fixed coding style to follow the GNU coding conventions.
+ *
+ * * reverted capture volume changes since they broke ExactMode display.
+ *
+ * * composed ChangeLog entries.
+ *
+ * 1998/11/04 19:43:45 perex
+ *
+ * * Stereo capture source and route selection...
+ * provided by Carl van Schaik <carl@dreamcoat.che.uct.ac.za>.
+ *
+ * 1998/09/20 08:05:24 perex
+ *
+ * * Fixed -m option...
+ *
+ * 1998/10/29 22:50:10
+ *
+ * * initial checkin of alsamixer.c, written by Tim Janik, modified by
+ * Jaroslav Kysela to feature asoundlib.h instead of plain ioctl()s and
+ * automated updates after select() (i always missed that with OSS!).
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <errno.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/signal.h>
+#include <sys/time.h>
+
+#include <locale.h>
+
+#ifndef CURSESINC
+#include <ncurses.h>
+#else
+#include CURSESINC
+#endif
+#include <time.h>
+
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+
+/* example compilation commandline:
+ * clear; gcc -Wall -pipe -O2 alsamixer.c -o alsamixer -lasound -lncurses
+ */
+
+/* --- defines --- */
+#define PRGNAME "alsamixer"
+#define PRGNAME_UPPER "AlsaMixer"
+#define CHECK_ABORT(e,s,n) ({ if ((n) != -EINTR) mixer_abort ((e), (s), (n)); })
+#define GETCH_BLOCK(w) ({ timeout ((w) ? -1 : 0); })
+
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#undef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#undef ABS
+#define ABS(a) (((a) < 0) ? -(a) : (a))
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+#define MIXER_MIN_X (18) /* abs minimum: 18 */
+#define MIXER_TEXT_Y (10)
+#define MIXER_CBAR_STD_HGT (10)
+#define MIXER_MIN_Y (MIXER_TEXT_Y + 6) /* abs minimum: 16 */
+
+#define MIXER_BLACK (COLOR_BLACK)
+#define MIXER_DARK_RED (COLOR_RED)
+#define MIXER_RED (COLOR_RED | A_BOLD)
+#define MIXER_GREEN (COLOR_GREEN | A_BOLD)
+#define MIXER_ORANGE (COLOR_YELLOW)
+#define MIXER_YELLOW (COLOR_YELLOW | A_BOLD)
+#define MIXER_MARIN (COLOR_BLUE)
+#define MIXER_BLUE (COLOR_BLUE | A_BOLD)
+#define MIXER_MAGENTA (COLOR_MAGENTA)
+#define MIXER_DARK_CYAN (COLOR_CYAN)
+#define MIXER_CYAN (COLOR_CYAN | A_BOLD)
+#define MIXER_GREY (COLOR_WHITE)
+#define MIXER_GRAY (MIXER_GREY)
+#define MIXER_WHITE (COLOR_WHITE | A_BOLD)
+
+
+/* --- views --- */
+enum {
+ VIEW_CHANNELS,
+ VIEW_PLAYBACK,
+ VIEW_CAPTURE,
+ VIEW_HELP,
+ VIEW_PROCINFO
+};
+
+
+/* --- variables --- */
+static WINDOW *mixer_window = NULL;
+static int mixer_needs_resize = 0;
+static int mixer_minimize = 0;
+static int mixer_no_lrcorner = 0;
+static int mixer_view = VIEW_PLAYBACK;
+static int mixer_view_saved = VIEW_PLAYBACK;
+static int mixer_max_x = 0;
+static int mixer_max_y = 0;
+static int mixer_ofs_x = 0;
+static float mixer_extra_space = 0;
+static int mixer_cbar_height = 0;
+static int mixer_text_y = MIXER_TEXT_Y;
+
+static char card_id[64] = "default";
+static snd_mixer_t *mixer_handle;
+static char mixer_card_name[128];
+static char mixer_device_name[128];
+static int mixer_level = 0;
+static struct snd_mixer_selem_regopt mixer_options;
+
+/* mixer bar channel : left or right */
+#define MIXER_CHN_LEFT 0
+#define MIXER_CHN_RIGHT 1
+/* mask for toggle mute and capture */
+#define MIXER_MASK_LEFT (1 << 0)
+#define MIXER_MASK_RIGHT (1 << 1)
+#define MIXER_MASK_STEREO (MIXER_MASK_LEFT|MIXER_MASK_RIGHT)
+
+/* mixer split types */
+enum {
+ MIXER_ELEM_FRONT, MIXER_ELEM_REAR,
+ MIXER_ELEM_CENTER, MIXER_ELEM_WOOFER,
+ MIXER_ELEM_SIDE,
+ MIXER_ELEM_CAPTURE,
+ MIXER_ELEM_ENUM, MIXER_ELEM_CAPTURE_ENUM,
+ MIXER_ELEM_END
+};
+
+#define MIXER_ELEM_TYPE_MASK 0xff
+#define MIXER_ELEM_CAPTURE_SWITCH 0x100 /* bit */
+#define MIXER_ELEM_MUTE_SWITCH 0x200 /* bit */
+#define MIXER_ELEM_CAPTURE_SUFFIX 0x400
+#define MIXER_ELEM_HAS_VOLUME 0x800
+
+/* left and right channels for each type */
+static const snd_mixer_selem_channel_id_t mixer_elem_chn[][2] = {
+ { SND_MIXER_SCHN_FRONT_LEFT, SND_MIXER_SCHN_FRONT_RIGHT },
+ { SND_MIXER_SCHN_REAR_LEFT, SND_MIXER_SCHN_REAR_RIGHT },
+ { SND_MIXER_SCHN_FRONT_CENTER, SND_MIXER_SCHN_UNKNOWN },
+ { SND_MIXER_SCHN_WOOFER, SND_MIXER_SCHN_UNKNOWN },
+ { SND_MIXER_SCHN_SIDE_LEFT, SND_MIXER_SCHN_SIDE_RIGHT },
+ { SND_MIXER_SCHN_FRONT_LEFT, SND_MIXER_SCHN_FRONT_RIGHT },
+};
+
+static void *mixer_sid = NULL;
+static int mixer_n_selems = 0;
+static int mixer_changed_state = 1;
+
+/* split scontrols */
+static int mixer_n_elems = 0;
+static int mixer_n_view_elems = 0;
+static int mixer_n_vis_elems = 0;
+static int mixer_first_vis_elem = 0;
+static int mixer_focus_elem = 0;
+static int mixer_have_old_focus = 0;
+static int *mixer_grpidx;
+static int *mixer_type;
+
+static int mixer_volume_delta[2]; /* left/right volume delta in % */
+static int mixer_volume_absolute = -1; /* absolute volume settings in % */
+static int mixer_balance_volumes = 0; /* boolean */
+static unsigned mixer_toggle_mute = 0; /* left/right mask */
+static unsigned mixer_toggle_capture = 0; /* left/right mask */
+
+static int mixer_hscroll_delta = 0;
+static int mixer_vscroll_delta = 0;
+
+
+/* --- text --- */
+static int mixer_procinfo_xoffs = 0;
+static int mixer_procinfo_yoffs = 0;
+static int mixer_help_xoffs = 0;
+static int mixer_help_yoffs = 0;
+static char *mixer_help_text =
+(
+ " Esc exit alsamixer\n"
+ " F1 ? show Help screen\n"
+ " F2 / show /proc info screen\n"
+ " F3 show Playback controls only\n"
+ " F4 show Capture controls only\n"
+ " F5 show all controls\n"
+ " Tab toggle view mode\n"
+ " Return return to main screen\n"
+ " Space toggle Capture facility\n"
+ " m M toggle mute on both channels\n"
+ " < > toggle mute on left/right channel\n"
+ " Up increase left and right volume\n"
+ " Down decrease left and right volume\n"
+ " Right move (scroll) to the right next channel\n"
+ " Left move (scroll) to the left next channel\n"
+ "\n"
+ "Alsamixer has been written and is Copyrighted in 1998, 1999 by\n"
+ "Tim Janik <timj@gtk.org> and Jaroslav Kysela <perex@perex.cz>.\n"
+ );
+
+
+/* --- draw contexts --- */
+enum {
+ DC_DEFAULT,
+ DC_BACK,
+ DC_TEXT,
+ DC_PROMPT,
+ DC_CBAR_FRAME,
+ DC_CBAR_MUTE,
+ DC_CBAR_NOMUTE,
+ DC_CBAR_CAPTURE,
+ DC_CBAR_NOCAPTURE,
+ DC_CBAR_EMPTY,
+ DC_CBAR_LABEL,
+ DC_CBAR_FOCUS_LABEL,
+ DC_FOCUS,
+ DC_ANY_1,
+ DC_ANY_2,
+ DC_ANY_3,
+ DC_ANY_4,
+ DC_LAST
+};
+
+static int dc_fg[DC_LAST] = { 0 };
+static int dc_attrib[DC_LAST] = { 0 };
+static int dc_char[DC_LAST] = { 0 };
+static int mixer_do_color = 1;
+
+static void
+mixer_init_dc (int c,
+ int n,
+ int f,
+ int b,
+ int a)
+{
+ dc_fg[n] = f;
+ dc_attrib[n] = a;
+ dc_char[n] = c;
+ if (n > 0)
+ init_pair (n, dc_fg[n] & 0xf, b & 0x0f);
+}
+
+static int
+mixer_dc (int n)
+{
+ if (mixer_do_color)
+ attrset (COLOR_PAIR (n) | (dc_fg[n] & 0xfffffff0));
+ else
+ attrset (dc_attrib[n]);
+
+ return dc_char[n];
+}
+
+static void
+mixer_init_draw_contexts (void)
+{
+ start_color ();
+
+ mixer_init_dc ('.', DC_BACK, MIXER_WHITE, MIXER_BLACK, A_NORMAL);
+ mixer_init_dc ('.', DC_TEXT, MIXER_YELLOW, MIXER_BLACK, A_BOLD);
+ mixer_init_dc ('.', DC_PROMPT, MIXER_DARK_CYAN, MIXER_BLACK, A_NORMAL);
+ mixer_init_dc ('.', DC_CBAR_FRAME, MIXER_CYAN, MIXER_BLACK, A_BOLD);
+ mixer_init_dc ('M', DC_CBAR_MUTE, MIXER_DARK_CYAN, MIXER_BLACK, A_NORMAL);
+ mixer_init_dc ('O', DC_CBAR_NOMUTE, MIXER_WHITE, MIXER_GREEN, A_BOLD);
+ mixer_init_dc ('x', DC_CBAR_CAPTURE, MIXER_DARK_RED, MIXER_BLACK, A_BOLD);
+ mixer_init_dc ('-', DC_CBAR_NOCAPTURE, MIXER_GRAY, MIXER_BLACK, A_NORMAL);
+ mixer_init_dc (' ', DC_CBAR_EMPTY, MIXER_GRAY, MIXER_BLACK, A_DIM);
+ mixer_init_dc ('.', DC_CBAR_LABEL, MIXER_WHITE, MIXER_BLUE, A_REVERSE | A_BOLD);
+ mixer_init_dc ('.', DC_CBAR_FOCUS_LABEL, MIXER_RED, MIXER_BLUE, A_REVERSE | A_BOLD);
+ mixer_init_dc ('.', DC_FOCUS, MIXER_RED, MIXER_BLACK, A_BOLD);
+ mixer_init_dc (ACS_CKBOARD, DC_ANY_1, MIXER_WHITE, MIXER_WHITE, A_BOLD);
+ mixer_init_dc (ACS_CKBOARD, DC_ANY_2, MIXER_GREEN, MIXER_GREEN, A_BOLD);
+ mixer_init_dc (ACS_CKBOARD, DC_ANY_3, MIXER_RED, MIXER_RED, A_BOLD);
+ mixer_init_dc ('.', DC_ANY_4, MIXER_WHITE, MIXER_BLUE, A_BOLD);
+}
+
+#define DC_FRAME (DC_PROMPT)
+
+
+/* --- error types --- */
+typedef enum
+{
+ ERR_NONE,
+ ERR_OPEN,
+ ERR_FCN,
+ ERR_SIGNAL,
+ ERR_WINSIZE,
+} ErrType;
+
+
+/* --- prototypes --- */
+static void
+mixer_abort (ErrType error,
+ const char *err_string,
+ int xerrno)
+ __attribute__
+((noreturn));
+
+
+/* --- functions --- */
+static void
+mixer_clear (int full_redraw)
+{
+ int x, y;
+ int f = full_redraw ? 0 : 1;
+
+ mixer_dc (DC_BACK);
+
+ if (full_redraw)
+ clearok (mixer_window, TRUE);
+
+ /* buggy ncurses doesn't really write spaces with the specified
+ * color into the screen on clear () or erase ()
+ */
+ for (x = f; x < mixer_max_x - f; x++)
+ for (y = f; y < mixer_max_y - f; y++)
+ mvaddch (y, x, ' ');
+}
+
+static void
+mixer_abort (ErrType error,
+ const char *err_string,
+ int xerrno)
+{
+ if (mixer_window)
+ {
+ mixer_clear (TRUE);
+ refresh ();
+ keypad (mixer_window, FALSE);
+ leaveok (mixer_window, FALSE);
+ endwin ();
+ mixer_window = NULL;
+ }
+ printf ("\n");
+
+ switch (error)
+ {
+ case ERR_OPEN:
+ fprintf (stderr,
+ PRGNAME ": function %s failed for %s: %s\n",
+ err_string,
+ card_id,
+ snd_strerror (xerrno));
+ break;
+ case ERR_FCN:
+ fprintf (stderr,
+ PRGNAME ": function %s failed: %s\n",
+ err_string,
+ snd_strerror (xerrno));
+ break;
+ case ERR_SIGNAL:
+ fprintf (stderr,
+ PRGNAME ": aborting due to signal `%s'\n",
+ err_string);
+ break;
+ case ERR_WINSIZE:
+ fprintf (stderr,
+ PRGNAME ": screen size too small (%dx%d)\n",
+ mixer_max_x,
+ mixer_max_y);
+ break;
+ default:
+ break;
+ }
+
+ exit (error);
+}
+
+static int
+mixer_cbar_get_pos (int elem_index,
+ int *x_p,
+ int *y_p)
+{
+ int x;
+ int y;
+
+ if (elem_index < mixer_first_vis_elem ||
+ elem_index - mixer_first_vis_elem >= mixer_n_vis_elems)
+ return FALSE;
+
+ elem_index -= mixer_first_vis_elem;
+
+ x = mixer_ofs_x;
+ x += (3 + 2 + 3 + 1) * elem_index + mixer_extra_space * (elem_index + 1);
+
+ if (mixer_text_y + MIXER_CBAR_STD_HGT < mixer_max_y)
+ y = (mixer_text_y + mixer_cbar_height) / 2 - 1 + mixer_max_y / 2;
+ else
+ y = mixer_text_y - 1 + mixer_cbar_height;
+ if (y >= mixer_max_y - 1)
+ y = mixer_max_y - 2;
+ if (x_p)
+ *x_p = x;
+ if (y_p)
+ *y_p = y;
+
+ return TRUE;
+}
+
+static int
+mixer_conv(int val, int omin, int omax, int nmin, int nmax)
+{
+ float orange = omax - omin, nrange = nmax - nmin;
+
+ if (orange == 0)
+ return 0;
+ return ((nrange * (val - omin)) + (orange / 2)) / orange + nmin;
+}
+
+static int
+mixer_calc_volume(snd_mixer_elem_t *elem,
+ int vol, int type,
+ snd_mixer_selem_channel_id_t chn)
+{
+ int vol1;
+ long v;
+ long min, max;
+ if (type != MIXER_ELEM_CAPTURE)
+ snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
+ else
+ snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
+ vol1 = (vol < 0) ? -vol : vol;
+ if (vol1 > 0) {
+ if (vol1 > 100)
+ vol1 = max;
+ else
+ vol1 = mixer_conv(vol1, 0, 100, min, max);
+ /* Note: we have delta in vol1 and we need to map our */
+ /* delta value to hardware range */
+ vol1 -= min;
+ if (vol1 <= 0)
+ vol1 = 1;
+ if (vol < 0)
+ vol1 = -vol1;
+ }
+ if (type != MIXER_ELEM_CAPTURE)
+ snd_mixer_selem_get_playback_volume(elem, chn, &v);
+ else
+ snd_mixer_selem_get_capture_volume(elem, chn, &v);
+ vol1 += v;
+ return CLAMP(vol1, min, max);
+}
+
+static int
+mixer_convert_volume(snd_mixer_elem_t *elem,
+ int vol, int type)
+{
+ long min, max;
+ if (type != MIXER_ELEM_CAPTURE)
+ snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
+ else
+ snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
+ return mixer_conv(vol, 0, 100, min, max);
+}
+
+/* update enum list */
+static void update_enum_list(snd_mixer_elem_t *elem, int chn, int delta)
+{
+ unsigned int eidx;
+ if (snd_mixer_selem_get_enum_item(elem, chn, &eidx) < 0)
+ return;
+ if (delta < 0) {
+ if (eidx == 0)
+ return;
+ eidx--;
+ } else {
+ int items = snd_mixer_selem_get_enum_items(elem);
+ if (items < 0)
+ return;
+ eidx++;
+ if (eidx >= items)
+ return;
+ }
+ snd_mixer_selem_set_enum_item(elem, chn, eidx);
+}
+
+/* set new channel values
+ */
+static void
+mixer_write_cbar (int elem_index)
+{
+ snd_mixer_elem_t *elem;
+ int vleft, vright, vbalance;
+ int type;
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_channel_id_t chn_left, chn_right, chn;
+ int sw;
+
+ if (mixer_sid == NULL)
+ return;
+
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_grpidx[elem_index]);
+ elem = snd_mixer_find_selem(mixer_handle, sid);
+ if (elem == NULL)
+ CHECK_ABORT (ERR_FCN, "snd_mixer_find_selem()", -EINVAL);
+ type = mixer_type[elem_index] & MIXER_ELEM_TYPE_MASK;
+ chn_left = mixer_elem_chn[type][MIXER_CHN_LEFT];
+ chn_right = mixer_elem_chn[type][MIXER_CHN_RIGHT];
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN) {
+ if (type != MIXER_ELEM_CAPTURE) {
+ if (!snd_mixer_selem_has_playback_channel(elem, chn_right))
+ chn_right = SND_MIXER_SCHN_UNKNOWN;
+ } else {
+ if (!snd_mixer_selem_has_capture_channel(elem, chn_right))
+ chn_right = SND_MIXER_SCHN_UNKNOWN;
+ }
+ }
+
+ /* volume
+ */
+ if ((mixer_volume_delta[MIXER_CHN_LEFT] ||
+ mixer_volume_delta[MIXER_CHN_RIGHT] ||
+ mixer_volume_absolute != -1 ||
+ mixer_balance_volumes) &&
+ (mixer_type[elem_index] & MIXER_ELEM_HAS_VOLUME)) {
+ int mono;
+ int joined;
+ mono = (chn_right == SND_MIXER_SCHN_UNKNOWN);
+ if (type != MIXER_ELEM_CAPTURE)
+ joined = snd_mixer_selem_has_playback_volume_joined(elem);
+ else
+ joined = snd_mixer_selem_has_capture_volume_joined(elem);
+ mono |= joined;
+ if (mixer_volume_absolute != -1) {
+ vbalance = vright = vleft = mixer_convert_volume(elem, mixer_volume_absolute, type);
+ } else {
+ if (mono && !mixer_volume_delta[MIXER_CHN_LEFT])
+ mixer_volume_delta[MIXER_CHN_LEFT] = mixer_volume_delta[MIXER_CHN_RIGHT];
+ vleft = mixer_calc_volume(elem, mixer_volume_delta[MIXER_CHN_LEFT], type, chn_left);
+ vbalance = vleft;
+ if (! mono) {
+ vright = mixer_calc_volume(elem, mixer_volume_delta[MIXER_CHN_RIGHT], type, chn_right);
+ vbalance += vright;
+ vbalance /= 2;
+ } else {
+ vright = vleft;
+ }
+ }
+
+ if (joined) {
+ for (chn = 0; chn < SND_MIXER_SCHN_LAST; chn++)
+ if (type != MIXER_ELEM_CAPTURE) {
+ if (snd_mixer_selem_has_playback_channel(elem, chn))
+ snd_mixer_selem_set_playback_volume(elem, chn, vleft);
+ } else {
+ if (snd_mixer_selem_has_capture_channel(elem, chn))
+ snd_mixer_selem_set_capture_volume(elem, chn, vleft);
+ }
+ } else {
+ if (mixer_balance_volumes)
+ vleft = vright = vbalance;
+ if (type != MIXER_ELEM_CAPTURE) {
+ if (snd_mixer_selem_has_playback_volume(elem) &&
+ snd_mixer_selem_has_playback_channel(elem, chn_left))
+ snd_mixer_selem_set_playback_volume(elem, chn_left, vleft);
+ } else {
+ if (snd_mixer_selem_has_capture_volume(elem) &&
+ snd_mixer_selem_has_capture_channel(elem, chn_left))
+ snd_mixer_selem_set_capture_volume(elem, chn_left, vleft);
+ }
+ if (! mono) {
+ if (type != MIXER_ELEM_CAPTURE) {
+ if (snd_mixer_selem_has_playback_volume(elem) &&
+ snd_mixer_selem_has_playback_channel(elem, chn_right))
+ snd_mixer_selem_set_playback_volume(elem, chn_right, vright);
+ } else {
+ if (snd_mixer_selem_has_capture_volume(elem) &&
+ snd_mixer_selem_has_capture_channel(elem, chn_right))
+ snd_mixer_selem_set_capture_volume(elem, chn_right, vright);
+ }
+ }
+ }
+ }
+
+ /* mute
+ */
+ if (mixer_type[elem_index] & MIXER_ELEM_MUTE_SWITCH) {
+ if (mixer_toggle_mute) {
+ if (snd_mixer_selem_has_playback_switch_joined(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn_left, &sw);
+ snd_mixer_selem_set_playback_switch_all(elem, !sw);
+ } else {
+ if (mixer_toggle_mute & MIXER_MASK_LEFT) {
+ snd_mixer_selem_get_playback_switch(elem, chn_left, &sw);
+ snd_mixer_selem_set_playback_switch(elem, chn_left, !sw);
+ }
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN &&
+ (mixer_toggle_mute & MIXER_MASK_RIGHT)) {
+ snd_mixer_selem_get_playback_switch(elem, chn_right, &sw);
+ snd_mixer_selem_set_playback_switch(elem, chn_right, !sw);
+ }
+ }
+ }
+ }
+ mixer_toggle_mute = 0;
+
+ /* capture
+ */
+ if (mixer_type[elem_index] & MIXER_ELEM_CAPTURE_SWITCH) {
+ if (mixer_toggle_capture && snd_mixer_selem_has_capture_switch(elem)) {
+ if (snd_mixer_selem_has_capture_switch_joined(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn_left, &sw);
+ snd_mixer_selem_set_capture_switch_all(elem, !sw);
+ } else {
+ if ((mixer_toggle_capture & MIXER_MASK_LEFT) &&
+ snd_mixer_selem_has_capture_channel(elem, chn_left)) {
+ snd_mixer_selem_get_capture_switch(elem, chn_left, &sw);
+ snd_mixer_selem_set_capture_switch(elem, chn_left, !sw);
+ }
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN &&
+ snd_mixer_selem_has_capture_channel(elem, chn_right) &&
+ (mixer_toggle_capture & MIXER_MASK_RIGHT)) {
+ snd_mixer_selem_get_capture_switch(elem, chn_right, &sw);
+ snd_mixer_selem_set_capture_switch(elem, chn_right, !sw);
+ }
+ }
+ }
+ }
+ mixer_toggle_capture = 0;
+
+ /* enum list
+ */
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
+ if (mixer_volume_delta[MIXER_CHN_LEFT])
+ update_enum_list(elem, MIXER_CHN_LEFT, mixer_volume_delta[MIXER_CHN_LEFT]);
+ if (mixer_volume_delta[MIXER_CHN_RIGHT])
+ update_enum_list(elem, MIXER_CHN_RIGHT, mixer_volume_delta[MIXER_CHN_RIGHT]);
+ }
+
+ mixer_volume_delta[MIXER_CHN_LEFT] = mixer_volume_delta[MIXER_CHN_RIGHT] = 0;
+ mixer_volume_absolute = -1;
+ mixer_balance_volumes = 0;
+}
+
+
+static void draw_blank(int x, int y, int lines)
+{
+ int i;
+
+ mixer_dc (DC_TEXT);
+ for (i = 0; i < lines; i++)
+ mvaddstr (y - i, x, " ");
+}
+
+/* show the current view mode */
+static void display_view_info(void)
+{
+ mixer_dc (DC_PROMPT);
+ mvaddstr (3, 2, "View: Playback Capture All ");
+ mixer_dc (DC_TEXT);
+ switch (mixer_view) {
+ case VIEW_PLAYBACK:
+ mvaddstr (3, 8, "[Playback]");
+ break;
+ case VIEW_CAPTURE:
+ mvaddstr (3, 18, "[Capture]");
+ break;
+ default:
+ mvaddstr (3, 27, "[All]");
+ break;
+ }
+}
+
+/* show the information of the focused item */
+static void display_item_info(int elem_index, snd_mixer_selem_id_t *sid, char *extra_info)
+{
+ char string[64], idxstr[10];
+ int idx;
+ int i, xlen = mixer_max_x - 8;
+ if (xlen > sizeof(string) - 1)
+ xlen = sizeof(string) - 1;
+ mixer_dc (DC_PROMPT);
+ mvaddstr (4, 2, "Item: ");
+ mixer_dc (DC_TEXT);
+ idx = snd_mixer_selem_id_get_index(sid);
+ if (idx > 0)
+ snprintf(idxstr, sizeof(idxstr), " %i", snd_mixer_selem_id_get_index(sid));
+ snprintf(string, sizeof(string), "%s%s%s%s",
+ snd_mixer_selem_id_get_name(sid),
+ (mixer_type[elem_index] & MIXER_ELEM_CAPTURE_SUFFIX) ? " Capture" : "",
+ idx > 0 ? idxstr : "",
+ extra_info);
+ for (i = strlen(string); i < sizeof(string) - 1; i++)
+ string[i] = ' ';
+ string[xlen] = '\0';
+ addstr(string);
+}
+
+/* show the bar item name */
+static void display_item_name(int x, int y, int elem_index, snd_mixer_selem_id_t *sid)
+{
+ const char *suffix;
+ char string1[9], string[9];
+ int i;
+
+ mixer_dc (elem_index == mixer_focus_elem ? DC_CBAR_FOCUS_LABEL : DC_CBAR_LABEL);
+ if (mixer_type[elem_index] & MIXER_ELEM_CAPTURE_SUFFIX)
+ suffix = " Capture";
+ else
+ suffix = "";
+ if (snd_mixer_selem_id_get_index(sid) > 0)
+ snprintf(string1, sizeof(string1), "%s%s %d", snd_mixer_selem_id_get_name(sid),
+ suffix, snd_mixer_selem_id_get_index(sid));
+ else
+ snprintf(string1, sizeof(string1), "%s%s", snd_mixer_selem_id_get_name(sid), suffix);
+ string[8] = 0;
+ for (i = 0; i < 8; i++)
+ string[i] = ' ';
+ memcpy(string + (8 - strlen (string1)) / 2, string1, strlen(string1));
+ mvaddstr (y, x, string);
+}
+
+static void display_enum_list(snd_mixer_elem_t *elem, int y, int x)
+{
+ int cury, ch, err;
+
+ draw_blank(x, y, mixer_cbar_height + (mixer_view == VIEW_PLAYBACK ? 5 : 6));
+
+ cury = y - 4;
+ for (ch = 0; ch < 2; ch++) {
+ unsigned int eidx, ofs;
+ char tmp[9];
+ err = snd_mixer_selem_get_enum_item(elem, ch, &eidx);
+ if (err < 0)
+ break;
+ if (snd_mixer_selem_get_enum_item_name(elem, eidx, sizeof(tmp) - 1, tmp) < 0)
+ break;
+ tmp[8] = 0;
+ ofs = (8 - strlen(tmp)) / 2;
+ mvaddstr(cury, x + ofs, tmp);
+ cury += 2;
+ }
+}
+
+static void draw_volume_bar(int x, int y, int elem_index, long vleft, long vright)
+{
+ int i, dc;
+
+ mixer_dc (DC_CBAR_FRAME);
+ if (mixer_type[elem_index] & MIXER_ELEM_MUTE_SWITCH) {
+ mvaddch (y, x + 2, ACS_LTEE);
+ mvaddch (y, x + 5, ACS_RTEE);
+ } else {
+ mvaddch (y, x + 2, ACS_LLCORNER);
+ mvaddch (y, x + 3, ACS_HLINE);
+ mvaddch (y, x + 4, ACS_HLINE);
+ mvaddch (y, x + 5, ACS_LRCORNER);
+ }
+ y--;
+ for (i = 0; i < mixer_cbar_height; i++)
+ {
+ mvaddstr (y - i, x, " ");
+ mvaddch (y - i, x + 2, ACS_VLINE);
+ mvaddch (y - i, x + 5, ACS_VLINE);
+ }
+ for (i = 0; i < mixer_cbar_height; i++)
+ {
+ if (i + 1 >= 0.8 * mixer_cbar_height)
+ dc = DC_ANY_3;
+ else if (i + 1 >= 0.4 * mixer_cbar_height)
+ dc = DC_ANY_2;
+ else
+ dc = DC_ANY_1;
+ mvaddch (y, x + 3, mixer_dc (vleft > i * 100 / mixer_cbar_height ? dc : DC_CBAR_EMPTY));
+ mvaddch (y, x + 4, mixer_dc (vright > i * 100 / mixer_cbar_height ? dc : DC_CBAR_EMPTY));
+ y--;
+ }
+
+ mixer_dc (DC_CBAR_FRAME);
+ mvaddstr (y, x, " ");
+ mvaddch (y, x + 2, ACS_ULCORNER);
+ mvaddch (y, x + 3, ACS_HLINE);
+ mvaddch (y, x + 4, ACS_HLINE);
+ mvaddch (y, x + 5, ACS_URCORNER);
+}
+
+static void draw_playback_switch(int x, int y, int elem_index, int swl, int swr)
+{
+ int dc;
+
+ mixer_dc (DC_CBAR_FRAME);
+ mvaddch (y, x + 2, ACS_LLCORNER);
+ mvaddch (y, x + 3, ACS_HLINE);
+ mvaddch (y, x + 4, ACS_HLINE);
+ mvaddch (y, x + 5, ACS_LRCORNER);
+ mvaddstr (y - 1, x, " ");
+ mvaddch (y - 1, x + 2, ACS_VLINE);
+ mvaddch (y - 1, x + 5, ACS_VLINE);
+ mvaddstr (y - 2, x, " ");
+ mvaddch (y - 2, x + 2, ACS_ULCORNER);
+ mvaddch (y - 2, x + 3, ACS_HLINE);
+ mvaddch (y - 2, x + 4, ACS_HLINE);
+ mvaddch (y - 2, x + 5, ACS_URCORNER);
+ dc = swl ? DC_CBAR_NOMUTE : DC_CBAR_MUTE;
+ mvaddch (y - 1, x + 3, mixer_dc (dc));
+ dc = swr ? DC_CBAR_NOMUTE : DC_CBAR_MUTE;
+ mvaddch (y - 1, x + 4, mixer_dc (dc));
+}
+
+static void draw_capture_switch(int x, int y, int elem_index, int swl, int swr)
+{
+ int i;
+
+ if (swl || swr) {
+ mixer_dc (DC_CBAR_CAPTURE);
+ mvaddstr (y, x + 1, "CAPTUR");
+ } else {
+ for (i = 0; i < 6; i++)
+ mvaddch(y, x + i + 1, mixer_dc(DC_CBAR_NOCAPTURE));
+ }
+ mixer_dc (DC_CBAR_CAPTURE);
+ mvaddch (y - 1, x + 1, swl ? 'L' : ' ');
+ mvaddch (y - 1, x + 6, swr ? 'R' : ' ');
+}
+
+#ifndef SND_CTL_TLV_DB_GAIN_MUTE
+#define SND_CTL_TLV_DB_GAIN_MUTE -9999999
+#endif
+
+static void dB_value(char *s, long val)
+{
+ if (val <= SND_CTL_TLV_DB_GAIN_MUTE)
+ strcpy(s, "mute");
+ else
+ snprintf(s, 10, "%3.2f", (float)val / 100);
+}
+
+static void
+mixer_update_cbar (int elem_index)
+{
+ snd_mixer_elem_t *elem;
+ long vleft, vright;
+ int type;
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_channel_id_t chn_left, chn_right;
+ int x, y;
+ int swl, swr;
+ char * extra_info;
+
+ /* set new scontrol indices and read info
+ */
+ if (mixer_sid == NULL)
+ return;
+
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_grpidx[elem_index]);
+ elem = snd_mixer_find_selem(mixer_handle, sid);
+ if (elem == NULL)
+ CHECK_ABORT (ERR_FCN, "snd_mixer_find_selem()", -EINVAL);
+
+ type = mixer_type[elem_index] & MIXER_ELEM_TYPE_MASK;
+ chn_left = mixer_elem_chn[type][MIXER_CHN_LEFT];
+ chn_right = mixer_elem_chn[type][MIXER_CHN_RIGHT];
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN) {
+ if (type != MIXER_ELEM_CAPTURE) {
+ if (!snd_mixer_selem_has_playback_channel(elem, chn_right))
+ chn_right = SND_MIXER_SCHN_UNKNOWN;
+ } else {
+ if (!snd_mixer_selem_has_capture_channel(elem, chn_right))
+ chn_right = SND_MIXER_SCHN_UNKNOWN;
+ }
+ }
+
+ vleft = vright = 0;
+ if (type != MIXER_ELEM_CAPTURE && snd_mixer_selem_has_playback_volume(elem)) {
+ long vmin, vmax;
+ snd_mixer_selem_get_playback_volume_range(elem, &vmin, &vmax);
+ snd_mixer_selem_get_playback_volume(elem, chn_left, &vleft);
+ vleft = mixer_conv(vleft, vmin, vmax, 0, 100);
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN) {
+ snd_mixer_selem_get_playback_volume(elem, chn_right, &vright);
+ vright = mixer_conv(vright, vmin, vmax, 0, 100);
+ } else {
+ vright = vleft;
+ }
+ }
+
+ if (type == MIXER_ELEM_CAPTURE && snd_mixer_selem_has_capture_volume(elem)) {
+ long vmin, vmax;
+ snd_mixer_selem_get_capture_volume_range(elem, &vmin, &vmax);
+ snd_mixer_selem_get_capture_volume(elem, chn_left, &vleft);
+ vleft = mixer_conv(vleft, vmin, vmax, 0, 100);
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN) {
+ snd_mixer_selem_get_capture_volume(elem, chn_right, &vright);
+ vright = mixer_conv(vright, vmin, vmax, 0, 100);
+ } else {
+ vright = vleft;
+ }
+ }
+
+ /* update the focused full bar name
+ */
+ if (elem_index == mixer_focus_elem) {
+ char tmp[50];
+ /* control muted? */
+ swl = swr = 1;
+ extra_info = "";
+ if (mixer_type[elem_index] & MIXER_ELEM_MUTE_SWITCH) {
+ snd_mixer_selem_get_playback_switch(elem, chn_left, &swl);
+ swr = swl;
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN)
+ snd_mixer_selem_get_playback_switch(elem, chn_right, &swr);
+ extra_info = !swl && !swr ? " [Off]" : "";
+ }
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
+ /* FIXME: should show the item names of secondary and later channels... */
+ unsigned int eidx, length;
+ tmp[0]=' ';
+ tmp[1]='[';
+ if (! snd_mixer_selem_get_enum_item(elem, 0, &eidx) &&
+ ! snd_mixer_selem_get_enum_item_name(elem, eidx, sizeof(tmp) - 3, tmp+2)) {
+ tmp[sizeof(tmp)-2] = 0;
+ length=strlen(tmp);
+ tmp[length]=']';
+ tmp[length+1]=0;
+ extra_info = tmp;
+ }
+ }
+ if (type != MIXER_ELEM_CAPTURE && snd_mixer_selem_has_playback_volume(elem)) {
+ long vdbleft, vdbright;
+ unsigned int length;
+ if (!snd_mixer_selem_get_playback_dB(elem, chn_left, &vdbleft)) {
+ char tmpl[10], tmpr[10];
+ dB_value(tmpl, vdbleft);
+ if ((chn_right != SND_MIXER_SCHN_UNKNOWN) &&
+ (!snd_mixer_selem_get_playback_dB(elem, chn_right, &vdbright))) {
+ dB_value(tmpr, vdbright);
+ snprintf(tmp, 48, " [dB gain=%s, %s]", tmpl, tmpr);
+ } else {
+ snprintf(tmp, 48, " [dB gain=%s]", tmpl);
+ }
+ tmp[sizeof(tmp)-2] = 0;
+ length=strlen(tmp);
+ tmp[length+1]=0;
+ extra_info = tmp;
+ }
+ }
+ if (type == MIXER_ELEM_CAPTURE && snd_mixer_selem_has_capture_volume(elem)) {
+ long vdbleft, vdbright;
+ unsigned int length;
+ if (!snd_mixer_selem_get_capture_dB(elem, chn_left, &vdbleft)) {
+ char tmpl[10], tmpr[10];
+ dB_value(tmpl, vdbleft);
+ if ((chn_right != SND_MIXER_SCHN_UNKNOWN) &&
+ (!snd_mixer_selem_get_capture_dB(elem, chn_right, &vdbright))) {
+ dB_value(tmpr, vdbright);
+ snprintf(tmp, 48, " [dB gain=%s, %s]", tmpl, tmpr);
+ } else {
+ snprintf(tmp, 48, " [dB gain=%s]", tmpl);
+ }
+ tmp[sizeof(tmp)-2] = 0;
+ length=strlen(tmp);
+ tmp[length+1]=0;
+ extra_info = tmp;
+ }
+ }
+ display_item_info(elem_index, sid, extra_info);
+ }
+
+ /* get channel bar position
+ */
+ if (!mixer_cbar_get_pos (elem_index, &x, &y))
+ return;
+
+ /* channel bar name
+ */
+ display_item_name(x, y, elem_index, sid);
+ y--;
+
+ /* enum list? */
+ if (type == MIXER_ELEM_ENUM || type == MIXER_ELEM_CAPTURE_ENUM) {
+ display_enum_list(elem, y, x);
+ return; /* no more to display */
+ }
+
+ /* current channel values
+ */
+ mixer_dc (DC_BACK);
+ mvaddstr (y, x, " ");
+ if (mixer_type[elem_index] & MIXER_ELEM_HAS_VOLUME) {
+ char string[4];
+ mixer_dc (DC_TEXT);
+ if (chn_right == SND_MIXER_SCHN_UNKNOWN) {
+ /* mono */
+ snprintf (string, sizeof(string), "%ld", vleft);
+ mvaddstr (y, x + 4 - strlen (string) / 2, string);
+ } else {
+ /* stereo */
+ snprintf (string, sizeof(string), "%ld", vleft);
+ mvaddstr (y, x + 3 - strlen (string), string);
+ mixer_dc (DC_CBAR_FRAME);
+ mvaddch (y, x + 3, '<');
+ mvaddch (y, x + 4, '>');
+ mixer_dc (DC_TEXT);
+ snprintf (string, sizeof(string), "%ld", vright);
+ mvaddstr (y, x + 5, string);
+ }
+ }
+ y--;
+
+ /* capture input?
+ */
+ if (mixer_view == VIEW_CAPTURE || mixer_view == VIEW_CHANNELS) {
+ if ((mixer_type[elem_index] & MIXER_ELEM_CAPTURE_SWITCH) &&
+ snd_mixer_selem_has_capture_switch(elem)) {
+ int has_r_sw = chn_right != SND_MIXER_SCHN_UNKNOWN &&
+ snd_mixer_selem_has_capture_channel(elem, chn_right);
+ snd_mixer_selem_get_capture_switch(elem, chn_left, &swl);
+ if (has_r_sw)
+ snd_mixer_selem_get_capture_switch(elem, chn_right, &swr);
+ else
+ swr = swl;
+ draw_capture_switch(x, y, elem_index, swl, swr);
+ } else
+ draw_blank(x, y, 2);
+ y--;
+ }
+
+ /* mute switch */
+ if (mixer_view == VIEW_PLAYBACK || mixer_view == VIEW_CHANNELS) {
+ if (mixer_type[elem_index] & MIXER_ELEM_MUTE_SWITCH) {
+ snd_mixer_selem_get_playback_switch(elem, chn_left, &swl);
+ if (chn_right != SND_MIXER_SCHN_UNKNOWN)
+ snd_mixer_selem_get_playback_switch(elem, chn_right, &swr);
+ else
+ swr = swl;
+ draw_playback_switch(x, y, elem_index, swl, swr);
+ } else {
+ mixer_dc (DC_CBAR_FRAME);
+ mvaddstr (y, x + 2, " ");
+ draw_blank(x, y - 1, 2);
+ }
+ y -= 2;
+ }
+
+ /* left/right volume bar
+ */
+ if (mixer_type[elem_index] & MIXER_ELEM_HAS_VOLUME)
+ draw_volume_bar(x, y, elem_index, vleft, vright);
+ else {
+ if (mixer_view == VIEW_CAPTURE)
+ mvaddstr (y, x + 2, " ");
+ draw_blank(x, y - 1, mixer_cbar_height + 1);
+ }
+}
+
+static void
+mixer_update_cbars (void)
+{
+ static int o_x = 0;
+ static int o_y = 0;
+ int i, x, y;
+
+ display_view_info();
+ if (!mixer_cbar_get_pos (mixer_focus_elem, &x, &y))
+ {
+ if (mixer_focus_elem < mixer_first_vis_elem)
+ mixer_first_vis_elem = mixer_focus_elem;
+ else if (mixer_focus_elem >= mixer_first_vis_elem + mixer_n_vis_elems)
+ mixer_first_vis_elem = mixer_focus_elem - mixer_n_vis_elems + 1;
+ mixer_cbar_get_pos (mixer_focus_elem, &x, &y);
+ }
+ if (mixer_first_vis_elem + mixer_n_vis_elems >= mixer_n_view_elems) {
+ mixer_first_vis_elem = mixer_n_view_elems - mixer_n_vis_elems;
+ if (mixer_first_vis_elem < 0)
+ mixer_first_vis_elem = 0;
+ mixer_cbar_get_pos (mixer_focus_elem, &x, &y);
+ }
+ mixer_write_cbar(mixer_focus_elem);
+ for (i = 0; i < mixer_n_vis_elems; i++) {
+ if (i + mixer_first_vis_elem >= mixer_n_view_elems)
+ continue;
+ mixer_update_cbar (i + mixer_first_vis_elem);
+ }
+
+ /* draw focused cbar
+ */
+ if (mixer_have_old_focus)
+ {
+ mixer_dc (DC_BACK);
+ mvaddstr (o_y, o_x, " ");
+ mvaddstr (o_y, o_x + 9, " ");
+ }
+ o_x = x - 1;
+ o_y = y;
+ mixer_dc (DC_FOCUS);
+ mvaddstr (o_y, o_x, "<");
+ mvaddstr (o_y, o_x + 9, ">");
+ mixer_have_old_focus = 1;
+}
+
+static void
+mixer_draw_frame (void)
+{
+ char string[128];
+ int i;
+ int max_len;
+
+ /* card name
+ */
+ mixer_dc (DC_PROMPT);
+ mvaddstr (1, 2, "Card: ");
+ mixer_dc (DC_TEXT);
+ sprintf (string, "%s", mixer_card_name);
+ max_len = mixer_max_x - 2 - 6 - 2;
+ if ((int)strlen (string) > max_len)
+ string[max_len] = 0;
+ addstr (string);
+
+ /* device name
+ */
+ mixer_dc (DC_PROMPT);
+ mvaddstr (2, 2, "Chip: ");
+ mixer_dc (DC_TEXT);
+ sprintf (string, "%s", mixer_device_name);
+ max_len = mixer_max_x - 2 - 6 - 2;
+ if ((int)strlen (string) > max_len)
+ string[max_len] = 0;
+ addstr (string);
+
+ /* lines
+ */
+ mixer_dc (DC_FRAME);
+ for (i = 1; i < mixer_max_y - 1; i++)
+ {
+ mvaddch (i, 0, ACS_VLINE);
+ mvaddch (i, mixer_max_x - 1, ACS_VLINE);
+ }
+ for (i = 1; i < mixer_max_x - 1; i++)
+ {
+ mvaddch (0, i, ACS_HLINE);
+ mvaddch (mixer_max_y - 1, i, ACS_HLINE);
+ }
+
+ /* corners
+ */
+ mvaddch (0, 0, ACS_ULCORNER);
+ mvaddch (0, mixer_max_x - 1, ACS_URCORNER);
+ mvaddch (mixer_max_y - 1, 0, ACS_LLCORNER);
+ if (!mixer_no_lrcorner)
+ mvaddch (mixer_max_y - 1, mixer_max_x - 1, ACS_LRCORNER);
+ else
+ {
+ mvaddch (mixer_max_y - 2, mixer_max_x - 1, ACS_LRCORNER);
+ mvaddch (mixer_max_y - 2, mixer_max_x - 2, ACS_ULCORNER);
+ mvaddch (mixer_max_y - 1, mixer_max_x - 2, ACS_LRCORNER);
+ }
+
+ /* left/right scroll indicators */
+ switch (mixer_view) {
+ case VIEW_PLAYBACK:
+ case VIEW_CAPTURE:
+ case VIEW_CHANNELS:
+ if (mixer_cbar_height > 0) {
+ int ind_hgt = (mixer_cbar_height + 1) / 2;
+ int ind_ofs = mixer_max_y / 2 - ind_hgt/2;
+ /* left scroll possible? */
+ if (mixer_first_vis_elem > 0) {
+ for (i = 0; i < ind_hgt; i++)
+ mvaddch (i + ind_ofs, 0, '<');
+ }
+ /* right scroll possible? */
+ if (mixer_first_vis_elem + mixer_n_vis_elems < mixer_n_view_elems) {
+ for (i = 0; i < ind_hgt; i++)
+ mvaddch (i + ind_ofs, mixer_max_x - 1, '>');
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ /* program title
+ */
+ sprintf (string, "%s v%s (Press Escape to quit)", PRGNAME_UPPER, VERSION);
+ max_len = strlen (string);
+ if (mixer_max_x >= max_len + 4)
+ {
+ mixer_dc (DC_PROMPT);
+ mvaddch (0, mixer_max_x / 2 - max_len / 2 - 1, '[');
+ mvaddch (0, mixer_max_x / 2 - max_len / 2 + max_len, ']');
+ }
+ if (mixer_max_x >= max_len + 2)
+ {
+ mixer_dc (DC_TEXT);
+ mvaddstr (0, mixer_max_x / 2 - max_len / 2, string);
+ }
+}
+
+static char*
+mixer_offset_text (char **t,
+ int col,
+ int *length)
+{
+ char *p = *t;
+ char *r;
+
+ while (*p && *p != '\n' && col--)
+ p++;
+ if (*p == '\n' || !*p)
+ {
+ if (*p == '\n')
+ p++;
+ *length = 0;
+ *t = p;
+ return p;
+ }
+
+ r = p;
+ while (*r && *r != '\n' && (*length)--)
+ r++;
+
+ *length = r - p;
+ while (*r && *r != '\n')
+ r++;
+ if (*r == '\n')
+ r++;
+ *t = r;
+
+ return p;
+}
+
+static void
+mixer_show_text (char *title,
+ char *text,
+ int *xoffs,
+ int *yoffs)
+{
+ int tlines = 0, tcols = 0;
+ float hscroll, vscroll;
+ float hoffs, voffs;
+ char *p, *text_offs = text;
+ int x1, x2, y1, y2;
+ int i, n, l, r;
+ unsigned long block, stipple;
+
+ /* coords
+ */
+ x1 = 2;
+ x2 = mixer_max_x - 3;
+ y1 = 4;
+ y2 = mixer_max_y - 2;
+
+ if ((y2 - y1) < 3 || (x2 - x1) < 3)
+ return;
+
+ /* text dimensions
+ */
+ l = 0;
+ for (p = text; *p; p++)
+ if (*p == '\n')
+ {
+ tlines++;
+ tcols = MAX (l, tcols);
+ l = 0;
+ }
+ else
+ l++;
+ tcols = MAX (l, tcols);
+ if (p > text && *(p - 1) != '\n')
+ tlines++;
+
+ /* scroll areas / offsets
+ */
+ l = x2 - x1 - 2;
+ if (l > tcols)
+ {
+ x1 += (l - tcols) / 2;
+ x2 = x1 + tcols + 1;
+ }
+ if (mixer_hscroll_delta)
+ {
+ *xoffs += mixer_hscroll_delta;
+ mixer_hscroll_delta = 0;
+ if (*xoffs < 0)
+ {
+ *xoffs = 0;
+ beep ();
+ }
+ else if (*xoffs > tcols - l - 1)
+ {
+ *xoffs = MAX (0, tcols - l - 1);
+ beep ();
+ }
+ }
+ if (tcols - l - 1 <= 0)
+ {
+ hscroll = 1;
+ hoffs = 0;
+ }
+ else
+ {
+ hscroll = ((float) l) / tcols;
+ hoffs = ((float) *xoffs) / (tcols - l - 1);
+ }
+
+ l = y2 - y1 - 2;
+ if (l > tlines)
+ {
+ y1 += (l - tlines) / 2;
+ y2 = y1 + tlines + 1;
+ }
+ if (mixer_vscroll_delta)
+ {
+ *yoffs += mixer_vscroll_delta;
+ mixer_vscroll_delta = 0;
+ if (*yoffs < 0)
+ {
+ *yoffs = 0;
+ beep ();
+ }
+ else if (*yoffs > tlines - l - 1)
+ {
+ *yoffs = MAX (0, tlines - l - 1);
+ beep ();
+ }
+ }
+ if (tlines - l - 1 <= 0)
+ {
+ voffs = 0;
+ vscroll = 1;
+ }
+ else
+ {
+ vscroll = ((float) l) / tlines;
+ voffs = ((float) *yoffs) / (tlines - l - 1);
+ }
+
+ /* colors
+ */
+ mixer_dc (DC_ANY_4);
+
+ /* corners
+ */
+ mvaddch (y2, x2, ACS_LRCORNER);
+ mvaddch (y2, x1, ACS_LLCORNER);
+ mvaddch (y1, x1, ACS_ULCORNER);
+ mvaddch (y1, x2, ACS_URCORNER);
+
+ /* left + upper border
+ */
+ for (i = y1 + 1; i < y2; i++)
+ mvaddch (i, x1, ACS_VLINE);
+ for (i = x1 + 1; i < x2; i++)
+ mvaddch (y1, i, ACS_HLINE);
+ if (title)
+ {
+ l = strlen (title);
+ if (l <= x2 - x1 - 3)
+ {
+ mvaddch (y1, x1 + 1 + (x2 - x1 - l) / 2 - 1, '[');
+ mvaddch (y1, x1 + 1 + (x2 - x1 - l) / 2 + l, ']');
+ }
+ if (l <= x2 - x1 - 1)
+ {
+ mixer_dc (DC_CBAR_LABEL);
+ mvaddstr (y1, x1 + 1 + (x2 - x1 - l) / 2, title);
+ }
+ mixer_dc (DC_ANY_4);
+ }
+
+ stipple = ACS_CKBOARD;
+ block = ACS_BLOCK;
+ if (block == '#' && ACS_BOARD == '#')
+ {
+ block = stipple;
+ stipple = ACS_BLOCK;
+ }
+
+ /* lower scroll border
+ */
+ l = x2 - x1 - 1;
+ n = hscroll * l;
+ r = (hoffs + 1.0 / (2 * (l - n - 1))) * (l - n - 1);
+ for (i = 0; i < l; i++)
+ mvaddch (y2, i + x1 + 1, hscroll >= 1 ? ACS_HLINE :
+ i >= r && i <= r + n ? block : stipple);
+
+ /* right scroll border
+ */
+ l = y2 - y1 - 1;
+ n = vscroll * l;
+ r = (voffs + 1.0 / (2 * (l - n - 1))) * (l - n - 1);
+ for (i = 0; i < l; i++)
+ mvaddch (i + y1 + 1, x2, vscroll >= 1 ? ACS_VLINE :
+ i >= r && i <= r + n ? block : stipple);
+
+ /* show text
+ */
+ x1++; y1++;
+ for (i = 0; i < *yoffs; i++)
+ {
+ l = 0;
+ mixer_offset_text (&text_offs, 0, &l);
+ }
+ for (i = y1; i < y2; i++)
+ {
+ l = x2 - x1;
+ p = mixer_offset_text (&text_offs, *xoffs, &l);
+ n = x1;
+ while (l--)
+ mvaddch (i, n++, *p++);
+ while (n < x2)
+ mvaddch (i, n++, ' ');
+ }
+}
+
+struct vbuffer
+{
+ char *buffer;
+ int size;
+ int len;
+};
+
+static void
+vbuffer_kill (struct vbuffer *vbuf)
+{
+ if (vbuf->size)
+ free (vbuf->buffer);
+ vbuf->buffer = NULL;
+ vbuf->size = 0;
+ vbuf->len = 0;
+}
+
+#define vbuffer_append_string(vb,str) vbuffer_append (vb, str, strlen (str))
+static void
+vbuffer_append (struct vbuffer *vbuf,
+ char *text,
+ int len)
+{
+ if (vbuf->size - vbuf->len <= len)
+ {
+ vbuf->size += len + 1;
+ vbuf->buffer = realloc (vbuf->buffer, vbuf->size);
+ }
+ memcpy (vbuf->buffer + vbuf->len, text, len);
+ vbuf->len += len;
+ vbuf->buffer[vbuf->len] = 0;
+}
+
+static int
+vbuffer_append_file (struct vbuffer *vbuf,
+ char *name)
+{
+ int fd;
+
+ fd = open (name, O_RDONLY);
+ if (fd >= 0)
+ {
+ char buffer[1025];
+ int l;
+
+ do
+ {
+ l = read (fd, buffer, 1024);
+
+ vbuffer_append (vbuf, buffer, MAX (0, l));
+ }
+ while (l > 0 || (l < 0 && (errno == EAGAIN || errno == EINTR)));
+
+ close (fd);
+
+ return 0;
+ }
+ else
+ return 1;
+}
+
+static void
+mixer_show_procinfo (void)
+{
+ struct vbuffer vbuf = { NULL, 0, 0 };
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/version:\n");
+ vbuffer_append_string (&vbuf, "====================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/version"))
+ {
+ vbuffer_kill (&vbuf);
+ mixer_procinfo_xoffs = mixer_procinfo_yoffs = 0;
+ mixer_show_text ("/proc",
+ " No /proc information available. ",
+ &mixer_procinfo_xoffs, &mixer_procinfo_yoffs);
+ return;
+ }
+ else
+ vbuffer_append_file (&vbuf, "/proc/asound/meminfo");
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/cards:\n");
+ vbuffer_append_string (&vbuf, "===================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/cards"))
+ vbuffer_append_string (&vbuf, "No information available.\n");
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/devices:\n");
+ vbuffer_append_string (&vbuf, "=====================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/devices"))
+ vbuffer_append_string (&vbuf, "No information available.\n");
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/oss/devices:\n");
+ vbuffer_append_string (&vbuf, "=========================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/oss/devices"))
+ vbuffer_append_string (&vbuf, "No information available.\n");
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/timers:\n");
+ vbuffer_append_string (&vbuf, "====================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/timers"))
+ vbuffer_append_string (&vbuf, "No information available.\n");
+
+ vbuffer_append_string (&vbuf, "\n");
+ vbuffer_append_string (&vbuf, "/proc/asound/pcm:\n");
+ vbuffer_append_string (&vbuf, "=================\n");
+ if (vbuffer_append_file (&vbuf, "/proc/asound/pcm"))
+ vbuffer_append_string (&vbuf, "No information available.\n");
+
+ mixer_show_text ("/proc", vbuf.buffer,
+ &mixer_procinfo_xoffs, &mixer_procinfo_yoffs);
+ vbuffer_kill (&vbuf);
+}
+
+static int
+mixer_event (snd_mixer_t *mixer, unsigned int mask, snd_mixer_elem_t *elem)
+{
+ mixer_changed_state = 1;
+ return 0;
+}
+
+static void
+mixer_init (void)
+{
+ snd_ctl_card_info_t *hw_info;
+ snd_ctl_t *ctl_handle;
+ int err;
+ snd_ctl_card_info_alloca(&hw_info);
+
+ if ((err = snd_ctl_open (&ctl_handle, card_id, 0)) < 0)
+ mixer_abort (ERR_OPEN, "snd_ctl_open", err);
+ if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0)
+ mixer_abort (ERR_FCN, "snd_ctl_card_info", err);
+ snd_ctl_close (ctl_handle);
+ /* open mixer device
+ */
+ if ((err = snd_mixer_open (&mixer_handle, 0)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_open", err);
+ if (mixer_level == 0 && (err = snd_mixer_attach (mixer_handle, card_id)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_attach", err);
+ if ((err = snd_mixer_selem_register (mixer_handle, mixer_level > 0 ? &mixer_options : NULL, NULL)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_selem_register", err);
+ snd_mixer_set_callback (mixer_handle, mixer_event);
+ if ((err = snd_mixer_load (mixer_handle)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_load", err);
+
+ /* setup global variables
+ */
+ strcpy(mixer_card_name, snd_ctl_card_info_get_name(hw_info));
+ strcpy(mixer_device_name, snd_ctl_card_info_get_mixername(hw_info));
+}
+
+/* init mixer screen
+ */
+static void
+recalc_screen_size (void)
+{
+ getmaxyx (mixer_window, mixer_max_y, mixer_max_x);
+ if (mixer_minimize)
+ {
+ mixer_max_x = MIXER_MIN_X;
+ mixer_max_y = MIXER_MIN_Y;
+ }
+ mixer_ofs_x = 2 /* extra begin padding: */ + 1;
+
+ /* required allocations */
+ mixer_n_vis_elems = (mixer_max_x - mixer_ofs_x * 2 + 1) / 9;
+ mixer_n_vis_elems = CLAMP (mixer_n_vis_elems, 1, mixer_n_view_elems);
+ mixer_extra_space = mixer_max_x - mixer_ofs_x * 2 + 1 - mixer_n_vis_elems * 9;
+ mixer_extra_space = MAX (0, mixer_extra_space / (mixer_n_vis_elems + 1));
+ mixer_text_y = MIXER_TEXT_Y;
+ if (mixer_view == VIEW_PLAYBACK || mixer_view == VIEW_CHANNELS)
+ mixer_text_y += 2; /* row for mute switch */
+ if (mixer_view == VIEW_CAPTURE || mixer_view == VIEW_CHANNELS)
+ mixer_text_y++; /* row for capture switch */
+ if (mixer_text_y + MIXER_CBAR_STD_HGT < mixer_max_y)
+ mixer_cbar_height = MIXER_CBAR_STD_HGT + MAX (1, mixer_max_y - mixer_text_y - MIXER_CBAR_STD_HGT + 1) / 2;
+ else
+ mixer_cbar_height = MAX (1, mixer_max_y - mixer_text_y);
+}
+
+static void
+mixer_reinit (void)
+{
+ snd_mixer_elem_t *elem;
+ int idx, elem_index, i, j, selem_count;
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_id_t *focus_gid;
+ int focus_type = -1;
+ snd_mixer_selem_id_alloca(&focus_gid);
+
+ if (!mixer_changed_state)
+ return;
+ if (mixer_sid) {
+ snd_mixer_selem_id_copy(focus_gid, (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_grpidx[mixer_focus_elem]));
+ focus_type = mixer_type[mixer_focus_elem] & MIXER_ELEM_TYPE_MASK;
+ }
+__again:
+ mixer_changed_state = 0;
+ if (mixer_sid != NULL)
+ free(mixer_sid);
+ selem_count = snd_mixer_get_count(mixer_handle);
+ mixer_sid = malloc(snd_mixer_selem_id_sizeof() * selem_count);
+ if (mixer_sid == NULL)
+ mixer_abort (ERR_FCN, "malloc", 0);
+
+ mixer_n_selems = 0;
+ for (elem = snd_mixer_first_elem(mixer_handle); elem; elem = snd_mixer_elem_next(elem)) {
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_n_selems);
+ if (mixer_changed_state)
+ goto __again;
+ if (!snd_mixer_selem_is_active(elem))
+ continue;
+ snd_mixer_selem_get_id(elem, sid);
+ mixer_n_selems++;
+ }
+
+ mixer_n_elems = 0;
+ for (idx = 0; idx < mixer_n_selems; idx++) {
+ int nelems_added = 0;
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * idx);
+ if (mixer_changed_state)
+ goto __again;
+ elem = snd_mixer_find_selem(mixer_handle, sid);
+ if (elem == NULL)
+ CHECK_ABORT (ERR_FCN, "snd_mixer_find_selem()", -EINVAL);
+ for (i = 0; i < MIXER_ELEM_CAPTURE; i++) {
+ int ok;
+ for (j = ok = 0; j < 2; j++) {
+ if (mixer_changed_state)
+ goto __again;
+ if (snd_mixer_selem_has_playback_channel(elem, mixer_elem_chn[i][j]))
+ ok++;
+ }
+ if (ok) {
+ nelems_added++;
+ mixer_n_elems++;
+ }
+ }
+ if (snd_mixer_selem_has_capture_volume(elem) ||
+ (nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem)))
+ mixer_n_elems++;
+ }
+
+ if (mixer_type)
+ free(mixer_type);
+ mixer_type = (int *)calloc(mixer_n_elems, sizeof(int));
+ if (mixer_type == NULL)
+ mixer_abort(ERR_FCN, "malloc", 0);
+ if (mixer_grpidx)
+ free(mixer_grpidx);
+ mixer_grpidx = (int *)calloc(mixer_n_elems, sizeof(int));
+ if (mixer_grpidx == NULL)
+ mixer_abort(ERR_FCN, "malloc", 0);
+ elem_index = 0;
+ for (idx = 0; idx < mixer_n_selems; idx++) {
+ int nelems_added = 0;
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * idx);
+ if (mixer_changed_state)
+ goto __again;
+ elem = snd_mixer_find_selem(mixer_handle, sid);
+ if (elem == NULL)
+ CHECK_ABORT (ERR_FCN, "snd_mixer_find_selem()", -EINVAL);
+ if ( (mixer_view == VIEW_PLAYBACK) || (mixer_view == VIEW_CHANNELS) ) {
+ for (i = MIXER_ELEM_FRONT; i <= MIXER_ELEM_SIDE; i++) {
+ int ok;
+ for (j = ok = 0; j < 2; j++) {
+ if (mixer_changed_state)
+ goto __again;
+ if (snd_mixer_selem_has_playback_channel(elem, mixer_elem_chn[i][j]))
+ ok++;
+ }
+ if (ok) {
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * idx);
+ mixer_grpidx[elem_index] = idx;
+ if (snd_mixer_selem_is_enumerated(elem)) {
+ if (mixer_view == VIEW_PLAYBACK &&
+ snd_mixer_selem_is_enum_capture(elem))
+ continue;
+ mixer_type[elem_index] = MIXER_ELEM_ENUM;
+ } else {
+ mixer_type[elem_index] = i;
+ if (i == 0 && snd_mixer_selem_has_playback_switch(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_MUTE_SWITCH;
+ if (snd_mixer_selem_has_playback_volume(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_HAS_VOLUME;
+ }
+ if (mixer_view == VIEW_CHANNELS) {
+ if (nelems_added == 0 &&
+ ! snd_mixer_selem_has_capture_volume(elem) &&
+ snd_mixer_selem_has_capture_switch(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SWITCH;
+ }
+ elem_index++;
+ nelems_added++;
+ if (elem_index >= mixer_n_elems)
+ break;
+ }
+ }
+ }
+
+ if ( (mixer_view == VIEW_CAPTURE) || (mixer_view == VIEW_CHANNELS) ) {
+ int do_add = 0;
+ if (snd_mixer_selem_has_capture_volume(elem) &&
+ (mixer_view == VIEW_CAPTURE || !snd_mixer_selem_has_common_volume(elem)))
+ do_add = 1;
+ if (!do_add &&
+ (nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem)) &&
+ (mixer_view == VIEW_CAPTURE || !snd_mixer_selem_has_common_switch(elem)))
+ do_add = 1;
+ if (!do_add &&
+ mixer_view == VIEW_CAPTURE && snd_mixer_selem_is_enum_capture(elem))
+ do_add = 1;
+
+ if (do_add) {
+ mixer_grpidx[elem_index] = idx;
+ if (snd_mixer_selem_is_enum_capture(elem))
+ mixer_type[elem_index] = MIXER_ELEM_CAPTURE_ENUM;
+ else {
+ mixer_type[elem_index] = MIXER_ELEM_CAPTURE;
+ if (nelems_added == 0 && snd_mixer_selem_has_capture_switch(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SWITCH;
+ if (nelems_added)
+ mixer_type[elem_index] |= MIXER_ELEM_CAPTURE_SUFFIX;
+ if (snd_mixer_selem_has_capture_volume(elem))
+ mixer_type[elem_index] |= MIXER_ELEM_HAS_VOLUME;
+ }
+ elem_index++;
+ if (elem_index >= mixer_n_elems)
+ break;
+ }
+ }
+ }
+
+ mixer_n_view_elems = elem_index;
+ recalc_screen_size();
+ mixer_focus_elem = 0;
+ if (focus_type >= 0) {
+ for (elem_index = 0; elem_index < mixer_n_view_elems; elem_index++) {
+ sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_grpidx[elem_index]);
+ if (!strcmp(snd_mixer_selem_id_get_name(focus_gid),
+ snd_mixer_selem_id_get_name(sid)) &&
+ snd_mixer_selem_id_get_index(focus_gid) ==
+ snd_mixer_selem_id_get_index(sid) &&
+ (mixer_type[elem_index] & MIXER_ELEM_TYPE_MASK) == focus_type) {
+ mixer_focus_elem = elem_index;
+ break;
+ }
+ }
+ }
+
+ if (mixer_changed_state)
+ goto __again;
+}
+
+static void
+mixer_init_window (void)
+{
+ /* initialize ncurses
+ */
+ setlocale(LC_CTYPE, "");
+ mixer_window = initscr ();
+ curs_set (0); /* hide the cursor */
+
+ mixer_no_lrcorner = tigetflag ("xenl") != 1 && tigetflag ("am") != 1;
+
+ if (mixer_do_color)
+ mixer_do_color = has_colors ();
+ mixer_init_draw_contexts ();
+
+ /* react on key presses
+ */
+ cbreak ();
+ noecho ();
+ leaveok (mixer_window, TRUE);
+ keypad (mixer_window, TRUE);
+ GETCH_BLOCK (1);
+
+ recalc_screen_size();
+
+ mixer_clear (TRUE);
+}
+
+static void
+mixer_resize (void)
+{
+ struct winsize winsz = { 0, };
+
+ mixer_needs_resize = 0;
+
+ if (ioctl (fileno (stdout), TIOCGWINSZ, &winsz) >= 0 &&
+ winsz.ws_row && winsz.ws_col)
+ {
+ keypad (mixer_window, FALSE);
+ leaveok (mixer_window, FALSE);
+
+ endwin ();
+
+ mixer_max_x = MAX (2, winsz.ws_col);
+ mixer_max_y = MAX (2, winsz.ws_row);
+
+ /* humpf, i don't get it, if only the number of rows change,
+ * ncurses will segfault shortly after (could trigger that with mc as well).
+ */
+ resizeterm (mixer_max_y + 1, mixer_max_x + 1);
+ resizeterm (mixer_max_y, mixer_max_x);
+
+ mixer_init_window ();
+
+ if (mixer_max_x < MIXER_MIN_X ||
+ mixer_max_y < MIXER_MIN_Y)
+ beep (); // mixer_abort (ERR_WINSIZE, "");
+
+ mixer_have_old_focus = 0;
+ }
+}
+
+static void
+mixer_set_delta(int delta)
+{
+ int grp;
+
+ for (grp = 0; grp < 2; grp++)
+ mixer_volume_delta[grp] = delta;
+}
+
+static void
+mixer_add_delta(int delta)
+{
+ int grp;
+
+ for (grp = 0; grp < 2; grp++)
+ mixer_volume_delta[grp] += delta;
+}
+
+static int
+mixer_iteration (void)
+{
+ int count, err;
+ struct pollfd *fds;
+ int finished = 0;
+ int key = 0;
+ int old_view;
+ unsigned short revents;
+
+ /* setup for select on stdin and the mixer fd */
+ if ((count = snd_mixer_poll_descriptors_count(mixer_handle)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_poll_descriptors_count", count);
+ fds = calloc(count + 1, sizeof(struct pollfd));
+ if (fds == NULL)
+ mixer_abort (ERR_FCN, "malloc", 0);
+ fds->fd = fileno(stdin);
+ fds->events = POLLIN;
+ if ((err = snd_mixer_poll_descriptors(mixer_handle, fds + 1, count)) < 0)
+ mixer_abort (ERR_FCN, "snd_mixer_poll_descriptors", err);
+ if (err != count)
+ mixer_abort (ERR_FCN, "snd_mixer_poll_descriptors (err != count)", 0);
+
+ finished = poll(fds, count + 1, -1);
+
+ /* don't abort on handled signals */
+ if (finished < 0 && errno == EINTR)
+ finished = 0;
+ if (mixer_needs_resize)
+ mixer_resize ();
+
+ if (finished > 0) {
+ if (fds->revents & POLLIN) {
+ key = getch ();
+ finished--;
+ }
+ } else {
+ key = 0;
+ }
+
+ if (finished > 0) {
+ if (snd_mixer_poll_descriptors_revents(mixer_handle, fds + 1, count, &revents) >= 0) {
+ if (revents & POLLNVAL)
+ mixer_abort (ERR_FCN, "snd_mixer_poll_descriptors (POLLNVAL)", 0);
+ if (revents & POLLERR)
+ mixer_abort (ERR_FCN, "snd_mixer_poll_descriptors (POLLERR)", 0);
+ if (revents & POLLIN)
+ snd_mixer_handle_events(mixer_handle);
+ }
+ }
+
+ finished = 0;
+ free(fds);
+
+ old_view = mixer_view;
+
+#if 0 /* DISABLED: it's not so usefull rather annoying... */
+ /* feature Escape prefixing for some keys */
+ if (key == 27)
+ {
+ GETCH_BLOCK (0);
+ key = getch ();
+ GETCH_BLOCK (1);
+ switch (key)
+ {
+ case 9: /* Tab */
+ key = KEY_BTAB;
+ break;
+ default:
+ key = 27;
+ break;
+ }
+ }
+#endif /* DISABLED */
+
+ /* general keys */
+ switch (key)
+ {
+ case 0:
+ /* ignore */
+ break;
+ case 27: /* Escape */
+ case KEY_F (10):
+ finished = 1;
+ key = 0;
+ break;
+ case 13: /* Return */
+ case 10: /* NewLine */
+ if (mixer_view != mixer_view_saved) {
+ mixer_view = mixer_view_saved;
+ mixer_changed_state=1;
+ mixer_reinit ();
+ }
+ key = 0;
+ break;
+ case 'h':
+ case 'H':
+ case '?':
+ case KEY_F (1):
+ mixer_view = VIEW_HELP;
+ key = 0;
+ break;
+ case '/':
+ case KEY_F (2):
+ mixer_view = VIEW_PROCINFO;
+ key = 0;
+ break;
+ case KEY_F (3):
+ if (mixer_view == VIEW_PLAYBACK) {
+ mixer_clear (FALSE);
+ } else {
+ mixer_view = mixer_view_saved = VIEW_PLAYBACK;
+ mixer_changed_state=1;
+ mixer_reinit ();
+ }
+ key = 0;
+ break;
+ case KEY_F (4):
+ if (mixer_view == VIEW_CAPTURE) {
+ mixer_clear (FALSE);
+ } else {
+ mixer_view = mixer_view_saved = VIEW_CAPTURE;
+ mixer_changed_state=1;
+ mixer_reinit ();
+ }
+ key = 0;
+ break;
+ case KEY_F (5):
+ if (mixer_view == VIEW_CHANNELS) {
+ mixer_clear (FALSE);
+ } else {
+ mixer_view = mixer_view_saved = VIEW_CHANNELS;
+ mixer_changed_state=1;
+ mixer_reinit ();
+ }
+ key = 0;
+ break;
+ case 9: /* Tab */
+ if (mixer_view >= VIEW_CHANNELS && mixer_view <= VIEW_CAPTURE) {
+ mixer_view = (mixer_view + 1) % 3 + VIEW_CHANNELS;
+ mixer_view_saved = mixer_view;
+ mixer_changed_state = 1;
+ mixer_reinit ();
+ key = 0;
+ }
+ break;
+ case '\014':
+ case 'L':
+ case 'l':
+ mixer_clear (TRUE);
+ break;
+ }
+
+ if (key && (mixer_view == VIEW_HELP ||
+ mixer_view == VIEW_PROCINFO))
+ switch (key)
+ {
+ case 9: /* Tab */
+ mixer_hscroll_delta += 8;
+ break;
+ case KEY_BTAB:
+ mixer_hscroll_delta -= 8;
+ break;
+ case KEY_A1:
+ mixer_hscroll_delta -= 1;
+ mixer_vscroll_delta -= 1;
+ break;
+ case KEY_A3:
+ mixer_hscroll_delta += 1;
+ mixer_vscroll_delta -= 1;
+ break;
+ case KEY_C1:
+ mixer_hscroll_delta -= 1;
+ mixer_vscroll_delta += 1;
+ break;
+ case KEY_C3:
+ mixer_hscroll_delta += 1;
+ mixer_vscroll_delta += 1;
+ break;
+ case KEY_RIGHT:
+ case 'n':
+ mixer_hscroll_delta += 1;
+ break;
+ case KEY_LEFT:
+ case 'p':
+ mixer_hscroll_delta -= 1;
+ break;
+ case KEY_UP:
+ case 'w':
+ case 'W':
+ mixer_vscroll_delta -= 1;
+ break;
+ case KEY_DOWN:
+ case 'x':
+ case 'X':
+ mixer_vscroll_delta += 1;
+ break;
+ case KEY_PPAGE:
+ case 'B':
+ case 'b':
+ mixer_vscroll_delta -= (mixer_max_y - 5) / 2;
+ break;
+ case KEY_NPAGE:
+ case ' ':
+ mixer_vscroll_delta += (mixer_max_y - 5) / 2;
+ break;
+ case KEY_BEG:
+ case KEY_HOME:
+ mixer_hscroll_delta -= 0xffffff;
+ break;
+ case KEY_LL:
+ case KEY_END:
+ mixer_hscroll_delta += 0xffffff;
+ break;
+ }
+
+ if (key &&
+ ((mixer_view == VIEW_CHANNELS) ||
+ (mixer_view == VIEW_PLAYBACK) ||
+ (mixer_view == VIEW_CAPTURE)) )
+ switch (key)
+ {
+ case KEY_RIGHT:
+ case 'n':
+ mixer_focus_elem += 1;
+ break;
+ case KEY_LEFT:
+ case 'p':
+ mixer_focus_elem -= 1;
+ break;
+ case KEY_PPAGE:
+ mixer_set_delta(5);
+ break;
+ case KEY_NPAGE:
+ mixer_set_delta(-5);
+ break;
+#if 0
+ case KEY_BEG:
+ case KEY_HOME:
+ mixer_set_delta(100);
+ break;
+#endif
+ case KEY_LL:
+ case KEY_END:
+ mixer_set_delta(-100);
+ break;
+ case '+':
+ mixer_set_delta(1);
+ break;
+ case '-':
+ mixer_set_delta(-1);
+ break;
+ case 'w':
+ case KEY_UP:
+ mixer_set_delta(1);
+ case 'W':
+ mixer_add_delta(1);
+ break;
+ case 'x':
+ case KEY_DOWN:
+ mixer_set_delta(-1);
+ case 'X':
+ mixer_add_delta(-1);
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ mixer_volume_absolute = 10 * (key - '0');
+ break;
+ case 'q':
+ mixer_volume_delta[MIXER_CHN_LEFT] = 1;
+ case 'Q':
+ mixer_volume_delta[MIXER_CHN_LEFT] += 1;
+ break;
+ case 'y':
+ case 'z':
+ mixer_volume_delta[MIXER_CHN_LEFT] = -1;
+ case 'Y':
+ case 'Z':
+ mixer_volume_delta[MIXER_CHN_LEFT] += -1;
+ break;
+ case 'e':
+ mixer_volume_delta[MIXER_CHN_RIGHT] = 1;
+ case 'E':
+ mixer_volume_delta[MIXER_CHN_RIGHT] += 1;
+ break;
+ case 'c':
+ mixer_volume_delta[MIXER_CHN_RIGHT] = -1;
+ case 'C':
+ mixer_volume_delta[MIXER_CHN_RIGHT] += -1;
+ break;
+ case 'm':
+ case 'M':
+ mixer_toggle_mute |= MIXER_MASK_STEREO;
+ break;
+ case 'b':
+ case 'B':
+ case '=':
+ mixer_balance_volumes = 1;
+ break;
+ case '<':
+ case ',':
+ mixer_toggle_mute |= MIXER_MASK_LEFT;
+ break;
+ case '>':
+ case '.':
+ mixer_toggle_mute |= MIXER_MASK_RIGHT;
+ break;
+ case ' ':
+ mixer_toggle_capture |= MIXER_MASK_STEREO;
+ break;
+ case KEY_IC:
+ case ';':
+ mixer_toggle_capture |= MIXER_MASK_LEFT;
+ break;
+ case '\'':
+ case KEY_DC:
+ mixer_toggle_capture |= MIXER_MASK_RIGHT;
+ break;
+ }
+
+ if (old_view != mixer_view)
+ mixer_clear (FALSE);
+
+ if (! mixer_n_view_elems)
+ mixer_focus_elem = 0;
+ else
+ mixer_focus_elem = CLAMP (mixer_focus_elem, 0, mixer_n_view_elems - 1);
+
+ return finished;
+}
+
+static void
+mixer_winch (void)
+{
+ signal (SIGWINCH, (void*) mixer_winch);
+
+ mixer_needs_resize++;
+}
+
+static void
+mixer_signal_handler (int signal)
+{
+ if (signal != SIGSEGV)
+ mixer_abort (ERR_SIGNAL, strsignal(signal), 0);
+ else
+ {
+ fprintf (stderr, "\nSegmentation fault.\n");
+ _exit (11);
+ }
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ int opt;
+
+ /* parse args
+ */
+ do
+ {
+ opt = getopt (argc, argv, "c:D:shgV:a:");
+ switch (opt)
+ {
+ case '?':
+ case 'h':
+ printf ("%s v%s\n", PRGNAME_UPPER, VERSION);
+ printf ("Usage: %s [-h] [-c <card: 0...7>] [-D <mixer device>] [-g] [-s] [-V <view>] [-a <abst>]\n", PRGNAME);
+ return 1;
+ case 'c':
+ {
+ int i = snd_card_get_index(optarg);
+ if (i < 0 || i > 31) {
+ fprintf (stderr, "wrong -c argument '%s'\n", optarg);
+ mixer_abort (ERR_NONE, "", 0);
+ }
+ sprintf(card_id, "hw:%i", i);
+ }
+ break;
+ case 'D':
+ strncpy(card_id, optarg, sizeof(card_id));
+ card_id[sizeof(card_id)-1] = '\0';
+ break;
+ case 'g':
+ mixer_do_color = !mixer_do_color;
+ break;
+ case 's':
+ mixer_minimize = 1;
+ break;
+ case 'V':
+ if (*optarg == 'p' || *optarg == 'P')
+ mixer_view = VIEW_PLAYBACK;
+ else if (*optarg == 'c' || *optarg == 'C')
+ mixer_view = VIEW_CAPTURE;
+ else
+ mixer_view = VIEW_CHANNELS;
+ break;
+ case 'a':
+ mixer_level = 1;
+ memset(&mixer_options, 0, sizeof(mixer_options));
+ mixer_options.ver = 1;
+ if (!strcmp(optarg, "none"))
+ mixer_options.abstract = SND_MIXER_SABSTRACT_NONE;
+ else if (!strcmp(optarg, "basic"))
+ mixer_options.abstract = SND_MIXER_SABSTRACT_BASIC;
+ else {
+ fprintf(stderr, "Select correct abstraction level (none or basic)...\n");
+ mixer_abort (ERR_NONE, "", 0);
+ }
+ break;
+ }
+ }
+ while (opt > 0);
+
+ mixer_options.device = card_id;
+
+ /* initialize mixer
+ */
+ mixer_init ();
+ mixer_reinit ();
+
+ if (mixer_n_elems == 0) {
+ fprintf(stderr, "No mixer elems found\n");
+ mixer_abort (ERR_NONE, "", 0);
+ }
+
+ /* setup signal handlers
+ */
+ signal (SIGINT, mixer_signal_handler);
+ signal (SIGTRAP, mixer_signal_handler);
+ // signal (SIGABRT, mixer_signal_handler);
+ signal (SIGQUIT, mixer_signal_handler);
+ signal (SIGBUS, mixer_signal_handler);
+ signal (SIGSEGV, mixer_signal_handler);
+ signal (SIGPIPE, mixer_signal_handler);
+ signal (SIGTERM, mixer_signal_handler);
+
+ /* initialize ncurses
+ */
+ mixer_init_window ();
+ if (mixer_max_x < MIXER_MIN_X ||
+ mixer_max_y < MIXER_MIN_Y)
+ beep (); // mixer_abort (ERR_WINSIZE, "");
+
+ signal (SIGWINCH, (void*) mixer_winch);
+
+ do
+ {
+ /* draw window upon every iteration */
+ if (!mixer_needs_resize)
+ {
+ switch (mixer_view)
+ {
+ case VIEW_CHANNELS:
+ case VIEW_PLAYBACK:
+ case VIEW_CAPTURE:
+ mixer_update_cbars ();
+ break;
+ case VIEW_HELP:
+ mixer_show_text ("Help", mixer_help_text, &mixer_help_xoffs, &mixer_help_yoffs);
+ break;
+ case VIEW_PROCINFO:
+ mixer_show_procinfo ();
+ break;
+ }
+ mixer_draw_frame ();
+ refresh ();
+ }
+ }
+ while (!mixer_iteration ());
+
+ mixer_abort (ERR_NONE, "", 0);
+}
diff --git a/alsa-utils/amidi/Makefile.am b/alsa-utils/amidi/Makefile.am
new file mode 100644
index 0000000..0b31a67
--- /dev/null
+++ b/alsa-utils/amidi/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = amidi.1
+
+bin_PROGRAMS = amidi
+man_MANS = amidi.1
diff --git a/alsa-utils/amidi/Makefile.in b/alsa-utils/amidi/Makefile.in
new file mode 100644
index 0000000..ea7361b
--- /dev/null
+++ b/alsa-utils/amidi/Makefile.in
@@ -0,0 +1,498 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = amidi$(EXEEXT)
+subdir = amidi
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+amidi_SOURCES = amidi.c
+amidi_OBJECTS = amidi.$(OBJEXT)
+amidi_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = amidi.c
+DIST_SOURCES = amidi.c
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = amidi.1
+man_MANS = amidi.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amidi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign amidi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+amidi$(EXEEXT): $(amidi_OBJECTS) $(amidi_DEPENDENCIES)
+ @rm -f amidi$(EXEEXT)
+ $(LINK) $(amidi_LDFLAGS) $(amidi_OBJECTS) $(amidi_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amidi.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/amidi/amidi.1 b/alsa-utils/amidi/amidi.1
new file mode 100644
index 0000000..c58d65c
--- /dev/null
+++ b/alsa-utils/amidi/amidi.1
@@ -0,0 +1,155 @@
+.TH AMIDI 1 "26 Jun 2006"
+
+.SH NAME
+amidi \- read from and write to ALSA RawMIDI ports
+
+.SH SYNOPSIS
+\fBamidi\fP [\fI\-p port\fP] [\fI\-s file\fP | \fI\-S data\fP]
+[\fI\-r file\fP] [\fI\-d\fP] [\fI\-t seconds\fP] [\fI\-a\fP]
+
+.SH DESCRIPTION
+.B amidi
+is a command-line utility which allows to receive and send
+SysEx (system exclusive) data from/to external MIDI devices.
+It can also send any other MIDI commands.
+
+.B amidi
+handles only files containing raw MIDI commands, without timing
+information.
+.B amidi
+does not support Standard MIDI (.mid) files, but
+.B aplaymidi(1)
+and
+.B arecordmidi(1)
+do.
+
+.SH OPTIONS
+
+Use the
+.I \-h,
+.I \-V,
+.I \-l,
+or
+.I \-L
+options to display information;
+or use at least one of the
+.I \-s,
+.I \-r,
+.I \-S,
+or
+.I \-d
+options to specify what data to send or receive.
+
+.TP
+.I \-h, \-\-help
+Help: prints a list of options.
+
+.TP
+.I \-V, \-\-version
+Prints the current version.
+
+.TP
+.I \-l, \-\-list\-devices
+Prints a list of all hardware MIDI ports.
+
+.TP
+.I \-L, \-\-list\-rawmidis
+Prints all RawMIDI definitions.
+(used when debugging configuration files)
+
+.TP
+.I \-p, \-\-port=name
+Sets the name of the ALSA RawMIDI port to use.
+If this is not specified,
+.B amidi
+uses the default port defined in the configuration file
+(the default for this is port 0 on card 0, which may not exist).
+
+.TP
+.I \-s, \-\-send=filename
+Sends the contents of the specified file to the MIDI port.
+The file must contain raw MIDI commands (e.g. a .syx file);
+for Standard MIDI (.mid) files, use
+.B aplaymidi(1).
+
+.TP
+.I \-r, \-\-receive=filename
+Writes data received from the MIDI port into the specified file.
+The file will contain raw MIDI commands (such as in a .syx file);
+to record a Standard MIDI (.mid) file, use
+.B arecordmidi(1).
+
+.B amidi
+will filter out any Active Sensing bytes (FEh), unless the
+.I \-a
+option has been given.
+
+.TP
+.I \-S, \-\-send\-hex="..."
+Sends the bytes specified as hexadecimal numbers to the MIDI port.
+
+.TP
+.I \-d, \-\-dump
+Prints data received from the MIDI port as hexadecimal bytes.
+Active Sensing bytes (FEh) will not be shown, unless the
+.I \-a
+option has been given.
+
+This option is useful for debugging.
+
+.TP
+.I \-t, \-\-timeout=seconds
+Stops receiving data when no data has been received for the specified
+amount of time.
+
+If this option has not been given, you must press Ctrl+C (or kill
+.B amidi\fR)
+to stop receiving data.
+
+.TP
+.I \-a, \-\-active\-sensing
+Does not ignore Active Sensing bytes (FEh) when saving or printing
+received MIDI commands.
+
+.SH EXAMPLES
+
+.TP
+.B amidi \-p hw:0 \-s my_settings.syx
+will send the MIDI commands in
+.I my_settings.syx
+to port
+.I hw:0.
+
+.TP
+.B amidi \-S 'F0 43 10 4C 00 00 7E 00 F7'
+sends an XG Reset to the default port.
+
+.TP
+.B amidi \-p hw:1,2 \-S F0411042110C000000000074F7 \-r dump.syx \-t 1
+sends a \(lqParameter Dump Request\(rq to a GS device, saves the received
+parameter data to the file
+.I dump.syx,
+and stops after the device has finished sending data
+(when no data has been received for one second).
+
+.TP
+.B amidi \-p virtual \-d
+creates a virtual RawMIDI port and prints all data sent to this port.
+
+.SH FILES
+.I /usr/share/alsa/alsa.conf
+default rawmidi definitions
+.br
+.I /etc/asound.conf
+system-wide rawmidi definitions
+.br
+.I ~/.asoundrc
+user specific rawmidi definitions
+
+.SH SEE ALSO
+aplaymidi(1)
+.br
+arecordmidi(1)
+
+.SH AUTHOR
+Clemens Ladisch <clemens@ladisch.de>
diff --git a/alsa-utils/amidi/amidi.c b/alsa-utils/amidi/amidi.c
new file mode 100644
index 0000000..2e970ae
--- /dev/null
+++ b/alsa-utils/amidi/amidi.c
@@ -0,0 +1,679 @@
+/*
+ * amidi.c - read from/write to RawMIDI ports
+ *
+ * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#include <getopt.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "version.h"
+
+static int do_device_list, do_rawmidi_list;
+static char *port_name = "default";
+static char *send_file_name;
+static char *receive_file_name;
+static char *send_hex;
+static char *send_data;
+static int send_data_length;
+static int receive_file;
+static int dump;
+static int timeout;
+static int stop;
+static snd_rawmidi_t *input, **inputp;
+static snd_rawmidi_t *output, **outputp;
+
+static void error(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ putc('\n', stderr);
+}
+
+static void usage(void)
+{
+ printf(
+ "Usage: amidi options\n"
+ "\n"
+ "-h, --help this help\n"
+ "-V, --version print current version\n"
+ "-l, --list-devices list all hardware ports\n"
+ "-L, --list-rawmidis list all RawMIDI definitions\n"
+ "-p, --port=name select port by name\n"
+ "-s, --send=file send the contents of a (.syx) file\n"
+ "-r, --receive=file write received data into a file\n"
+ "-S, --send-hex=\"...\" send hexadecimal bytes\n"
+ "-d, --dump print received data as hexadecimal bytes\n"
+ "-t, --timeout=seconds exits when no data has been received\n"
+ " for the specified duration\n"
+ "-a, --active-sensing don't ignore active sensing bytes\n");
+}
+
+static void version(void)
+{
+ puts("amidi version " SND_UTIL_VERSION_STR);
+}
+
+static void *my_malloc(size_t size)
+{
+ void *p = malloc(size);
+ if (!p) {
+ error("out of memory");
+ exit(EXIT_FAILURE);
+ }
+ return p;
+}
+
+static int is_input(snd_ctl_t *ctl, int card, int device, int sub)
+{
+ snd_rawmidi_info_t *info;
+ int err;
+
+ snd_rawmidi_info_alloca(&info);
+ snd_rawmidi_info_set_device(info, device);
+ snd_rawmidi_info_set_subdevice(info, sub);
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT);
+
+ if ((err = snd_ctl_rawmidi_info(ctl, info)) < 0 && err != -ENXIO)
+ return err;
+ else if (err == 0)
+ return 1;
+
+ return 0;
+}
+
+static int is_output(snd_ctl_t *ctl, int card, int device, int sub)
+{
+ snd_rawmidi_info_t *info;
+ int err;
+
+ snd_rawmidi_info_alloca(&info);
+ snd_rawmidi_info_set_device(info, device);
+ snd_rawmidi_info_set_subdevice(info, sub);
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT);
+
+ if ((err = snd_ctl_rawmidi_info(ctl, info)) < 0 && err != -ENXIO)
+ return err;
+ else if (err == 0)
+ return 1;
+
+ return 0;
+}
+
+static void list_device(snd_ctl_t *ctl, int card, int device)
+{
+ snd_rawmidi_info_t *info;
+ const char *name;
+ const char *sub_name;
+ int subs, subs_in, subs_out;
+ int sub, in, out;
+ int err;
+
+ snd_rawmidi_info_alloca(&info);
+ snd_rawmidi_info_set_device(info, device);
+
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT);
+ snd_ctl_rawmidi_info(ctl, info);
+ subs_in = snd_rawmidi_info_get_subdevices_count(info);
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT);
+ snd_ctl_rawmidi_info(ctl, info);
+ subs_out = snd_rawmidi_info_get_subdevices_count(info);
+ subs = subs_in > subs_out ? subs_in : subs_out;
+
+ sub = 0;
+ in = out = 0;
+ if ((err = is_output(ctl, card, device, sub)) < 0) {
+ error("cannot get rawmidi information %d:%d: %s",
+ card, device, snd_strerror(err));
+ return;
+ } else if (err)
+ out = 1;
+
+ if (err == 0) {
+ if ((err = is_input(ctl, card, device, sub)) < 0) {
+ error("cannot get rawmidi information %d:%d: %s",
+ card, device, snd_strerror(err));
+ return;
+ }
+ } else if (err)
+ in = 1;
+
+ if (err == 0)
+ return;
+
+ name = snd_rawmidi_info_get_name(info);
+ sub_name = snd_rawmidi_info_get_subdevice_name(info);
+ if (sub_name[0] == '\0') {
+ if (subs == 1) {
+ printf("%c%c hw:%d,%d %s\n",
+ in ? 'I' : ' ', out ? 'O' : ' ',
+ card, device, name);
+ } else
+ printf("%c%c hw:%d,%d %s (%d subdevices)\n",
+ in ? 'I' : ' ', out ? 'O' : ' ',
+ card, device, name, subs);
+ } else {
+ sub = 0;
+ for (;;) {
+ printf("%c%c hw:%d,%d,%d %s\n",
+ in ? 'I' : ' ', out ? 'O' : ' ',
+ card, device, sub, sub_name);
+ if (++sub >= subs)
+ break;
+
+ in = is_input(ctl, card, device, sub);
+ out = is_output(ctl, card, device, sub);
+ snd_rawmidi_info_set_subdevice(info, sub);
+ if (out) {
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_OUTPUT);
+ if ((err = snd_ctl_rawmidi_info(ctl, info)) < 0) {
+ error("cannot get rawmidi information %d:%d:%d: %s",
+ card, device, sub, snd_strerror(err));
+ break;
+ }
+ } else {
+ snd_rawmidi_info_set_stream(info, SND_RAWMIDI_STREAM_INPUT);
+ if ((err = snd_ctl_rawmidi_info(ctl, info)) < 0) {
+ error("cannot get rawmidi information %d:%d:%d: %s",
+ card, device, sub, snd_strerror(err));
+ break;
+ }
+ }
+ sub_name = snd_rawmidi_info_get_subdevice_name(info);
+ }
+ }
+}
+
+static void list_card_devices(int card)
+{
+ snd_ctl_t *ctl;
+ char name[32];
+ int device;
+ int err;
+
+ sprintf(name, "hw:%d", card);
+ if ((err = snd_ctl_open(&ctl, name, 0)) < 0) {
+ error("cannot open control for card %d: %s", card, snd_strerror(err));
+ return;
+ }
+ device = -1;
+ for (;;) {
+ if ((err = snd_ctl_rawmidi_next_device(ctl, &device)) < 0) {
+ error("cannot determine device number: %s", snd_strerror(err));
+ break;
+ }
+ if (device < 0)
+ break;
+ list_device(ctl, card, device);
+ }
+ snd_ctl_close(ctl);
+}
+
+static void device_list(void)
+{
+ int card, err;
+
+ card = -1;
+ if ((err = snd_card_next(&card)) < 0) {
+ error("cannot determine card number: %s", snd_strerror(err));
+ return;
+ }
+ if (card < 0) {
+ error("no sound card found");
+ return;
+ }
+ puts("Dir Device Name");
+ do {
+ list_card_devices(card);
+ if ((err = snd_card_next(&card)) < 0) {
+ error("cannot determine card number: %s", snd_strerror(err));
+ break;
+ }
+ } while (card >= 0);
+}
+
+static void rawmidi_list(void)
+{
+ snd_output_t *output;
+ snd_config_t *config;
+ int err;
+
+ if ((err = snd_config_update()) < 0) {
+ error("snd_config_update failed: %s", snd_strerror(err));
+ return;
+ }
+ if ((err = snd_output_stdio_attach(&output, stdout, 0)) < 0) {
+ error("snd_output_stdio_attach failed: %s", snd_strerror(err));
+ return;
+ }
+ if (snd_config_search(snd_config, "rawmidi", &config) >= 0) {
+ puts("RawMIDI list:");
+ snd_config_save(config, output);
+ }
+ snd_output_close(output);
+}
+
+static void load_file(void)
+{
+ int fd;
+ off_t length;
+
+ fd = open(send_file_name, O_RDONLY);
+ if (fd == -1) {
+ error("cannot open %s - %s", send_file_name, strerror(errno));
+ return;
+ }
+ length = lseek(fd, 0, SEEK_END);
+ if (length == (off_t)-1) {
+ error("cannot determine length of %s: %s", send_file_name, strerror(errno));
+ goto _error;
+ }
+ send_data = my_malloc(length);
+ lseek(fd, 0, SEEK_SET);
+ if (read(fd, send_data, length) != length) {
+ error("cannot read from %s: %s", send_file_name, strerror(errno));
+ goto _error;
+ }
+ if (length >= 4 && !memcmp(send_data, "MThd", 4)) {
+ error("%s is a Standard MIDI File; use aplaymidi to send it", send_file_name);
+ goto _error;
+ }
+ send_data_length = length;
+ goto _exit;
+_error:
+ free(send_data);
+ send_data = NULL;
+_exit:
+ close(fd);
+}
+
+static int hex_value(char c)
+{
+ if ('0' <= c && c <= '9')
+ return c - '0';
+ if ('A' <= c && c <= 'F')
+ return c - 'A' + 10;
+ if ('a' <= c && c <= 'f')
+ return c - 'a' + 10;
+ error("invalid character %c", c);
+ return -1;
+}
+
+static void parse_data(void)
+{
+ const char *p;
+ int i, value;
+
+ send_data = my_malloc(strlen(send_hex)); /* guesstimate */
+ i = 0;
+ value = -1; /* value is >= 0 when the first hex digit of a byte has been read */
+ for (p = send_hex; *p; ++p) {
+ int digit;
+ if (isspace((unsigned char)*p)) {
+ if (value >= 0) {
+ send_data[i++] = value;
+ value = -1;
+ }
+ continue;
+ }
+ digit = hex_value(*p);
+ if (digit < 0) {
+ send_data = NULL;
+ return;
+ }
+ if (value < 0) {
+ value = digit;
+ } else {
+ send_data[i++] = (value << 4) | digit;
+ value = -1;
+ }
+ }
+ if (value >= 0)
+ send_data[i++] = value;
+ send_data_length = i;
+}
+
+/*
+ * prints MIDI commands, formatting them nicely
+ */
+static void print_byte(unsigned char byte)
+{
+ static enum {
+ STATE_UNKNOWN,
+ STATE_1PARAM,
+ STATE_1PARAM_CONTINUE,
+ STATE_2PARAM_1,
+ STATE_2PARAM_2,
+ STATE_2PARAM_1_CONTINUE,
+ STATE_SYSEX
+ } state = STATE_UNKNOWN;
+ int newline = 0;
+
+ if (byte >= 0xf8)
+ newline = 1;
+ else if (byte >= 0xf0) {
+ newline = 1;
+ switch (byte) {
+ case 0xf0:
+ state = STATE_SYSEX;
+ break;
+ case 0xf1:
+ case 0xf3:
+ state = STATE_1PARAM;
+ break;
+ case 0xf2:
+ state = STATE_2PARAM_1;
+ break;
+ case 0xf4:
+ case 0xf5:
+ case 0xf6:
+ state = STATE_UNKNOWN;
+ break;
+ case 0xf7:
+ newline = state != STATE_SYSEX;
+ state = STATE_UNKNOWN;
+ break;
+ }
+ } else if (byte >= 0x80) {
+ newline = 1;
+ if (byte >= 0xc0 && byte <= 0xdf)
+ state = STATE_1PARAM;
+ else
+ state = STATE_2PARAM_1;
+ } else /* b < 0x80 */ {
+ int running_status = 0;
+ newline = state == STATE_UNKNOWN;
+ switch (state) {
+ case STATE_1PARAM:
+ state = STATE_1PARAM_CONTINUE;
+ break;
+ case STATE_1PARAM_CONTINUE:
+ running_status = 1;
+ break;
+ case STATE_2PARAM_1:
+ state = STATE_2PARAM_2;
+ break;
+ case STATE_2PARAM_2:
+ state = STATE_2PARAM_1_CONTINUE;
+ break;
+ case STATE_2PARAM_1_CONTINUE:
+ running_status = 1;
+ state = STATE_2PARAM_2;
+ break;
+ default:
+ break;
+ }
+ if (running_status)
+ fputs("\n ", stdout);
+ }
+ printf("%c%02X", newline ? '\n' : ' ', byte);
+}
+
+static void sig_handler(int dummy)
+{
+ stop = 1;
+}
+
+static void add_send_hex_data(const char *str)
+{
+ int length;
+ char *s;
+
+ length = (send_hex ? strlen(send_hex) + 1 : 0) + strlen(str) + 1;
+ s = my_malloc(length);
+ if (send_hex) {
+ strcpy(s, send_hex);
+ strcat(s, " ");
+ } else {
+ s[0] = '\0';
+ }
+ strcat(s, str);
+ free(send_hex);
+ send_hex = s;
+}
+
+int main(int argc, char *argv[])
+{
+ static const char short_options[] = "hVlLp:s:r:S::dt:a";
+ static const struct option long_options[] = {
+ {"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 'V'},
+ {"list-devices", 0, NULL, 'l'},
+ {"list-rawmidis", 0, NULL, 'L'},
+ {"port", 1, NULL, 'p'},
+ {"send", 1, NULL, 's'},
+ {"receive", 1, NULL, 'r'},
+ {"send-hex", 2, NULL, 'S'},
+ {"dump", 0, NULL, 'd'},
+ {"timeout", 1, NULL, 't'},
+ {"active-sensing", 0, NULL, 'a'},
+ { }
+ };
+ int c, err, ok = 0;
+ int ignore_active_sensing = 1;
+ int do_send_hex = 0;
+
+ while ((c = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (c) {
+ case 'h':
+ usage();
+ return 0;
+ case 'V':
+ version();
+ return 0;
+ case 'l':
+ do_device_list = 1;
+ break;
+ case 'L':
+ do_rawmidi_list = 1;
+ break;
+ case 'p':
+ port_name = optarg;
+ break;
+ case 's':
+ send_file_name = optarg;
+ break;
+ case 'r':
+ receive_file_name = optarg;
+ break;
+ case 'S':
+ do_send_hex = 1;
+ if (optarg)
+ add_send_hex_data(optarg);
+ break;
+ case 'd':
+ dump = 1;
+ break;
+ case 't':
+ timeout = atoi(optarg);
+ break;
+ case 'a':
+ ignore_active_sensing = 0;
+ break;
+ default:
+ error("Try `amidi --help' for more information.");
+ return 1;
+ }
+ }
+ if (do_send_hex) {
+ /* data for -S can be specified as multiple arguments */
+ if (!send_hex && !argv[optind]) {
+ error("Please specify some data for --send-hex.");
+ return 1;
+ }
+ for (; argv[optind]; ++optind)
+ add_send_hex_data(argv[optind]);
+ } else {
+ if (argv[optind]) {
+ error("%s is not an option.", argv[optind]);
+ return 1;
+ }
+ }
+
+ if (do_rawmidi_list)
+ rawmidi_list();
+ if (do_device_list)
+ device_list();
+ if (do_rawmidi_list || do_device_list)
+ return 0;
+
+ if (!send_file_name && !receive_file_name && !send_hex && !dump) {
+ error("Please specify at least one of --send, --receive, --send-hex, or --dump.");
+ return 1;
+ }
+ if (send_file_name && send_hex) {
+ error("--send and --send-hex cannot be specified at the same time.");
+ return 1;
+ }
+
+ if (send_file_name)
+ load_file();
+ else if (send_hex)
+ parse_data();
+ if ((send_file_name || send_hex) && !send_data)
+ return 1;
+
+ if (receive_file_name) {
+ receive_file = creat(receive_file_name, 0666);
+ if (receive_file == -1) {
+ error("cannot create %s: %s", receive_file_name, strerror(errno));
+ return -1;
+ }
+ } else {
+ receive_file = -1;
+ }
+
+ if (receive_file_name || dump)
+ inputp = &input;
+ else
+ inputp = NULL;
+ if (send_data)
+ outputp = &output;
+ else
+ outputp = NULL;
+
+ if ((err = snd_rawmidi_open(inputp, outputp, port_name, SND_RAWMIDI_NONBLOCK)) < 0) {
+ error("cannot open port \"%s\": %s", port_name, snd_strerror(err));
+ goto _exit2;
+ }
+
+ if (inputp)
+ snd_rawmidi_read(input, NULL, 0); /* trigger reading */
+
+ if (send_data) {
+ if ((err = snd_rawmidi_nonblock(output, 0)) < 0) {
+ error("cannot set blocking mode: %s", snd_strerror(err));
+ goto _exit;
+ }
+ if ((err = snd_rawmidi_write(output, send_data, send_data_length)) < 0) {
+ error("cannot send data: %s", snd_strerror(err));
+ goto _exit;
+ }
+ }
+
+ if (inputp) {
+ int read = 0;
+ int npfds, time = 0;
+ struct pollfd *pfds;
+
+ timeout *= 1000;
+ npfds = snd_rawmidi_poll_descriptors_count(input);
+ pfds = alloca(npfds * sizeof(struct pollfd));
+ snd_rawmidi_poll_descriptors(input, pfds, npfds);
+ signal(SIGINT, sig_handler);
+ for (;;) {
+ unsigned char buf[256];
+ int i, length;
+ unsigned short revents;
+
+ err = poll(pfds, npfds, 200);
+ if (stop || (err < 0 && errno == EINTR))
+ break;
+ if (err < 0) {
+ error("poll failed: %s", strerror(errno));
+ break;
+ }
+ if (err == 0) {
+ time += 200;
+ if (timeout && time >= timeout)
+ break;
+ continue;
+ }
+ if ((err = snd_rawmidi_poll_descriptors_revents(input, pfds, npfds, &revents)) < 0) {
+ error("cannot get poll events: %s", snd_strerror(errno));
+ break;
+ }
+ if (revents & (POLLERR | POLLHUP))
+ break;
+ if (!(revents & POLLIN))
+ continue;
+ err = snd_rawmidi_read(input, buf, sizeof(buf));
+ if (err == -EAGAIN)
+ continue;
+ if (err < 0) {
+ error("cannot read from port \"%s\": %s", port_name, snd_strerror(err));
+ break;
+ }
+ length = 0;
+ for (i = 0; i < err; ++i)
+ if (!ignore_active_sensing || buf[i] != 0xfe)
+ buf[length++] = buf[i];
+ if (length == 0)
+ continue;
+ read += length;
+ time = 0;
+ if (receive_file != -1)
+ write(receive_file, buf, length);
+ if (dump) {
+ for (i = 0; i < length; ++i)
+ print_byte(buf[i]);
+ fflush(stdout);
+ }
+ }
+ if (isatty(fileno(stdout)))
+ printf("\n%d bytes read\n", read);
+ }
+
+ ok = 1;
+_exit:
+ if (inputp)
+ snd_rawmidi_close(input);
+ if (outputp)
+ snd_rawmidi_close(output);
+_exit2:
+ if (receive_file != -1)
+ close(receive_file);
+ return !ok;
+}
diff --git a/alsa-utils/amixer/Makefile.am b/alsa-utils/amixer/Makefile.am
new file mode 100644
index 0000000..fcd0e81
--- /dev/null
+++ b/alsa-utils/amixer/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+# LDFLAGS = -static
+# CFLAGS += -g -Wall
+
+bin_PROGRAMS = amixer
+amixer_SOURCES = amixer.c
+noinst_HEADERS = amixer.h
+man_MANS = amixer.1
+EXTRA_DIST = amixer.1
diff --git a/alsa-utils/amixer/Makefile.in b/alsa-utils/amixer/Makefile.in
new file mode 100644
index 0000000..7ed5a12
--- /dev/null
+++ b/alsa-utils/amixer/Makefile.in
@@ -0,0 +1,505 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = amixer$(EXEEXT)
+subdir = amixer
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_amixer_OBJECTS = amixer.$(OBJEXT)
+amixer_OBJECTS = $(am_amixer_OBJECTS)
+amixer_LDADD = $(LDADD)
+amixer_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(amixer_SOURCES)
+DIST_SOURCES = $(amixer_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+amixer_SOURCES = amixer.c
+noinst_HEADERS = amixer.h
+man_MANS = amixer.1
+EXTRA_DIST = amixer.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign amixer/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign amixer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+amixer$(EXEEXT): $(amixer_OBJECTS) $(amixer_DEPENDENCIES)
+ @rm -f amixer$(EXEEXT)
+ $(LINK) $(amixer_LDFLAGS) $(amixer_OBJECTS) $(amixer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amixer.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/amixer/amixer.1 b/alsa-utils/amixer/amixer.1
new file mode 100644
index 0000000..b1ac323
--- /dev/null
+++ b/alsa-utils/amixer/amixer.1
@@ -0,0 +1,141 @@
+.TH AMIXER 1 "11 Aug 2000"
+.SH NAME
+amixer \- command-line mixer for ALSA soundcard driver
+.SH SYNOPSIS
+\fBamixer\fP [\fI\-option\fP] [\fIcmd\fP]
+.SH DESCRIPTION
+\fBamixer\fP allows command-line control of the mixer for the ALSA
+soundcard driver.
+\fBamixer\fP supports multiple soundcards.
+
+\fBamixer\fR with no arguments will display the current mixer settings
+for the default soundcard and device. This is a good way to see a list
+of the simple mixer controls you can use.
+
+.SH COMMANDS
+
+.TP
+\fIhelp\fP
+Shows syntax.
+
+.TP
+\fIinfo\fP
+Shows the information about a mixer device.
+
+.TP
+\fIscontrols\fP
+Shows a complete list of simple mixer controls.
+
+.TP
+\fIscontents\fP
+Shows a complete list of simple mixer controls with their contents.
+
+.TP
+\fIset\fP or \fIsset\fP <\fISCONTROL\fP> <\fIPARAMETER\fP> ...
+Sets the simple mixer control contents. The parameter can be the volume
+either as a percentage from 0% to 100% with \fI%\fP suffix,
+a dB gain with \fIdB\fP suffix (like -12.5dB), or an exact hardware value.
+The dB gain can be used only for the mixer elements with available
+dB information.
+When plus(+) or minus(\-) letter is appended after
+volume value, the volume is incremented or decremented from the current
+value, respectively.
+
+The parameters \fIcap, nocap, mute, unmute, toggle\fP are used to
+change capture (recording) and muting for the group specified.
+
+The optional modifiers can be put as extra parameters to specify
+the stream direction or channels to apply.
+The modifiers \fIplayback\fP and \fIcapture\fP specify the stream,
+and the modifiers \fIfront, rear, center, woofer\fP are used to specify
+channels to be changed.
+
+A simple mixer control must be specified. Only one device can be controlled
+at a time.
+
+.TP
+\fIget\fP or \fIsget\fP <\fISCONTROL\fP>
+Shows the simple mixer control contents.
+
+A simple mixer control must be specified. Only one device can be controlled
+at a time.
+
+.TP
+\fIcontrols\fP
+Shows a complete list of card controls.
+
+.TP
+\fIcontents\fP
+Shows a complete list of card controls with their contents.
+
+.TP
+\fIcset\fP <\fICONTROL\fP> <\fIPARAMETER\fP> ...
+Sets the card control contents. The identifier has these components: iface,
+name, index, device, subdevice, numid. The next argument specifies the value
+of control.
+
+.TP
+\fIcget\fP <\fICONTROL\fP>
+Shows the card control contents. The identifier has same syntax as for
+the \fIcset\fP command.
+
+.SH OPTIONS
+
+.TP
+\fI\-c\fP card
+
+Select the card number to control. The device name created from this
+parameter has syntax 'hw:N' where N is specified card number.
+
+.TP
+\fI\-D\fP device
+
+Select the device name to control. The default control name is 'default'.
+
+.TP
+\fI\-s\fP | \fI\-\-stdin\fP
+
+Read from stdin and execute the command on each line sequentially.
+When this option is given, the command in command-line arguments is ignored.
+
+Only sset and cset are accepted. Other commands are ignored.
+The commands to unmatched ids are ignored without errors too.
+
+.TP
+\fI\-h\fP
+Help: show syntax.
+.TP
+\fI\-q\fP
+Quiet mode. Do not show results of changes.
+
+.SH EXAMPLES
+
+.TP
+\fBamixer \-c 1 sset Line,0 80%,40% unmute cap\fR
+will set the second soundcard's left line input volume to 80% and
+right line input to 40%, unmute it, and select it as a source for
+capture (recording).\fR
+
+.TP
+\fBamixer \-c 1 \-\- sset Master playback -20dB\fR
+will set the master volume of the second card to -20dB. If the master
+has multiple channels, all channels are set to the same value.
+
+.TP
+\fBamixer \-c 1 set PCM 2dB+\fR
+will increase the PCM volume of the second card with 2dB. When both
+playback and capture volumes exist, this is applied to both volumes.
+
+.TP
+\fBamixer \-c 2 cset iface=MIXER,name='Line Playback Volume",index=1 40%\fR
+will set the third soundcard's second line playback volume(s) to 40%
+
+.TP
+\fBamixer \-c 2 cset numid=34 40%\fR
+will set the 34th soundcard element to 40%
+
+.SH BUGS
+None known.
+.SH AUTHOR
+\fBamixer\fP is by Jaroslav Kysela <perex@perex.cz>.
+This document is by Paul Winkler <zarmzarm@erols.com> and Jaroslav Kysela <perex@perex.cz>.
diff --git a/alsa-utils/amixer/amixer.c b/alsa-utils/amixer/amixer.c
new file mode 100644
index 0000000..9620721
--- /dev/null
+++ b/alsa-utils/amixer/amixer.c
@@ -0,0 +1,2013 @@
+/*
+ * ALSA command line mixer utility
+ * Copyright (c) 1999-2000 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <math.h>
+#include <errno.h>
+#include <assert.h>
+#include <alsa/asoundlib.h>
+#include <sys/poll.h>
+#include "amixer.h"
+
+#define LEVEL_BASIC (1<<0)
+#define LEVEL_INACTIVE (1<<1)
+#define LEVEL_ID (1<<2)
+
+static int quiet = 0;
+static int debugflag = 0;
+static int no_check = 0;
+static int smixer_level = 0;
+static int ignore_error = 0;
+static struct snd_mixer_selem_regopt smixer_options;
+static char card[64] = "default";
+
+static void error(const char *fmt,...)
+{
+ va_list va;
+
+ va_start(va, fmt);
+ fprintf(stderr, "amixer: ");
+ vfprintf(stderr, fmt, va);
+ fprintf(stderr, "\n");
+ va_end(va);
+}
+
+static int help(void)
+{
+ printf("Usage: amixer <options> [command]\n");
+ printf("\nAvailable options:\n");
+ printf(" -h,--help this help\n");
+ printf(" -c,--card N select the card\n");
+ printf(" -D,--device N select the device, default '%s'\n", card);
+ printf(" -d,--debug debug mode\n");
+ printf(" -n,--nocheck do not perform range checking\n");
+ printf(" -v,--version print version of this program\n");
+ printf(" -q,--quiet be quiet\n");
+ printf(" -i,--inactive show also inactive controls\n");
+ printf(" -a,--abstract L select abstraction level (none or basic)\n");
+ printf(" -s,--stdin Read and execute commands from stdin sequentially\n");
+ printf("\nAvailable commands:\n");
+ printf(" scontrols show all mixer simple controls\n");
+ printf(" scontents show contents of all mixer simple controls (default command)\n");
+ printf(" sset sID P set contents for one mixer simple control\n");
+ printf(" sget sID get contents for one mixer simple control\n");
+ printf(" controls show all controls for given card\n");
+ printf(" contents show contents of all controls for given card\n");
+ printf(" cset cID P set control contents for one control\n");
+ printf(" cget cID get control contents for one control\n");
+ return 0;
+}
+
+static int info(void)
+{
+ int err;
+ snd_ctl_t *handle;
+ snd_mixer_t *mhandle;
+ snd_ctl_card_info_t *info;
+ snd_ctl_elem_list_t *clist;
+ snd_ctl_card_info_alloca(&info);
+ snd_ctl_elem_list_alloca(&clist);
+
+ if ((err = snd_ctl_open(&handle, card, 0)) < 0) {
+ error("Control device %s open error: %s", card, snd_strerror(err));
+ return err;
+ }
+
+ if ((err = snd_ctl_card_info(handle, info)) < 0) {
+ error("Control device %s hw info error: %s", card, snd_strerror(err));
+ return err;
+ }
+ printf("Card %s '%s'/'%s'\n", card, snd_ctl_card_info_get_id(info),
+ snd_ctl_card_info_get_longname(info));
+ printf(" Mixer name : '%s'\n", snd_ctl_card_info_get_mixername(info));
+ printf(" Components : '%s'\n", snd_ctl_card_info_get_components(info));
+ if ((err = snd_ctl_elem_list(handle, clist)) < 0) {
+ error("snd_ctl_elem_list failure: %s", snd_strerror(err));
+ } else {
+ printf(" Controls : %i\n", snd_ctl_elem_list_get_count(clist));
+ }
+ snd_ctl_close(handle);
+ if ((err = snd_mixer_open(&mhandle, 0)) < 0) {
+ error("Mixer open error: %s", snd_strerror(err));
+ return err;
+ }
+ if (smixer_level == 0 && (err = snd_mixer_attach(mhandle, card)) < 0) {
+ error("Mixer attach %s error: %s", card, snd_strerror(err));
+ snd_mixer_close(mhandle);
+ return err;
+ }
+ if ((err = snd_mixer_selem_register(mhandle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) {
+ error("Mixer register error: %s", snd_strerror(err));
+ snd_mixer_close(mhandle);
+ return err;
+ }
+ err = snd_mixer_load(mhandle);
+ if (err < 0) {
+ error("Mixer load %s error: %s", card, snd_strerror(err));
+ snd_mixer_close(mhandle);
+ return err;
+ }
+ printf(" Simple ctrls : %i\n", snd_mixer_get_count(mhandle));
+ snd_mixer_close(mhandle);
+ return 0;
+}
+
+static const char *control_iface(snd_ctl_elem_id_t *id)
+{
+ return snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(id));
+}
+
+static const char *control_type(snd_ctl_elem_info_t *info)
+{
+ return snd_ctl_elem_type_name(snd_ctl_elem_info_get_type(info));
+}
+
+static const char *control_access(snd_ctl_elem_info_t *info)
+{
+ static char result[10];
+ char *res = result;
+
+ *res++ = snd_ctl_elem_info_is_readable(info) ? 'r' : '-';
+ *res++ = snd_ctl_elem_info_is_writable(info) ? 'w' : '-';
+ *res++ = snd_ctl_elem_info_is_inactive(info) ? 'i' : '-';
+ *res++ = snd_ctl_elem_info_is_volatile(info) ? 'v' : '-';
+ *res++ = snd_ctl_elem_info_is_locked(info) ? 'l' : '-';
+ *res++ = snd_ctl_elem_info_is_tlv_readable(info) ? 'R' : '-';
+ *res++ = snd_ctl_elem_info_is_tlv_writable(info) ? 'W' : '-';
+ *res++ = snd_ctl_elem_info_is_tlv_commandable(info) ? 'C' : '-';
+ *res++ = '\0';
+ return result;
+}
+
+#define check_range(val, min, max) \
+ (no_check ? (val) : ((val < min) ? (min) : (val > max) ? (max) : (val)))
+#if 0
+static int convert_range(int val, int omin, int omax, int nmin, int nmax)
+{
+ int orange = omax - omin, nrange = nmax - nmin;
+
+ if (orange == 0)
+ return 0;
+ return rint((((double)nrange * ((double)val - (double)omin)) + ((double)orange / 2.0)) / ((double)orange + (double)nmin));
+}
+#endif
+
+#if 0
+static int convert_db_range(int val, int omin, int omax, int nmin, int nmax)
+{
+ int orange = omax - omin, nrange = nmax - nmin;
+
+ if (orange == 0)
+ return 0;
+ return rint((((double)nrange * ((double)val - (double)omin)) + ((double)orange / 2.0)) / (double)orange + (double)nmin);
+}
+#endif
+
+/* Fuction to convert from volume to percentage. val = volume */
+
+static int convert_prange(int val, int min, int max)
+{
+ int range = max - min;
+ int tmp;
+
+ if (range == 0)
+ return 0;
+ val -= min;
+ tmp = rint((double)val/(double)range * 100);
+ return tmp;
+}
+
+/* Function to convert from percentage to volume. val = percentage */
+
+#define convert_prange1(val, min, max) \
+ ceil((val) * ((max) - (min)) * 0.01 + (min))
+
+static const char *get_percent(int val, int min, int max)
+{
+ static char str[32];
+ int p;
+
+ p = convert_prange(val, min, max);
+ sprintf(str, "%i [%i%%]", val, p);
+ return str;
+}
+
+#if 0
+static const char *get_percent1(int val, int min, int max, int min_dB, int max_dB)
+{
+ static char str[32];
+ int p, db;
+
+ p = convert_prange(val, min, max);
+ db = convert_db_range(val, min, max, min_dB, max_dB);
+ sprintf(str, "%i [%i%%] [%i.%02idB]", val, p, db / 100, abs(db % 100));
+ return str;
+}
+#endif
+
+static long get_integer(char **ptr, long min, long max)
+{
+ long val = min;
+ char *p = *ptr, *s;
+
+ if (*p == ':')
+ p++;
+ if (*p == '\0' || (!isdigit(*p) && *p != '-'))
+ goto out;
+
+ s = p;
+ val = strtol(s, &p, 10);
+ if (*p == '.') {
+ p++;
+ strtol(p, &p, 10);
+ }
+ if (*p == '%') {
+ val = (long)convert_prange1(strtod(s, NULL), min, max);
+ p++;
+ }
+ val = check_range(val, min, max);
+ if (*p == ',')
+ p++;
+ out:
+ *ptr = p;
+ return val;
+}
+
+static long get_integer64(char **ptr, long long min, long long max)
+{
+ long long val = min;
+ char *p = *ptr, *s;
+
+ if (*p == ':')
+ p++;
+ if (*p == '\0' || (!isdigit(*p) && *p != '-'))
+ goto out;
+
+ s = p;
+ val = strtol(s, &p, 10);
+ if (*p == '.') {
+ p++;
+ strtol(p, &p, 10);
+ }
+ if (*p == '%') {
+ val = (long long)convert_prange1(strtod(s, NULL), min, max);
+ p++;
+ }
+ val = check_range(val, min, max);
+ if (*p == ',')
+ p++;
+ out:
+ *ptr = p;
+ return val;
+}
+
+struct volume_ops {
+ int (*get_range)(snd_mixer_elem_t *elem, long *min, long *max);
+ int (*get)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c,
+ long *value);
+ int (*set)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t c,
+ long value);
+};
+
+enum { VOL_RAW, VOL_DB };
+
+struct volume_ops_set {
+ int (*has_volume)(snd_mixer_elem_t *elem);
+ struct volume_ops v[2];
+};
+
+static int set_playback_dB(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c, long value)
+{
+ return snd_mixer_selem_set_playback_dB(elem, c, value, 0);
+}
+
+static int set_capture_dB(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t c, long value)
+{
+ return snd_mixer_selem_set_capture_dB(elem, c, value, 0);
+}
+
+static const struct volume_ops_set vol_ops[2] = {
+ {
+ .has_volume = snd_mixer_selem_has_playback_volume,
+ .v = {{ snd_mixer_selem_get_playback_volume_range,
+ snd_mixer_selem_get_playback_volume,
+ snd_mixer_selem_set_playback_volume },
+ { snd_mixer_selem_get_playback_dB_range,
+ snd_mixer_selem_get_playback_dB,
+ set_playback_dB }},
+ },
+ {
+ .has_volume = snd_mixer_selem_has_capture_volume,
+ .v = {{ snd_mixer_selem_get_capture_volume_range,
+ snd_mixer_selem_get_capture_volume,
+ snd_mixer_selem_set_capture_volume },
+ { snd_mixer_selem_get_capture_dB_range,
+ snd_mixer_selem_get_capture_dB,
+ set_capture_dB }},
+ },
+};
+
+static int set_volume_simple(snd_mixer_elem_t *elem,
+ snd_mixer_selem_channel_id_t chn,
+ char **ptr, int dir)
+{
+ long val, orig, pmin, pmax;
+ char *p = *ptr, *s;
+ int invalid = 0, err = 0, vol_type = VOL_RAW;
+
+ if (! vol_ops[dir].has_volume(elem))
+ invalid = 1;
+
+ if (*p == ':')
+ p++;
+ if (*p == '\0' || (!isdigit(*p) && *p != '-'))
+ goto skip;
+
+ if (! invalid &&
+ vol_ops[dir].v[VOL_RAW].get_range(elem, &pmin, &pmax) < 0)
+ invalid = 1;
+
+ s = p;
+ val = strtol(s, &p, 10);
+ if (*p == '.') {
+ p++;
+ strtol(p, &p, 10);
+ }
+ if (*p == '%') {
+ if (! invalid)
+ val = (long)convert_prange1(strtod(s, NULL), pmin, pmax);
+ p++;
+ } else if (p[0] == 'd' && p[1] == 'B') {
+ if (! invalid) {
+ val = (long)(strtod(s, NULL) * 100.0);
+ vol_type = VOL_DB;
+ if (vol_ops[dir].v[vol_type].get_range(elem, &pmin, &pmax) < 0)
+ invalid = 1;
+ }
+ p += 2;
+ }
+ if (*p == '+' || *p == '-') {
+ if (! invalid) {
+ if (vol_ops[dir].v[vol_type].get(elem, chn, &orig) < 0)
+ invalid = 1;
+ if (*p == '+')
+ val = orig + val;
+ else
+ val = orig - val;
+ }
+ p++;
+ }
+ if (! invalid) {
+ val = check_range(val, pmin, pmax);
+ err = vol_ops[dir].v[vol_type].set(elem, chn, val);
+ }
+ skip:
+ if (*p == ',')
+ p++;
+ *ptr = p;
+ return err ? err : (invalid ? -ENOENT : 0);
+}
+
+static int get_bool_simple(char **ptr, char *str, int invert, int orig)
+{
+ if (**ptr == ':')
+ (*ptr)++;
+ if (!strncasecmp(*ptr, str, strlen(str))) {
+ orig = 1 ^ (invert ? 1 : 0);
+ while (**ptr != '\0' && **ptr != ',' && **ptr != ':')
+ (*ptr)++;
+ }
+ if (**ptr == ',' || **ptr == ':')
+ (*ptr)++;
+ return orig;
+}
+
+static int simple_skip_word(char **ptr, char *str)
+{
+ char *xptr = *ptr;
+ if (*xptr == ':')
+ xptr++;
+ if (!strncasecmp(xptr, str, strlen(str))) {
+ while (*xptr != '\0' && *xptr != ',' && *xptr != ':')
+ xptr++;
+ if (*xptr == ',' || *xptr == ':')
+ xptr++;
+ *ptr = xptr;
+ return 1;
+ }
+ return 0;
+}
+
+static void show_control_id(snd_ctl_elem_id_t *id)
+{
+ unsigned int index, device, subdevice;
+ printf("numid=%u,iface=%s,name='%s'",
+ snd_ctl_elem_id_get_numid(id),
+ control_iface(id),
+ snd_ctl_elem_id_get_name(id));
+ index = snd_ctl_elem_id_get_index(id);
+ device = snd_ctl_elem_id_get_device(id);
+ subdevice = snd_ctl_elem_id_get_subdevice(id);
+ if (index)
+ printf(",index=%i", index);
+ if (device)
+ printf(",device=%i", device);
+ if (subdevice)
+ printf(",subdevice=%i", subdevice);
+}
+
+static void print_spaces(unsigned int spaces)
+{
+ while (spaces-- > 0)
+ putc(' ', stdout);
+}
+
+static void print_dB(long dB)
+{
+ printf("%li.%02lidB", dB / 100, (dB < 0 ? -dB : dB) % 100);
+}
+
+static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_size)
+{
+ unsigned int type = tlv[0];
+ unsigned int size;
+ unsigned int idx = 0;
+
+ if (tlv_size < 2 * sizeof(unsigned int)) {
+ printf("TLV size error!\n");
+ return;
+ }
+ print_spaces(spaces);
+ printf("| ");
+ type = tlv[idx++];
+ size = tlv[idx++];
+ tlv_size -= 2 * sizeof(unsigned int);
+ if (size > tlv_size) {
+ printf("TLV size error (%i, %i, %i)!\n", type, size, tlv_size);
+ return;
+ }
+ switch (type) {
+ case SND_CTL_TLVT_CONTAINER:
+ size += sizeof(unsigned int) -1;
+ size /= sizeof(unsigned int);
+ while (idx < size) {
+ if (tlv[idx+1] > (size - idx) * sizeof(unsigned int)) {
+ printf("TLV size error in compound!\n");
+ return;
+ }
+ decode_tlv(spaces + 2, tlv + idx, tlv[idx+1]);
+ idx += 2 + (tlv[1] + sizeof(unsigned int) - 1) / sizeof(unsigned int);
+ }
+ break;
+ case SND_CTL_TLVT_DB_SCALE:
+ printf("dBscale-");
+ if (size != 2 * sizeof(unsigned int)) {
+ while (size > 0) {
+ printf("0x%08x,", tlv[idx++]);
+ size -= sizeof(unsigned int);
+ }
+ } else {
+ printf("min=");
+ print_dB((int)tlv[2]);
+ printf(",step=");
+ print_dB(tlv[3] & 0xffff);
+ printf(",mute=%i", (tlv[3] >> 16) & 1);
+ }
+ break;
+#ifdef SND_CTL_TLVT_DB_LINEAR
+ case SND_CTL_TLVT_DB_LINEAR:
+ printf("dBlinear-");
+ if (size != 2 * sizeof(unsigned int)) {
+ while (size > 0) {
+ printf("0x%08x,", tlv[idx++]);
+ size -= sizeof(unsigned int);
+ }
+ } else {
+ printf("min=");
+ print_dB(tlv[2]);
+ printf(",max=");
+ print_dB(tlv[3]);
+ }
+ break;
+#endif
+#ifdef SND_CTL_TLVT_DB_RANGE
+ case SND_CTL_TLVT_DB_RANGE:
+ printf("dBrange-\n");
+ if ((size / (6 * sizeof(unsigned int))) != 0) {
+ while (size > 0) {
+ printf("0x%08x,", tlv[idx++]);
+ size -= sizeof(unsigned int);
+ }
+ break;
+ }
+ idx = 0;
+ while (idx < size) {
+ print_spaces(spaces + 2);
+ printf("rangemin=%i,", tlv[0]);
+ printf(",rangemax=%i\n", tlv[1]);
+ decode_tlv(spaces + 4, tlv + 2, 6 * sizeof(unsigned int));
+ idx += 6 * sizeof(unsigned int);
+ }
+ break;
+#endif
+ default:
+ printf("unk-%i-", type);
+ while (size > 0) {
+ printf("0x%08x,", tlv[idx++]);
+ size -= sizeof(unsigned int);
+ }
+ break;
+ }
+ putc('\n', stdout);
+}
+
+static int show_control(const char *space, snd_hctl_elem_t *elem,
+ int level)
+{
+ int err;
+ unsigned int item, idx, count, *tlv;
+ snd_ctl_elem_type_t type;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *control;
+ snd_aes_iec958_t iec958;
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_value_alloca(&control);
+ if ((err = snd_hctl_elem_info(elem, info)) < 0) {
+ error("Control %s snd_hctl_elem_info error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ if (level & LEVEL_ID) {
+ snd_hctl_elem_get_id(elem, id);
+ show_control_id(id);
+ printf("\n");
+ }
+ count = snd_ctl_elem_info_get_count(info);
+ type = snd_ctl_elem_info_get_type(info);
+ printf("%s; type=%s,access=%s,values=%i", space, control_type(info), control_access(info), count);
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ printf(",min=%li,max=%li,step=%li\n",
+ snd_ctl_elem_info_get_min(info),
+ snd_ctl_elem_info_get_max(info),
+ snd_ctl_elem_info_get_step(info));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ printf(",min=%Li,max=%Li,step=%Li\n",
+ snd_ctl_elem_info_get_min64(info),
+ snd_ctl_elem_info_get_max64(info),
+ snd_ctl_elem_info_get_step64(info));
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ {
+ unsigned int items = snd_ctl_elem_info_get_items(info);
+ printf(",items=%u\n", items);
+ for (item = 0; item < items; item++) {
+ snd_ctl_elem_info_set_item(info, item);
+ if ((err = snd_hctl_elem_info(elem, info)) < 0) {
+ error("Control %s element info error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ printf("%s; Item #%u '%s'\n", space, item, snd_ctl_elem_info_get_item_name(info));
+ }
+ break;
+ }
+ default:
+ printf("\n");
+ break;
+ }
+ if (level & LEVEL_BASIC) {
+ if ((err = snd_hctl_elem_read(elem, control)) < 0) {
+ error("Control %s element read error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ printf("%s: values=", space);
+ for (idx = 0; idx < count; idx++) {
+ if (idx > 0)
+ printf(",");
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ printf("%s", snd_ctl_elem_value_get_boolean(control, idx) ? "on" : "off");
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ printf("%li", snd_ctl_elem_value_get_integer(control, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ printf("%Li", snd_ctl_elem_value_get_integer64(control, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ printf("%u", snd_ctl_elem_value_get_enumerated(control, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ printf("0x%02x", snd_ctl_elem_value_get_byte(control, idx));
+ break;
+ case SND_CTL_ELEM_TYPE_IEC958:
+ snd_ctl_elem_value_get_iec958(control, &iec958);
+ printf("[AES0=0x%02x AES1=0x%02x AES2=0x%02x AES3=0x%02x]",
+ iec958.status[0], iec958.status[1],
+ iec958.status[2], iec958.status[3]);
+ break;
+ default:
+ printf("?");
+ break;
+ }
+ }
+ printf("\n");
+ if (!snd_ctl_elem_info_is_tlv_readable(info))
+ goto __skip_tlv;
+ tlv = malloc(4096);
+ if ((err = snd_hctl_elem_tlv_read(elem, tlv, 4096)) < 0) {
+ error("Control %s element TLV read error: %s\n", card, snd_strerror(err));
+ free(tlv);
+ return err;
+ }
+ decode_tlv(strlen(space), tlv, 4096);
+ free(tlv);
+ }
+ __skip_tlv:
+ return 0;
+}
+
+static int controls(int level)
+{
+ int err;
+ snd_hctl_t *handle;
+ snd_hctl_elem_t *elem;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_alloca(&info);
+
+ if ((err = snd_hctl_open(&handle, card, 0)) < 0) {
+ error("Control %s open error: %s", card, snd_strerror(err));
+ return err;
+ }
+ if ((err = snd_hctl_load(handle)) < 0) {
+ error("Control %s local error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ for (elem = snd_hctl_first_elem(handle); elem; elem = snd_hctl_elem_next(elem)) {
+ if ((err = snd_hctl_elem_info(elem, info)) < 0) {
+ error("Control %s snd_hctl_elem_info error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ if (!(level & LEVEL_INACTIVE) && snd_ctl_elem_info_is_inactive(info))
+ continue;
+ snd_hctl_elem_get_id(elem, id);
+ show_control_id(id);
+ printf("\n");
+ if (level & LEVEL_BASIC)
+ show_control(" ", elem, 1);
+ }
+ snd_hctl_close(handle);
+ return 0;
+}
+
+static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char *space, int level)
+{
+ snd_mixer_selem_channel_id_t chn;
+ long pmin = 0, pmax = 0;
+ long cmin = 0, cmax = 0;
+ long pvol, cvol;
+ int psw, csw;
+ int pmono, cmono, mono_ok = 0;
+ long db;
+ snd_mixer_elem_t *elem;
+
+ elem = snd_mixer_find_selem(handle, id);
+ if (!elem) {
+ error("Mixer %s simple element not found", card);
+ return -ENOENT;
+ }
+
+ if (level & LEVEL_BASIC) {
+ printf("%sCapabilities:", space);
+ if (snd_mixer_selem_has_common_volume(elem)) {
+ printf(" volume");
+ if (snd_mixer_selem_has_playback_volume_joined(elem))
+ printf(" volume-joined");
+ } else {
+ if (snd_mixer_selem_has_playback_volume(elem)) {
+ printf(" pvolume");
+ if (snd_mixer_selem_has_playback_volume_joined(elem))
+ printf(" pvolume-joined");
+ }
+ if (snd_mixer_selem_has_capture_volume(elem)) {
+ printf(" cvolume");
+ if (snd_mixer_selem_has_capture_volume_joined(elem))
+ printf(" cvolume-joined");
+ }
+ }
+ if (snd_mixer_selem_has_common_switch(elem)) {
+ printf(" switch");
+ if (snd_mixer_selem_has_playback_switch_joined(elem))
+ printf(" switch-joined");
+ } else {
+ if (snd_mixer_selem_has_playback_switch(elem)) {
+ printf(" pswitch");
+ if (snd_mixer_selem_has_playback_switch_joined(elem))
+ printf(" pswitch-joined");
+ }
+ if (snd_mixer_selem_has_capture_switch(elem)) {
+ printf(" cswitch");
+ if (snd_mixer_selem_has_capture_switch_joined(elem))
+ printf(" cswitch-joined");
+ if (snd_mixer_selem_has_capture_switch_exclusive(elem))
+ printf(" cswitch-exclusive");
+ }
+ }
+ if (snd_mixer_selem_is_enum_playback(elem)) {
+ printf(" penum");
+ } else if (snd_mixer_selem_is_enum_capture(elem)) {
+ printf(" cenum");
+ } else if (snd_mixer_selem_is_enumerated(elem)) {
+ printf(" enum");
+ }
+ printf("\n");
+ if (snd_mixer_selem_is_enumerated(elem)) {
+ int i, items;
+ unsigned int idx;
+ char itemname[40];
+ items = snd_mixer_selem_get_enum_items(elem);
+ printf(" Items:");
+ for (i = 0; i < items; i++) {
+ snd_mixer_selem_get_enum_item_name(elem, i, sizeof(itemname) - 1, itemname);
+ printf(" '%s'", itemname);
+ }
+ printf("\n");
+ for (i = 0; !snd_mixer_selem_get_enum_item(elem, i, &idx); i++) {
+ snd_mixer_selem_get_enum_item_name(elem, idx, sizeof(itemname) - 1, itemname);
+ printf(" Item%d: '%s'\n", i, itemname);
+ }
+ return 0; /* no more thing to do */
+ }
+ if (snd_mixer_selem_has_capture_switch_exclusive(elem))
+ printf("%sCapture exclusive group: %i\n", space,
+ snd_mixer_selem_get_capture_group(elem));
+ if (snd_mixer_selem_has_playback_volume(elem) ||
+ snd_mixer_selem_has_playback_switch(elem)) {
+ printf("%sPlayback channels:", space);
+ if (snd_mixer_selem_is_playback_mono(elem)) {
+ printf(" Mono");
+ } else {
+ int first = 1;
+ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
+ if (!snd_mixer_selem_has_playback_channel(elem, chn))
+ continue;
+ if (!first)
+ printf(" -");
+ printf(" %s", snd_mixer_selem_channel_name(chn));
+ first = 0;
+ }
+ }
+ printf("\n");
+ }
+ if (snd_mixer_selem_has_capture_volume(elem) ||
+ snd_mixer_selem_has_capture_switch(elem)) {
+ printf("%sCapture channels:", space);
+ if (snd_mixer_selem_is_capture_mono(elem)) {
+ printf(" Mono");
+ } else {
+ int first = 1;
+ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
+ if (!snd_mixer_selem_has_capture_channel(elem, chn))
+ continue;
+ if (!first)
+ printf(" -");
+ printf(" %s", snd_mixer_selem_channel_name(chn));
+ first = 0;
+ }
+ }
+ printf("\n");
+ }
+ if (snd_mixer_selem_has_playback_volume(elem) ||
+ snd_mixer_selem_has_capture_volume(elem)) {
+ printf("%sLimits:", space);
+ if (snd_mixer_selem_has_common_volume(elem)) {
+ snd_mixer_selem_get_playback_volume_range(elem, &pmin, &pmax);
+ snd_mixer_selem_get_capture_volume_range(elem, &cmin, &cmax);
+ printf(" %li - %li", pmin, pmax);
+ } else {
+ if (snd_mixer_selem_has_playback_volume(elem)) {
+ snd_mixer_selem_get_playback_volume_range(elem, &pmin, &pmax);
+ printf(" Playback %li - %li", pmin, pmax);
+ }
+ if (snd_mixer_selem_has_capture_volume(elem)) {
+ snd_mixer_selem_get_capture_volume_range(elem, &cmin, &cmax);
+ printf(" Capture %li - %li", cmin, cmax);
+ }
+ }
+ printf("\n");
+ }
+ pmono = snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_MONO) &&
+ (snd_mixer_selem_is_playback_mono(elem) ||
+ (!snd_mixer_selem_has_playback_volume(elem) &&
+ !snd_mixer_selem_has_playback_switch(elem)));
+ cmono = snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO) &&
+ (snd_mixer_selem_is_capture_mono(elem) ||
+ (!snd_mixer_selem_has_capture_volume(elem) &&
+ !snd_mixer_selem_has_capture_switch(elem)));
+#if 0
+ printf("pmono = %i, cmono = %i (%i, %i, %i, %i)\n", pmono, cmono,
+ snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO),
+ snd_mixer_selem_is_capture_mono(elem),
+ snd_mixer_selem_has_capture_volume(elem),
+ snd_mixer_selem_has_capture_switch(elem));
+#endif
+ if (pmono || cmono) {
+ if (!mono_ok) {
+ printf("%s%s:", space, "Mono");
+ mono_ok = 1;
+ }
+ if (snd_mixer_selem_has_common_volume(elem)) {
+ snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &pvol);
+ printf(" %s", get_percent(pvol, pmin, pmax));
+ if (!snd_mixer_selem_get_playback_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ if (snd_mixer_selem_has_common_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, SND_MIXER_SCHN_MONO, &psw);
+ printf(" [%s]", psw ? "on" : "off");
+ }
+ }
+ if (pmono && snd_mixer_selem_has_playback_channel(elem, SND_MIXER_SCHN_MONO)) {
+ int title = 0;
+ if (!mono_ok) {
+ printf("%s%s:", space, "Mono");
+ mono_ok = 1;
+ }
+ if (!snd_mixer_selem_has_common_volume(elem)) {
+ if (snd_mixer_selem_has_playback_volume(elem)) {
+ printf(" Playback");
+ title = 1;
+ snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &pvol);
+ printf(" %s", get_percent(pvol, pmin, pmax));
+ if (!snd_mixer_selem_get_playback_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ }
+ if (!snd_mixer_selem_has_common_switch(elem)) {
+ if (snd_mixer_selem_has_playback_switch(elem)) {
+ if (!title)
+ printf(" Playback");
+ snd_mixer_selem_get_playback_switch(elem, SND_MIXER_SCHN_MONO, &psw);
+ printf(" [%s]", psw ? "on" : "off");
+ }
+ }
+ }
+ if (cmono && snd_mixer_selem_has_capture_channel(elem, SND_MIXER_SCHN_MONO)) {
+ int title = 0;
+ if (!mono_ok) {
+ printf("%s%s:", space, "Mono");
+ mono_ok = 1;
+ }
+ if (!snd_mixer_selem_has_common_volume(elem)) {
+ if (snd_mixer_selem_has_capture_volume(elem)) {
+ printf(" Capture");
+ title = 1;
+ snd_mixer_selem_get_capture_volume(elem, SND_MIXER_SCHN_MONO, &cvol);
+ printf(" %s", get_percent(cvol, cmin, cmax));
+ if (!snd_mixer_selem_get_capture_dB(elem, SND_MIXER_SCHN_MONO, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ }
+ if (!snd_mixer_selem_has_common_switch(elem)) {
+ if (snd_mixer_selem_has_capture_switch(elem)) {
+ if (!title)
+ printf(" Capture");
+ snd_mixer_selem_get_capture_switch(elem, SND_MIXER_SCHN_MONO, &csw);
+ printf(" [%s]", csw ? "on" : "off");
+ }
+ }
+ }
+ if (pmono || cmono)
+ printf("\n");
+ if (!pmono || !cmono) {
+ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
+ if ((pmono || !snd_mixer_selem_has_playback_channel(elem, chn)) &&
+ (cmono || !snd_mixer_selem_has_capture_channel(elem, chn)))
+ continue;
+ printf("%s%s:", space, snd_mixer_selem_channel_name(chn));
+ if (!pmono && !cmono && snd_mixer_selem_has_common_volume(elem)) {
+ snd_mixer_selem_get_playback_volume(elem, chn, &pvol);
+ printf(" %s", get_percent(pvol, pmin, pmax));
+ if (!snd_mixer_selem_get_playback_dB(elem, chn, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ if (!pmono && !cmono && snd_mixer_selem_has_common_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &psw);
+ printf(" [%s]", psw ? "on" : "off");
+ }
+ if (!pmono && snd_mixer_selem_has_playback_channel(elem, chn)) {
+ int title = 0;
+ if (!snd_mixer_selem_has_common_volume(elem)) {
+ if (snd_mixer_selem_has_playback_volume(elem)) {
+ printf(" Playback");
+ title = 1;
+ snd_mixer_selem_get_playback_volume(elem, chn, &pvol);
+ printf(" %s", get_percent(pvol, pmin, pmax));
+ if (!snd_mixer_selem_get_playback_dB(elem, chn, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ }
+ if (!snd_mixer_selem_has_common_switch(elem)) {
+ if (snd_mixer_selem_has_playback_switch(elem)) {
+ if (!title)
+ printf(" Playback");
+ snd_mixer_selem_get_playback_switch(elem, chn, &psw);
+ printf(" [%s]", psw ? "on" : "off");
+ }
+ }
+ }
+ if (!cmono && snd_mixer_selem_has_capture_channel(elem, chn)) {
+ int title = 0;
+ if (!snd_mixer_selem_has_common_volume(elem)) {
+ if (snd_mixer_selem_has_capture_volume(elem)) {
+ printf(" Capture");
+ title = 1;
+ snd_mixer_selem_get_capture_volume(elem, chn, &cvol);
+ printf(" %s", get_percent(cvol, cmin, cmax));
+ if (!snd_mixer_selem_get_capture_dB(elem, chn, &db)) {
+ printf(" [");
+ print_dB(db);
+ printf("]");
+ }
+ }
+ }
+ if (!snd_mixer_selem_has_common_switch(elem)) {
+ if (snd_mixer_selem_has_capture_switch(elem)) {
+ if (!title)
+ printf(" Capture");
+ snd_mixer_selem_get_capture_switch(elem, chn, &csw);
+ printf(" [%s]", csw ? "on" : "off");
+ }
+ }
+ }
+ printf("\n");
+ }
+ }
+ }
+ return 0;
+}
+
+static int selems(int level)
+{
+ int err;
+ snd_mixer_t *handle;
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_elem_t *elem;
+ snd_mixer_selem_id_alloca(&sid);
+
+ if ((err = snd_mixer_open(&handle, 0)) < 0) {
+ error("Mixer %s open error: %s", card, snd_strerror(err));
+ return err;
+ }
+ if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) {
+ error("Mixer attach %s error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+ if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) {
+ error("Mixer register error: %s", snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+ err = snd_mixer_load(handle);
+ if (err < 0) {
+ error("Mixer %s load error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+ for (elem = snd_mixer_first_elem(handle); elem; elem = snd_mixer_elem_next(elem)) {
+ snd_mixer_selem_get_id(elem, sid);
+ if (!(level & LEVEL_INACTIVE) && !snd_mixer_selem_is_active(elem))
+ continue;
+ printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+ show_selem(handle, sid, " ", level);
+ }
+ snd_mixer_close(handle);
+ return 0;
+}
+
+static int parse_control_id(const char *str, snd_ctl_elem_id_t *id)
+{
+ int c, size, numid;
+ char *ptr;
+
+ while (*str == ' ' || *str == '\t')
+ str++;
+ if (!(*str))
+ return -EINVAL;
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); /* default */
+ while (*str) {
+ if (!strncasecmp(str, "numid=", 6)) {
+ str += 6;
+ numid = atoi(str);
+ if (numid <= 0) {
+ fprintf(stderr, "amixer: Invalid numid %d\n", numid);
+ return -EINVAL;
+ }
+ snd_ctl_elem_id_set_numid(id, atoi(str));
+ while (isdigit(*str))
+ str++;
+ } else if (!strncasecmp(str, "iface=", 6)) {
+ str += 6;
+ if (!strncasecmp(str, "card", 4)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_CARD);
+ str += 4;
+ } else if (!strncasecmp(str, "mixer", 5)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
+ str += 5;
+ } else if (!strncasecmp(str, "pcm", 3)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM);
+ str += 3;
+ } else if (!strncasecmp(str, "rawmidi", 7)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_RAWMIDI);
+ str += 7;
+ } else if (!strncasecmp(str, "timer", 5)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_TIMER);
+ str += 5;
+ } else if (!strncasecmp(str, "sequencer", 9)) {
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_SEQUENCER);
+ str += 9;
+ } else {
+ return -EINVAL;
+ }
+ } else if (!strncasecmp(str, "name=", 5)) {
+ char buf[64];
+ str += 5;
+ ptr = buf;
+ size = 0;
+ if (*str == '\'' || *str == '\"') {
+ c = *str++;
+ while (*str && *str != c) {
+ if (size < (int)sizeof(buf)) {
+ *ptr++ = *str;
+ size++;
+ }
+ str++;
+ }
+ if (*str == c)
+ str++;
+ } else {
+ while (*str && *str != ',') {
+ if (size < (int)sizeof(buf)) {
+ *ptr++ = *str;
+ size++;
+ }
+ str++;
+ }
+ *ptr = '\0';
+ }
+ snd_ctl_elem_id_set_name(id, buf);
+ } else if (!strncasecmp(str, "index=", 6)) {
+ str += 6;
+ snd_ctl_elem_id_set_index(id, atoi(str));
+ while (isdigit(*str))
+ str++;
+ } else if (!strncasecmp(str, "device=", 7)) {
+ str += 7;
+ snd_ctl_elem_id_set_device(id, atoi(str));
+ while (isdigit(*str))
+ str++;
+ } else if (!strncasecmp(str, "subdevice=", 10)) {
+ str += 10;
+ snd_ctl_elem_id_set_subdevice(id, atoi(str));
+ while (isdigit(*str))
+ str++;
+ }
+ if (*str == ',') {
+ str++;
+ } else {
+ if (*str)
+ return -EINVAL;
+ }
+ }
+ return 0;
+}
+
+static int parse_simple_id(const char *str, snd_mixer_selem_id_t *sid)
+{
+ int c, size;
+ char buf[128];
+ char *ptr = buf;
+
+ while (*str == ' ' || *str == '\t')
+ str++;
+ if (!(*str))
+ return -EINVAL;
+ size = 1; /* for '\0' */
+ if (*str != '"' && *str != '\'') {
+ while (*str && *str != ',') {
+ if (size < (int)sizeof(buf)) {
+ *ptr++ = *str;
+ size++;
+ }
+ str++;
+ }
+ } else {
+ c = *str++;
+ while (*str && *str != c) {
+ if (size < (int)sizeof(buf)) {
+ *ptr++ = *str;
+ size++;
+ }
+ str++;
+ }
+ if (*str == c)
+ str++;
+ }
+ if (*str == '\0') {
+ snd_mixer_selem_id_set_index(sid, 0);
+ *ptr = 0;
+ goto _set;
+ }
+ if (*str != ',')
+ return -EINVAL;
+ *ptr = 0; /* terminate the string */
+ str++;
+ if (!isdigit(*str))
+ return -EINVAL;
+ snd_mixer_selem_id_set_index(sid, atoi(str));
+ _set:
+ snd_mixer_selem_id_set_name(sid, buf);
+ return 0;
+}
+
+static int get_ctl_enum_item_index(snd_ctl_t *handle, snd_ctl_elem_info_t *info,
+ char **ptrp)
+{
+ char *ptr = *ptrp;
+ int items, i, len;
+ const char *name;
+
+ items = snd_ctl_elem_info_get_items(info);
+ if (items <= 0)
+ return -1;
+
+ for (i = 0; i < items; i++) {
+ snd_ctl_elem_info_set_item(info, i);
+ if (snd_ctl_elem_info(handle, info) < 0)
+ return -1;
+ name = snd_ctl_elem_info_get_item_name(info);
+ len = strlen(name);
+ if (! strncmp(name, ptr, len)) {
+ if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') {
+ ptr += len;
+ *ptrp = ptr;
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+static int cset(int argc, char *argv[], int roflag, int keep_handle)
+{
+ int err;
+ static snd_ctl_t *handle = NULL;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_value_t *control;
+ char *ptr;
+ unsigned int idx, count;
+ long tmp;
+ snd_ctl_elem_type_t type;
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_value_alloca(&control);
+
+ if (argc < 1) {
+ fprintf(stderr, "Specify a full control identifier: [[iface=<iface>,][name='name',][index=<index>,][device=<device>,][subdevice=<subdevice>]]|[numid=<numid>]\n");
+ return -EINVAL;
+ }
+ if (parse_control_id(argv[0], id)) {
+ fprintf(stderr, "Wrong control identifier: %s\n", argv[0]);
+ return -EINVAL;
+ }
+ if (debugflag) {
+ printf("VERIFY ID: ");
+ show_control_id(id);
+ printf("\n");
+ }
+ if (handle == NULL &&
+ (err = snd_ctl_open(&handle, card, 0)) < 0) {
+ error("Control %s open error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ snd_ctl_elem_info_set_id(info, id);
+ if ((err = snd_ctl_elem_info(handle, info)) < 0) {
+ if (ignore_error)
+ return 0;
+ error("Cannot find the given element from control %s\n", card);
+ if (! keep_handle) {
+ snd_ctl_close(handle);
+ handle = NULL;
+ }
+ return err;
+ }
+ snd_ctl_elem_info_get_id(info, id); /* FIXME: Remove it when hctl find works ok !!! */
+ type = snd_ctl_elem_info_get_type(info);
+ count = snd_ctl_elem_info_get_count(info);
+ snd_ctl_elem_value_set_id(control, id);
+
+ if (!roflag) {
+ ptr = argv[1];
+ for (idx = 0; idx < count && idx < 128 && ptr && *ptr; idx++) {
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ tmp = 0;
+ if (!strncasecmp(ptr, "on", 2) || !strncasecmp(ptr, "up", 2)) {
+ tmp = 1;
+ ptr += 2;
+ } else if (!strncasecmp(ptr, "yes", 3)) {
+ tmp = 1;
+ ptr += 3;
+ } else if (!strncasecmp(ptr, "toggle", 6)) {
+ tmp = snd_ctl_elem_value_get_boolean(control, idx);
+ tmp = tmp > 0 ? 0 : 1;
+ ptr += 6;
+ } else if (isdigit(*ptr)) {
+ tmp = atoi(ptr) > 0 ? 1 : 0;
+ while (isdigit(*ptr))
+ ptr++;
+ } else {
+ while (*ptr && *ptr != ',')
+ ptr++;
+ }
+ snd_ctl_elem_value_set_boolean(control, idx, tmp);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ tmp = get_integer(&ptr,
+ snd_ctl_elem_info_get_min(info),
+ snd_ctl_elem_info_get_max(info));
+ snd_ctl_elem_value_set_integer(control, idx, tmp);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ tmp = get_integer64(&ptr,
+ snd_ctl_elem_info_get_min64(info),
+ snd_ctl_elem_info_get_max64(info));
+ snd_ctl_elem_value_set_integer64(control, idx, tmp);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ tmp = get_ctl_enum_item_index(handle, info, &ptr);
+ if (tmp < 0)
+ tmp = get_integer(&ptr, 0, snd_ctl_elem_info_get_items(info) - 1);
+ snd_ctl_elem_value_set_enumerated(control, idx, tmp);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ tmp = get_integer(&ptr, 0, 255);
+ snd_ctl_elem_value_set_byte(control, idx, tmp);
+ break;
+ default:
+ break;
+ }
+ if (!strchr(argv[1], ','))
+ ptr = argv[1];
+ else if (*ptr == ',')
+ ptr++;
+ }
+ if ((err = snd_ctl_elem_write(handle, control)) < 0) {
+ if (!ignore_error)
+ error("Control %s element write error: %s\n", card, snd_strerror(err));
+ if (!keep_handle) {
+ snd_ctl_close(handle);
+ handle = NULL;
+ }
+ return ignore_error ? 0 : err;
+ }
+ }
+ if (! keep_handle) {
+ snd_ctl_close(handle);
+ handle = NULL;
+ }
+ if (!quiet) {
+ snd_hctl_t *hctl;
+ snd_hctl_elem_t *elem;
+ if ((err = snd_hctl_open(&hctl, card, 0)) < 0) {
+ error("Control %s open error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ if ((err = snd_hctl_load(hctl)) < 0) {
+ error("Control %s load error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ elem = snd_hctl_find_elem(hctl, id);
+ if (elem)
+ show_control(" ", elem, LEVEL_BASIC | LEVEL_ID);
+ else
+ printf("Could not find the specified element\n");
+ snd_hctl_close(hctl);
+ }
+ return 0;
+}
+
+typedef struct channel_mask {
+ char *name;
+ unsigned int mask;
+} channel_mask_t;
+static const channel_mask_t chanmask[] = {
+ {"frontleft", 1 << SND_MIXER_SCHN_FRONT_LEFT},
+ {"frontright", 1 << SND_MIXER_SCHN_FRONT_RIGHT},
+ {"frontcenter", 1 << SND_MIXER_SCHN_FRONT_CENTER},
+ {"front", ((1 << SND_MIXER_SCHN_FRONT_LEFT) |
+ (1 << SND_MIXER_SCHN_FRONT_RIGHT))},
+ {"center", 1 << SND_MIXER_SCHN_FRONT_CENTER},
+ {"rearleft", 1 << SND_MIXER_SCHN_REAR_LEFT},
+ {"rearright", 1 << SND_MIXER_SCHN_REAR_RIGHT},
+ {"rear", ((1 << SND_MIXER_SCHN_REAR_LEFT) |
+ (1 << SND_MIXER_SCHN_REAR_RIGHT))},
+ {"woofer", 1 << SND_MIXER_SCHN_WOOFER},
+ {NULL, 0}
+};
+
+static unsigned int channels_mask(char **arg, unsigned int def)
+{
+ const channel_mask_t *c;
+
+ for (c = chanmask; c->name; c++) {
+ if (strncasecmp(*arg, c->name, strlen(c->name)) == 0) {
+ while (**arg != '\0' && **arg != ',' && **arg != ' ' && **arg != '\t')
+ (*arg)++;
+ if (**arg == ',' || **arg == ' ' || **arg == '\t')
+ (*arg)++;
+ return c->mask;
+ }
+ }
+ return def;
+}
+
+static unsigned int dir_mask(char **arg, unsigned int def)
+{
+ int findend = 0;
+
+ if (strncasecmp(*arg, "playback", 8) == 0)
+ def = findend = 1;
+ else if (strncasecmp(*arg, "capture", 8) == 0)
+ def = findend = 2;
+ if (findend) {
+ while (**arg != '\0' && **arg != ',' && **arg != ' ' && **arg != '\t')
+ (*arg)++;
+ if (**arg == ',' || **arg == ' ' || **arg == '\t')
+ (*arg)++;
+ }
+ return def;
+}
+
+static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
+{
+ char *ptr = *ptrp;
+ int items, i, len;
+ char name[40];
+
+ items = snd_mixer_selem_get_enum_items(elem);
+ if (items <= 0)
+ return -1;
+
+ for (i = 0; i < items; i++) {
+ if (snd_mixer_selem_get_enum_item_name(elem, i, sizeof(name)-1, name) < 0)
+ continue;
+ len = strlen(name);
+ if (! strncmp(name, ptr, len)) {
+ if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') {
+ ptr += len;
+ *ptrp = ptr;
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
+{
+ unsigned int idx, chn = 0;
+ int check_flag = ignore_error ? 0 : -1;
+
+ for (idx = 1; idx < argc; idx++) {
+ char *ptr = argv[idx];
+ while (*ptr) {
+ int ival = get_enum_item_index(elem, &ptr);
+ if (ival < 0)
+ return check_flag;
+ if (snd_mixer_selem_set_enum_item(elem, chn, ival) >= 0)
+ check_flag = 1;
+ /* skip separators */
+ while (*ptr == ',' || isspace(*ptr))
+ ptr++;
+ }
+ }
+ return check_flag;
+}
+
+static int sset_channels(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
+{
+ unsigned int channels = ~0U;
+ unsigned int dir = 3, okflag = 3;
+ unsigned int idx;
+ snd_mixer_selem_channel_id_t chn;
+ int check_flag = ignore_error ? 0 : -1;
+
+ for (idx = 1; idx < argc; idx++) {
+ char *ptr = argv[idx], *optr;
+ int multi, firstchn = 1;
+ channels = channels_mask(&ptr, channels);
+ if (*ptr == '\0')
+ continue;
+ dir = dir_mask(&ptr, dir);
+ if (*ptr == '\0')
+ continue;
+ multi = (strchr(ptr, ',') != NULL);
+ optr = ptr;
+ for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
+ char *sptr = NULL;
+ int ival;
+
+ if (!(channels & (1 << chn)))
+ continue;
+
+ if ((dir & 1) && snd_mixer_selem_has_playback_channel(elem, chn)) {
+ sptr = ptr;
+ if (!strncmp(ptr, "mute", 4) && snd_mixer_selem_has_playback_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "mute", 1, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "off", 3) && snd_mixer_selem_has_playback_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "off", 1, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "unmute", 6) && snd_mixer_selem_has_playback_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "unmute", 0, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "on", 2) && snd_mixer_selem_has_playback_switch(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_playback_switch(elem, chn, get_bool_simple(&ptr, "on", 0, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "toggle", 6) && snd_mixer_selem_has_playback_switch(elem)) {
+ if (firstchn || !snd_mixer_selem_has_playback_switch_joined(elem)) {
+ snd_mixer_selem_get_playback_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_playback_switch(elem, chn, (ival ? 1 : 0) ^ 1) >= 0)
+ check_flag = 1;
+ }
+ simple_skip_word(&ptr, "toggle");
+ } else if (isdigit(*ptr) || *ptr == '-' || *ptr == '+') {
+ if (set_volume_simple(elem, chn, &ptr, 0) >= 0)
+ check_flag = 1;
+ } else if (simple_skip_word(&ptr, "cap") || simple_skip_word(&ptr, "rec") ||
+ simple_skip_word(&ptr, "nocap") || simple_skip_word(&ptr, "norec")) {
+ /* nothing */
+ } else {
+ okflag &= ~1;
+ }
+ }
+ if ((dir & 2) && snd_mixer_selem_has_capture_channel(elem, chn)) {
+ if (sptr != NULL)
+ ptr = sptr;
+ sptr = ptr;
+ if (!strncmp(ptr, "cap", 3) && snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "cap", 0, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "rec", 3) && snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "rec", 0, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "nocap", 5) && snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "nocap", 1, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "norec", 5) && snd_mixer_selem_has_capture_switch(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_capture_switch(elem, chn, get_bool_simple(&ptr, "norec", 1, ival)) >= 0)
+ check_flag = 1;
+ } else if (!strncmp(ptr, "toggle", 6) && snd_mixer_selem_has_capture_switch(elem)) {
+ if (firstchn || !snd_mixer_selem_has_capture_switch_joined(elem)) {
+ snd_mixer_selem_get_capture_switch(elem, chn, &ival);
+ if (snd_mixer_selem_set_capture_switch(elem, chn, (ival ? 1 : 0) ^ 1) >= 0)
+ check_flag = 1;
+ }
+ simple_skip_word(&ptr, "toggle");
+ } else if (isdigit(*ptr) || *ptr == '-' || *ptr == '+') {
+ if (set_volume_simple(elem, chn, &ptr, 1) >= 0)
+ check_flag = 1;
+ } else if (simple_skip_word(&ptr, "mute") || simple_skip_word(&ptr, "off") ||
+ simple_skip_word(&ptr, "unmute") || simple_skip_word(&ptr, "on")) {
+ /* nothing */
+ } else {
+ okflag &= ~2;
+ }
+ }
+ if (okflag == 0) {
+ if (debugflag) {
+ if (dir & 1)
+ error("Unknown playback setup '%s'..", ptr);
+ if (dir & 2)
+ error("Unknown capture setup '%s'..", ptr);
+ }
+ return 0; /* just skip it */
+ }
+ if (!multi)
+ ptr = optr;
+ firstchn = 0;
+ }
+ }
+ return check_flag;
+}
+
+static int sset(unsigned int argc, char *argv[], int roflag, int keep_handle)
+{
+ int err = 0;
+ static snd_mixer_t *handle = NULL;
+ snd_mixer_elem_t *elem;
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_id_alloca(&sid);
+
+ if (argc < 1) {
+ fprintf(stderr, "Specify a scontrol identifier: 'name',index\n");
+ return 1;
+ }
+ if (parse_simple_id(argv[0], sid)) {
+ fprintf(stderr, "Wrong scontrol identifier: %s\n", argv[0]);
+ return 1;
+ }
+ if (!roflag && argc < 2) {
+ fprintf(stderr, "Specify what you want to set...\n");
+ return 1;
+ }
+ if (handle == NULL) {
+ if ((err = snd_mixer_open(&handle, 0)) < 0) {
+ error("Mixer %s open error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) {
+ error("Mixer attach %s error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ handle = NULL;
+ return err;
+ }
+ if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) {
+ error("Mixer register error: %s", snd_strerror(err));
+ snd_mixer_close(handle);
+ handle = NULL;
+ return err;
+ }
+ err = snd_mixer_load(handle);
+ if (err < 0) {
+ error("Mixer %s load error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ handle = NULL;
+ return err;
+ }
+ }
+ elem = snd_mixer_find_selem(handle, sid);
+ if (!elem) {
+ if (ignore_error)
+ return 0;
+ error("Unable to find simple control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+ snd_mixer_close(handle);
+ handle = NULL;
+ return -ENOENT;
+ }
+ if (!roflag) {
+ /* enum control */
+ if (snd_mixer_selem_is_enumerated(elem))
+ err = sset_enum(elem, argc, argv);
+ else
+ err = sset_channels(elem, argc, argv);
+
+ if (!err)
+ goto done;
+ if (err < 0) {
+ error("Invalid command!");
+ goto done;
+ }
+ }
+ if (!quiet) {
+ printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+ show_selem(handle, sid, " ", 1);
+ }
+ done:
+ if (! keep_handle) {
+ snd_mixer_close(handle);
+ handle = NULL;
+ }
+ return err < 0 ? 1 : 0;
+}
+
+static void events_info(snd_hctl_elem_t *helem)
+{
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_id_alloca(&id);
+ snd_hctl_elem_get_id(helem, id);
+ printf("event info: ");
+ show_control_id(id);
+ printf("\n");
+}
+
+static void events_value(snd_hctl_elem_t *helem)
+{
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_id_alloca(&id);
+ snd_hctl_elem_get_id(helem, id);
+ printf("event value: ");
+ show_control_id(id);
+ printf("\n");
+}
+
+static void events_remove(snd_hctl_elem_t *helem)
+{
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_id_alloca(&id);
+ snd_hctl_elem_get_id(helem, id);
+ printf("event remove: ");
+ show_control_id(id);
+ printf("\n");
+}
+
+static int element_callback(snd_hctl_elem_t *elem, unsigned int mask)
+{
+ if (mask == SND_CTL_EVENT_MASK_REMOVE) {
+ events_remove(elem);
+ return 0;
+ }
+ if (mask & SND_CTL_EVENT_MASK_INFO)
+ events_info(elem);
+ if (mask & SND_CTL_EVENT_MASK_VALUE)
+ events_value(elem);
+ return 0;
+}
+
+static void events_add(snd_hctl_elem_t *helem)
+{
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_id_alloca(&id);
+ snd_hctl_elem_get_id(helem, id);
+ printf("event add: ");
+ show_control_id(id);
+ printf("\n");
+ snd_hctl_elem_set_callback(helem, element_callback);
+}
+
+static int ctl_callback(snd_hctl_t *ctl, unsigned int mask,
+ snd_hctl_elem_t *elem)
+{
+ if (mask & SND_CTL_EVENT_MASK_ADD)
+ events_add(elem);
+ return 0;
+}
+
+static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
+{
+ snd_hctl_t *handle;
+ snd_hctl_elem_t *helem;
+ int err;
+
+ if ((err = snd_hctl_open(&handle, card, 0)) < 0) {
+ error("Control %s open error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ snd_hctl_set_callback(handle, ctl_callback);
+ if ((err = snd_hctl_load(handle)) < 0) {
+ error("Control %s hbuild error: %s\n", card, snd_strerror(err));
+ return err;
+ }
+ for (helem = snd_hctl_first_elem(handle); helem; helem = snd_hctl_elem_next(helem)) {
+ snd_hctl_elem_set_callback(helem, element_callback);
+ }
+ printf("Ready to listen...\n");
+ while (1) {
+ int res = snd_hctl_wait(handle, -1);
+ if (res >= 0) {
+ printf("Poll ok: %i\n", res);
+ res = snd_hctl_handle_events(handle);
+ assert(res > 0);
+ }
+ }
+ snd_hctl_close(handle);
+ return 0;
+}
+
+static void sevents_value(snd_mixer_selem_id_t *sid)
+{
+ printf("event value: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+}
+
+static void sevents_info(snd_mixer_selem_id_t *sid)
+{
+ printf("event info: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+}
+
+static void sevents_remove(snd_mixer_selem_id_t *sid)
+{
+ printf("event remove: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+}
+
+static int melem_event(snd_mixer_elem_t *elem, unsigned int mask)
+{
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_id_alloca(&sid);
+ snd_mixer_selem_get_id(elem, sid);
+ if (mask == SND_CTL_EVENT_MASK_REMOVE) {
+ sevents_remove(sid);
+ return 0;
+ }
+ if (mask & SND_CTL_EVENT_MASK_INFO)
+ sevents_info(sid);
+ if (mask & SND_CTL_EVENT_MASK_VALUE)
+ sevents_value(sid);
+ return 0;
+}
+
+static void sevents_add(snd_mixer_elem_t *elem)
+{
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_id_alloca(&sid);
+ snd_mixer_selem_get_id(elem, sid);
+ printf("event add: '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
+ snd_mixer_elem_set_callback(elem, melem_event);
+}
+
+static int mixer_event(snd_mixer_t *mixer, unsigned int mask,
+ snd_mixer_elem_t *elem)
+{
+ if (mask & SND_CTL_EVENT_MASK_ADD)
+ sevents_add(elem);
+ return 0;
+}
+
+static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
+{
+ snd_mixer_t *handle;
+ int err;
+
+ if ((err = snd_mixer_open(&handle, 0)) < 0) {
+ error("Mixer %s open error: %s", card, snd_strerror(err));
+ return err;
+ }
+ if (smixer_level == 0 && (err = snd_mixer_attach(handle, card)) < 0) {
+ error("Mixer attach %s error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+ if ((err = snd_mixer_selem_register(handle, smixer_level > 0 ? &smixer_options : NULL, NULL)) < 0) {
+ error("Mixer register error: %s", snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+ snd_mixer_set_callback(handle, mixer_event);
+ err = snd_mixer_load(handle);
+ if (err < 0) {
+ error("Mixer %s load error: %s", card, snd_strerror(err));
+ snd_mixer_close(handle);
+ return err;
+ }
+
+ printf("Ready to listen...\n");
+ while (1) {
+ int res;
+ res = snd_mixer_wait(handle, -1);
+ if (res >= 0) {
+ printf("Poll ok: %i\n", res);
+ res = snd_mixer_handle_events(handle);
+ assert(res >= 0);
+ }
+ }
+ snd_mixer_close(handle);
+ return 0;
+}
+
+/*
+ * split a line into tokens
+ * the content in the line buffer is modified
+ */
+static int split_line(char *buf, char **token, int max_token)
+{
+ char *dst;
+ int n, esc, quote;
+
+ for (n = 0; n < max_token; n++) {
+ while (isspace(*buf))
+ buf++;
+ if (! *buf || *buf == '\n')
+ return n;
+ /* skip comments */
+ if (*buf == '#' || *buf == '!')
+ return n;
+ esc = 0;
+ quote = 0;
+ token[n] = buf;
+ for (dst = buf; *buf && *buf != '\n'; buf++) {
+ if (esc)
+ esc = 0;
+ else if (isspace(*buf) && !quote) {
+ buf++;
+ break;
+ } else if (*buf == '\\') {
+ esc = 1;
+ continue;
+ } else if (*buf == '\'' || *buf == '"') {
+ if (! quote) {
+ quote = *buf;
+ continue;
+ } else if (*buf == quote) {
+ quote = 0;
+ continue;
+ }
+ }
+ *dst++ = *buf;
+ }
+ *dst = 0;
+ }
+ return n;
+}
+
+#define MAX_ARGS 32
+
+static int exec_stdin(void)
+{
+ int narg;
+ char buf[256], *args[MAX_ARGS];
+ int err = 0;
+
+ /* quiet = 1; */
+ ignore_error = 1;
+
+ while (fgets(buf, sizeof(buf), stdin)) {
+ narg = split_line(buf, args, MAX_ARGS);
+ if (narg > 0) {
+ if (!strcmp(args[0], "sset") || !strcmp(args[0], "set"))
+ err = sset(narg - 1, args + 1, 0, 1);
+ else if (!strcmp(args[0], "cset"))
+ err = cset(narg - 1, args + 1, 0, 1);
+ if (err < 0)
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+int main(int argc, char *argv[])
+{
+ int morehelp, level = 0;
+ int read_stdin = 0;
+ static const struct option long_option[] =
+ {
+ {"help", 0, NULL, 'h'},
+ {"card", 1, NULL, 'c'},
+ {"device", 1, NULL, 'D'},
+ {"quiet", 0, NULL, 'q'},
+ {"inactive", 0, NULL, 'i'},
+ {"debug", 0, NULL, 'd'},
+ {"nocheck", 0, NULL, 'n'},
+ {"version", 0, NULL, 'v'},
+ {"abstract", 1, NULL, 'a'},
+ {"stdin", 0, NULL, 's'},
+ {NULL, 0, NULL, 0},
+ };
+
+ morehelp = 0;
+ while (1) {
+ int c;
+
+ if ((c = getopt_long(argc, argv, "hc:D:qidnva:s", long_option, NULL)) < 0)
+ break;
+ switch (c) {
+ case 'h':
+ help();
+ return 0;
+ case 'c':
+ {
+ int i;
+ i = snd_card_get_index(optarg);
+ if (i >= 0 && i < 32)
+ sprintf(card, "hw:%i", i);
+ else {
+ fprintf(stderr, "Invalid card number.\n");
+ morehelp++;
+ }
+ }
+ break;
+ case 'D':
+ strncpy(card, optarg, sizeof(card)-1);
+ card[sizeof(card)-1] = '\0';
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 'i':
+ level |= LEVEL_INACTIVE;
+ break;
+ case 'd':
+ debugflag = 1;
+ break;
+ case 'n':
+ no_check = 1;
+ break;
+ case 'v':
+ printf("amixer version " SND_UTIL_VERSION_STR "\n");
+ return 1;
+ case 'a':
+ smixer_level = 1;
+ memset(&smixer_options, 0, sizeof(smixer_options));
+ smixer_options.ver = 1;
+ if (!strcmp(optarg, "none"))
+ smixer_options.abstract = SND_MIXER_SABSTRACT_NONE;
+ else if (!strcmp(optarg, "basic"))
+ smixer_options.abstract = SND_MIXER_SABSTRACT_BASIC;
+ else {
+ fprintf(stderr, "Select correct abstraction level (none or basic)...\n");
+ morehelp++;
+ }
+ break;
+ case 's':
+ read_stdin = 1;
+ break;
+ default:
+ fprintf(stderr, "Invalid switch or option needs an argument.\n");
+ morehelp++;
+ }
+ }
+ if (morehelp) {
+ help();
+ return 1;
+ }
+ smixer_options.device = card;
+
+ if (read_stdin)
+ return exec_stdin();
+
+ if (argc - optind <= 0) {
+ return selems(LEVEL_BASIC | level) ? 1 : 0;
+ }
+ if (!strcmp(argv[optind], "help")) {
+ return help() ? 1 : 0;
+ } else if (!strcmp(argv[optind], "info")) {
+ return info() ? 1 : 0;
+ } else if (!strcmp(argv[optind], "controls")) {
+ return controls(level) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "contents")) {
+ return controls(LEVEL_BASIC | level) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "scontrols") || !strcmp(argv[optind], "simple")) {
+ return selems(level) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "scontents")) {
+ return selems(LEVEL_BASIC | level) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "sset") || !strcmp(argv[optind], "set")) {
+ return sset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 0, 0) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "sget") || !strcmp(argv[optind], "get")) {
+ return sset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 1, 0) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "cset")) {
+ return cset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 0, 0) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "cget")) {
+ return cset(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL, 1, 0) ? 1 : 0;
+ } else if (!strcmp(argv[optind], "events")) {
+ return events(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL);
+ } else if (!strcmp(argv[optind], "sevents")) {
+ return sevents(argc - optind - 1, argc - optind > 1 ? argv + optind + 1 : NULL);
+ } else {
+ fprintf(stderr, "amixer: Unknown command '%s'...\n", argv[optind]);
+ }
+
+ return 0;
+}
diff --git a/alsa-utils/amixer/amixer.h b/alsa-utils/amixer/amixer.h
new file mode 100644
index 0000000..3588f04
--- /dev/null
+++ b/alsa-utils/amixer/amixer.h
@@ -0,0 +1,21 @@
+/*
+ * ALSA command line mixer utility
+ * Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "../include/version.h"
diff --git a/alsa-utils/android/aconfig.h b/alsa-utils/android/aconfig.h
new file mode 100644
index 0000000..1ac3aa0
--- /dev/null
+++ b/alsa-utils/android/aconfig.h
@@ -0,0 +1,14 @@
+
+#define DATADIR "/system/usr/share/alsa"
+
+#define rindex strrchr
+#define open64 open
+
+//typedef int off64_t;
+
+#undef __swab16
+#define __swab16(x) __arch__swab16((x))
+
+#undef __swab32
+#define __swab32(x) __arch__swab32((x))
+
diff --git a/alsa-utils/android/sys/signal.h b/alsa-utils/android/sys/signal.h
new file mode 100644
index 0000000..4b80dde
--- /dev/null
+++ b/alsa-utils/android/sys/signal.h
@@ -0,0 +1,2 @@
+#include <signal.h>
+
diff --git a/alsa-utils/aplay/Makefile.am b/alsa-utils/aplay/Makefile.am
new file mode 100644
index 0000000..60811de
--- /dev/null
+++ b/alsa-utils/aplay/Makefile.am
@@ -0,0 +1,29 @@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBINTL)
+
+# debug flags
+#LDFLAGS = -static
+#LDADD += -ldl
+
+bin_PROGRAMS = aplay
+man_MANS = aplay.1 arecord.1
+noinst_HEADERS = formats.h
+
+EXTRA_DIST = aplay.1 arecord.1
+EXTRA_CLEAN = arecord
+
+arecord: aplay
+ rm -f arecord
+ $(LN_S) $< $@
+
+arecord.1: aplay.1
+ rm -f arecord.1
+ $(LN_S) $< $@
+
+install-exec-hook: arecord
+ rm -f $(DESTDIR)$(bindir)/arecord
+ (cd $(DESTDIR)$(bindir) && $(LN_S) aplay arecord)
+
+install-data-hook:
+ rm -f $(DESTDIR)$(mandir)/man1/arecord.1
+ (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) aplay.1 arecord.1)
diff --git a/alsa-utils/aplay/Makefile.in b/alsa-utils/aplay/Makefile.in
new file mode 100644
index 0000000..6a35153
--- /dev/null
+++ b/alsa-utils/aplay/Makefile.in
@@ -0,0 +1,527 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aplay$(EXEEXT)
+subdir = aplay
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+aplay_SOURCES = aplay.c
+aplay_OBJECTS = aplay.$(OBJEXT)
+aplay_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+aplay_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = aplay.c
+DIST_SOURCES = aplay.c
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = $(LIBINTL)
+man_MANS = aplay.1 arecord.1
+noinst_HEADERS = formats.h
+EXTRA_DIST = aplay.1 arecord.1
+EXTRA_CLEAN = arecord
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign aplay/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign aplay/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+aplay$(EXEEXT): $(aplay_OBJECTS) $(aplay_DEPENDENCIES)
+ @rm -f aplay$(EXEEXT)
+ $(LINK) $(aplay_LDFLAGS) $(aplay_OBJECTS) $(aplay_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aplay.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-data-hook install-exec \
+ install-exec-am install-exec-hook install-info install-info-am \
+ install-man install-man1 install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-info-am \
+ uninstall-man uninstall-man1
+
+
+arecord: aplay
+ rm -f arecord
+ $(LN_S) $< $@
+
+arecord.1: aplay.1
+ rm -f arecord.1
+ $(LN_S) $< $@
+
+install-exec-hook: arecord
+ rm -f $(DESTDIR)$(bindir)/arecord
+ (cd $(DESTDIR)$(bindir) && $(LN_S) aplay arecord)
+
+install-data-hook:
+ rm -f $(DESTDIR)$(mandir)/man1/arecord.1
+ (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) aplay.1 arecord.1)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/aplay/aplay.1 b/alsa-utils/aplay/aplay.1
new file mode 100644
index 0000000..7759347
--- /dev/null
+++ b/alsa-utils/aplay/aplay.1
@@ -0,0 +1,160 @@
+.TH APLAY 1 "2 August 2001"
+.SH NAME
+arecord, aplay \- command-line sound recorder and player for ALSA
+soundcard driver
+.SH SYNOPSIS
+\fBarecord\fP [\fIflags\fP] [filename]
+.br
+\fBaplay\fP [\fIflags\fP] [filename [filename]] ...
+
+.SH DESCRIPTION
+\fBarecord\fP is a command-line soundfile recorder for the ALSA soundcard
+driver. It supports several file formats and multiple soundcards with
+multiple devices. If recording with interleaved mode samples the file is
+automatically split before the 2GB filesize.
+
+\fBaplay\fP is much the same, only it plays instead of recording. For
+supported soundfile formats, the sampling rate, bit depth, and so
+forth can be automatically determined from the soundfile header.
+
+If filename is not specified, the standard output or input is used. The \fBaplay\fP utility accepts multiple filenames.
+
+.SH OPTIONS
+.TP
+\fI\-h, \-\-help\fP
+Help: show syntax.
+.TP
+\fI\-\-version\fP
+Print current version.
+.TP
+\fI\-l, \-\-list\-devices\fP
+List all soundcards and digital audio devices
+.TP
+\fI\-L, \-\-list\-pcms\fP
+List all PCMs defined
+.TP
+\fI\-D, \-\-device=NAME\fP
+Select PCM by name
+.TP
+\fI\-q \-\-quiet\fP
+Quiet mode. Suppress messages (not sound :))
+.TP
+\fI\-t, \-\-file\-type TYPE\fP
+File type (voc, wav, raw or au).
+If this parameter is omitted the WAVE format is used.
+.TP
+\fI\-c, \-\-channels=#\fP
+The number of channels.
+The default is one channel.
+.TP
+\fI\-f \-\-format=FORMAT\fP
+Sample format
+.br
+Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE
+S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE
+FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW
+A_LAW IMA_ADPCM MPEG GSM
+.br
+Some of these may not be available on selected hardware
+.br
+There are also two format shortcuts available:
+.nf
+\-f cd (16 bit little endian, 44100, stereo [\-f S16_LE \-c2 \-r44100]
+\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000]
+.fi
+If no format is given U8 is used.
+.TP
+\fI\-r, \-\-rate=#<Hz>\fP
+Sampling rate in Hertz. The default rate is 8000 Hertz.
+.TP
+\fI\-d, \-\-duration=#\fP
+Interrupt after # seconds.
+A value of zero means infinity.
+The default is zero, so if this option is omitted then the arecord process will run until it is killed.
+.TP
+\fI\-s, \-\-sleep\-min=#\fP
+Min ticks to sleep. The default is not to sleep.
+.TP
+\fI\-M, \-\-mmap\fP
+Use memory-mapped (mmap) I/O mode for the audio stream.
+If this option is not set, the read/write I/O mode will be used.
+.TP
+\fI\-N, \-\-nonblock\fP
+Open the audio device in non-blocking mode. If the device is busy the program will exit immediately.
+If this option is not set the program will block until the audio device is available again.
+.TP
+\fI\-F, \-\-period\-time=#\fP
+Distance between interrupts is # microseconds.
+If no period time and no period size is given then a quarter of the buffer time is set.
+.TP
+\fI\-B, \-\-buffer\-time=#\fP
+Buffer duration is # microseconds
+If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set.
+.TP
+\fI\-\-period\-size=#\fP
+Distance between interrupts is # frames
+If no period size and no period time is given then a quarter of the buffer size is set.
+.TP
+\fI\-\-buffer\-size=#\fP
+Buffer duration is # frames
+If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set.
+.TP
+\fI\-A, \-\-avail\-min=#\fP
+Min available space for wakeup is # microseconds
+.TP
+\fI\-R, \-\-start\-delay=#\fP
+Delay for automatic PCM start is # microseconds
+(relative to buffer size if <= 0)
+.TP
+\fI\-T, \-\-stop\-delay=#\fP
+Delay for automatic PCM stop is # microseconds from xrun
+.TP
+\fI\-v, \-\-verbose\fP
+Show PCM structure and setup.
+This option is accumulative. The VU meter is displayed when this
+is given twice or three times.
+.TP
+\fI\-V, \-\-vumeter=TYPE\fP
+Specifies the VU-meter type, either \fIstereo\fP or \fImono\fP.
+The stereo VU-meter is available only for 2-channel stereo samples
+with interleaved format.
+.TP
+\fI\-I, \-\-separate\-channels\fP
+One file for each channel
+
+.SS
+Example:
+
+.TP
+\fBaplay \-c 1 \-t raw \-r 22050 \-f mu_law foobar\fR
+will play the raw file "foobar" as a
+22050-Hz, mono, 8-bit, Mu-Law .au file.
+
+.TP
+\fBarecord \-d 10 \-f cd \-t wav \-D copy foobar.wav\fP
+will record foobar.wav as a 10-second, CD-quality wave file, using the
+PCM "copy" (which might be defined in the user's .asoundrc file as:
+.nf
+pcm.copy {
+ type plug
+ slave {
+ pcm hw
+ }
+ route_policy copy
+}
+.fi
+
+.SH SEE ALSO
+\fB
+alsamixer(1),
+amixer(1)
+\fP
+
+.SH BUGS
+Note that .aiff files are not currently supported.
+
+.SH AUTHOR
+\fBarecord\fP and \fBaplay\fP are by Jaroslav Kysela <perex@perex.cz>
+This document is by Paul Winkler <zarmzarm@erols.com>.
+Updated for Alsa 0.9 by James Tappin <james@xena.uklinux.net>
+
diff --git a/alsa-utils/aplay/aplay.c b/alsa-utils/aplay/aplay.c
new file mode 100644
index 0000000..837e46a
--- /dev/null
+++ b/alsa-utils/aplay/aplay.c
@@ -0,0 +1,2565 @@
+/*
+ * aplay.c - plays and records
+ *
+ * CREATIVE LABS CHANNEL-files
+ * Microsoft WAVE-files
+ * SPARC AUDIO .AU-files
+ * Raw Data
+ *
+ * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
+ * Based on vplay program by Michael Beck
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <getopt.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <time.h>
+#include <locale.h>
+#include <alsa/asoundlib.h>
+#include <assert.h>
+#include <sys/poll.h>
+#include <sys/uio.h>
+#include <sys/time.h>
+#include <sys/signal.h>
+#include <asm/byteorder.h>
+#include "aconfig.h"
+#include "gettext.h"
+#include "formats.h"
+#include "version.h"
+
+#ifndef LLONG_MAX
+#define LLONG_MAX 9223372036854775807LL
+#endif
+
+#define DEFAULT_FORMAT SND_PCM_FORMAT_U8
+#define DEFAULT_SPEED 8000
+
+#define FORMAT_DEFAULT -1
+#define FORMAT_RAW 0
+#define FORMAT_VOC 1
+#define FORMAT_WAVE 2
+#define FORMAT_AU 3
+
+/* global data */
+
+static snd_pcm_sframes_t (*readi_func)(snd_pcm_t *handle, void *buffer, snd_pcm_uframes_t size);
+static snd_pcm_sframes_t (*writei_func)(snd_pcm_t *handle, const void *buffer, snd_pcm_uframes_t size);
+static snd_pcm_sframes_t (*readn_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size);
+static snd_pcm_sframes_t (*writen_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size);
+
+enum {
+ VUMETER_NONE,
+ VUMETER_MONO,
+ VUMETER_STEREO
+};
+
+static char *command;
+static snd_pcm_t *handle;
+static struct {
+ snd_pcm_format_t format;
+ unsigned int channels;
+ unsigned int rate;
+} hwparams, rhwparams;
+static int timelimit = 0;
+static int quiet_mode = 0;
+static int file_type = FORMAT_DEFAULT;
+static int open_mode = 0;
+static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
+static int mmap_flag = 0;
+static int interleaved = 1;
+static int nonblock = 0;
+static u_char *audiobuf = NULL;
+static snd_pcm_uframes_t chunk_size = 0;
+static unsigned period_time = 0;
+static unsigned buffer_time = 0;
+static snd_pcm_uframes_t period_frames = 0;
+static snd_pcm_uframes_t buffer_frames = 0;
+static int avail_min = -1;
+static int start_delay = 0;
+static int stop_delay = 0;
+static int verbose = 0;
+static int vumeter = VUMETER_NONE;
+static int buffer_pos = 0;
+static size_t bits_per_sample, bits_per_frame;
+static size_t chunk_bytes;
+static int test_position = 0;
+static snd_output_t *log;
+
+static int fd = -1;
+static off64_t pbrec_count = LLONG_MAX, fdcount;
+static int vocmajor, vocminor;
+
+/* needed prototypes */
+
+static void playback(char *filename);
+static void capture(char *filename);
+static void playbackv(char **filenames, unsigned int count);
+static void capturev(char **filenames, unsigned int count);
+
+static void begin_voc(int fd, size_t count);
+static void end_voc(int fd);
+static void begin_wave(int fd, size_t count);
+static void end_wave(int fd);
+static void begin_au(int fd, size_t count);
+static void end_au(int fd);
+
+static const struct fmt_capture {
+ void (*start) (int fd, size_t count);
+ void (*end) (int fd);
+ char *what;
+ long long max_filesize;
+} fmt_rec_table[] = {
+ { NULL, NULL, N_("raw data"), LLONG_MAX },
+ { begin_voc, end_voc, N_("VOC"), 16000000LL },
+ /* FIXME: can WAV handle exactly 2GB or less than it? */
+ { begin_wave, end_wave, N_("WAVE"), 2147483648LL },
+ { begin_au, end_au, N_("Sparc Audio"), LLONG_MAX }
+};
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define error(...) do {\
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ putc('\n', stderr); \
+} while (0)
+#else
+#define error(args...) do {\
+ fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##args); \
+ putc('\n', stderr); \
+} while (0)
+#endif
+
+static void usage(char *command)
+{
+ snd_pcm_format_t k;
+ printf(
+_("Usage: %s [OPTION]... [FILE]...\n"
+"\n"
+"-h, --help help\n"
+" --version print current version\n"
+"-l, --list-devices list all soundcards and digital audio devices\n"
+"-L, --list-pcms list device names\n"
+"-D, --device=NAME select PCM by name\n"
+"-q, --quiet quiet mode\n"
+"-t, --file-type TYPE file type (voc, wav, raw or au)\n"
+"-c, --channels=# channels\n"
+"-f, --format=FORMAT sample format (case insensitive)\n"
+"-r, --rate=# sample rate\n"
+"-d, --duration=# interrupt after # seconds\n"
+"-M, --mmap mmap stream\n"
+"-N, --nonblock nonblocking mode\n"
+"-F, --period-time=# distance between interrupts is # microseconds\n"
+"-B, --buffer-time=# buffer duration is # microseconds\n"
+" --period-size=# distance between interrupts is # frames\n"
+" --buffer-size=# buffer duration is # frames\n"
+"-A, --avail-min=# min available space for wakeup is # microseconds\n"
+"-R, --start-delay=# delay for automatic PCM start is # microseconds \n"
+" (relative to buffer size if <= 0)\n"
+"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun\n"
+"-v, --verbose show PCM structure and setup (accumulative)\n"
+"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n"
+"-I, --separate-channels one file for each channel\n"
+" --disable-resample disable automatic rate resample\n"
+" --disable-channels disable automatic channel conversions\n"
+" --disable-format disable automatic format conversions\n"
+" --disable-softvol disable software volume control (softvol)\n"
+" --test-position test ring buffer position\n")
+ , command);
+ printf(_("Recognized sample formats are:"));
+ for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
+ const char *s = snd_pcm_format_name(k);
+ if (s)
+ printf(" %s", s);
+ }
+ printf(_("\nSome of these may not be available on selected hardware\n"));
+ printf(_("The availabled format shortcuts are:\n"));
+ printf(_("-f cd (16 bit little endian, 44100, stereo)\n"));
+ printf(_("-f cdr (16 bit big endian, 44100, stereo)\n"));
+ printf(_("-f dat (16 bit little endian, 48000, stereo)\n"));
+}
+
+static void device_list(void)
+{
+ snd_ctl_t *handle;
+ int card, err, dev, idx;
+ snd_ctl_card_info_t *info;
+ snd_pcm_info_t *pcminfo;
+ snd_ctl_card_info_alloca(&info);
+ snd_pcm_info_alloca(&pcminfo);
+
+ card = -1;
+ if (snd_card_next(&card) < 0 || card < 0) {
+ error(_("no soundcards found..."));
+ return;
+ }
+ printf(_("**** List of %s Hardware Devices ****\n"),
+ snd_pcm_stream_name(stream));
+ while (card >= 0) {
+ char name[32];
+ sprintf(name, "hw:%d", card);
+ if ((err = snd_ctl_open(&handle, name, 0)) < 0) {
+ error("control open (%i): %s", card, snd_strerror(err));
+ goto next_card;
+ }
+ if ((err = snd_ctl_card_info(handle, info)) < 0) {
+ error("control hardware info (%i): %s", card, snd_strerror(err));
+ snd_ctl_close(handle);
+ goto next_card;
+ }
+ dev = -1;
+ while (1) {
+ unsigned int count;
+ if (snd_ctl_pcm_next_device(handle, &dev)<0)
+ error("snd_ctl_pcm_next_device");
+ if (dev < 0)
+ break;
+ snd_pcm_info_set_device(pcminfo, dev);
+ snd_pcm_info_set_subdevice(pcminfo, 0);
+ snd_pcm_info_set_stream(pcminfo, stream);
+ if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
+ if (err != -ENOENT)
+ error("control digital audio info (%i): %s", card, snd_strerror(err));
+ continue;
+ }
+ printf(_("card %i: %s [%s], device %i: %s [%s]\n"),
+ card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info),
+ dev,
+ snd_pcm_info_get_id(pcminfo),
+ snd_pcm_info_get_name(pcminfo));
+ count = snd_pcm_info_get_subdevices_count(pcminfo);
+ printf( _(" Subdevices: %i/%i\n"),
+ snd_pcm_info_get_subdevices_avail(pcminfo), count);
+ for (idx = 0; idx < (int)count; idx++) {
+ snd_pcm_info_set_subdevice(pcminfo, idx);
+ if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
+ error("control digital audio playback info (%i): %s", card, snd_strerror(err));
+ } else {
+ printf(_(" Subdevice #%i: %s\n"),
+ idx, snd_pcm_info_get_subdevice_name(pcminfo));
+ }
+ }
+ }
+ snd_ctl_close(handle);
+ next_card:
+ if (snd_card_next(&card) < 0) {
+ error("snd_card_next");
+ break;
+ }
+ }
+}
+
+static void pcm_list(void)
+{
+ void **hints, **n;
+ char *name, *descr, *descr1, *io;
+ const char *filter;
+
+ if (snd_device_name_hint(-1, "pcm", &hints) < 0)
+ return;
+ n = hints;
+ filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output";
+ while (*n != NULL) {
+ name = snd_device_name_get_hint(*n, "NAME");
+ descr = snd_device_name_get_hint(*n, "DESC");
+ io = snd_device_name_get_hint(*n, "IOID");
+ if (io != NULL && strcmp(io, filter) != 0)
+ goto __end;
+ printf("%s\n", name);
+ if ((descr1 = descr) != NULL) {
+ printf(" ");
+ while (*descr1) {
+ if (*descr1 == '\n')
+ printf("\n ");
+ else
+ putchar(*descr1);
+ descr1++;
+ }
+ putchar('\n');
+ }
+ __end:
+ if (name != NULL)
+ free(name);
+ if (descr != NULL)
+ free(descr);
+ if (io != NULL)
+ free(io);
+ n++;
+ }
+ snd_device_name_free_hint(hints);
+}
+
+static void version(void)
+{
+ printf("%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela <perex@perex.cz>\n", command);
+}
+
+static void signal_handler(int sig)
+{
+ if (verbose==2)
+ putchar('\n');
+ if (!quiet_mode)
+ fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
+ if (stream == SND_PCM_STREAM_CAPTURE) {
+ if (fmt_rec_table[file_type].end) {
+ fmt_rec_table[file_type].end(fd);
+ fd = -1;
+ }
+ stream = -1;
+ }
+ if (fd > 1) {
+ close(fd);
+ fd = -1;
+ }
+ if (handle && sig != SIGABRT) {
+ snd_pcm_close(handle);
+ handle = NULL;
+ }
+ exit(EXIT_FAILURE);
+}
+
+enum {
+ OPT_VERSION = 1,
+ OPT_PERIOD_SIZE,
+ OPT_BUFFER_SIZE,
+ OPT_DISABLE_RESAMPLE,
+ OPT_DISABLE_CHANNELS,
+ OPT_DISABLE_FORMAT,
+ OPT_DISABLE_SOFTVOL,
+ OPT_TEST_POSITION
+};
+
+int main(int argc, char *argv[])
+{
+ int option_index;
+ static const char short_options[] = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vV:IPC";
+ static const struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"version", 0, 0, OPT_VERSION},
+ {"list-devnames", 0, 0, 'n'},
+ {"list-devices", 0, 0, 'l'},
+ {"list-pcms", 0, 0, 'L'},
+ {"device", 1, 0, 'D'},
+ {"quiet", 0, 0, 'q'},
+ {"file-type", 1, 0, 't'},
+ {"channels", 1, 0, 'c'},
+ {"format", 1, 0, 'f'},
+ {"rate", 1, 0, 'r'},
+ {"duration", 1, 0 ,'d'},
+ {"mmap", 0, 0, 'M'},
+ {"nonblock", 0, 0, 'N'},
+ {"period-time", 1, 0, 'F'},
+ {"period-size", 1, 0, OPT_PERIOD_SIZE},
+ {"avail-min", 1, 0, 'A'},
+ {"start-delay", 1, 0, 'R'},
+ {"stop-delay", 1, 0, 'T'},
+ {"buffer-time", 1, 0, 'B'},
+ {"buffer-size", 1, 0, OPT_BUFFER_SIZE},
+ {"verbose", 0, 0, 'v'},
+ {"vumeter", 1, 0, 'V'},
+ {"separate-channels", 0, 0, 'I'},
+ {"playback", 0, 0, 'P'},
+ {"capture", 0, 0, 'C'},
+ {"disable-resample", 0, 0, OPT_DISABLE_RESAMPLE},
+ {"disable-channels", 0, 0, OPT_DISABLE_CHANNELS},
+ {"disable-format", 0, 0, OPT_DISABLE_FORMAT},
+ {"disable-softvol", 0, 0, OPT_DISABLE_SOFTVOL},
+ {"test-position", 0, 0, OPT_TEST_POSITION},
+ {0, 0, 0, 0}
+ };
+ char *pcm_name = "default";
+ int tmp, err, c;
+ int do_device_list = 0, do_pcm_list = 0;
+ snd_pcm_info_t *info;
+
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ textdomain(PACKAGE);
+#endif
+
+ snd_pcm_info_alloca(&info);
+
+ err = snd_output_stdio_attach(&log, stderr, 0);
+ assert(err >= 0);
+
+ command = argv[0];
+ file_type = FORMAT_DEFAULT;
+ if (strstr(argv[0], "arecord")) {
+ stream = SND_PCM_STREAM_CAPTURE;
+ file_type = FORMAT_WAVE;
+ command = "arecord";
+ start_delay = 1;
+ } else if (strstr(argv[0], "aplay")) {
+ stream = SND_PCM_STREAM_PLAYBACK;
+ command = "aplay";
+ } else {
+ error(_("command should be named either arecord or aplay"));
+ return 1;
+ }
+
+ chunk_size = -1;
+ rhwparams.format = DEFAULT_FORMAT;
+ rhwparams.rate = DEFAULT_SPEED;
+ rhwparams.channels = 1;
+
+ while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) {
+ switch (c) {
+ case 'h':
+ usage(command);
+ return 0;
+ case OPT_VERSION:
+ version();
+ return 0;
+ case 'l':
+ do_device_list = 1;
+ break;
+ case 'L':
+ do_pcm_list = 1;
+ break;
+ case 'D':
+ pcm_name = optarg;
+ break;
+ case 'q':
+ quiet_mode = 1;
+ break;
+ case 't':
+ if (strcasecmp(optarg, "raw") == 0)
+ file_type = FORMAT_RAW;
+ else if (strcasecmp(optarg, "voc") == 0)
+ file_type = FORMAT_VOC;
+ else if (strcasecmp(optarg, "wav") == 0)
+ file_type = FORMAT_WAVE;
+ else if (strcasecmp(optarg, "au") == 0 || strcasecmp(optarg, "sparc") == 0)
+ file_type = FORMAT_AU;
+ else {
+ error(_("unrecognized file format %s"), optarg);
+ return 1;
+ }
+ break;
+ case 'c':
+ rhwparams.channels = strtol(optarg, NULL, 0);
+ if (rhwparams.channels < 1 || rhwparams.channels > 32) {
+ error(_("value %i for channels is invalid"), rhwparams.channels);
+ return 1;
+ }
+ break;
+ case 'f':
+ if (strcasecmp(optarg, "cd") == 0 || strcasecmp(optarg, "cdr") == 0) {
+ if (strcasecmp(optarg, "cdr") == 0)
+ rhwparams.format = SND_PCM_FORMAT_S16_BE;
+ else
+ rhwparams.format = file_type == FORMAT_AU ? SND_PCM_FORMAT_S16_BE : SND_PCM_FORMAT_S16_LE;
+ rhwparams.rate = 44100;
+ rhwparams.channels = 2;
+ } else if (strcasecmp(optarg, "dat") == 0) {
+ rhwparams.format = file_type == FORMAT_AU ? SND_PCM_FORMAT_S16_BE : SND_PCM_FORMAT_S16_LE;
+ rhwparams.rate = 48000;
+ rhwparams.channels = 2;
+ } else {
+ rhwparams.format = snd_pcm_format_value(optarg);
+ if (rhwparams.format == SND_PCM_FORMAT_UNKNOWN) {
+ error(_("wrong extended format '%s'"), optarg);
+ exit(EXIT_FAILURE);
+ }
+ }
+ break;
+ case 'r':
+ tmp = strtol(optarg, NULL, 0);
+ if (tmp < 300)
+ tmp *= 1000;
+ rhwparams.rate = tmp;
+ if (tmp < 2000 || tmp > 192000) {
+ error(_("bad speed value %i"), tmp);
+ return 1;
+ }
+ break;
+ case 'd':
+ timelimit = strtol(optarg, NULL, 0);
+ break;
+ case 'N':
+ nonblock = 1;
+ open_mode |= SND_PCM_NONBLOCK;
+ break;
+ case 'F':
+ period_time = strtol(optarg, NULL, 0);
+ break;
+ case 'B':
+ buffer_time = strtol(optarg, NULL, 0);
+ break;
+ case OPT_PERIOD_SIZE:
+ period_frames = strtol(optarg, NULL, 0);
+ break;
+ case OPT_BUFFER_SIZE:
+ buffer_frames = strtol(optarg, NULL, 0);
+ break;
+ case 'A':
+ avail_min = strtol(optarg, NULL, 0);
+ break;
+ case 'R':
+ start_delay = strtol(optarg, NULL, 0);
+ break;
+ case 'T':
+ stop_delay = strtol(optarg, NULL, 0);
+ break;
+ case 'v':
+ verbose++;
+ if (verbose > 1 && !vumeter)
+ vumeter = VUMETER_MONO;
+ break;
+ case 'V':
+ if (*optarg == 's')
+ vumeter = VUMETER_STEREO;
+ else if (*optarg == 'm')
+ vumeter = VUMETER_MONO;
+ else
+ vumeter = VUMETER_NONE;
+ break;
+ case 'M':
+ mmap_flag = 1;
+ break;
+ case 'I':
+ interleaved = 0;
+ break;
+ case 'P':
+ stream = SND_PCM_STREAM_PLAYBACK;
+ command = "aplay";
+ break;
+ case 'C':
+ stream = SND_PCM_STREAM_CAPTURE;
+ command = "arecord";
+ start_delay = 1;
+ if (file_type == FORMAT_DEFAULT)
+ file_type = FORMAT_WAVE;
+ break;
+ case OPT_DISABLE_RESAMPLE:
+ open_mode |= SND_PCM_NO_AUTO_RESAMPLE;
+ break;
+ case OPT_DISABLE_CHANNELS:
+ open_mode |= SND_PCM_NO_AUTO_CHANNELS;
+ break;
+ case OPT_DISABLE_FORMAT:
+ open_mode |= SND_PCM_NO_AUTO_FORMAT;
+ break;
+ case OPT_DISABLE_SOFTVOL:
+ open_mode |= SND_PCM_NO_SOFTVOL;
+ break;
+ case OPT_TEST_POSITION:
+ test_position = 1;
+ break;
+ default:
+ fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
+ return 1;
+ }
+ }
+
+ if (do_device_list) {
+ if (do_pcm_list) pcm_list();
+ device_list();
+ goto __end;
+ } else if (do_pcm_list) {
+ pcm_list();
+ goto __end;
+ }
+
+ err = snd_pcm_open(&handle, pcm_name, stream, open_mode);
+ if (err < 0) {
+ error(_("audio open error: %s"), snd_strerror(err));
+ return 1;
+ }
+
+ if ((err = snd_pcm_info(handle, info)) < 0) {
+ error(_("info error: %s"), snd_strerror(err));
+ return 1;
+ }
+
+ if (nonblock) {
+ err = snd_pcm_nonblock(handle, 1);
+ if (err < 0) {
+ error(_("nonblock setting error: %s"), snd_strerror(err));
+ return 1;
+ }
+ }
+
+ chunk_size = 1024;
+ hwparams = rhwparams;
+
+ audiobuf = (u_char *)malloc(1024);
+ if (audiobuf == NULL) {
+ error(_("not enough memory"));
+ return 1;
+ }
+
+ if (mmap_flag) {
+ writei_func = snd_pcm_mmap_writei;
+ readi_func = snd_pcm_mmap_readi;
+ writen_func = snd_pcm_mmap_writen;
+ readn_func = snd_pcm_mmap_readn;
+ } else {
+ writei_func = snd_pcm_writei;
+ readi_func = snd_pcm_readi;
+ writen_func = snd_pcm_writen;
+ readn_func = snd_pcm_readn;
+ }
+
+
+ signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGABRT, signal_handler);
+ if (interleaved) {
+ if (optind > argc - 1) {
+ if (stream == SND_PCM_STREAM_PLAYBACK)
+ playback(NULL);
+ else
+ capture(NULL);
+ } else {
+ while (optind <= argc - 1) {
+ if (stream == SND_PCM_STREAM_PLAYBACK)
+ playback(argv[optind++]);
+ else
+ capture(argv[optind++]);
+ }
+ }
+ } else {
+ if (stream == SND_PCM_STREAM_PLAYBACK)
+ playbackv(&argv[optind], argc - optind);
+ else
+ capturev(&argv[optind], argc - optind);
+ }
+ if (verbose==2)
+ putchar('\n');
+ snd_pcm_close(handle);
+ free(audiobuf);
+ __end:
+ snd_output_close(log);
+ snd_config_update_free_global();
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Safe read (for pipes)
+ */
+
+static ssize_t safe_read(int fd, void *buf, size_t count)
+{
+ ssize_t result = 0, res;
+
+ while (count > 0) {
+ if ((res = read(fd, buf, count)) == 0)
+ break;
+ if (res < 0)
+ return result > 0 ? result : res;
+ count -= res;
+ result += res;
+ buf = (char *)buf + res;
+ }
+ return result;
+}
+
+/*
+ * Test, if it is a .VOC file and return >=0 if ok (this is the length of rest)
+ * < 0 if not
+ */
+static int test_vocfile(void *buffer)
+{
+ VocHeader *vp = buffer;
+
+ if (!memcmp(vp->magic, VOC_MAGIC_STRING, 20)) {
+ vocminor = LE_SHORT(vp->version) & 0xFF;
+ vocmajor = LE_SHORT(vp->version) / 256;
+ if (LE_SHORT(vp->version) != (0x1233 - LE_SHORT(vp->coded_ver)))
+ return -2; /* coded version mismatch */
+ return LE_SHORT(vp->headerlen) - sizeof(VocHeader); /* 0 mostly */
+ }
+ return -1; /* magic string fail */
+}
+
+/*
+ * helper for test_wavefile
+ */
+
+static size_t test_wavefile_read(int fd, u_char *buffer, size_t *size, size_t reqsize, int line)
+{
+ if (*size >= reqsize)
+ return *size;
+ if ((size_t)safe_read(fd, buffer + *size, reqsize - *size) != reqsize - *size) {
+ error(_("read error (called from line %i)"), line);
+ exit(EXIT_FAILURE);
+ }
+ return *size = reqsize;
+}
+
+#define check_wavefile_space(buffer, len, blimit) \
+ if (len > blimit) { \
+ blimit = len; \
+ if ((buffer = realloc(buffer, blimit)) == NULL) { \
+ error(_("not enough memory")); \
+ exit(EXIT_FAILURE); \
+ } \
+ }
+
+/*
+ * test, if it's a .WAV file, > 0 if ok (and set the speed, stereo etc.)
+ * == 0 if not
+ * Value returned is bytes to be discarded.
+ */
+static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size)
+{
+ WaveHeader *h = (WaveHeader *)_buffer;
+ u_char *buffer = NULL;
+ size_t blimit = 0;
+ WaveFmtBody *f;
+ WaveChunkHeader *c;
+ u_int type, len;
+
+ if (size < sizeof(WaveHeader))
+ return -1;
+ if (h->magic != WAV_RIFF || h->type != WAV_WAVE)
+ return -1;
+ if (size > sizeof(WaveHeader)) {
+ check_wavefile_space(buffer, size - sizeof(WaveHeader), blimit);
+ memcpy(buffer, _buffer + sizeof(WaveHeader), size - sizeof(WaveHeader));
+ }
+ size -= sizeof(WaveHeader);
+ while (1) {
+ check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit);
+ test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
+ c = (WaveChunkHeader*)buffer;
+ type = c->type;
+ len = LE_INT(c->length);
+ len += len % 2;
+ if (size > sizeof(WaveChunkHeader))
+ memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
+ size -= sizeof(WaveChunkHeader);
+ if (type == WAV_FMT)
+ break;
+ check_wavefile_space(buffer, len, blimit);
+ test_wavefile_read(fd, buffer, &size, len, __LINE__);
+ if (size > len)
+ memmove(buffer, buffer + len, size - len);
+ size -= len;
+ }
+
+ if (len < sizeof(WaveFmtBody)) {
+ error(_("unknown length of 'fmt ' chunk (read %u, should be %u at least)"),
+ len, (u_int)sizeof(WaveFmtBody));
+ exit(EXIT_FAILURE);
+ }
+ check_wavefile_space(buffer, len, blimit);
+ test_wavefile_read(fd, buffer, &size, len, __LINE__);
+ f = (WaveFmtBody*) buffer;
+ if (LE_SHORT(f->format) == WAV_FMT_EXTENSIBLE) {
+ WaveFmtExtensibleBody *fe = (WaveFmtExtensibleBody*)buffer;
+ if (len < sizeof(WaveFmtExtensibleBody)) {
+ error(_("unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"),
+ len, (u_int)sizeof(WaveFmtExtensibleBody));
+ exit(EXIT_FAILURE);
+ }
+ if (memcmp(fe->guid_tag, WAV_GUID_TAG, 14) != 0) {
+ error(_("wrong format tag in extensible 'fmt ' chunk"));
+ exit(EXIT_FAILURE);
+ }
+ f->format = fe->guid_format;
+ }
+ if (LE_SHORT(f->format) != WAV_FMT_PCM &&
+ LE_SHORT(f->format) != WAV_FMT_IEEE_FLOAT) {
+ error(_("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), LE_SHORT(f->format));
+ exit(EXIT_FAILURE);
+ }
+ if (LE_SHORT(f->channels) < 1) {
+ error(_("can't play WAVE-files with %d tracks"), LE_SHORT(f->channels));
+ exit(EXIT_FAILURE);
+ }
+ hwparams.channels = LE_SHORT(f->channels);
+ switch (LE_SHORT(f->bit_p_spl)) {
+ case 8:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_U8)
+ fprintf(stderr, _("Warning: format is changed to U8\n"));
+ hwparams.format = SND_PCM_FORMAT_U8;
+ break;
+ case 16:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_S16_LE)
+ fprintf(stderr, _("Warning: format is changed to S16_LE\n"));
+ hwparams.format = SND_PCM_FORMAT_S16_LE;
+ break;
+ case 24:
+ switch (LE_SHORT(f->byte_p_spl) / hwparams.channels) {
+ case 3:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_S24_3LE)
+ fprintf(stderr, _("Warning: format is changed to S24_3LE\n"));
+ hwparams.format = SND_PCM_FORMAT_S24_3LE;
+ break;
+ case 4:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_S24_LE)
+ fprintf(stderr, _("Warning: format is changed to S24_LE\n"));
+ hwparams.format = SND_PCM_FORMAT_S24_LE;
+ break;
+ default:
+ error(_(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"),
+ LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl), hwparams.channels);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 32:
+ if (LE_SHORT(f->format) == WAV_FMT_PCM)
+ hwparams.format = SND_PCM_FORMAT_S32_LE;
+ else if (LE_SHORT(f->format) == WAV_FMT_IEEE_FLOAT)
+ hwparams.format = SND_PCM_FORMAT_FLOAT_LE;
+ break;
+ default:
+ error(_(" can't play WAVE-files with sample %d bits wide"),
+ LE_SHORT(f->bit_p_spl));
+ exit(EXIT_FAILURE);
+ }
+ hwparams.rate = LE_INT(f->sample_fq);
+
+ if (size > len)
+ memmove(buffer, buffer + len, size - len);
+ size -= len;
+
+ while (1) {
+ u_int type, len;
+
+ check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit);
+ test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
+ c = (WaveChunkHeader*)buffer;
+ type = c->type;
+ len = LE_INT(c->length);
+ if (size > sizeof(WaveChunkHeader))
+ memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
+ size -= sizeof(WaveChunkHeader);
+ if (type == WAV_DATA) {
+ if (len < pbrec_count && len < 0x7ffffffe)
+ pbrec_count = len;
+ if (size > 0)
+ memcpy(_buffer, buffer, size);
+ free(buffer);
+ return size;
+ }
+ len += len % 2;
+ check_wavefile_space(buffer, len, blimit);
+ test_wavefile_read(fd, buffer, &size, len, __LINE__);
+ if (size > len)
+ memmove(buffer, buffer + len, size - len);
+ size -= len;
+ }
+
+ /* shouldn't be reached */
+ return -1;
+}
+
+/*
+
+ */
+
+static int test_au(int fd, void *buffer)
+{
+ AuHeader *ap = buffer;
+
+ if (ap->magic != AU_MAGIC)
+ return -1;
+ if (BE_INT(ap->hdr_size) > 128 || BE_INT(ap->hdr_size) < 24)
+ return -1;
+ pbrec_count = BE_INT(ap->data_size);
+ switch (BE_INT(ap->encoding)) {
+ case AU_FMT_ULAW:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_MU_LAW)
+ fprintf(stderr, _("Warning: format is changed to MU_LAW\n"));
+ hwparams.format = SND_PCM_FORMAT_MU_LAW;
+ break;
+ case AU_FMT_LIN8:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_U8)
+ fprintf(stderr, _("Warning: format is changed to U8\n"));
+ hwparams.format = SND_PCM_FORMAT_U8;
+ break;
+ case AU_FMT_LIN16:
+ if (hwparams.format != DEFAULT_FORMAT &&
+ hwparams.format != SND_PCM_FORMAT_S16_BE)
+ fprintf(stderr, _("Warning: format is changed to S16_BE\n"));
+ hwparams.format = SND_PCM_FORMAT_S16_BE;
+ break;
+ default:
+ return -1;
+ }
+ hwparams.rate = BE_INT(ap->sample_rate);
+ if (hwparams.rate < 2000 || hwparams.rate > 256000)
+ return -1;
+ hwparams.channels = BE_INT(ap->channels);
+ if (hwparams.channels < 1 || hwparams.channels > 128)
+ return -1;
+ if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
+ error(_("read error"));
+ exit(EXIT_FAILURE);
+ }
+ return 0;
+}
+
+static void set_params(void)
+{
+ snd_pcm_hw_params_t *params;
+ snd_pcm_sw_params_t *swparams;
+ snd_pcm_uframes_t buffer_size;
+ int err;
+ size_t n;
+ unsigned int rate;
+ snd_pcm_uframes_t start_threshold, stop_threshold;
+ snd_pcm_hw_params_alloca(&params);
+ snd_pcm_sw_params_alloca(&swparams);
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0) {
+ error(_("Broken configuration for this PCM: no configurations available"));
+ exit(EXIT_FAILURE);
+ }
+ if (mmap_flag) {
+ snd_pcm_access_mask_t *mask = alloca(snd_pcm_access_mask_sizeof());
+ snd_pcm_access_mask_none(mask);
+ snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
+ snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX);
+ err = snd_pcm_hw_params_set_access_mask(handle, params, mask);
+ } else if (interleaved)
+ err = snd_pcm_hw_params_set_access(handle, params,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ else
+ err = snd_pcm_hw_params_set_access(handle, params,
+ SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ if (err < 0) {
+ error(_("Access type not available"));
+ exit(EXIT_FAILURE);
+ }
+ err = snd_pcm_hw_params_set_format(handle, params, hwparams.format);
+ if (err < 0) {
+ error(_("Sample format non available"));
+ exit(EXIT_FAILURE);
+ }
+ err = snd_pcm_hw_params_set_channels(handle, params, hwparams.channels);
+ if (err < 0) {
+ error(_("Channels count non available"));
+ exit(EXIT_FAILURE);
+ }
+
+#if 0
+ err = snd_pcm_hw_params_set_periods_min(handle, params, 2);
+ assert(err >= 0);
+#endif
+ rate = hwparams.rate;
+ err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0);
+ assert(err >= 0);
+ if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
+ if (!quiet_mode) {
+ char plugex[64];
+ const char *pcmname = snd_pcm_name(handle);
+ fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate);
+ if (! pcmname || strchr(snd_pcm_name(handle), ':'))
+ *plugex = 0;
+ else
+ snprintf(plugex, sizeof(plugex), "(-Dplug:%s)",
+ snd_pcm_name(handle));
+ fprintf(stderr, _(" please, try the plug plugin %s\n"),
+ plugex);
+ }
+ }
+ rate = hwparams.rate;
+ if (buffer_time == 0 && buffer_frames == 0) {
+ err = snd_pcm_hw_params_get_buffer_time_max(params,
+ &buffer_time, 0);
+ assert(err >= 0);
+ if (buffer_time > 500000)
+ buffer_time = 500000;
+ }
+ if (period_time == 0 && period_frames == 0) {
+ if (buffer_time > 0)
+ period_time = buffer_time / 4;
+ else
+ period_frames = buffer_frames / 4;
+ }
+ if (period_time > 0)
+ err = snd_pcm_hw_params_set_period_time_near(handle, params,
+ &period_time, 0);
+ else
+ err = snd_pcm_hw_params_set_period_size_near(handle, params,
+ &period_frames, 0);
+ assert(err >= 0);
+ if (buffer_time > 0) {
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
+ &buffer_time, 0);
+ } else {
+ err = snd_pcm_hw_params_set_buffer_size_near(handle, params,
+ &buffer_frames);
+ }
+ assert(err >= 0);
+ err = snd_pcm_hw_params(handle, params);
+ if (err < 0) {
+ error(_("Unable to install hw params:"));
+ snd_pcm_hw_params_dump(params, log);
+ exit(EXIT_FAILURE);
+ }
+ snd_pcm_hw_params_get_period_size(params, &chunk_size, 0);
+ snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
+ if (chunk_size == buffer_size) {
+ error(_("Can't use period equal to buffer size (%lu == %lu)"),
+ chunk_size, buffer_size);
+ exit(EXIT_FAILURE);
+ }
+ snd_pcm_sw_params_current(handle, swparams);
+ if (avail_min < 0)
+ n = chunk_size;
+ else
+ n = (double) rate * avail_min / 1000000;
+ err = snd_pcm_sw_params_set_avail_min(handle, swparams, n);
+
+ /* round up to closest transfer boundary */
+ n = buffer_size;
+ if (start_delay <= 0) {
+ start_threshold = n + (double) rate * start_delay / 1000000;
+ } else
+ start_threshold = (double) rate * start_delay / 1000000;
+ if (start_threshold < 1)
+ start_threshold = 1;
+ if (start_threshold > n)
+ start_threshold = n;
+ err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold);
+ assert(err >= 0);
+ if (stop_delay <= 0)
+ stop_threshold = buffer_size + (double) rate * stop_delay / 1000000;
+ else
+ stop_threshold = (double) rate * stop_delay / 1000000;
+ err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold);
+ assert(err >= 0);
+
+ if (snd_pcm_sw_params(handle, swparams) < 0) {
+ error(_("unable to install sw params:"));
+ snd_pcm_sw_params_dump(swparams, log);
+ exit(EXIT_FAILURE);
+ }
+
+ if (verbose)
+ snd_pcm_dump(handle, log);
+
+ bits_per_sample = snd_pcm_format_physical_width(hwparams.format);
+ bits_per_frame = bits_per_sample * hwparams.channels;
+ chunk_bytes = chunk_size * bits_per_frame / 8;
+ audiobuf = realloc(audiobuf, chunk_bytes);
+ if (audiobuf == NULL) {
+ error(_("not enough memory"));
+ exit(EXIT_FAILURE);
+ }
+ // fprintf(stderr, "real chunk_size = %i, frags = %i, total = %i\n", chunk_size, setup.buf.block.frags, setup.buf.block.frags * chunk_size);
+
+ /* stereo VU-meter isn't always available... */
+ if (vumeter == VUMETER_STEREO) {
+ if (hwparams.channels != 2 || !interleaved || verbose > 2)
+ vumeter = VUMETER_MONO;
+ }
+
+ /* show mmap buffer arragment */
+ if (mmap_flag && verbose) {
+ const snd_pcm_channel_area_t *areas;
+ snd_pcm_uframes_t offset;
+ int i;
+ err = snd_pcm_mmap_begin(handle, &areas, &offset, &chunk_size);
+ if (err < 0) {
+ error("snd_pcm_mmap_begin problem: %s", snd_strerror(err));
+ exit(EXIT_FAILURE);
+ }
+ for (i = 0; i < hwparams.channels; i++)
+ fprintf(stderr, "mmap_area[%i] = %p,%u,%u (%u)\n", i, areas[i].addr, areas[i].first, areas[i].step, snd_pcm_format_physical_width(hwparams.format));
+ /* not required, but for sure */
+ snd_pcm_mmap_commit(handle, offset, 0);
+ }
+
+ buffer_frames = buffer_size; /* for position test */
+}
+
+#ifndef timersub
+#define timersub(a, b, result) \
+do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+} while (0)
+#endif
+
+/* I/O error handler */
+static void xrun(void)
+{
+ snd_pcm_status_t *status;
+ int res;
+
+ snd_pcm_status_alloca(&status);
+ if ((res = snd_pcm_status(handle, status))<0) {
+ error(_("status error: %s"), snd_strerror(res));
+ exit(EXIT_FAILURE);
+ }
+ if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
+ struct timeval now, diff, tstamp;
+ gettimeofday(&now, 0);
+ snd_pcm_status_get_trigger_tstamp(status, &tstamp);
+ timersub(&now, &tstamp, &diff);
+ fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
+ stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
+ diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
+ if (verbose) {
+ fprintf(stderr, _("Status:\n"));
+ snd_pcm_status_dump(status, log);
+ }
+ if ((res = snd_pcm_prepare(handle))<0) {
+ error(_("xrun: prepare error: %s"), snd_strerror(res));
+ exit(EXIT_FAILURE);
+ }
+ return; /* ok, data should be accepted again */
+ } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
+ if (verbose) {
+ fprintf(stderr, _("Status(DRAINING):\n"));
+ snd_pcm_status_dump(status, log);
+ }
+ if (stream == SND_PCM_STREAM_CAPTURE) {
+ fprintf(stderr, _("capture stream format change? attempting recover...\n"));
+ if ((res = snd_pcm_prepare(handle))<0) {
+ error(_("xrun(DRAINING): prepare error: %s"), snd_strerror(res));
+ exit(EXIT_FAILURE);
+ }
+ return;
+ }
+ }
+ if (verbose) {
+ fprintf(stderr, _("Status(R/W):\n"));
+ snd_pcm_status_dump(status, log);
+ }
+ error(_("read/write error, state = %s"), snd_pcm_state_name(snd_pcm_status_get_state(status)));
+ exit(EXIT_FAILURE);
+}
+
+/* I/O suspend handler */
+static void suspend(void)
+{
+ int res;
+
+ if (!quiet_mode)
+ fprintf(stderr, _("Suspended. Trying resume. ")); fflush(stderr);
+ while ((res = snd_pcm_resume(handle)) == -EAGAIN)
+ sleep(1); /* wait until suspend flag is released */
+ if (res < 0) {
+ if (!quiet_mode)
+ fprintf(stderr, _("Failed. Restarting stream. ")); fflush(stderr);
+ if ((res = snd_pcm_prepare(handle)) < 0) {
+ error(_("suspend: prepare error: %s"), snd_strerror(res));
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (!quiet_mode)
+ fprintf(stderr, _("Done.\n"));
+}
+
+static void print_vu_meter_mono(int perc, int maxperc)
+{
+ const int bar_length = 50;
+ char line[80];
+ int val;
+
+ for (val = 0; val <= perc * bar_length / 100 && val < bar_length; val++)
+ line[val] = '#';
+ for (; val <= maxperc * bar_length / 100 && val < bar_length; val++)
+ line[val] = ' ';
+ line[val] = '+';
+ for (++val; val <= bar_length; val++)
+ line[val] = ' ';
+ if (maxperc > 99)
+ sprintf(line + val, "| MAX");
+ else
+ sprintf(line + val, "| %02i%%", maxperc);
+ fputs(line, stdout);
+ if (perc > 100)
+ printf(_(" !clip "));
+}
+
+static void print_vu_meter_stereo(int *perc, int *maxperc)
+{
+ const int bar_length = 35;
+ char line[80];
+ int c;
+
+ memset(line, ' ', sizeof(line) - 1);
+ line[bar_length + 3] = '|';
+
+ for (c = 0; c < 2; c++) {
+ int p = perc[c] * bar_length / 100;
+ char tmp[4];
+ if (p > bar_length)
+ p = bar_length;
+ if (c)
+ memset(line + bar_length + 6 + 1, '#', p);
+ else
+ memset(line + bar_length - p - 1, '#', p);
+ p = maxperc[c] * bar_length / 100;
+ if (p > bar_length)
+ p = bar_length;
+ if (c)
+ line[bar_length + 6 + 1 + p] = '+';
+ else
+ line[bar_length - p - 1] = '+';
+ if (maxperc[c] > 99)
+ sprintf(tmp, "MAX");
+ else
+ sprintf(tmp, "%02d%%", maxperc[c]);
+ if (c)
+ memcpy(line + bar_length + 3 + 1, tmp, 3);
+ else
+ memcpy(line + bar_length, tmp, 3);
+ }
+ line[bar_length * 2 + 6 + 2] = 0;
+ fputs(line, stdout);
+}
+
+static void print_vu_meter(signed int *perc, signed int *maxperc)
+{
+ if (vumeter == VUMETER_STEREO)
+ print_vu_meter_stereo(perc, maxperc);
+ else
+ print_vu_meter_mono(*perc, *maxperc);
+}
+
+/* peak handler */
+static void compute_max_peak(u_char *data, size_t count)
+{
+ signed int val, max, perc[2], max_peak[2];
+ static int run = 0;
+ size_t ocount = count;
+ int format_little_endian = snd_pcm_format_little_endian(hwparams.format);
+ int ichans, c;
+
+ if (vumeter == VUMETER_STEREO)
+ ichans = 2;
+ else
+ ichans = 1;
+
+ memset(max_peak, 0, sizeof(max_peak));
+ switch (bits_per_sample) {
+ case 8: {
+ signed char *valp = (signed char *)data;
+ signed char mask = snd_pcm_format_silence(hwparams.format);
+ c = 0;
+ while (count-- > 0) {
+ val = *valp++ ^ mask;
+ val = abs(val);
+ if (max_peak[c] < val)
+ max_peak[c] = val;
+ if (vumeter == VUMETER_STEREO)
+ c = !c;
+ }
+ break;
+ }
+ case 16: {
+ signed short *valp = (signed short *)data;
+ signed short mask = snd_pcm_format_silence_16(hwparams.format);
+ signed short sval;
+
+ count /= 2;
+ c = 0;
+ while (count-- > 0) {
+ if (format_little_endian)
+ sval = __le16_to_cpu(*valp);
+ else
+ sval = __be16_to_cpu(*valp);
+ sval = abs(sval) ^ mask;
+ if (max_peak[c] < sval)
+ max_peak[c] = sval;
+ valp++;
+ if (vumeter == VUMETER_STEREO)
+ c = !c;
+ }
+ break;
+ }
+ case 24: {
+ unsigned char *valp = data;
+ signed int mask = snd_pcm_format_silence_32(hwparams.format);
+
+ count /= 3;
+ c = 0;
+ while (count-- > 0) {
+ if (format_little_endian) {
+ val = valp[0] | (valp[1]<<8) | (valp[2]<<16);
+ } else {
+ val = (valp[0]<<16) | (valp[1]<<8) | valp[2];
+ }
+ /* Correct signed bit in 32-bit value */
+ if (val & (1<<(bits_per_sample-1))) {
+ val |= 0xff<<24; /* Negate upper bits too */
+ }
+ val = abs(val) ^ mask;
+ if (max_peak[c] < val)
+ max_peak[c] = val;
+ valp += 3;
+ if (vumeter == VUMETER_STEREO)
+ c = !c;
+ }
+ break;
+ }
+ case 32: {
+ signed int *valp = (signed int *)data;
+ signed int mask = snd_pcm_format_silence_32(hwparams.format);
+
+ count /= 4;
+ c = 0;
+ while (count-- > 0) {
+ if (format_little_endian)
+ val = __le32_to_cpu(*valp);
+ else
+ val = __be32_to_cpu(*valp);
+ val = abs(val) ^ mask;
+ if (max_peak[c] < val)
+ max_peak[c] = val;
+ valp++;
+ if (vumeter == VUMETER_STEREO)
+ c = !c;
+ }
+ break;
+ }
+ default:
+ if (run == 0) {
+ fprintf(stderr, _("Unsupported bit size %d.\n"), (int)bits_per_sample);
+ run = 1;
+ }
+ return;
+ }
+ max = 1 << (bits_per_sample-1);
+ if (max <= 0)
+ max = 0x7fffffff;
+
+ for (c = 0; c < ichans; c++) {
+ if (bits_per_sample > 16)
+ perc[c] = max_peak[c] / (max / 100);
+ else
+ perc[c] = max_peak[c] * 100 / max;
+ }
+
+ if (interleaved && verbose <= 2) {
+ static int maxperc[2];
+ static time_t t=0;
+ const time_t tt=time(NULL);
+ if(tt>t) {
+ t=tt;
+ maxperc[0] = 0;
+ maxperc[1] = 0;
+ }
+ for (c = 0; c < ichans; c++)
+ if (perc[c] > maxperc[c])
+ maxperc[c] = perc[c];
+
+ putchar('\r');
+ print_vu_meter(perc, maxperc);
+ fflush(stdout);
+ }
+ else if(verbose==3) {
+ printf(_("Max peak (%li samples): 0x%08x "), (long)ocount, max_peak[0]);
+ for (val = 0; val < 20; val++)
+ if (val <= perc[0] / 5)
+ putchar('#');
+ else
+ putchar(' ');
+ printf(" %i%%\n", perc[0]);
+ fflush(stdout);
+ }
+}
+
+static void do_test_position(void)
+{
+ static int counter = 0;
+ snd_pcm_sframes_t avail, delay;
+ int err;
+
+ err = snd_pcm_avail_delay(handle, &avail, &delay);
+ if (err < 0)
+ return;
+ if (avail > 4 * (snd_pcm_sframes_t)buffer_frames ||
+ avail < -4 * (snd_pcm_sframes_t)buffer_frames ||
+ delay > 4 * (snd_pcm_sframes_t)buffer_frames ||
+ delay < -4 * (snd_pcm_sframes_t)buffer_frames) {
+ fprintf(stderr, "Suspicious buffer position (%i total): avail = %li, delay = %li, buffer = %li\n", ++counter, (long)avail, (long)delay, (long)buffer_frames);
+ } else if (verbose) {
+ fprintf(stderr, "Buffer position: %li/%li (%li)\n", (long)avail, (long)delay, (long)buffer_frames);
+ }
+}
+
+/*
+ * write function
+ */
+
+static ssize_t pcm_write(u_char *data, size_t count)
+{
+ ssize_t r;
+ ssize_t result = 0;
+
+ if (count < chunk_size) {
+ snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels);
+ count = chunk_size;
+ }
+ while (count > 0) {
+ if (test_position)
+ do_test_position();
+ r = writei_func(handle, data, count);
+ if (test_position)
+ do_test_position();
+ if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
+ snd_pcm_wait(handle, 1000);
+ } else if (r == -EPIPE) {
+ xrun();
+ } else if (r == -ESTRPIPE) {
+ suspend();
+ } else if (r < 0) {
+ error(_("write error: %s"), snd_strerror(r));
+ exit(EXIT_FAILURE);
+ }
+ if (r > 0) {
+ if (vumeter)
+ compute_max_peak(data, r * hwparams.channels);
+ result += r;
+ count -= r;
+ data += r * bits_per_frame / 8;
+ }
+ }
+ return result;
+}
+
+static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count)
+{
+ ssize_t r;
+ size_t result = 0;
+
+ if (count != chunk_size) {
+ unsigned int channel;
+ size_t offset = count;
+ size_t remaining = chunk_size - count;
+ for (channel = 0; channel < channels; channel++)
+ snd_pcm_format_set_silence(hwparams.format, data[channel] + offset * bits_per_sample / 8, remaining);
+ count = chunk_size;
+ }
+ while (count > 0) {
+ unsigned int channel;
+ void *bufs[channels];
+ size_t offset = result;
+ for (channel = 0; channel < channels; channel++)
+ bufs[channel] = data[channel] + offset * bits_per_sample / 8;
+ if (test_position)
+ do_test_position();
+ r = writen_func(handle, bufs, count);
+ if (test_position)
+ do_test_position();
+ if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
+ snd_pcm_wait(handle, 1000);
+ } else if (r == -EPIPE) {
+ xrun();
+ } else if (r == -ESTRPIPE) {
+ suspend();
+ } else if (r < 0) {
+ error(_("writev error: %s"), snd_strerror(r));
+ exit(EXIT_FAILURE);
+ }
+ if (r > 0) {
+ if (vumeter) {
+ for (channel = 0; channel < channels; channel++)
+ compute_max_peak(data[channel], r);
+ }
+ result += r;
+ count -= r;
+ }
+ }
+ return result;
+}
+
+/*
+ * read function
+ */
+
+static ssize_t pcm_read(u_char *data, size_t rcount)
+{
+ ssize_t r;
+ size_t result = 0;
+ size_t count = rcount;
+
+ if (count != chunk_size) {
+ count = chunk_size;
+ }
+
+ while (count > 0) {
+ if (test_position)
+ do_test_position();
+ r = readi_func(handle, data, count);
+ if (test_position)
+ do_test_position();
+ if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
+ snd_pcm_wait(handle, 1000);
+ } else if (r == -EPIPE) {
+ xrun();
+ } else if (r == -ESTRPIPE) {
+ suspend();
+ } else if (r < 0) {
+ error(_("read error: %s"), snd_strerror(r));
+ exit(EXIT_FAILURE);
+ }
+ if (r > 0) {
+ if (vumeter)
+ compute_max_peak(data, r * hwparams.channels);
+ result += r;
+ count -= r;
+ data += r * bits_per_frame / 8;
+ }
+ }
+ return rcount;
+}
+
+static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
+{
+ ssize_t r;
+ size_t result = 0;
+ size_t count = rcount;
+
+ if (count != chunk_size) {
+ count = chunk_size;
+ }
+
+ while (count > 0) {
+ unsigned int channel;
+ void *bufs[channels];
+ size_t offset = result;
+ for (channel = 0; channel < channels; channel++)
+ bufs[channel] = data[channel] + offset * bits_per_sample / 8;
+ if (test_position)
+ do_test_position();
+ r = readn_func(handle, bufs, count);
+ if (test_position)
+ do_test_position();
+ if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
+ snd_pcm_wait(handle, 1000);
+ } else if (r == -EPIPE) {
+ xrun();
+ } else if (r == -ESTRPIPE) {
+ suspend();
+ } else if (r < 0) {
+ error(_("readv error: %s"), snd_strerror(r));
+ exit(EXIT_FAILURE);
+ }
+ if (r > 0) {
+ if (vumeter) {
+ for (channel = 0; channel < channels; channel++)
+ compute_max_peak(data[channel], r);
+ }
+ result += r;
+ count -= r;
+ }
+ }
+ return rcount;
+}
+
+/*
+ * ok, let's play a .voc file
+ */
+
+static ssize_t voc_pcm_write(u_char *data, size_t count)
+{
+ ssize_t result = count, r;
+ size_t size;
+
+ while (count > 0) {
+ size = count;
+ if (size > chunk_bytes - buffer_pos)
+ size = chunk_bytes - buffer_pos;
+ memcpy(audiobuf + buffer_pos, data, size);
+ data += size;
+ count -= size;
+ buffer_pos += size;
+ if ((size_t)buffer_pos == chunk_bytes) {
+ if ((size_t)(r = pcm_write(audiobuf, chunk_size)) != chunk_size)
+ return r;
+ buffer_pos = 0;
+ }
+ }
+ return result;
+}
+
+static void voc_write_silence(unsigned x)
+{
+ unsigned l;
+ u_char *buf;
+
+ buf = (u_char *) malloc(chunk_bytes);
+ if (buf == NULL) {
+ error(_("can't allocate buffer for silence"));
+ return; /* not fatal error */
+ }
+ snd_pcm_format_set_silence(hwparams.format, buf, chunk_size * hwparams.channels);
+ while (x > 0) {
+ l = x;
+ if (l > chunk_size)
+ l = chunk_size;
+ if (voc_pcm_write(buf, l) != (ssize_t)l) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ x -= l;
+ }
+ free(buf);
+}
+
+static void voc_pcm_flush(void)
+{
+ if (buffer_pos > 0) {
+ size_t b;
+ if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0)
+ fprintf(stderr, _("voc_pcm_flush - silence error"));
+ b = chunk_size;
+ if (pcm_write(audiobuf, b) != (ssize_t)b)
+ error(_("voc_pcm_flush error"));
+ }
+ snd_pcm_nonblock(handle, 0);
+ snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
+}
+
+static void voc_play(int fd, int ofs, char *name)
+{
+ int l;
+ VocBlockType *bp;
+ VocVoiceData *vd;
+ VocExtBlock *eb;
+ size_t nextblock, in_buffer;
+ u_char *data, *buf;
+ char was_extended = 0, output = 0;
+ u_short *sp, repeat = 0;
+ size_t silence;
+ off64_t filepos = 0;
+
+#define COUNT(x) nextblock -= x; in_buffer -= x; data += x
+#define COUNT1(x) in_buffer -= x; data += x
+
+ data = buf = (u_char *)malloc(64 * 1024);
+ buffer_pos = 0;
+ if (data == NULL) {
+ error(_("malloc error"));
+ exit(EXIT_FAILURE);
+ }
+ if (!quiet_mode) {
+ fprintf(stderr, _("Playing Creative Labs Channel file '%s'...\n"), name);
+ }
+ /* first we waste the rest of header, ugly but we don't need seek */
+ while (ofs > (ssize_t)chunk_bytes) {
+ if ((size_t)safe_read(fd, buf, chunk_bytes) != chunk_bytes) {
+ error(_("read error"));
+ exit(EXIT_FAILURE);
+ }
+ ofs -= chunk_bytes;
+ }
+ if (ofs) {
+ if (safe_read(fd, buf, ofs) != ofs) {
+ error(_("read error"));
+ exit(EXIT_FAILURE);
+ }
+ }
+ hwparams.format = DEFAULT_FORMAT;
+ hwparams.channels = 1;
+ hwparams.rate = DEFAULT_SPEED;
+ set_params();
+
+ in_buffer = nextblock = 0;
+ while (1) {
+ Fill_the_buffer: /* need this for repeat */
+ if (in_buffer < 32) {
+ /* move the rest of buffer to pos 0 and fill the buf up */
+ if (in_buffer)
+ memcpy(buf, data, in_buffer);
+ data = buf;
+ if ((l = safe_read(fd, buf + in_buffer, chunk_bytes - in_buffer)) > 0)
+ in_buffer += l;
+ else if (!in_buffer) {
+ /* the file is truncated, so simulate 'Terminator'
+ and reduce the datablock for safe landing */
+ nextblock = buf[0] = 0;
+ if (l == -1) {
+ perror(name);
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+ while (!nextblock) { /* this is a new block */
+ if (in_buffer < sizeof(VocBlockType))
+ goto __end;
+ bp = (VocBlockType *) data;
+ COUNT1(sizeof(VocBlockType));
+ nextblock = VOC_DATALEN(bp);
+ if (output && !quiet_mode)
+ fprintf(stderr, "\n"); /* write /n after ASCII-out */
+ output = 0;
+ switch (bp->type) {
+ case 0:
+#if 0
+ d_printf("Terminator\n");
+#endif
+ return; /* VOC-file stop */
+ case 1:
+ vd = (VocVoiceData *) data;
+ COUNT1(sizeof(VocVoiceData));
+ /* we need a SYNC, before we can set new SPEED, STEREO ... */
+
+ if (!was_extended) {
+ hwparams.rate = (int) (vd->tc);
+ hwparams.rate = 1000000 / (256 - hwparams.rate);
+#if 0
+ d_printf("Channel data %d Hz\n", dsp_speed);
+#endif
+ if (vd->pack) { /* /dev/dsp can't it */
+ error(_("can't play packed .voc files"));
+ return;
+ }
+ if (hwparams.channels == 2) /* if we are in Stereo-Mode, switch back */
+ hwparams.channels = 1;
+ } else { /* there was extended block */
+ hwparams.channels = 2;
+ was_extended = 0;
+ }
+ set_params();
+ break;
+ case 2: /* nothing to do, pure data */
+#if 0
+ d_printf("Channel continuation\n");
+#endif
+ break;
+ case 3: /* a silence block, no data, only a count */
+ sp = (u_short *) data;
+ COUNT1(sizeof(u_short));
+ hwparams.rate = (int) (*data);
+ COUNT1(1);
+ hwparams.rate = 1000000 / (256 - hwparams.rate);
+ set_params();
+ silence = (((size_t) * sp) * 1000) / hwparams.rate;
+#if 0
+ d_printf("Silence for %d ms\n", (int) silence);
+#endif
+ voc_write_silence(*sp);
+ break;
+ case 4: /* a marker for syncronisation, no effect */
+ sp = (u_short *) data;
+ COUNT1(sizeof(u_short));
+#if 0
+ d_printf("Marker %d\n", *sp);
+#endif
+ break;
+ case 5: /* ASCII text, we copy to stderr */
+ output = 1;
+#if 0
+ d_printf("ASCII - text :\n");
+#endif
+ break;
+ case 6: /* repeat marker, says repeatcount */
+ /* my specs don't say it: maybe this can be recursive, but
+ I don't think somebody use it */
+ repeat = *(u_short *) data;
+ COUNT1(sizeof(u_short));
+#if 0
+ d_printf("Repeat loop %d times\n", repeat);
+#endif
+ if (filepos >= 0) { /* if < 0, one seek fails, why test another */
+ if ((filepos = lseek64(fd, 0, 1)) < 0) {
+ error(_("can't play loops; %s isn't seekable\n"), name);
+ repeat = 0;
+ } else {
+ filepos -= in_buffer; /* set filepos after repeat */
+ }
+ } else {
+ repeat = 0;
+ }
+ break;
+ case 7: /* ok, lets repeat that be rewinding tape */
+ if (repeat) {
+ if (repeat != 0xFFFF) {
+#if 0
+ d_printf("Repeat loop %d\n", repeat);
+#endif
+ --repeat;
+ }
+#if 0
+ else
+ d_printf("Neverending loop\n");
+#endif
+ lseek64(fd, filepos, 0);
+ in_buffer = 0; /* clear the buffer */
+ goto Fill_the_buffer;
+ }
+#if 0
+ else
+ d_printf("End repeat loop\n");
+#endif
+ break;
+ case 8: /* the extension to play Stereo, I have SB 1.0 :-( */
+ was_extended = 1;
+ eb = (VocExtBlock *) data;
+ COUNT1(sizeof(VocExtBlock));
+ hwparams.rate = (int) (eb->tc);
+ hwparams.rate = 256000000L / (65536 - hwparams.rate);
+ hwparams.channels = eb->mode == VOC_MODE_STEREO ? 2 : 1;
+ if (hwparams.channels == 2)
+ hwparams.rate = hwparams.rate >> 1;
+ if (eb->pack) { /* /dev/dsp can't it */
+ error(_("can't play packed .voc files"));
+ return;
+ }
+#if 0
+ d_printf("Extended block %s %d Hz\n",
+ (eb->mode ? "Stereo" : "Mono"), dsp_speed);
+#endif
+ break;
+ default:
+ error(_("unknown blocktype %d. terminate."), bp->type);
+ return;
+ } /* switch (bp->type) */
+ } /* while (! nextblock) */
+ /* put nextblock data bytes to dsp */
+ l = in_buffer;
+ if (nextblock < (size_t)l)
+ l = nextblock;
+ if (l) {
+ if (output && !quiet_mode) {
+ if (write(2, data, l) != l) { /* to stderr */
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ if (voc_pcm_write(data, l) != l) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ }
+ COUNT(l);
+ }
+ } /* while(1) */
+ __end:
+ voc_pcm_flush();
+ free(buf);
+}
+/* that was a big one, perhaps somebody split it :-) */
+
+/* setting the globals for playing raw data */
+static void init_raw_data(void)
+{
+ hwparams = rhwparams;
+}
+
+/* calculate the data count to read from/to dsp */
+static off64_t calc_count(void)
+{
+ off64_t count;
+
+ if (timelimit == 0) {
+ count = pbrec_count;
+ } else {
+ count = snd_pcm_format_size(hwparams.format, hwparams.rate * hwparams.channels);
+ count *= (off64_t)timelimit;
+ }
+ return count < pbrec_count ? count : pbrec_count;
+}
+
+/* write a .VOC-header */
+static void begin_voc(int fd, size_t cnt)
+{
+ VocHeader vh;
+ VocBlockType bt;
+ VocVoiceData vd;
+ VocExtBlock eb;
+
+ memcpy(vh.magic, VOC_MAGIC_STRING, 20);
+ vh.headerlen = LE_SHORT(sizeof(VocHeader));
+ vh.version = LE_SHORT(VOC_ACTUAL_VERSION);
+ vh.coded_ver = LE_SHORT(0x1233 - VOC_ACTUAL_VERSION);
+
+ if (write(fd, &vh, sizeof(VocHeader)) != sizeof(VocHeader)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ if (hwparams.channels > 1) {
+ /* write an extended block */
+ bt.type = 8;
+ bt.datalen = 4;
+ bt.datalen_m = bt.datalen_h = 0;
+ if (write(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ eb.tc = LE_SHORT(65536 - 256000000L / (hwparams.rate << 1));
+ eb.pack = 0;
+ eb.mode = 1;
+ if (write(fd, &eb, sizeof(VocExtBlock)) != sizeof(VocExtBlock)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ }
+ bt.type = 1;
+ cnt += sizeof(VocVoiceData); /* Channel_data block follows */
+ bt.datalen = (u_char) (cnt & 0xFF);
+ bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8);
+ bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
+ if (write(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ vd.tc = (u_char) (256 - (1000000 / hwparams.rate));
+ vd.pack = 0;
+ if (write(fd, &vd, sizeof(VocVoiceData)) != sizeof(VocVoiceData)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+}
+
+/* write a WAVE-header */
+static void begin_wave(int fd, size_t cnt)
+{
+ WaveHeader h;
+ WaveFmtBody f;
+ WaveChunkHeader cf, cd;
+ int bits;
+ u_int tmp;
+ u_short tmp2;
+
+ /* WAVE cannot handle greater than 32bit (signed?) int */
+ if (cnt == (size_t)-2)
+ cnt = 0x7fffff00;
+
+ bits = 8;
+ switch ((unsigned long) hwparams.format) {
+ case SND_PCM_FORMAT_U8:
+ bits = 8;
+ break;
+ case SND_PCM_FORMAT_S16_LE:
+ bits = 16;
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ case SND_PCM_FORMAT_FLOAT_LE:
+ bits = 32;
+ break;
+ case SND_PCM_FORMAT_S24_LE:
+ case SND_PCM_FORMAT_S24_3LE:
+ bits = 24;
+ break;
+ default:
+ error(_("Wave doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
+ exit(EXIT_FAILURE);
+ }
+ h.magic = WAV_RIFF;
+ tmp = cnt + sizeof(WaveHeader) + sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + sizeof(WaveChunkHeader) - 8;
+ h.length = LE_INT(tmp);
+ h.type = WAV_WAVE;
+
+ cf.type = WAV_FMT;
+ cf.length = LE_INT(16);
+
+ if (hwparams.format == SND_PCM_FORMAT_FLOAT_LE)
+ f.format = LE_SHORT(WAV_FMT_IEEE_FLOAT);
+ else
+ f.format = LE_SHORT(WAV_FMT_PCM);
+ f.channels = LE_SHORT(hwparams.channels);
+ f.sample_fq = LE_INT(hwparams.rate);
+#if 0
+ tmp2 = (samplesize == 8) ? 1 : 2;
+ f.byte_p_spl = LE_SHORT(tmp2);
+ tmp = dsp_speed * hwparams.channels * (u_int) tmp2;
+#else
+ tmp2 = hwparams.channels * snd_pcm_format_physical_width(hwparams.format) / 8;
+ f.byte_p_spl = LE_SHORT(tmp2);
+ tmp = (u_int) tmp2 * hwparams.rate;
+#endif
+ f.byte_p_sec = LE_INT(tmp);
+ f.bit_p_spl = LE_SHORT(bits);
+
+ cd.type = WAV_DATA;
+ cd.length = LE_INT(cnt);
+
+ if (write(fd, &h, sizeof(WaveHeader)) != sizeof(WaveHeader) ||
+ write(fd, &cf, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader) ||
+ write(fd, &f, sizeof(WaveFmtBody)) != sizeof(WaveFmtBody) ||
+ write(fd, &cd, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+}
+
+/* write a Au-header */
+static void begin_au(int fd, size_t cnt)
+{
+ AuHeader ah;
+
+ ah.magic = AU_MAGIC;
+ ah.hdr_size = BE_INT(24);
+ ah.data_size = BE_INT(cnt);
+ switch ((unsigned long) hwparams.format) {
+ case SND_PCM_FORMAT_MU_LAW:
+ ah.encoding = BE_INT(AU_FMT_ULAW);
+ break;
+ case SND_PCM_FORMAT_U8:
+ ah.encoding = BE_INT(AU_FMT_LIN8);
+ break;
+ case SND_PCM_FORMAT_S16_BE:
+ ah.encoding = BE_INT(AU_FMT_LIN16);
+ break;
+ default:
+ error(_("Sparc Audio doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
+ exit(EXIT_FAILURE);
+ }
+ ah.sample_rate = BE_INT(hwparams.rate);
+ ah.channels = BE_INT(hwparams.channels);
+ if (write(fd, &ah, sizeof(AuHeader)) != sizeof(AuHeader)) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+}
+
+/* closing .VOC */
+static void end_voc(int fd)
+{
+ off64_t length_seek;
+ VocBlockType bt;
+ size_t cnt;
+ char dummy = 0; /* Write a Terminator */
+
+ if (write(fd, &dummy, 1) != 1) {
+ error(_("write error"));
+ exit(EXIT_FAILURE);
+ }
+ length_seek = sizeof(VocHeader);
+ if (hwparams.channels > 1)
+ length_seek += sizeof(VocBlockType) + sizeof(VocExtBlock);
+ bt.type = 1;
+ cnt = fdcount;
+ cnt += sizeof(VocVoiceData); /* Channel_data block follows */
+ if (cnt > 0x00ffffff)
+ cnt = 0x00ffffff;
+ bt.datalen = (u_char) (cnt & 0xFF);
+ bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8);
+ bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
+ if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
+ write(fd, &bt, sizeof(VocBlockType));
+ if (fd != 1)
+ close(fd);
+}
+
+static void end_wave(int fd)
+{ /* only close output */
+ WaveChunkHeader cd;
+ off64_t length_seek;
+ off64_t filelen;
+ u_int rifflen;
+
+ length_seek = sizeof(WaveHeader) +
+ sizeof(WaveChunkHeader) +
+ sizeof(WaveFmtBody);
+ cd.type = WAV_DATA;
+ cd.length = fdcount > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(fdcount);
+ filelen = fdcount + 2*sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + 4;
+ rifflen = filelen > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(filelen);
+ if (lseek64(fd, 4, SEEK_SET) == 4)
+ write(fd, &rifflen, 4);
+ if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
+ write(fd, &cd, sizeof(WaveChunkHeader));
+ if (fd != 1)
+ close(fd);
+}
+
+static void end_au(int fd)
+{ /* only close output */
+ AuHeader ah;
+ off64_t length_seek;
+
+ length_seek = (char *)&ah.data_size - (char *)&ah;
+ ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount);
+ if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
+ write(fd, &ah.data_size, sizeof(ah.data_size));
+ if (fd != 1)
+ close(fd);
+}
+
+static void header(int rtype, char *name)
+{
+ if (!quiet_mode) {
+ if (! name)
+ name = (stream == SND_PCM_STREAM_PLAYBACK) ? "stdout" : "stdin";
+ fprintf(stderr, "%s %s '%s' : ",
+ (stream == SND_PCM_STREAM_PLAYBACK) ? _("Playing") : _("Recording"),
+ gettext(fmt_rec_table[rtype].what),
+ name);
+ fprintf(stderr, "%s, ", snd_pcm_format_description(hwparams.format));
+ fprintf(stderr, _("Rate %d Hz, "), hwparams.rate);
+ if (hwparams.channels == 1)
+ fprintf(stderr, _("Mono"));
+ else if (hwparams.channels == 2)
+ fprintf(stderr, _("Stereo"));
+ else
+ fprintf(stderr, _("Channels %i"), hwparams.channels);
+ fprintf(stderr, "\n");
+ }
+}
+
+/* playing raw data */
+
+static void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name)
+{
+ int l, r;
+ off64_t written = 0;
+ off64_t c;
+
+ header(rtype, name);
+ set_params();
+
+ while (loaded > chunk_bytes && written < count) {
+ if (pcm_write(audiobuf + written, chunk_size) <= 0)
+ return;
+ written += chunk_bytes;
+ loaded -= chunk_bytes;
+ }
+ if (written > 0 && loaded > 0)
+ memmove(audiobuf, audiobuf + written, loaded);
+
+ l = loaded;
+ while (written < count) {
+ do {
+ c = count - written;
+ if (c > chunk_bytes)
+ c = chunk_bytes;
+ c -= l;
+
+ if (c == 0)
+ break;
+ r = safe_read(fd, audiobuf + l, c);
+ if (r < 0) {
+ perror(name);
+ exit(EXIT_FAILURE);
+ }
+ fdcount += r;
+ if (r == 0)
+ break;
+ l += r;
+ } while ((size_t)l < chunk_bytes);
+ l = l * 8 / bits_per_frame;
+ r = pcm_write(audiobuf, l);
+ if (r != l)
+ break;
+ r = r * bits_per_frame / 8;
+ written += r;
+ l = 0;
+ }
+ snd_pcm_nonblock(handle, 0);
+ snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
+}
+
+
+/*
+ * let's play or capture it (capture_type says VOC/WAVE/raw)
+ */
+
+static void playback(char *name)
+{
+ int ofs;
+ size_t dta;
+ ssize_t dtawave;
+
+ pbrec_count = LLONG_MAX;
+ fdcount = 0;
+ if (!name || !strcmp(name, "-")) {
+ fd = fileno(stdin);
+ name = "stdin";
+ } else {
+ if ((fd = open64(name, O_RDONLY, 0)) == -1) {
+ perror(name);
+ exit(EXIT_FAILURE);
+ }
+ }
+ /* read the file header */
+ dta = sizeof(AuHeader);
+ if ((size_t)safe_read(fd, audiobuf, dta) != dta) {
+ error(_("read error"));
+ exit(EXIT_FAILURE);
+ }
+ if (test_au(fd, audiobuf) >= 0) {
+ rhwparams.format = hwparams.format;
+ pbrec_count = calc_count();
+ playback_go(fd, 0, pbrec_count, FORMAT_AU, name);
+ goto __end;
+ }
+ dta = sizeof(VocHeader);
+ if ((size_t)safe_read(fd, audiobuf + sizeof(AuHeader),
+ dta - sizeof(AuHeader)) != dta - sizeof(AuHeader)) {
+ error(_("read error"));
+ exit(EXIT_FAILURE);
+ }
+ if ((ofs = test_vocfile(audiobuf)) >= 0) {
+ pbrec_count = calc_count();
+ voc_play(fd, ofs, name);
+ goto __end;
+ }
+ /* read bytes for WAVE-header */
+ if ((dtawave = test_wavefile(fd, audiobuf, dta)) >= 0) {
+ pbrec_count = calc_count();
+ playback_go(fd, dtawave, pbrec_count, FORMAT_WAVE, name);
+ } else {
+ /* should be raw data */
+ init_raw_data();
+ pbrec_count = calc_count();
+ playback_go(fd, dta, pbrec_count, FORMAT_RAW, name);
+ }
+ __end:
+ if (fd != 0)
+ close(fd);
+}
+
+static int new_capture_file(char *name, char *namebuf, size_t namelen,
+ int filecount)
+{
+ /* get a copy of the original filename */
+ char *s;
+ char buf[PATH_MAX+1];
+
+ strncpy(buf, name, sizeof(buf));
+
+ /* separate extension from filename */
+ s = buf + strlen(buf);
+ while (s > buf && *s != '.' && *s != '/')
+ --s;
+ if (*s == '.')
+ *s++ = 0;
+ else if (*s == '/')
+ s = buf + strlen(buf);
+
+ /* upon first jump to this if block rename the first file */
+ if (filecount == 1) {
+ if (*s)
+ snprintf(namebuf, namelen, "%s-01.%s", buf, s);
+ else
+ snprintf(namebuf, namelen, "%s-01", buf);
+ remove(namebuf);
+ rename(name, namebuf);
+ filecount = 2;
+ }
+
+ /* name of the current file */
+ if (*s)
+ snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s);
+ else
+ snprintf(namebuf, namelen, "%s-%02i", buf, filecount);
+
+ return filecount;
+}
+
+static void capture(char *orig_name)
+{
+ int tostdout=0; /* boolean which describes output stream */
+ int filecount=0; /* number of files written */
+ char *name = orig_name; /* current filename */
+ char namebuf[PATH_MAX+1];
+ off64_t count, rest; /* number of bytes to capture */
+
+ /* get number of bytes to capture */
+ count = calc_count();
+ if (count == 0)
+ count = LLONG_MAX;
+ /* WAVE-file should be even (I'm not sure), but wasting one byte
+ isn't a problem (this can only be in 8 bit mono) */
+ if (count < LLONG_MAX)
+ count += count % 2;
+ else
+ count -= count % 2;
+
+ /* display verbose output to console */
+ header(file_type, name);
+
+ /* setup sound hardware */
+ set_params();
+
+ /* write to stdout? */
+ if (!name || !strcmp(name, "-")) {
+ fd = fileno(stdout);
+ name = "stdout";
+ tostdout=1;
+ if (count > fmt_rec_table[file_type].max_filesize)
+ count = fmt_rec_table[file_type].max_filesize;
+ }
+
+ do {
+ /* open a file to write */
+ if(!tostdout) {
+ /* upon the second file we start the numbering scheme */
+ if (filecount) {
+ filecount = new_capture_file(orig_name, namebuf,
+ sizeof(namebuf),
+ filecount);
+ name = namebuf;
+ }
+
+ /* open a new file */
+ remove(name);
+ if ((fd = open64(name, O_WRONLY | O_CREAT, 0644)) == -1) {
+ perror(name);
+ exit(EXIT_FAILURE);
+ }
+ filecount++;
+ }
+
+ rest = count;
+ if (rest > fmt_rec_table[file_type].max_filesize)
+ rest = fmt_rec_table[file_type].max_filesize;
+
+ /* setup sample header */
+ if (fmt_rec_table[file_type].start)
+ fmt_rec_table[file_type].start(fd, rest);
+
+ /* capture */
+ fdcount = 0;
+ while (rest > 0) {
+ size_t c = (rest <= (off64_t)chunk_bytes) ?
+ (size_t)rest : chunk_bytes;
+ size_t f = c * 8 / bits_per_frame;
+ if (pcm_read(audiobuf, f) != f)
+ break;
+ if (write(fd, audiobuf, c) != c) {
+ perror(name);
+ exit(EXIT_FAILURE);
+ }
+ count -= c;
+ rest -= c;
+ fdcount += c;
+ }
+
+ /* finish sample container */
+ if (fmt_rec_table[file_type].end && !tostdout) {
+ fmt_rec_table[file_type].end(fd);
+ fd = -1;
+ }
+
+ /* repeat the loop when format is raw without timelimit or
+ * requested counts of data are recorded
+ */
+ } while ((file_type == FORMAT_RAW && !timelimit) || count > 0);
+}
+
+static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count, int rtype, char **names)
+{
+ int r;
+ size_t vsize;
+
+ unsigned int channel;
+ u_char *bufs[channels];
+
+ header(rtype, names[0]);
+ set_params();
+
+ vsize = chunk_bytes / channels;
+
+ // Not yet implemented
+ assert(loaded == 0);
+
+ for (channel = 0; channel < channels; ++channel)
+ bufs[channel] = audiobuf + vsize * channel;
+
+ while (count > 0) {
+ size_t c = 0;
+ size_t expected = count / channels;
+ if (expected > vsize)
+ expected = vsize;
+ do {
+ r = safe_read(fds[0], bufs[0], expected);
+ if (r < 0) {
+ perror(names[channel]);
+ exit(EXIT_FAILURE);
+ }
+ for (channel = 1; channel < channels; ++channel) {
+ if (safe_read(fds[channel], bufs[channel], r) != r) {
+ perror(names[channel]);
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (r == 0)
+ break;
+ c += r;
+ } while (c < expected);
+ c = c * 8 / bits_per_sample;
+ r = pcm_writev(bufs, channels, c);
+ if ((size_t)r != c)
+ break;
+ r = r * bits_per_frame / 8;
+ count -= r;
+ }
+ snd_pcm_nonblock(handle, 0);
+ snd_pcm_drain(handle);
+ snd_pcm_nonblock(handle, nonblock);
+}
+
+static void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names)
+{
+ size_t c;
+ ssize_t r;
+ unsigned int channel;
+ size_t vsize;
+ u_char *bufs[channels];
+
+ header(rtype, names[0]);
+ set_params();
+
+ vsize = chunk_bytes / channels;
+
+ for (channel = 0; channel < channels; ++channel)
+ bufs[channel] = audiobuf + vsize * channel;
+
+ while (count > 0) {
+ size_t rv;
+ c = count;
+ if (c > chunk_bytes)
+ c = chunk_bytes;
+ c = c * 8 / bits_per_frame;
+ if ((size_t)(r = pcm_readv(bufs, channels, c)) != c)
+ break;
+ rv = r * bits_per_sample / 8;
+ for (channel = 0; channel < channels; ++channel) {
+ if ((size_t)write(fds[channel], bufs[channel], rv) != rv) {
+ perror(names[channel]);
+ exit(EXIT_FAILURE);
+ }
+ }
+ r = r * bits_per_frame / 8;
+ count -= r;
+ fdcount += r;
+ }
+}
+
+static void playbackv(char **names, unsigned int count)
+{
+ int ret = 0;
+ unsigned int channel;
+ unsigned int channels = rhwparams.channels;
+ int alloced = 0;
+ int fds[channels];
+ for (channel = 0; channel < channels; ++channel)
+ fds[channel] = -1;
+
+ if (count == 1 && channels > 1) {
+ size_t len = strlen(names[0]);
+ char format[1024];
+ memcpy(format, names[0], len);
+ strcpy(format + len, ".%d");
+ len += 4;
+ names = malloc(sizeof(*names) * channels);
+ for (channel = 0; channel < channels; ++channel) {
+ names[channel] = malloc(len);
+ sprintf(names[channel], format, channel);
+ }
+ alloced = 1;
+ } else if (count != channels) {
+ error(_("You need to specify %d files"), channels);
+ exit(EXIT_FAILURE);
+ }
+
+ for (channel = 0; channel < channels; ++channel) {
+ fds[channel] = open(names[channel], O_RDONLY, 0);
+ if (fds[channel] < 0) {
+ perror(names[channel]);
+ ret = EXIT_FAILURE;
+ goto __end;
+ }
+ }
+ /* should be raw data */
+ init_raw_data();
+ pbrec_count = calc_count();
+ playbackv_go(fds, channels, 0, pbrec_count, FORMAT_RAW, names);
+
+ __end:
+ for (channel = 0; channel < channels; ++channel) {
+ if (fds[channel] >= 0)
+ close(fds[channel]);
+ if (alloced)
+ free(names[channel]);
+ }
+ if (alloced)
+ free(names);
+ if (ret)
+ exit(ret);
+}
+
+static void capturev(char **names, unsigned int count)
+{
+ int ret = 0;
+ unsigned int channel;
+ unsigned int channels = rhwparams.channels;
+ int alloced = 0;
+ int fds[channels];
+ for (channel = 0; channel < channels; ++channel)
+ fds[channel] = -1;
+
+ if (count == 1) {
+ size_t len = strlen(names[0]);
+ char format[1024];
+ memcpy(format, names[0], len);
+ strcpy(format + len, ".%d");
+ len += 4;
+ names = malloc(sizeof(*names) * channels);
+ for (channel = 0; channel < channels; ++channel) {
+ names[channel] = malloc(len);
+ sprintf(names[channel], format, channel);
+ }
+ alloced = 1;
+ } else if (count != channels) {
+ error(_("You need to specify %d files"), channels);
+ exit(EXIT_FAILURE);
+ }
+
+ for (channel = 0; channel < channels; ++channel) {
+ fds[channel] = open(names[channel], O_WRONLY + O_CREAT, 0644);
+ if (fds[channel] < 0) {
+ perror(names[channel]);
+ ret = EXIT_FAILURE;
+ goto __end;
+ }
+ }
+ /* should be raw data */
+ init_raw_data();
+ pbrec_count = calc_count();
+ capturev_go(fds, channels, pbrec_count, FORMAT_RAW, names);
+
+ __end:
+ for (channel = 0; channel < channels; ++channel) {
+ if (fds[channel] >= 0)
+ close(fds[channel]);
+ if (alloced)
+ free(names[channel]);
+ }
+ if (alloced)
+ free(names);
+ if (ret)
+ exit(ret);
+}
diff --git a/alsa-utils/aplay/arecord.1 b/alsa-utils/aplay/arecord.1
new file mode 100644
index 0000000..7759347
--- /dev/null
+++ b/alsa-utils/aplay/arecord.1
@@ -0,0 +1,160 @@
+.TH APLAY 1 "2 August 2001"
+.SH NAME
+arecord, aplay \- command-line sound recorder and player for ALSA
+soundcard driver
+.SH SYNOPSIS
+\fBarecord\fP [\fIflags\fP] [filename]
+.br
+\fBaplay\fP [\fIflags\fP] [filename [filename]] ...
+
+.SH DESCRIPTION
+\fBarecord\fP is a command-line soundfile recorder for the ALSA soundcard
+driver. It supports several file formats and multiple soundcards with
+multiple devices. If recording with interleaved mode samples the file is
+automatically split before the 2GB filesize.
+
+\fBaplay\fP is much the same, only it plays instead of recording. For
+supported soundfile formats, the sampling rate, bit depth, and so
+forth can be automatically determined from the soundfile header.
+
+If filename is not specified, the standard output or input is used. The \fBaplay\fP utility accepts multiple filenames.
+
+.SH OPTIONS
+.TP
+\fI\-h, \-\-help\fP
+Help: show syntax.
+.TP
+\fI\-\-version\fP
+Print current version.
+.TP
+\fI\-l, \-\-list\-devices\fP
+List all soundcards and digital audio devices
+.TP
+\fI\-L, \-\-list\-pcms\fP
+List all PCMs defined
+.TP
+\fI\-D, \-\-device=NAME\fP
+Select PCM by name
+.TP
+\fI\-q \-\-quiet\fP
+Quiet mode. Suppress messages (not sound :))
+.TP
+\fI\-t, \-\-file\-type TYPE\fP
+File type (voc, wav, raw or au).
+If this parameter is omitted the WAVE format is used.
+.TP
+\fI\-c, \-\-channels=#\fP
+The number of channels.
+The default is one channel.
+.TP
+\fI\-f \-\-format=FORMAT\fP
+Sample format
+.br
+Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE
+S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE
+FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW
+A_LAW IMA_ADPCM MPEG GSM
+.br
+Some of these may not be available on selected hardware
+.br
+There are also two format shortcuts available:
+.nf
+\-f cd (16 bit little endian, 44100, stereo [\-f S16_LE \-c2 \-r44100]
+\-f dat (16 bit little endian, 48000, stereo) [\-f S16_LE \-c2 \-r48000]
+.fi
+If no format is given U8 is used.
+.TP
+\fI\-r, \-\-rate=#<Hz>\fP
+Sampling rate in Hertz. The default rate is 8000 Hertz.
+.TP
+\fI\-d, \-\-duration=#\fP
+Interrupt after # seconds.
+A value of zero means infinity.
+The default is zero, so if this option is omitted then the arecord process will run until it is killed.
+.TP
+\fI\-s, \-\-sleep\-min=#\fP
+Min ticks to sleep. The default is not to sleep.
+.TP
+\fI\-M, \-\-mmap\fP
+Use memory-mapped (mmap) I/O mode for the audio stream.
+If this option is not set, the read/write I/O mode will be used.
+.TP
+\fI\-N, \-\-nonblock\fP
+Open the audio device in non-blocking mode. If the device is busy the program will exit immediately.
+If this option is not set the program will block until the audio device is available again.
+.TP
+\fI\-F, \-\-period\-time=#\fP
+Distance between interrupts is # microseconds.
+If no period time and no period size is given then a quarter of the buffer time is set.
+.TP
+\fI\-B, \-\-buffer\-time=#\fP
+Buffer duration is # microseconds
+If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set.
+.TP
+\fI\-\-period\-size=#\fP
+Distance between interrupts is # frames
+If no period size and no period time is given then a quarter of the buffer size is set.
+.TP
+\fI\-\-buffer\-size=#\fP
+Buffer duration is # frames
+If no buffer time and no buffer size is given then the maximal allowed buffer time but not more than 500ms is set.
+.TP
+\fI\-A, \-\-avail\-min=#\fP
+Min available space for wakeup is # microseconds
+.TP
+\fI\-R, \-\-start\-delay=#\fP
+Delay for automatic PCM start is # microseconds
+(relative to buffer size if <= 0)
+.TP
+\fI\-T, \-\-stop\-delay=#\fP
+Delay for automatic PCM stop is # microseconds from xrun
+.TP
+\fI\-v, \-\-verbose\fP
+Show PCM structure and setup.
+This option is accumulative. The VU meter is displayed when this
+is given twice or three times.
+.TP
+\fI\-V, \-\-vumeter=TYPE\fP
+Specifies the VU-meter type, either \fIstereo\fP or \fImono\fP.
+The stereo VU-meter is available only for 2-channel stereo samples
+with interleaved format.
+.TP
+\fI\-I, \-\-separate\-channels\fP
+One file for each channel
+
+.SS
+Example:
+
+.TP
+\fBaplay \-c 1 \-t raw \-r 22050 \-f mu_law foobar\fR
+will play the raw file "foobar" as a
+22050-Hz, mono, 8-bit, Mu-Law .au file.
+
+.TP
+\fBarecord \-d 10 \-f cd \-t wav \-D copy foobar.wav\fP
+will record foobar.wav as a 10-second, CD-quality wave file, using the
+PCM "copy" (which might be defined in the user's .asoundrc file as:
+.nf
+pcm.copy {
+ type plug
+ slave {
+ pcm hw
+ }
+ route_policy copy
+}
+.fi
+
+.SH SEE ALSO
+\fB
+alsamixer(1),
+amixer(1)
+\fP
+
+.SH BUGS
+Note that .aiff files are not currently supported.
+
+.SH AUTHOR
+\fBarecord\fP and \fBaplay\fP are by Jaroslav Kysela <perex@perex.cz>
+This document is by Paul Winkler <zarmzarm@erols.com>.
+Updated for Alsa 0.9 by James Tappin <james@xena.uklinux.net>
+
diff --git a/alsa-utils/aplay/formats.h b/alsa-utils/aplay/formats.h
new file mode 100644
index 0000000..b5314f9
--- /dev/null
+++ b/alsa-utils/aplay/formats.h
@@ -0,0 +1,127 @@
+#ifndef FORMATS_H
+#define FORMATS_H 1
+
+#include <endian.h>
+#include <byteswap.h>
+
+/* Definitions for .VOC files */
+
+#define VOC_MAGIC_STRING "Creative Voice File\x1A"
+#define VOC_ACTUAL_VERSION 0x010A
+#define VOC_SAMPLESIZE 8
+
+#define VOC_MODE_MONO 0
+#define VOC_MODE_STEREO 1
+
+#define VOC_DATALEN(bp) ((u_long)(bp->datalen) | \
+ ((u_long)(bp->datalen_m) << 8) | \
+ ((u_long)(bp->datalen_h) << 16) )
+
+typedef struct voc_header {
+ u_char magic[20]; /* must be MAGIC_STRING */
+ u_short headerlen; /* Headerlength, should be 0x1A */
+ u_short version; /* VOC-file version */
+ u_short coded_ver; /* 0x1233-version */
+} VocHeader;
+
+typedef struct voc_blocktype {
+ u_char type;
+ u_char datalen; /* low-byte */
+ u_char datalen_m; /* medium-byte */
+ u_char datalen_h; /* high-byte */
+} VocBlockType;
+
+typedef struct voc_voice_data {
+ u_char tc;
+ u_char pack;
+} VocVoiceData;
+
+typedef struct voc_ext_block {
+ u_short tc;
+ u_char pack;
+ u_char mode;
+} VocExtBlock;
+
+/* Definitions for Microsoft WAVE format */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
+#define LE_SHORT(v) (v)
+#define LE_INT(v) (v)
+#define BE_SHORT(v) bswap_16(v)
+#define BE_INT(v) bswap_32(v)
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
+#define LE_SHORT(v) bswap_16(v)
+#define LE_INT(v) bswap_32(v)
+#define BE_SHORT(v) (v)
+#define BE_INT(v) (v)
+#else
+#error "Wrong endian"
+#endif
+
+#define WAV_RIFF COMPOSE_ID('R','I','F','F')
+#define WAV_WAVE COMPOSE_ID('W','A','V','E')
+#define WAV_FMT COMPOSE_ID('f','m','t',' ')
+#define WAV_DATA COMPOSE_ID('d','a','t','a')
+
+/* WAVE fmt block constants from Microsoft mmreg.h header */
+#define WAV_FMT_PCM 0x0001
+#define WAV_FMT_IEEE_FLOAT 0x0003
+#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
+#define WAV_FMT_EXTENSIBLE 0xfffe
+
+/* Used with WAV_FMT_EXTENSIBLE format */
+#define WAV_GUID_TAG "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
+
+/* it's in chunks like .voc and AMIGA iff, but my source say there
+ are in only in this combination, so I combined them in one header;
+ it works on all WAVE-file I have
+ */
+typedef struct {
+ u_int magic; /* 'RIFF' */
+ u_int length; /* filelen */
+ u_int type; /* 'WAVE' */
+} WaveHeader;
+
+typedef struct {
+ u_short format; /* see WAV_FMT_* */
+ u_short channels;
+ u_int sample_fq; /* frequence of sample */
+ u_int byte_p_sec;
+ u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
+ u_short bit_p_spl; /* 8, 12 or 16 bit */
+} WaveFmtBody;
+
+typedef struct {
+ WaveFmtBody format;
+ u_short ext_size;
+ u_short bit_p_spl;
+ u_int channel_mask;
+ u_short guid_format; /* WAV_FMT_* */
+ u_char guid_tag[14]; /* WAV_GUID_TAG */
+} WaveFmtExtensibleBody;
+
+typedef struct {
+ u_int type; /* 'data' */
+ u_int length; /* samplecount */
+} WaveChunkHeader;
+
+/* Definitions for Sparc .au header */
+
+#define AU_MAGIC COMPOSE_ID('.','s','n','d')
+
+#define AU_FMT_ULAW 1
+#define AU_FMT_LIN8 2
+#define AU_FMT_LIN16 3
+
+typedef struct au_header {
+ u_int magic; /* '.snd' */
+ u_int hdr_size; /* size of header (min 24) */
+ u_int data_size; /* size of data */
+ u_int encoding; /* see to AU_FMT_XXXX */
+ u_int sample_rate; /* sample rate */
+ u_int channels; /* number of channels (voices) */
+} AuHeader;
+
+#endif /* FORMATS */
diff --git a/alsa-utils/config.guess b/alsa-utils/config.guess
new file mode 100644
index 0000000..33c9ad7
--- /dev/null
+++ b/alsa-utils/config.guess
@@ -0,0 +1,1507 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2006-05-13'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_MACHINE}" in
+ i?86)
+ test -z "$VENDOR" && VENDOR=pc
+ ;;
+ *)
+ test -z "$VENDOR" && VENDOR=unknown
+ ;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[345]*)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T:Interix*:[345]*)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-${VENDOR}-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-${VENDOR}-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-${VENDOR}-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-${VENDOR}-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
+ PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
+ *) echo hppa-${VENDOR}-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-${VENDOR}-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-${VENDOR}-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/alsa-utils/config.rpath b/alsa-utils/config.rpath
new file mode 100644
index 0000000..c492a93
--- /dev/null
+++ b/alsa-utils/config.rpath
@@ -0,0 +1,614 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2006 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ darwin*)
+ case $cc_basename in
+ xlc*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ mingw* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux*)
+ case $cc_basename in
+ icc* | ecc*)
+ wl='-Wl,'
+ ;;
+ pgcc | pgf77 | pgf90)
+ wl='-Wl,'
+ ;;
+ ccc*)
+ wl='-Wl,'
+ ;;
+ como)
+ wl='-lopt='
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ unicos*)
+ wl='-Wl,'
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we cannot use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ interix3*)
+ hardcode_direct=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ linux*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = no; then
+ hardcode_libdir_flag_spec=
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ hardcode_direct=no
+ if test "$GCC" = yes ; then
+ :
+ else
+ case $cc_basename in
+ xlc*)
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd* | kfreebsd*-gnu | dragonfly*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ ;;
+ *)
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6*)
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator=':'
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ ;;
+ aix4* | aix5*)
+ ;;
+ amigaos*)
+ ;;
+ beos*)
+ ;;
+ bsdi[45]*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ ;;
+ dgux*)
+ ;;
+ freebsd1*)
+ ;;
+ kfreebsd*-gnu)
+ ;;
+ freebsd* | dragonfly*)
+ ;;
+ gnu*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $host_cpu in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ ;;
+ interix3*)
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux*)
+ ;;
+ knetbsd*-gnu)
+ ;;
+ netbsd*)
+ ;;
+ newsos6)
+ ;;
+ nto-qnx*)
+ ;;
+ openbsd*)
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ ;;
+ osf3* | osf4* | osf5*)
+ ;;
+ solaris*)
+ ;;
+ sunos4*)
+ ;;
+ sysv4 | sysv4.3*)
+ ;;
+ sysv4*MP*)
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ ;;
+ uts4*)
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/alsa-utils/config.sub b/alsa-utils/config.sub
new file mode 100644
index 0000000..4d936e2
--- /dev/null
+++ b/alsa-utils/config.sub
@@ -0,0 +1,1608 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2006-05-13'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/alsa-utils/configure b/alsa-utils/configure
new file mode 100644
index 0000000..10b429c
--- /dev/null
+++ b/alsa-utils/configure
@@ -0,0 +1,10157 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.60.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="alsamixer/alsamixer.c"
+ac_default_prefix=/usr
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+USE_NLS
+MSGFMT
+GMSGFMT
+MSGFMT_015
+GMSGFMT_015
+XGETTEXT
+XGETTEXT_015
+MSGMERGE
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+INTL_MACOSX_LIBS
+LIBICONV
+LTLIBICONV
+INTLLIBS
+LIBINTL
+LTLIBINTL
+POSUB
+LN_S
+ALSA_CFLAGS
+ALSA_LIBS
+ALSAMIXER_TRUE
+ALSAMIXER_FALSE
+ALSACONF_TRUE
+ALSACONF_FALSE
+xmlto
+USE_XMLTO_TRUE
+USE_XMLTO_FALSE
+CPP
+GREP
+EGREP
+ncursesw5_config
+ncurses5_config
+CURSESINC
+CURSESLIB
+CURSES_CFLAGS
+TESTSOUND
+SND_UTIL_VERSION
+SND_UTIL_MAJOR
+SND_UTIL_MINOR
+SND_UTIL_SUBMINOR
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval with_$ac_package=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-nls do not use Native Language Support
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-rpath do not hardcode runtime library paths
+ --disable-alsatest Do not try to compile and run a test Alsa program
+ --disable-alsamixer Disable alsamixer compilation
+ --disable-alsaconf Disable alsaconf packaging
+ --disable-xmlto Disable man page creation via xmlto
+ --disable-largefile omit support for large files
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld default=no
+ --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
+ --without-libiconv-prefix don't search for libiconv in includedir and libdir
+ --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib
+ --without-libintl-prefix don't search for libintl in includedir and libdir
+ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)
+ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)
+ --with-curses libname Specify the curses library to use (default=auto)
+ --with-testsound=file give the path of test sound file for alsaconf
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.60
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+am__api_version="1.9"
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ SET_MAKE=
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=alsa-utils
+ VERSION=1.0.19
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+
+ { echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6; }
+ # Check whether --enable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval=$enable_nls; USE_NLS=$enableval
+else
+ USE_NLS=yes
+fi
+
+ { echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6; }
+
+
+
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MSGFMT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case "$MSGFMT" in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ echo "$as_me: trying $ac_dir/$ac_word..." >&5
+ if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test "$MSGFMT" != ":"; then
+ { echo "$as_me:$LINENO: result: $MSGFMT" >&5
+echo "${ECHO_T}$MSGFMT" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GMSGFMT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $GMSGFMT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+ { echo "$as_me:$LINENO: result: $GMSGFMT" >&5
+echo "${ECHO_T}$GMSGFMT" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+ case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
+ *) MSGFMT_015=$MSGFMT ;;
+ esac
+
+ case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+ *) GMSGFMT_015=$GMSGFMT ;;
+ esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_XGETTEXT+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case "$XGETTEXT" in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ echo "$as_me: trying $ac_dir/$ac_word..." >&5
+ if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test "$XGETTEXT" != ":"; then
+ { echo "$as_me:$LINENO: result: $XGETTEXT" >&5
+echo "${ECHO_T}$XGETTEXT" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ rm -f messages.po
+
+ case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+ *) XGETTEXT_015=$XGETTEXT ;;
+ esac
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MSGMERGE+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case "$MSGMERGE" in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ echo "$as_me: trying $ac_dir/$ac_word..." >&5
+ if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then
+ ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+ test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
+ ;;
+esac
+fi
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+ { echo "$as_me:$LINENO: result: $MSGMERGE" >&5
+echo "${ECHO_T}$MSGMERGE" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$localedir" || localedir='${datadir}/locale'
+
+
+ ac_config_commands="$ac_config_commands po-directories"
+
+
+
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${acl_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break ;;
+ *)
+ test "$with_gnu_ld" != yes && break ;;
+ esac
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${acl_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes ;;
+*)
+ acl_cv_prog_gnu_ld=no ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$acl_cv_prog_gnu_ld
+
+
+
+
+ { echo "$as_me:$LINENO: checking for shared library run path origin" >&5
+echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6; }
+if test "${acl_cv_rpath+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+
+fi
+{ echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5
+echo "${ECHO_T}$acl_cv_rpath" >&6; }
+ wl="$acl_cv_wl"
+ libext="$acl_cv_libext"
+ shlibext="$acl_cv_shlibext"
+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ hardcode_direct="$acl_cv_hardcode_direct"
+ hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ # Check whether --enable-rpath was given.
+if test "${enable_rpath+set}" = set; then
+ enableval=$enable_rpath; :
+else
+ enable_rpath=yes
+fi
+
+
+
+ acl_libdirstem=lib
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+
+
+
+
+
+
+
+
+ use_additional=yes
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+
+# Check whether --with-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then
+ withval=$with_libiconv_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+
+fi
+
+ LIBICONV=
+ LTLIBICONV=
+ INCICONV=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='iconv '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ else
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ else
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$hardcode_direct" = yes; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBICONV; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+ done
+ fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5
+echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6; }
+if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <CoreFoundation/CFPreferences.h>
+int
+main ()
+{
+CFPreferencesCopyAppValue(NULL, NULL)
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gt_cv_func_CFPreferencesCopyAppValue=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gt_cv_func_CFPreferencesCopyAppValue=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$gt_save_LIBS"
+fi
+{ echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
+echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
+_ACEOF
+
+ fi
+ { echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5
+echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6; }
+if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <CoreFoundation/CFLocale.h>
+int
+main ()
+{
+CFLocaleCopyCurrent();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gt_cv_func_CFLocaleCopyCurrent=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gt_cv_func_CFLocaleCopyCurrent=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$gt_save_LIBS"
+fi
+{ echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
+echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6; }
+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CFLOCALECOPYCURRENT 1
+_ACEOF
+
+ fi
+ INTL_MACOSX_LIBS=
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+ fi
+
+
+
+
+
+
+ LIBINTL=
+ LTLIBINTL=
+ POSUB=
+
+ if test "$USE_NLS" = "yes"; then
+ gt_use_preinstalled_gnugettext=no
+
+
+
+
+
+
+ { echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5
+echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6; }
+if test "${gt_cv_func_gnugettext1_libc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gt_cv_func_gnugettext1_libc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gt_cv_func_gnugettext1_libc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5
+echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6; }
+
+ if test "$gt_cv_func_gnugettext1_libc" != "yes"; then
+
+
+
+
+
+ am_save_CPPFLAGS="$CPPFLAGS"
+
+ for element in $INCICONV; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+
+ { echo "$as_me:$LINENO: checking for iconv" >&5
+echo $ECHO_N "checking for iconv... $ECHO_C" >&6; }
+if test "${am_cv_func_iconv+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ am_cv_func_iconv=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ am_cv_lib_iconv=yes
+ am_cv_func_iconv=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$am_save_LIBS"
+ fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5
+echo "${ECHO_T}$am_cv_func_iconv" >&6; }
+ if test "$am_cv_func_iconv" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ICONV 1
+_ACEOF
+
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ { echo "$as_me:$LINENO: checking how to link with libiconv" >&5
+echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: $LIBICONV" >&5
+echo "${ECHO_T}$LIBICONV" >&6; }
+ else
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+
+
+
+
+
+
+
+ use_additional=yes
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+
+# Check whether --with-libintl-prefix was given.
+if test "${with_libintl_prefix+set}" = set; then
+ withval=$with_libintl_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+
+fi
+
+ LIBINTL=
+ LTLIBINTL=
+ INCINTL=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='intl '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ else
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBINTL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ else
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$hardcode_direct" = yes; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBINTL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+ else
+ LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a"
+ else
+ LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCINTL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBINTL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBINTL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$dep"
+ LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+ LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir"
+ done
+ fi
+
+ { echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5
+echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6; }
+if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gt_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCINTL"
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBINTL"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gt_cv_func_gnugettext1_libintl=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gt_cv_func_gnugettext1_libintl=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then
+ LIBS="$LIBS $LIBICONV"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ LIBINTL="$LIBINTL $LIBICONV"
+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+ gt_cv_func_gnugettext1_libintl=yes
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ fi
+ CPPFLAGS="$gt_save_CPPFLAGS"
+ LIBS="$gt_save_LIBS"
+fi
+{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5
+echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6; }
+ fi
+
+ if test "$gt_cv_func_gnugettext1_libc" = "yes" \
+ || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \
+ && test "$PACKAGE" != gettext-runtime \
+ && test "$PACKAGE" != gettext-tools; }; then
+ gt_use_preinstalled_gnugettext=yes
+ else
+ LIBINTL=
+ LTLIBINTL=
+ INCINTL=
+ fi
+
+
+
+ if test -n "$INTL_MACOSX_LIBS"; then
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+ fi
+ fi
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_NLS 1
+_ACEOF
+
+ else
+ USE_NLS=no
+ fi
+ fi
+
+ { echo "$as_me:$LINENO: checking whether to use NLS" >&5
+echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6; }
+ if test "$USE_NLS" = "yes"; then
+ { echo "$as_me:$LINENO: checking where the gettext function comes from" >&5
+echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6; }
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
+ gt_source="external libintl"
+ else
+ gt_source="libc"
+ fi
+ else
+ gt_source="included intl directory"
+ fi
+ { echo "$as_me:$LINENO: result: $gt_source" >&5
+echo "${ECHO_T}$gt_source" >&6; }
+ fi
+
+ if test "$USE_NLS" = "yes"; then
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
+ { echo "$as_me:$LINENO: checking how to link with libintl" >&5
+echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: $LIBINTL" >&5
+echo "${ECHO_T}$LIBINTL" >&6; }
+
+ for element in $INCINTL; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+ fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETTEXT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DCGETTEXT 1
+_ACEOF
+
+ fi
+
+ POSUB=po
+ fi
+
+
+
+ INTLLIBS="$LIBINTL"
+
+
+
+
+
+
+
+
+
+if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
+then
+ { echo "$as_me:$LINENO: checking for cross-compiler" >&5
+echo $ECHO_N "checking for cross-compiler... $ECHO_C" >&6; }
+
+ which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
+ which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
+ && CC=${target_cpu}-${target-os}-gcc
+ which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
+ && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
+
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+alsa_save_CFLAGS="$CFLAGS"
+alsa_save_LDFLAGS="$LDFLAGS"
+alsa_save_LIBS="$LIBS"
+alsa_found=yes
+
+
+# Check whether --with-alsa-prefix was given.
+if test "${with_alsa_prefix+set}" = set; then
+ withval=$with_alsa_prefix; alsa_prefix="$withval"
+else
+ alsa_prefix=""
+fi
+
+
+
+# Check whether --with-alsa-inc-prefix was given.
+if test "${with_alsa_inc_prefix+set}" = set; then
+ withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval"
+else
+ alsa_inc_prefix=""
+fi
+
+
+# Check whether --enable-alsatest was given.
+if test "${enable_alsatest+set}" = set; then
+ enableval=$enable_alsatest; enable_alsatest="$enableval"
+else
+ enable_alsatest=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for ALSA CFLAGS" >&5
+echo $ECHO_N "checking for ALSA CFLAGS... $ECHO_C" >&6; }
+if test "$alsa_inc_prefix" != "" ; then
+ ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
+ CFLAGS="$CFLAGS -I$alsa_inc_prefix"
+fi
+{ echo "$as_me:$LINENO: result: $ALSA_CFLAGS" >&5
+echo "${ECHO_T}$ALSA_CFLAGS" >&6; }
+
+{ echo "$as_me:$LINENO: checking for ALSA LDFLAGS" >&5
+echo $ECHO_N "checking for ALSA LDFLAGS... $ECHO_C" >&6; }
+if test "$alsa_prefix" != "" ; then
+ ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
+ LDFLAGS="$LDFLAGS $ALSA_LIBS"
+fi
+
+ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
+LIBS="$ALSA_LIBS $LIBS"
+{ echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5
+echo "${ECHO_T}$ALSA_LIBS" >&6; }
+
+min_alsa_version=1.0.16
+{ echo "$as_me:$LINENO: checking for libasound headers version >= $min_alsa_version" >&5
+echo $ECHO_N "checking for libasound headers version >= $min_alsa_version... $ECHO_C" >&6; }
+no_alsa=""
+ alsa_min_major_version=`echo $min_alsa_version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+ alsa_min_minor_version=`echo $min_alsa_version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+ alsa_min_micro_version=`echo $min_alsa_version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <alsa/asoundlib.h>
+
+int
+main ()
+{
+
+/* ensure backward compatibility */
+#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
+#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
+#endif
+#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
+#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
+#endif
+#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
+#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
+#endif
+
+# if(SND_LIB_MAJOR > $alsa_min_major_version)
+ exit(0);
+# else
+# if(SND_LIB_MAJOR < $alsa_min_major_version)
+# error not present
+# endif
+
+# if(SND_LIB_MINOR > $alsa_min_minor_version)
+ exit(0);
+# else
+# if(SND_LIB_MINOR < $alsa_min_minor_version)
+# error not present
+# endif
+
+# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
+# error not present
+# endif
+# endif
+# endif
+exit(0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ { echo "$as_me:$LINENO: result: found." >&5
+echo "${ECHO_T}found." >&6; }
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: not present." >&5
+echo "${ECHO_T}not present." >&6; }
+ { { echo "$as_me:$LINENO: error: Sufficiently new version of libasound not found." >&5
+echo "$as_me: error: Sufficiently new version of libasound not found." >&2;}
+ { (exit 1); exit 1; }; }
+ alsa_found=no
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+if test "x$enable_alsatest" = "xyes"; then
+
+{ echo "$as_me:$LINENO: checking for snd_ctl_open in -lasound" >&5
+echo $ECHO_N "checking for snd_ctl_open in -lasound... $ECHO_C" >&6; }
+if test "${ac_cv_lib_asound_snd_ctl_open+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lasound $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char snd_ctl_open ();
+int
+main ()
+{
+return snd_ctl_open ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_asound_snd_ctl_open=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_asound_snd_ctl_open=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_ctl_open" >&5
+echo "${ECHO_T}$ac_cv_lib_asound_snd_ctl_open" >&6; }
+if test $ac_cv_lib_asound_snd_ctl_open = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBASOUND 1
+_ACEOF
+
+ LIBS="-lasound $LIBS"
+
+else
+ { { echo "$as_me:$LINENO: error: No linkable libasound was found." >&5
+echo "$as_me: error: No linkable libasound was found." >&2;}
+ { (exit 1); exit 1; }; }
+ alsa_found=no
+
+fi
+
+fi
+
+if test "x$alsa_found" = "xyes" ; then
+ :
+ LIBS=`echo $LIBS | sed 's/-lasound//g'`
+ LIBS=`echo $LIBS | sed 's/ //'`
+ LIBS="-lasound $LIBS"
+fi
+if test "x$alsa_found" = "xno" ; then
+ :
+ CFLAGS="$alsa_save_CFLAGS"
+ LDFLAGS="$alsa_save_LDFLAGS"
+ LIBS="$alsa_save_LIBS"
+ ALSA_CFLAGS=""
+ ALSA_LIBS=""
+fi
+
+
+
+
+
+CURSESINC=""
+CURSESLIB=""
+CURSES_CFLAGS=""
+# Check whether --enable-alsamixer was given.
+if test "${enable_alsamixer+set}" = set; then
+ enableval=$enable_alsamixer; case "${enableval}" in
+ yes) alsamixer=true ;;
+ no) alsamixer=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-alsamixer" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-alsamixer" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ alsamixer=true
+fi
+
+
+
+if test x$alsamixer = xtrue; then
+ ALSAMIXER_TRUE=
+ ALSAMIXER_FALSE='#'
+else
+ ALSAMIXER_TRUE='#'
+ ALSAMIXER_FALSE=
+fi
+
+
+# Check whether --enable-alsaconf was given.
+if test "${enable_alsaconf+set}" = set; then
+ enableval=$enable_alsaconf; case "${enableval}" in
+ yes) alsaconf=true ;;
+ no) alsaconf=false ;;
+ *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-alsaconf" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-alsaconf" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ alsaconf=true
+fi
+
+
+
+if test x$alsaconf = xtrue; then
+ ALSACONF_TRUE=
+ ALSACONF_FALSE='#'
+else
+ ALSACONF_TRUE='#'
+ ALSACONF_FALSE=
+fi
+
+
+xmlto=""
+if test x"$alsaconf" = xtrue; then
+ # Check whether --enable-xmlto was given.
+if test "${enable_xmlto+set}" = set; then
+ enableval=$enable_xmlto; xmlto="$enableval"
+else
+ xmlto="yes"
+fi
+
+ if test "$xmlto" = "yes"; then
+ # Extract the first word of "xmlto", so it can be a program name with args.
+set dummy xmlto; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_xmlto+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$xmlto"; then
+ ac_cv_prog_xmlto="$xmlto" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_xmlto="yes"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+xmlto=$ac_cv_prog_xmlto
+if test -n "$xmlto"; then
+ { echo "$as_me:$LINENO: result: $xmlto" >&5
+echo "${ECHO_T}$xmlto" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ fi
+fi
+
+
+if test x"$xmlto" = xyes; then
+ USE_XMLTO_TRUE=
+ USE_XMLTO_FALSE='#'
+else
+ USE_XMLTO_TRUE='#'
+ USE_XMLTO_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+if test x$alsamixer = xtrue; then
+
+# Check whether --with-curses was given.
+if test "${with_curses+set}" = set; then
+ withval=$with_curses; curseslib="$withval"
+else
+ curseslib="auto"
+fi
+
+ if test "$curseslib" = "ncursesw"; then
+ # Extract the first word of "ncursesw5-config", so it can be a program name with args.
+set dummy ncursesw5-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ncursesw5_config+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ncursesw5_config"; then
+ ac_cv_prog_ncursesw5_config="$ncursesw5_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ncursesw5_config="yes"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ncursesw5_config=$ac_cv_prog_ncursesw5_config
+if test -n "$ncursesw5_config"; then
+ { echo "$as_me:$LINENO: result: $ncursesw5_config" >&5
+echo "${ECHO_T}$ncursesw5_config" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ if test "$ncursesw5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncursesw5-config --libs`
+ CURSES_CFLAGS=`ncursesw5-config --cflags`
+ curseslib="ncursesw"
+ else
+ { echo "$as_me:$LINENO: checking for initscr in -lncursesw" >&5
+echo $ECHO_N "checking for initscr in -lncursesw... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ncursesw_initscr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncursesw $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ncursesw_initscr=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ncursesw_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncursesw_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncursesw_initscr" >&6; }
+if test $ac_cv_lib_ncursesw_initscr = yes; then
+ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"
+fi
+
+ fi
+ fi
+ if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
+ # Extract the first word of "ncurses5-config", so it can be a program name with args.
+set dummy ncurses5-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ncurses5_config+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ncurses5_config"; then
+ ac_cv_prog_ncurses5_config="$ncurses5_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ncurses5_config="yes"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ncurses5_config=$ac_cv_prog_ncurses5_config
+if test -n "$ncurses5_config"; then
+ { echo "$as_me:$LINENO: result: $ncurses5_config" >&5
+echo "${ECHO_T}$ncurses5_config" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ if test "$ncurses5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncurses5-config --libs`
+ CURSES_CFLAGS=`ncurses5-config --cflags`
+ curseslib="ncurses"
+ else
+ { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ncurses_initscr=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ncurses_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; }
+if test $ac_cv_lib_ncurses_initscr = yes; then
+ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"
+fi
+
+ fi
+ fi
+ if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
+ { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5
+echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_curses_initscr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcurses $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char initscr ();
+int
+main ()
+{
+return initscr ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_curses_initscr=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_curses_initscr=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; }
+if test $ac_cv_lib_curses_initscr = yes; then
+ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"
+fi
+
+ fi
+ if test -z "$CURSESINC"; then
+ { { echo "$as_me:$LINENO: error: this packages requires a curses library" >&5
+echo "$as_me: error: this packages requires a curses library" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+
+eval dir="$datadir"
+case "$dir" in
+/*) ;;
+*) dir="$prefix/share"
+esac
+
+soundsdir="$dir/sounds/alsa"
+
+cat >>confdefs.h <<_ACEOF
+#define SOUNDSDIR "$soundsdir"
+_ACEOF
+
+
+mydatadir="$dir/alsa"
+
+cat >>confdefs.h <<_ACEOF
+#define DATADIR "$mydatadir"
+_ACEOF
+
+
+
+# Check whether --with-testsound was given.
+if test "${with_testsound+set}" = set; then
+ withval=$with_testsound; TESTSOUND="$withval"
+else
+ TESTSOUND="$dir/test.wav"
+fi
+
+
+
+ac_config_headers="$ac_config_headers include/aconfig.h"
+
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !x[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_inline=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+if test $ac_cv_c_compiler_gnu = yes; then
+ { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; }
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; }
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_largefile_CC=' -n32'; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ ac_cv_sys_file_offset_bits=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_file_offset_bits=64; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+if test "$ac_cv_sys_file_offset_bits" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+
+fi
+rm -f conftest*
+ { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ ac_cv_sys_large_files=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_large_files=1; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+if test "$ac_cv_sys_large_files" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+
+fi
+rm -f conftest*
+fi
+
+
+
+SND_UTIL_VERSION=$VERSION
+echo $VERSION > $srcdir/version
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$SND_UTIL_VERSION"
+_ACEOF
+
+
+SND_UTIL_MAJOR=`echo $VERSION | cut -d . -f 1`
+
+SND_UTIL_MINOR=`echo $VERSION | cut -d . -f 2`
+
+SND_UTIL_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/pre[0-9]*//g'`
+
+
+
+ac_config_files="$ac_config_files Makefile alsactl/Makefile alsactl/init/Makefile alsamixer/Makefile amidi/Makefile amixer/Makefile m4/Makefile po/Makefile.in alsaconf/alsaconf alsaconf/Makefile alsaconf/po/Makefile aplay/Makefile include/Makefile iecset/Makefile utils/Makefile utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile speaker-test/Makefile speaker-test/samples/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${ALSAMIXER_TRUE}" && test -z "${ALSAMIXER_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"ALSAMIXER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ALSAMIXER\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${ALSACONF_TRUE}" && test -z "${ALSACONF_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"ALSACONF\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ALSACONF\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${USE_XMLTO_TRUE}" && test -z "${USE_XMLTO_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"USE_XMLTO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"USE_XMLTO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.60. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+ # from automake < 1.5.
+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
+ LINGUAS="${LINGUAS-%UNSET%}"
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "include/aconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS include/aconfig.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "alsactl/Makefile") CONFIG_FILES="$CONFIG_FILES alsactl/Makefile" ;;
+ "alsactl/init/Makefile") CONFIG_FILES="$CONFIG_FILES alsactl/init/Makefile" ;;
+ "alsamixer/Makefile") CONFIG_FILES="$CONFIG_FILES alsamixer/Makefile" ;;
+ "amidi/Makefile") CONFIG_FILES="$CONFIG_FILES amidi/Makefile" ;;
+ "amixer/Makefile") CONFIG_FILES="$CONFIG_FILES amixer/Makefile" ;;
+ "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
+ "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
+ "alsaconf/alsaconf") CONFIG_FILES="$CONFIG_FILES alsaconf/alsaconf" ;;
+ "alsaconf/Makefile") CONFIG_FILES="$CONFIG_FILES alsaconf/Makefile" ;;
+ "alsaconf/po/Makefile") CONFIG_FILES="$CONFIG_FILES alsaconf/po/Makefile" ;;
+ "aplay/Makefile") CONFIG_FILES="$CONFIG_FILES aplay/Makefile" ;;
+ "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+ "iecset/Makefile") CONFIG_FILES="$CONFIG_FILES iecset/Makefile" ;;
+ "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;;
+ "utils/alsa-utils.spec") CONFIG_FILES="$CONFIG_FILES utils/alsa-utils.spec" ;;
+ "seq/Makefile") CONFIG_FILES="$CONFIG_FILES seq/Makefile" ;;
+ "seq/aconnect/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aconnect/Makefile" ;;
+ "seq/aplaymidi/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aplaymidi/Makefile" ;;
+ "seq/aseqdump/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aseqdump/Makefile" ;;
+ "seq/aseqnet/Makefile") CONFIG_FILES="$CONFIG_FILES seq/aseqnet/Makefile" ;;
+ "speaker-test/Makefile") CONFIG_FILES="$CONFIG_FILES speaker-test/Makefile" ;;
+ "speaker-test/samples/Makefile") CONFIG_FILES="$CONFIG_FILES speaker-test/samples/Makefile" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+USE_NLS!$USE_NLS$ac_delim
+MSGFMT!$MSGFMT$ac_delim
+GMSGFMT!$GMSGFMT$ac_delim
+MSGFMT_015!$MSGFMT_015$ac_delim
+GMSGFMT_015!$GMSGFMT_015$ac_delim
+XGETTEXT!$XGETTEXT$ac_delim
+XGETTEXT_015!$XGETTEXT_015$ac_delim
+MSGMERGE!$MSGMERGE$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+INTL_MACOSX_LIBS!$INTL_MACOSX_LIBS$ac_delim
+LIBICONV!$LIBICONV$ac_delim
+LTLIBICONV!$LTLIBICONV$ac_delim
+INTLLIBS!$INTLLIBS$ac_delim
+LIBINTL!$LIBINTL$ac_delim
+LTLIBINTL!$LTLIBINTL$ac_delim
+POSUB!$POSUB$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+LN_S!$LN_S$ac_delim
+ALSA_CFLAGS!$ALSA_CFLAGS$ac_delim
+ALSA_LIBS!$ALSA_LIBS$ac_delim
+ALSAMIXER_TRUE!$ALSAMIXER_TRUE$ac_delim
+ALSAMIXER_FALSE!$ALSAMIXER_FALSE$ac_delim
+ALSACONF_TRUE!$ALSACONF_TRUE$ac_delim
+ALSACONF_FALSE!$ALSACONF_FALSE$ac_delim
+xmlto!$xmlto$ac_delim
+USE_XMLTO_TRUE!$USE_XMLTO_TRUE$ac_delim
+USE_XMLTO_FALSE!$USE_XMLTO_FALSE$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+ncursesw5_config!$ncursesw5_config$ac_delim
+ncurses5_config!$ncurses5_config$ac_delim
+CURSESINC!$CURSESINC$ac_delim
+CURSESLIB!$CURSESLIB$ac_delim
+CURSES_CFLAGS!$CURSES_CFLAGS$ac_delim
+TESTSOUND!$TESTSOUND$ac_delim
+SND_UTIL_VERSION!$SND_UTIL_VERSION$ac_delim
+SND_UTIL_MAJOR!$SND_UTIL_MAJOR$ac_delim
+SND_UTIL_MINOR!$SND_UTIL_MINOR$ac_delim
+SND_UTIL_SUBMINOR!$SND_UTIL_SUBMINOR$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+ if test x"$ac_file" != x-; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
+ fi
+ else
+ echo "/* $configure_input */"
+ cat "$ac_result"
+ fi
+ rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "po-directories":C)
+ for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ # Treat a directory as a PO directory if and only if it has a
+ # POTFILES.in file. This allows packages to have multiple PO
+ # directories under different names or in different locations.
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ POMAKEFILEDEPS="POTFILES.in"
+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+ # on $ac_dir but don't depend on user-specified configuration
+ # parameters.
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ # Hide the ALL_LINGUAS assigment from automake < 1.5.
+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # The set of available languages was given in configure.in.
+ # Hide the ALL_LINGUAS assigment from automake < 1.5.
+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+ fi
+ # Compute POFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+ # Compute UPDATEPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+ # Compute DUMMYPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+ # Compute GMOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ GMOFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+ fi
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+ if test -f "$f"; then
+ case "$f" in
+ *.orig | *.bak | *~) ;;
+ *) cat "$f" >> "$ac_dir/Makefile" ;;
+ esac
+ fi
+ done
+ fi
+ ;;
+ esac
+ done ;;
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/alsa-utils/configure.in b/alsa-utils/configure.in
new file mode 100644
index 0000000..59247ed
--- /dev/null
+++ b/alsa-utils/configure.in
@@ -0,0 +1,153 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.59)
+AC_INIT(alsamixer/alsamixer.c)
+AC_PREFIX_DEFAULT(/usr)
+AM_INIT_AUTOMAKE(alsa-utils, 1.0.19)
+
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.15])
+
+dnl Checks for programs.
+
+dnl try to gues cross-compiler if not set
+if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
+then
+ AC_MSG_CHECKING(for cross-compiler)
+
+ which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
+ which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
+ && CC=${target_cpu}-${target-os}-gcc
+ which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
+ && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
+
+ AC_MSG_RESULT($CC)
+fi
+
+AC_PROG_CC
+dnl AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AM_PATH_ALSA(1.0.16)
+
+dnl Disable alsamixer
+CURSESINC=""
+CURSESLIB=""
+CURSES_CFLAGS=""
+AC_ARG_ENABLE(alsamixer,
+ [ --disable-alsamixer Disable alsamixer compilation],
+ [case "${enableval}" in
+ yes) alsamixer=true ;;
+ no) alsamixer=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;;
+ esac],[alsamixer=true])
+AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue)
+
+dnl Disable alsaconf
+AC_ARG_ENABLE(alsaconf,
+ [ --disable-alsaconf Disable alsaconf packaging],
+ [case "${enableval}" in
+ yes) alsaconf=true ;;
+ no) alsaconf=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;;
+ esac],[alsaconf=true])
+AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue)
+
+xmlto=""
+if test x"$alsaconf" = xtrue; then
+ AC_ARG_ENABLE(xmlto,
+ AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]),
+ xmlto="$enableval", xmlto="yes")
+ if test "$xmlto" = "yes"; then
+ AC_CHECK_PROG([xmlto], [xmlto], [yes])
+ fi
+fi
+AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+if test x$alsamixer = xtrue; then
+ AC_ARG_WITH(curses,
+ [ --with-curses libname Specify the curses library to use (default=auto)],
+ curseslib="$withval",
+ curseslib="auto")
+ if test "$curseslib" = "ncursesw"; then
+ AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
+ if test "$ncursesw5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncursesw5-config --libs`
+ CURSES_CFLAGS=`ncursesw5-config --cflags`
+ curseslib="ncursesw"
+ else
+ AC_CHECK_LIB(ncursesw, initscr,
+ [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
+ fi
+ fi
+ if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
+ AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
+ if test "$ncurses5_config" = "yes"; then
+ CURSESINC="<ncurses.h>"
+ CURSESLIB=`ncurses5-config --libs`
+ CURSES_CFLAGS=`ncurses5-config --cflags`
+ curseslib="ncurses"
+ else
+ AC_CHECK_LIB(ncurses, initscr,
+ [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
+ fi
+ fi
+ if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
+ AC_CHECK_LIB(curses, initscr,
+ [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"])
+ fi
+ if test -z "$CURSESINC"; then
+ AC_MSG_ERROR(this packages requires a curses library)
+ fi
+fi
+
+AC_SUBST(CURSESINC)
+AC_SUBST(CURSESLIB)
+AC_SUBST(CURSES_CFLAGS)
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+
+eval dir="$datadir"
+case "$dir" in
+/*) ;;
+*) dir="$prefix/share"
+esac
+
+soundsdir="$dir/sounds/alsa"
+AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data])
+
+mydatadir="$dir/alsa"
+AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration])
+
+AC_ARG_WITH(testsound,
+ [ --with-testsound=file give the path of test sound file for alsaconf],
+ TESTSOUND="$withval",
+ TESTSOUND="$dir/test.wav")
+AC_SUBST(TESTSOUND)
+
+AM_CONFIG_HEADER(include/aconfig.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+
+dnl Enable largefile support
+AC_SYS_LARGEFILE
+
+SAVE_UTIL_VERSION
+
+AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
+ alsamixer/Makefile amidi/Makefile amixer/Makefile \
+ m4/Makefile po/Makefile.in \
+ alsaconf/alsaconf alsaconf/Makefile \
+ alsaconf/po/Makefile \
+ aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
+ utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
+ seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
+ speaker-test/Makefile speaker-test/samples/Makefile)
diff --git a/alsa-utils/depcomp b/alsa-utils/depcomp
new file mode 100644
index 0000000..04701da
--- /dev/null
+++ b/alsa-utils/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-utils/gitcompile b/alsa-utils/gitcompile
new file mode 100644
index 0000000..513ef72
--- /dev/null
+++ b/alsa-utils/gitcompile
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if test -d ../alsa-lib/utils && ! test -r `aclocal --print-ac-dir`/alsa.m4; then
+ alsa_m4_flags="-I ../alsa-lib/utils"
+fi
+aclocal $alsa_m4_flags $ACLOCAL_FLAGS
+# save original files to avoid stupid modifications by gettextize
+cp Makefile.am Makefile.am.ok
+cp configure.in configure.in.ok
+gettextize -c -f --no-changelog
+echo "EXTRA_DIST = gettext.m4" > m4/Makefile.am
+cp Makefile.am.ok Makefile.am
+cp configure.in.ok configure.in
+autoheader
+automake --foreign --copy --add-missing
+touch depcomp # for older automake
+autoconf
+export CFLAGS='-O2 -Wall -pipe -g'
+echo "CFLAGS=$CFLAGS"
+echo "./configure $@"
+./configure $@ || exit 1
+unset CFLAGS
+if [ -z "$GITCOMPILE_NO_MAKE" ]; then
+ make
+fi
diff --git a/alsa-utils/iecset/Makefile.am b/alsa-utils/iecset/Makefile.am
new file mode 100644
index 0000000..c03a7f1
--- /dev/null
+++ b/alsa-utils/iecset/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+# LDFLAGS = -static
+# CFLAGS += -g -Wall
+
+bin_PROGRAMS = iecset
+iecset_SOURCES = iecset.c iecbits.c
+man_MANS = iecset.1
+EXTRA_DIST = iecset.1
diff --git a/alsa-utils/iecset/Makefile.in b/alsa-utils/iecset/Makefile.in
new file mode 100644
index 0000000..82c31cc
--- /dev/null
+++ b/alsa-utils/iecset/Makefile.in
@@ -0,0 +1,502 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = iecset$(EXEEXT)
+subdir = iecset
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_iecset_OBJECTS = iecset.$(OBJEXT) iecbits.$(OBJEXT)
+iecset_OBJECTS = $(am_iecset_OBJECTS)
+iecset_LDADD = $(LDADD)
+iecset_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(iecset_SOURCES)
+DIST_SOURCES = $(iecset_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+LDADD = -lm
+iecset_SOURCES = iecset.c iecbits.c
+man_MANS = iecset.1
+EXTRA_DIST = iecset.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign iecset/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign iecset/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+iecset$(EXEEXT): $(iecset_OBJECTS) $(iecset_DEPENDENCIES)
+ @rm -f iecset$(EXEEXT)
+ $(LINK) $(iecset_LDFLAGS) $(iecset_OBJECTS) $(iecset_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecbits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iecset.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/iecset/iecbits.c b/alsa-utils/iecset/iecbits.c
new file mode 100644
index 0000000..edea932
--- /dev/null
+++ b/alsa-utils/iecset/iecbits.c
@@ -0,0 +1,259 @@
+/*
+ iecdump - dump IEC958 status bits on ALSA
+ Copyright (C) 2003 by Takashi Iwai <tiwai@suse.de>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <alsa/asoundlib.h>
+
+struct category_str {
+ int val;
+ const char *name;
+};
+
+static const struct category_str con_category[] = {
+ { IEC958_AES1_CON_GENERAL, "general" },
+
+ { IEC958_AES1_CON_IEC908_CD, "CD" },
+ { IEC958_AES1_CON_NON_IEC908_CD, "non-IEC908 CD" },
+ { IEC958_AES1_CON_MINI_DISC, "Mini-Disc" },
+ { IEC958_AES1_CON_DVD, "DVD" },
+
+ { IEC958_AES1_CON_PCM_CODER, "PCM coder" },
+ { IEC958_AES1_CON_MIXER, "digital signal mixer" },
+ { IEC958_AES1_CON_RATE_CONVERTER, "rate converter" },
+ { IEC958_AES1_CON_SAMPLER, "sampler" },
+ { IEC958_AES1_CON_DSP, "digital sound processor" },
+
+ { IEC958_AES1_CON_DAT, "DAT" },
+ { IEC958_AES1_CON_VCR, "VCR" },
+ { IEC958_AES1_CON_DCC, "DCC" },
+ { IEC958_AES1_CON_MAGNETIC_DISC, "magnetic disc" },
+
+ { IEC958_AES1_CON_DAB_JAPAN, "digital audio broadcast (Japan)" },
+ { IEC958_AES1_CON_DAB_EUROPE, "digital audio broadcast (Europe)" },
+ { IEC958_AES1_CON_DAB_USA, "digital audio broadcast (USA)" },
+ { IEC958_AES1_CON_SOFTWARE, "software delivery" },
+
+ { IEC958_AES1_CON_SYNTHESIZER, "synthesizer" },
+ { IEC958_AES1_CON_MICROPHONE, "microphone" },
+
+ { IEC958_AES1_CON_ADC, "ADC without copyright information" },
+
+ { IEC958_AES1_CON_ADC_COPYRIGHT, "ADC with copyright information" },
+
+ { IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER, "flash memory recorder/player" },
+
+ { IEC958_AES1_CON_EXPERIMENTAL, "experimental" },
+};
+
+
+#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
+
+void dump_iec958(snd_aes_iec958_t *iec)
+{
+ int i;
+
+ if (! (iec->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ /* consumer */
+ printf("Mode: consumer\n");
+ printf("Data: ");
+ if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) {
+ printf("audio\n");
+ } else {
+ printf("non-audio\n");
+ }
+ printf("Rate: ");
+ switch (iec->status[3] & IEC958_AES3_CON_FS) {
+ case IEC958_AES3_CON_FS_22050:
+ printf("22050 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_24000:
+ printf("24000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_32000:
+ printf("32000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_44100:
+ printf("44100 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_48000:
+ printf("48000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_88200:
+ printf("88200 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_96000:
+ printf("96000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_176400:
+ printf("176400 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_192000:
+ printf("192000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_768000:
+ printf("768000 Hz\n");
+ break;
+ case IEC958_AES3_CON_FS_NOTID:
+ printf("not indicated\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Copyright: ");
+ if (iec->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT) {
+ printf("permitted\n");
+ } else {
+ printf("protected\n");
+ }
+ printf("Emphasis: ");
+ if ((iec->status[0] & IEC958_AES0_CON_EMPHASIS) != IEC958_AES0_CON_EMPHASIS_5015) {
+ printf("none\n");
+ } else {
+ printf("50/15us\n");
+ }
+ printf("Category: ");
+ for (i = 0; i < ARRAY_SIZE(con_category); i++) {
+ if ((iec->status[1] & IEC958_AES1_CON_CATEGORY) == con_category[i].val) {
+ printf("%s\n", con_category[i].name);
+ break;
+ }
+ }
+ if (i >= ARRAY_SIZE(con_category)) {
+ printf("unknown 0x%x\n", iec->status[1] & IEC958_AES1_CON_CATEGORY);
+ }
+ printf("Original: ");
+ if (iec->status[1] & IEC958_AES1_CON_ORIGINAL) {
+ printf("original\n");
+ } else {
+ printf("1st generation\n");
+ }
+ printf("Clock: ");
+ switch (iec->status[3] & IEC958_AES3_CON_CLOCK) {
+ case IEC958_AES3_CON_CLOCK_1000PPM:
+ printf("1000 ppm\n");
+ break;
+ case IEC958_AES3_CON_CLOCK_50PPM:
+ printf("50 ppm\n");
+ break;
+ case IEC958_AES3_CON_CLOCK_VARIABLE:
+ printf("variable pitch\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ } else {
+ printf("Mode: professional\n");
+ printf("Data: ");
+ if (!(iec->status[0] & IEC958_AES0_NONAUDIO)) {
+ printf("audio\n");
+ } else {
+ printf("non-audio\n");
+ }
+ printf("Rate: ");
+ switch (iec->status[0] & IEC958_AES0_PRO_FS) {
+ case IEC958_AES0_PRO_FS_44100:
+ printf("44100 Hz\n");
+ break;
+ case IEC958_AES0_PRO_FS_48000:
+ printf("48000 Hz\n");
+ break;
+ case IEC958_AES0_PRO_FS_32000:
+ printf("32000 Hz\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Rate Locked: ");
+ if (iec->status[0] & IEC958_AES0_PRO_FREQ_UNLOCKED)
+ printf("no\n");
+ else
+ printf("yes\n");
+ printf("Emphasis: ");
+ switch (iec->status[0] & IEC958_AES0_PRO_EMPHASIS) {
+ case IEC958_AES0_PRO_EMPHASIS_CCITT:
+ printf("CCITT J.17\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_NONE:
+ printf("none\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_5015:
+ printf("50/15us\n");
+ break;
+ case IEC958_AES0_PRO_EMPHASIS_NOTID:
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Stereophonic: ");
+ if ((iec->status[1] & IEC958_AES1_PRO_MODE) == IEC958_AES1_PRO_MODE_STEREOPHONIC) {
+ printf("stereo\n");
+ } else {
+ printf("not indicated\n");
+ }
+ printf("Userbits: ");
+ switch (iec->status[1] & IEC958_AES1_PRO_USERBITS) {
+ case IEC958_AES1_PRO_USERBITS_192:
+ printf("192bit\n");
+ break;
+ case IEC958_AES1_PRO_USERBITS_UDEF:
+ printf("user-defined\n");
+ break;
+ default:
+ printf("unkown\n");
+ break;
+ }
+ printf("Sample Bits: ");
+ switch (iec->status[2] & IEC958_AES2_PRO_SBITS) {
+ case IEC958_AES2_PRO_SBITS_20:
+ printf("20 bit\n");
+ break;
+ case IEC958_AES2_PRO_SBITS_24:
+ printf("24 bit\n");
+ break;
+ case IEC958_AES2_PRO_SBITS_UDEF:
+ printf("user defined\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ printf("Word Length: ");
+ switch (iec->status[2] & IEC958_AES2_PRO_WORDLEN) {
+ case IEC958_AES2_PRO_WORDLEN_22_18:
+ printf("22 bit or 18 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_23_19:
+ printf("23 bit or 19 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_24_20:
+ printf("24 bit or 20 bit\n");
+ break;
+ case IEC958_AES2_PRO_WORDLEN_20_16:
+ printf("20 bit or 16 bit\n");
+ break;
+ default:
+ printf("unknown\n");
+ break;
+ }
+ }
+}
+
diff --git a/alsa-utils/iecset/iecset.1 b/alsa-utils/iecset/iecset.1
new file mode 100644
index 0000000..dec4ac0
--- /dev/null
+++ b/alsa-utils/iecset/iecset.1
@@ -0,0 +1,104 @@
+.TH iecset 1 "23 Oct 2003"
+.SH NAME
+iecset \- Set or dump IEC958 status bits
+
+.SH SYNOPSIS
+\fBiecset\fP [\fIoptions\fP] [\fIcmd\fP \fIarg\fP...]
+
+.SH DESCRIPTION
+\fBiecset\fP is a small utility to set or dump the IEC958 (or so-called
+"S/PDIF") status bits of the specified sound card via ALSA control API.
+
+When \fBiecset\fP is started without arguments except for options,
+it will show the current IEC958 status in a human-readable form.
+When the commands are given in the arguments, they are parsed
+and the IEC958 status bits are updated. The resultant status is
+shown as well.
+
+The commands consist of the command directive and the argument.
+As the boolean argument, \fIyes\fP, \fIno\fP, \fItrue\fP, \fIfalse\fP,
+or a digit number is allowed.
+
+.SH EXAMPLES
+.TP
+.BI iecset\ \-Dhw:1
+Displays the current IEC958 status bits on the second card.
+This is equivalent with \fI\-c 1\fP.
+.TP
+.BI iecset\ \-x
+Displays the current IEC958 status bits in a style of the arguments
+for the PCM stream. The output string can be passed to the \fIiec958\fP
+(or \fIspdif\fP) PCM type as the optional argument.
+.TP
+.BI iecset\ pro\ off\ audio\ off
+Sets the current status to the consumer-mode and turns on the
+non-audio bit. The modified status will be shown, too.
+
+.SH OPTIONS
+.TP
+\fI\-D\fP device
+Specifies the device name of the control to open
+.TP
+\fI\-c\fP card
+Specifies the card index to open. Equivalent with \fI\-Dhw:x\fP.
+.TP
+\fI\-n\fP index
+Specifies the IEC958 control element index, in case you have multiple
+IEC958 devices and need to choose one of them.
+.TP
+\fI\-x\fP
+Dumps the status in the form of AESx bytes.
+.TP
+\fI\-i\fP
+Reads the command sequences from stdin.
+Each line has single command.
+
+.SH COMMANDS
+.TP
+\fIprofessional\fP <bool>
+The professional mode (true) or consumer mode (false).
+
+.TP
+\fIaudio\fP <bool>
+The audio mode (true) or non-audio mode (false).
+
+.TP
+\fIrate\fP <int>
+The sample rate in Hz.
+
+.TP
+\fIemphasis\fP <int>
+The emphasis: 0 = none, 1 = 50/15us, 2 = CCITT.
+
+.TP
+\fIlock\fP <bool>
+Rate lock: locked (true), unlocked (false).
+This command is for the professional mode only.
+
+.TP
+\fIsbits\fP <int>
+Sample bits: 2 = 20bit, 4 = 24bit, 6 = undefined.
+This command is for the professional mode only.
+
+.TP
+\fIwordlength\fP <int>
+Wordlength: 0 = No, 2 = 22-18 bit, 4 = 23-19 bit, 5 = 24-20 bit, 6 = 20-16 bit.
+This command is for the professional mode only.
+
+.TP
+\fIcategory\fP <int>
+Category: the value is from 0 to 0x7f.
+This command is for the consumer mode only.
+
+.TP
+\fIcopyright\fP <bool>
+Copyright: copyrighted (true), non-copyrighted (false).
+This command is for the consumer mode only.
+
+.TP
+\fIoriginal\fP <boo>
+Original flag: original (true), 1st generation (false).
+This command is for the consumer mode only.
+
+.SH AUTHOR
+Takashi Iwai <tiwai@suse.de>
diff --git a/alsa-utils/iecset/iecset.c b/alsa-utils/iecset/iecset.c
new file mode 100644
index 0000000..92a93e8
--- /dev/null
+++ b/alsa-utils/iecset/iecset.c
@@ -0,0 +1,432 @@
+/*
+ iecset - change IEC958 status bits on ALSA
+ Copyright (C) 2003 by Takashi Iwai <tiwai@suse.de>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <alsa/asoundlib.h>
+
+void dump_iec958(snd_aes_iec958_t *iec);
+
+static int get_bool(const char *str)
+{
+ if (strncmp(str, "yes", 3) == 0 ||
+ strncmp(str, "YES", 3) == 0 ||
+ strncmp(str, "on", 2) == 0 ||
+ strncmp(str, "ON", 2) == 0 ||
+ strncmp(str, "true", 4) == 0 ||
+ strncmp(str, "TRUE", 4) == 0 ||
+ *str == '1')
+ return 1;
+ return 0;
+}
+
+enum {
+ CMD_BOOL, CMD_BOOL_INV, CMD_INT
+};
+
+enum {
+ IDX_PRO, IDX_NOAUDIO, IDX_RATE, IDX_UNLOCK, IDX_SBITS, IDX_WORD, IDX_EMP, IDX_CAT, IDX_NOCOPY, IDX_ORIG,
+ IDX_LAST
+};
+
+struct cmdtbl {
+ const char *name;
+ int idx;
+ int type;
+ const char *desc;
+};
+
+static const struct cmdtbl cmds[] = {
+ { "pro", IDX_PRO, CMD_BOOL,
+ "professional (common)\n\toff = consumer mode, on = professional mode" },
+ { "aud", IDX_NOAUDIO, CMD_BOOL_INV,
+ "audio (common)\n\ton = audio mode, off = non-audio mode" },
+ { "rat", IDX_RATE, CMD_INT,
+ "rate (common)\n\tsample rate in Hz (0 = not indicated)" },
+ { "emp", IDX_EMP, CMD_INT,
+ "emphasis (common)\n\t0 = none, 1 = 50/15us, 2 = CCITT" },
+ { "loc", IDX_UNLOCK, CMD_BOOL_INV,
+ "lock (prof.)\n\toff = rate unlocked, on = rate locked" },
+ { "sbi", IDX_SBITS, CMD_INT,
+ "sbits (prof.)\n\tsample bits 2 = 20bit, 4 = 24bit, 6 = undef" },
+ { "wor", IDX_WORD, CMD_INT,
+ "wordlength (prof.)\n\t0=no, 2=22-18bit, 4=23-19bit, 5=24-20bit, 6=20-16bit" },
+ { "cat", IDX_CAT, CMD_INT,
+ "category (consumer)\n\t0-0x7f" },
+ { "cop", IDX_NOCOPY, CMD_BOOL_INV,
+ "copyright (consumer)\n\toff = non-copyright, on = copyright" },
+ { "ori", IDX_ORIG, CMD_BOOL,
+ "original (consumer)\n\toff = 1st-gen, on = original" },
+};
+
+
+static void error(const char *s, int err)
+{
+ fprintf(stderr, "%s: %s\n", s, snd_strerror(err));
+}
+
+
+static void usage(void)
+{
+ int i;
+
+ printf("Usage: iecset [options] [cmd arg...]\n");
+ printf("Options:\n");
+ printf(" -D device specifies the control device to use\n");
+ printf(" -c card specifies the card number to use (equiv. with -Dhw:#)\n");
+ printf(" -n number specifies the control index number (default = 0)\n");
+ printf(" -x dump the dump the AESx hex code for IEC958 PCM parameters\n");
+ printf(" -i read commands from stdin\n");
+ printf("Commands:\n");
+ for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) {
+ printf(" %s\n", cmds[i].desc);
+ }
+}
+
+
+/*
+ * parse iecset commands
+ */
+static void parse_command(int *parms, const char *c, const char *arg)
+{
+ int i;
+
+ for (i = 0; i < (int)(sizeof(cmds)/sizeof(cmds[0])); i++) {
+ if (strncmp(c, cmds[i].name, strlen(cmds[i].name)) == 0) {
+ int val;
+ switch (cmds[i].type) {
+ case CMD_BOOL:
+ val = get_bool(arg);
+ break;
+ case CMD_BOOL_INV:
+ val = !get_bool(arg);
+ break;
+ case CMD_INT:
+ default:
+ val = (int)strtol(arg, NULL, 0);
+ break;
+ }
+ parms[cmds[i].idx] = val;
+ return;
+ }
+ }
+}
+
+static char *skipspace(char *line)
+{
+ char *p;
+ for (p = line; *p && isspace(*p); p++)
+ ;
+ return p;
+}
+
+/*
+ * parse iecset commands from the file
+ */
+static void parse_file(int *parms, FILE *fp)
+{
+ char line[1024], *cmd, *arg;
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ cmd = skipspace(line);
+ if (*cmd == '#' || ! *cmd)
+ continue;
+ for (arg = cmd; *arg && !isspace(*arg); arg++)
+ ;
+ if (! *arg)
+ continue;
+ *arg++ = 0;
+ arg = skipspace(arg);
+ if (! *arg)
+ continue;
+ parse_command(parms, cmd, arg);
+ }
+}
+
+/* update iec958 status values
+ * return non-zero if the values are modified
+ */
+static int update_iec958_status(snd_aes_iec958_t *iec958, int *parms)
+{
+ int changed = 0;
+ if (parms[IDX_PRO] >= 0) {
+ if (parms[IDX_PRO])
+ iec958->status[0] |= IEC958_AES0_PROFESSIONAL;
+ else
+ iec958->status[0] &= ~IEC958_AES0_PROFESSIONAL;
+ changed = 1;
+ }
+ if (parms[IDX_NOAUDIO] >= 0) {
+ if (parms[IDX_NOAUDIO])
+ iec958->status[0] |= IEC958_AES0_NONAUDIO;
+ else
+ iec958->status[0] &= ~IEC958_AES0_NONAUDIO;
+ changed = 1;
+ }
+ if (parms[IDX_RATE] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[0] &= ~IEC958_AES0_PRO_FS;
+ switch (parms[IDX_RATE]) {
+ case 44100:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_44100;
+ break;
+ case 48000:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_48000;
+ break;
+ case 32000:
+ iec958->status[0] |= IEC958_AES0_PRO_FS_32000;
+ break;
+ }
+ } else {
+ iec958->status[3] &= ~IEC958_AES3_CON_FS;
+ switch (parms[IDX_RATE]) {
+ case 22050:
+ iec958->status[3] |= IEC958_AES3_CON_FS_22050;
+ break;
+ case 24000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_24000;
+ break;
+ case 32000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_32000;
+ break;
+ case 44100:
+ iec958->status[3] |= IEC958_AES3_CON_FS_44100;
+ break;
+ case 48000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_48000;
+ break;
+ case 88200:
+ iec958->status[3] |= IEC958_AES3_CON_FS_88200;;
+ break;
+ case 96000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_96000;
+ break;
+ case 176400:
+ iec958->status[3] |= IEC958_AES3_CON_FS_176400;
+ break;
+ case 192000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_192000;
+ break;
+ case 768000:
+ iec958->status[3] |= IEC958_AES3_CON_FS_768000;
+ break;
+ default:
+ iec958->status[3] |= IEC958_AES3_CON_FS_NOTID;
+ break;
+ }
+ }
+ changed = 1;
+ }
+ if (parms[IDX_NOCOPY] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ if (parms[IDX_NOCOPY])
+ iec958->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;
+ else
+ iec958->status[0] &= ~IEC958_AES0_CON_NOT_COPYRIGHT;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_ORIG] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ if (parms[IDX_ORIG])
+ iec958->status[1] |= IEC958_AES1_CON_ORIGINAL;
+ else
+ iec958->status[1] &= ~IEC958_AES1_CON_ORIGINAL;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_EMP] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[0] &= ~IEC958_AES0_PRO_EMPHASIS;
+ switch (parms[IDX_EMP]) {
+ case 0:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE;
+ break;
+ case 1:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015;
+ break;
+ case 2:
+ iec958->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT;
+ break;
+ }
+ } else {
+ if (parms[IDX_EMP])
+ iec958->status[0] |= IEC958_AES0_CON_EMPHASIS_5015;
+ else
+ iec958->status[0] &= ~IEC958_AES0_CON_EMPHASIS_5015;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_UNLOCK] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ if (parms[IDX_UNLOCK])
+ iec958->status[0] |= IEC958_AES0_PRO_FREQ_UNLOCKED;
+ else
+ iec958->status[0] &= ~IEC958_AES0_PRO_FREQ_UNLOCKED;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_SBITS] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[2] &= ~IEC958_AES2_PRO_SBITS;
+ iec958->status[2] |= parms[IDX_SBITS] & 7;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_WORD] >= 0) {
+ if (iec958->status[0] & IEC958_AES0_PROFESSIONAL) {
+ iec958->status[2] &= ~IEC958_AES2_PRO_WORDLEN;
+ iec958->status[2] |= (parms[IDX_WORD] & 7) << 3;
+ }
+ changed = 1;
+ }
+ if (parms[IDX_CAT] >= 0) {
+ if (! (iec958->status[0] & IEC958_AES0_PROFESSIONAL)) {
+ iec958->status[1] &= ~IEC958_AES1_CON_CATEGORY;
+ iec958->status[1] |= parms[IDX_CAT] & 0x7f;
+ }
+ changed = 1;
+ }
+
+ return changed;
+}
+
+
+int main(int argc, char **argv)
+{
+ const char *dev = "default";
+ const char *spdif_str = SND_CTL_NAME_IEC958("", PLAYBACK, DEFAULT);
+ int spdif_index = -1;
+ snd_ctl_t *ctl;
+ snd_ctl_elem_list_t *clist;
+ snd_ctl_elem_id_t *cid;
+ snd_ctl_elem_value_t *cval;
+ snd_aes_iec958_t iec958;
+ int from_stdin = 0;
+ int dumphex = 0;
+ int i, c, err;
+ unsigned int controls, cidx;
+ char tmpname[32];
+ int parms[IDX_LAST];
+
+ for (i = 0; i < IDX_LAST; i++)
+ parms[i] = -1; /* not set */
+
+ while ((c = getopt(argc, argv, "D:c:n:xhi")) != -1) {
+ switch (c) {
+ case 'D':
+ dev = optarg;
+ break;
+ case 'c':
+ i = atoi(optarg);
+ if (i < 0 || i >= 32) {
+ fprintf(stderr, "invalid card index %d\n", i);
+ return 1;
+ }
+ sprintf(tmpname, "hw:%d", i);
+ dev = tmpname;
+ break;
+ case 'n':
+ spdif_index = atoi(optarg);
+ break;
+ case 'x':
+ dumphex = 1;
+ break;
+ case 'i':
+ from_stdin = 1;
+ break;
+ default:
+ usage();
+ return 1;
+ }
+ }
+
+ if ((err = snd_ctl_open(&ctl, dev, 0)) < 0) {
+ error("snd_ctl_open", err);
+ return 1;
+ }
+
+ snd_ctl_elem_list_alloca(&clist);
+ if ((err = snd_ctl_elem_list(ctl, clist)) < 0) {
+ error("snd_ctl_elem_list", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_list_alloc_space(clist, snd_ctl_elem_list_get_count(clist))) < 0) {
+ error("snd_ctl_elem_list_alloc_space", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_list(ctl, clist)) < 0) {
+ error("snd_ctl_elem_list", err);
+ return 1;
+ }
+
+ controls = snd_ctl_elem_list_get_used(clist);
+ for (cidx = 0; cidx < controls; cidx++) {
+ if (!strcmp(snd_ctl_elem_list_get_name(clist, cidx), spdif_str))
+ if (spdif_index < 0 ||
+ snd_ctl_elem_list_get_index(clist, cidx) == spdif_index)
+ break;
+ }
+ if (cidx >= controls) {
+ fprintf(stderr, "control \"%s\" (index %d) not found\n",
+ spdif_str, spdif_index);
+ return 1;
+ }
+
+ snd_ctl_elem_id_alloca(&cid);
+ snd_ctl_elem_list_get_id(clist, cidx, cid);
+ snd_ctl_elem_value_alloca(&cval);
+ snd_ctl_elem_value_set_id(cval, cid);
+ if ((err = snd_ctl_elem_read(ctl, cval)) < 0) {
+ error("snd_ctl_elem_read", err);
+ return 1;
+ }
+
+ snd_ctl_elem_value_get_iec958(cval, &iec958);
+
+ /* parse from stdin */
+ if (from_stdin)
+ parse_file(parms, stdin);
+
+ /* parse commands */
+ for (c = optind; c < argc - 1; c += 2)
+ parse_command(parms, argv[c], argv[c + 1]);
+
+ if (update_iec958_status(&iec958, parms)) {
+ /* store the values */
+ snd_ctl_elem_value_set_iec958(cval, &iec958);
+ if ((err = snd_ctl_elem_write(ctl, cval)) < 0) {
+ error("snd_ctl_elem_write", err);
+ return 1;
+ }
+ if ((err = snd_ctl_elem_read(ctl, cval)) < 0) {
+ error("snd_ctl_elem_write", err);
+ return 1;
+ }
+ snd_ctl_elem_value_get_iec958(cval, &iec958);
+ }
+
+ if (dumphex)
+ printf("AES0=0x%02x,AES1=0x%02x,AES2=0x%02x,AES3=0x%02x\n",
+ iec958.status[0], iec958.status[1], iec958.status[2], iec958.status[3]);
+ else
+ dump_iec958(&iec958);
+
+ snd_ctl_close(ctl);
+ return 0;
+}
diff --git a/alsa-utils/include/Makefile.am b/alsa-utils/include/Makefile.am
new file mode 100644
index 0000000..112e5ce
--- /dev/null
+++ b/alsa-utils/include/Makefile.am
@@ -0,0 +1,25 @@
+noinst_HEADERS=version.h gettext.h
+
+version.h: stamp-vh
+ @:
+
+stamp-vh: $(top_builddir)/configure.in
+ @echo "/*" > ver.tmp
+ @echo " * version.h" >> ver.tmp
+ @echo " */" >> ver.tmp
+ @echo "" >> ver.tmp
+ @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp
+ @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp
+ @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp
+ @echo " SND_UTIL_SUBMINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp
+ @echo >> ver.tmp
+ @cmp -s version.h ver.tmp \
+ || (echo "Updating version.h"; \
+ cp ver.tmp version.h; \
+ echo timestamp > stamp-vh)
+ -@rm -f ver.tmp
+
+INCLUDES=-I$(top_srcdir)/include
diff --git a/alsa-utils/include/Makefile.in b/alsa-utils/include/Makefile.in
new file mode 100644
index 0000000..e835006
--- /dev/null
+++ b/alsa-utils/include/Makefile.in
@@ -0,0 +1,418 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/aconfig.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = aconfig.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+noinst_HEADERS = version.h gettext.h
+INCLUDES = -I$(top_srcdir)/include
+all: aconfig.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+aconfig.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/aconfig.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status include/aconfig.h
+$(srcdir)/aconfig.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f aconfig.h stamp-h1
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) aconfig.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) aconfig.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) aconfig.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) aconfig.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS) aconfig.h
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ ctags distclean distclean-generic distclean-hdr distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
+
+
+version.h: stamp-vh
+ @:
+
+stamp-vh: $(top_builddir)/configure.in
+ @echo "/*" > ver.tmp
+ @echo " * version.h" >> ver.tmp
+ @echo " */" >> ver.tmp
+ @echo "" >> ver.tmp
+ @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp
+ @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp
+ @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp
+ @echo " SND_UTIL_SUBMINOR)" >> ver.tmp
+ @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp
+ @echo >> ver.tmp
+ @cmp -s version.h ver.tmp \
+ || (echo "Updating version.h"; \
+ cp ver.tmp version.h; \
+ echo timestamp > stamp-vh)
+ -@rm -f ver.tmp
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/include/aconfig.h.in b/alsa-utils/include/aconfig.h.in
new file mode 100644
index 0000000..600c887
--- /dev/null
+++ b/alsa-utils/include/aconfig.h.in
@@ -0,0 +1,74 @@
+/* include/aconfig.h.in. Generated from configure.in by autoheader. */
+
+/* directory containing alsa configuration */
+#undef DATADIR
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#undef ENABLE_NLS
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+#undef HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+#undef HAVE_DCGETTEXT
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#undef HAVE_GETTEXT
+
+/* Define if you have the iconv() function. */
+#undef HAVE_ICONV
+
+/* Define to 1 if you have the `asound' library (-lasound). */
+#undef HAVE_LIBASOUND
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* directory containing sample data */
+#undef SOUNDSDIR
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* ALSA util version */
+#undef VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
diff --git a/alsa-utils/include/gettext.h b/alsa-utils/include/gettext.h
new file mode 100644
index 0000000..c2bfe96
--- /dev/null
+++ b/alsa-utils/include/gettext.h
@@ -0,0 +1,16 @@
+#ifndef __MY_GETTEXT_H
+#define __MY_GETTEXT_H
+
+#if ENABLE_NLS
+# include <libintl.h>
+#else
+# define gettext(msgid) (msgid)
+# define textdomain(domain)
+# define bindtextdomain(domain, dir)
+#endif
+
+#define _(msgid) gettext (msgid)
+#define gettext_noop(msgid) msgid
+#define N_(msgid) gettext_noop (msgid)
+
+#endif /* __MY_GETTEXT_H */
diff --git a/alsa-utils/include/version.h b/alsa-utils/include/version.h
new file mode 100644
index 0000000..36a48c1
--- /dev/null
+++ b/alsa-utils/include/version.h
@@ -0,0 +1,12 @@
+/*
+ * version.h
+ */
+
+#define SND_UTIL_MAJOR 1
+#define SND_UTIL_MINOR 0
+#define SND_UTIL_SUBMINOR 19
+#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\
+ (SND_UTIL_MINOR<<8)|\
+ SND_UTIL_SUBMINOR)
+#define SND_UTIL_VERSION_STR "1.0.19"
+
diff --git a/alsa-utils/install-sh b/alsa-utils/install-sh
new file mode 100644
index 0000000..4d4a951
--- /dev/null
+++ b/alsa-utils/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-utils/m4/Makefile.am b/alsa-utils/m4/Makefile.am
new file mode 100644
index 0000000..15df0b1
--- /dev/null
+++ b/alsa-utils/m4/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = codeset.m4 gettext.m4 glibc2.m4 glibc21.m4 iconv.m4 intdiv0.m4 intmax.m4 inttypes_h.m4 inttypes-h.m4 inttypes-pri.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 lock.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4 gettext.m4
diff --git a/alsa-utils/m4/Makefile.in b/alsa-utils/m4/Makefile.in
new file mode 100644
index 0000000..06e33ad
--- /dev/null
+++ b/alsa-utils/m4/Makefile.in
@@ -0,0 +1,329 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = m4
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+EXTRA_DIST = codeset.m4 gettext.m4 glibc2.m4 glibc21.m4 iconv.m4 intdiv0.m4 intmax.m4 inttypes_h.m4 inttypes-h.m4 inttypes-pri.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 lock.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4 gettext.m4
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign m4/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign m4/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/m4/codeset.m4 b/alsa-utils/m4/codeset.m4
new file mode 100644
index 0000000..a6e67ec
--- /dev/null
+++ b/alsa-utils/m4/codeset.m4
@@ -0,0 +1,21 @@
+# codeset.m4 serial AM1 (gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+ [AC_TRY_LINK([#include <langinfo.h>],
+ [char* cs = nl_langinfo(CODESET);],
+ am_cv_langinfo_codeset=yes,
+ am_cv_langinfo_codeset=no)
+ ])
+ if test $am_cv_langinfo_codeset = yes; then
+ AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+ [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+ fi
+])
diff --git a/alsa-utils/m4/gettext.m4 b/alsa-utils/m4/gettext.m4
new file mode 100644
index 0000000..dae3d81
--- /dev/null
+++ b/alsa-utils/m4/gettext.m4
@@ -0,0 +1,631 @@
+# gettext.m4 serial 53 (gettext-0.15)
+dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2005.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl default (if it is not specified or empty) is 'no-libtool'.
+dnl INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl depending on --{enable,disable}-{shared,static} and on the presence of
+dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl implementations (in libc or libintl) without the ngettext() function
+dnl will be ignored. If NEEDSYMBOL is specified and is
+dnl 'need-formatstring-macros', then GNU gettext implementations that don't
+dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries. If empty,
+dnl the value `$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl and used.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl Catalog format: none
+dnl Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+ dnl Argument checking.
+ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+ define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
+ define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
+
+ AC_REQUIRE([AM_PO_SUBDIRS])dnl
+ ifelse(gt_included_intl, yes, [
+ AC_REQUIRE([AM_INTL_SUBDIR])dnl
+ ])
+
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ dnl Ideally we would do this search only after the
+ dnl if test "$USE_NLS" = "yes"; then
+ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+ dnl the configure script would need to contain the same shell code
+ dnl again, outside any 'if'. There are two solutions:
+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+ dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+ dnl documented, we avoid it.
+ ifelse(gt_included_intl, yes, , [
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+ ])
+
+ dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
+ gt_INTL_MACOSX
+
+ dnl Set USE_NLS.
+ AC_REQUIRE([AM_NLS])
+
+ ifelse(gt_included_intl, yes, [
+ BUILD_INCLUDED_LIBINTL=no
+ USE_INCLUDED_LIBINTL=no
+ ])
+ LIBINTL=
+ LTLIBINTL=
+ POSUB=
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ gt_use_preinstalled_gnugettext=no
+ ifelse(gt_included_intl, yes, [
+ AC_MSG_CHECKING([whether included gettext is requested])
+ AC_ARG_WITH(included-gettext,
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ ])
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If GNU gettext is available we use this. Else we have
+ dnl to fall back to GNU NLS library.
+
+ dnl Add a version number to the cache macros.
+ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+]], [])[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;],
+ [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+ gt_cv_func_gnugettext_libc=yes,
+ gt_cv_func_gnugettext_libc=no)])
+
+ if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ ifelse(gt_included_intl, yes, , [
+ AM_ICONV_LINK
+ ])
+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+ dnl even if libiconv doesn't exist.
+ AC_LIB_LINKFLAGS_BODY([intl])
+ AC_CACHE_CHECK([for GNU gettext in libintl],
+ gt_cv_func_gnugettext_libintl,
+ [gt_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCINTL"
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBINTL"
+ dnl Now see whether libintl exists and does not depend on libiconv.
+ AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+]], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);],
+ [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+ gt_cv_func_gnugettext_libintl=yes,
+ gt_cv_func_gnugettext_libintl=no)
+ dnl Now see whether libintl exists and depends on libiconv.
+ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+ LIBS="$LIBS $LIBICONV"
+ AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+]], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);],
+ [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+ [LIBINTL="$LIBINTL $LIBICONV"
+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+ gt_cv_func_gnugettext_libintl=yes
+ ])
+ fi
+ CPPFLAGS="$gt_save_CPPFLAGS"
+ LIBS="$gt_save_LIBS"])
+ fi
+
+ dnl If an already present or preinstalled GNU gettext() is found,
+ dnl use it. But if this macro is used in GNU gettext, and GNU
+ dnl gettext is already preinstalled in libintl, we update this
+ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
+ if test "$gt_cv_func_gnugettext_libc" = "yes" \
+ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+ && test "$PACKAGE" != gettext-runtime \
+ && test "$PACKAGE" != gettext-tools; }; then
+ gt_use_preinstalled_gnugettext=yes
+ else
+ dnl Reset the values set by searching for libintl.
+ LIBINTL=
+ LTLIBINTL=
+ INCINTL=
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+ dnl GNU gettext is not found in the C library.
+ dnl Fall back on included GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions used to generate GNU NLS library.
+ BUILD_INCLUDED_LIBINTL=yes
+ USE_INCLUDED_LIBINTL=yes
+ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
+ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+ fi
+
+ CATOBJEXT=
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions to use GNU gettext tools.
+ CATOBJEXT=.gmo
+ fi
+ ])
+
+ if test -n "$INTL_MACOSX_LIBS"; then
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Some extra flags are needed during linking.
+ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+ fi
+ fi
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ AC_DEFINE(ENABLE_NLS, 1,
+ [Define to 1 if translation of program messages to the user's native language
+ is requested.])
+ else
+ USE_NLS=no
+ fi
+ fi
+
+ AC_MSG_CHECKING([whether to use NLS])
+ AC_MSG_RESULT([$USE_NLS])
+ if test "$USE_NLS" = "yes"; then
+ AC_MSG_CHECKING([where the gettext function comes from])
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+ gt_source="external libintl"
+ else
+ gt_source="libc"
+ fi
+ else
+ gt_source="included intl directory"
+ fi
+ AC_MSG_RESULT([$gt_source])
+ fi
+
+ if test "$USE_NLS" = "yes"; then
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+ AC_MSG_CHECKING([how to link with libintl])
+ AC_MSG_RESULT([$LIBINTL])
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+ fi
+
+ dnl For backward compatibility. Some packages may be using this.
+ AC_DEFINE(HAVE_GETTEXT, 1,
+ [Define if the GNU gettext() function is already present or preinstalled.])
+ AC_DEFINE(HAVE_DCGETTEXT, 1,
+ [Define if the GNU dcgettext() function is already present or preinstalled.])
+ fi
+
+ dnl We need to process the po/ directory.
+ POSUB=po
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+ dnl to 'yes' because some of the testsuite requires it.
+ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+ BUILD_INCLUDED_LIBINTL=yes
+ fi
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(BUILD_INCLUDED_LIBINTL)
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATOBJEXT)
+
+ dnl For backward compatibility. Some configure.ins may be using this.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ DATADIRNAME=share
+ AC_SUBST(DATADIRNAME)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INSTOBJEXT=.mo
+ AC_SUBST(INSTOBJEXT)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ GENCAT=gencat
+ AC_SUBST(GENCAT)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INTLOBJS=
+ if test "$USE_INCLUDED_LIBINTL" = yes; then
+ INTLOBJS="\$(GETTOBJS)"
+ fi
+ AC_SUBST(INTLOBJS)
+
+ dnl Enable libtool support if the surrounding package wishes it.
+ INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+ AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+ ])
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INTLLIBS="$LIBINTL"
+ AC_SUBST(INTLLIBS)
+
+ dnl Make all documented variables known to autoconf.
+ AC_SUBST(LIBINTL)
+ AC_SUBST(LTLIBINTL)
+ AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+ AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ AC_REQUIRE([gt_GLIBC2])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([gl_VISIBILITY])dnl
+ AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
+ AC_REQUIRE([bh_C_SIGNED])dnl
+ AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
+ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
+ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
+ AC_REQUIRE([gt_TYPE_WINT_T])dnl
+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([gt_TYPE_INTMAX_T])
+ AC_REQUIRE([gt_PRINTF_POSIX])
+ AC_REQUIRE([gl_GLIBC21])dnl
+ AC_REQUIRE([gl_XSIZE])dnl
+ AC_REQUIRE([gt_INTL_MACOSX])dnl
+
+ AC_CHECK_TYPE([ptrdiff_t], ,
+ [AC_DEFINE([ptrdiff_t], [long],
+ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
+ ])
+ AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
+ AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen])
+
+ dnl Use the _snprintf function only if it is declared (because on NetBSD it
+ dnl is defined as a weak alias of snprintf; we prefer to use the latter).
+ gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
+ gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
+
+ dnl Use the *_unlocked functions only if they are declared.
+ dnl (because some of them were defined without being declared in Solaris
+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+ dnl on Solaris 2.5.1 to run on Solaris 2.6).
+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
+ gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
+
+ case $gt_cv_func_printf_posix in
+ *yes) HAVE_POSIX_PRINTF=1 ;;
+ *) HAVE_POSIX_PRINTF=0 ;;
+ esac
+ AC_SUBST([HAVE_POSIX_PRINTF])
+ if test "$ac_cv_func_asprintf" = yes; then
+ HAVE_ASPRINTF=1
+ else
+ HAVE_ASPRINTF=0
+ fi
+ AC_SUBST([HAVE_ASPRINTF])
+ if test "$ac_cv_func_snprintf" = yes; then
+ HAVE_SNPRINTF=1
+ else
+ HAVE_SNPRINTF=0
+ fi
+ AC_SUBST([HAVE_SNPRINTF])
+ if test "$ac_cv_func_wprintf" = yes; then
+ HAVE_WPRINTF=1
+ else
+ HAVE_WPRINTF=0
+ fi
+ AC_SUBST([HAVE_WPRINTF])
+
+ AM_LANGINFO_CODESET
+ gt_LC_MESSAGES
+
+ dnl Compilation on mingw and Cygwin needs special Makefile rules, because
+ dnl 1. when we install a shared library, we must arrange to export
+ dnl auxiliary pointer variables for every exported variable,
+ dnl 2. when we install a shared library and a static library simultaneously,
+ dnl the include file specifies __declspec(dllimport) and therefore we
+ dnl must arrange to define the auxiliary pointer variables for the
+ dnl exported variables _also_ in the static library.
+ if test "$enable_shared" = yes; then
+ case "$host_os" in
+ cygwin*) is_woe32dll=yes ;;
+ *) is_woe32dll=no ;;
+ esac
+ else
+ is_woe32dll=no
+ fi
+ WOE32DLL=$is_woe32dll
+ AC_SUBST([WOE32DLL])
+
+ dnl Rename some macros and functions used for locking.
+ AH_BOTTOM([
+#define __libc_lock_t gl_lock_t
+#define __libc_lock_define gl_lock_define
+#define __libc_lock_define_initialized gl_lock_define_initialized
+#define __libc_lock_init gl_lock_init
+#define __libc_lock_lock gl_lock_lock
+#define __libc_lock_unlock gl_lock_unlock
+#define __libc_lock_recursive_t gl_recursive_lock_t
+#define __libc_lock_define_recursive gl_recursive_lock_define
+#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
+#define __libc_lock_init_recursive gl_recursive_lock_init
+#define __libc_lock_lock_recursive gl_recursive_lock_lock
+#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
+#define glthread_in_use libintl_thread_in_use
+#define glthread_lock_init libintl_lock_init
+#define glthread_lock_lock libintl_lock_lock
+#define glthread_lock_unlock libintl_lock_unlock
+#define glthread_lock_destroy libintl_lock_destroy
+#define glthread_rwlock_init libintl_rwlock_init
+#define glthread_rwlock_rdlock libintl_rwlock_rdlock
+#define glthread_rwlock_wrlock libintl_rwlock_wrlock
+#define glthread_rwlock_unlock libintl_rwlock_unlock
+#define glthread_rwlock_destroy libintl_rwlock_destroy
+#define glthread_recursive_lock_init libintl_recursive_lock_init
+#define glthread_recursive_lock_lock libintl_recursive_lock_lock
+#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
+#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
+#define glthread_once libintl_once
+#define glthread_once_call libintl_once_call
+#define glthread_once_singlethreaded libintl_once_singlethreaded
+])
+])
+
+
+dnl Checks for the core files of the intl subdirectory:
+dnl dcigettext.c
+dnl eval-plural.h
+dnl explodename.c
+dnl finddomain.c
+dnl gettextP.h
+dnl gmo.h
+dnl hash-string.h hash-string.c
+dnl l10nflist.c
+dnl libgnuintl.h.in (except the *printf stuff)
+dnl loadinfo.h
+dnl loadmsgcat.c
+dnl localealias.c
+dnl log.c
+dnl plural-exp.h plural-exp.c
+dnl plural.y
+dnl Used by libglocale.
+AC_DEFUN([gt_INTL_SUBDIR_CORE],
+[
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+ AC_REQUIRE([gt_INTDIV0])dnl
+ AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
+ AC_REQUIRE([gl_HEADER_INTTYPES_H])dnl
+ AC_REQUIRE([gt_INTTYPES_PRI])dnl
+ AC_REQUIRE([gl_LOCK])dnl
+
+ AC_TRY_LINK(
+ [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
+ [],
+ [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
+ [Define to 1 if the compiler understands __builtin_expect.])])
+
+ AC_CHECK_HEADERS([argz.h limits.h unistd.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
+ stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
+ argz_next __fsetlocking])
+
+ dnl Use the *_unlocked functions only if they are declared.
+ dnl (because some of them were defined without being declared in Solaris
+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+ dnl on Solaris 2.5.1 to run on Solaris 2.6).
+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
+ gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
+ gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
+
+ AM_ICONV
+
+ dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined,
+ dnl and a _NL_LOCALE_NAME macro always.
+ AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
+ [AC_TRY_LINK([#include <langinfo.h>
+#include <locale.h>],
+ [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));],
+ gt_cv_nl_locale_name=yes,
+ gt_cv_nl_locale_name=no)
+ ])
+ if test $gt_cv_nl_locale_name = yes; then
+ AC_DEFINE(HAVE_NL_LOCALE_NAME, 1,
+ [Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.])
+ fi
+
+ dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+ dnl because plural.y uses bison specific features. It requires at least
+ dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+ dnl compile.
+ dnl bison is only needed for the maintainer (who touches plural.y). But in
+ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+ dnl the rule in general Makefile. Now, some people carelessly touch the
+ dnl files or have a broken "make" program, hence the plural.c rule will
+ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+ dnl present or too old.
+ AC_CHECK_PROGS([INTLBISON], [bison])
+ if test -z "$INTLBISON"; then
+ ac_verc_fail=yes
+ else
+ dnl Found it, now check the version.
+ AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ esac
+ AC_MSG_RESULT([$ac_prog_version])
+ fi
+ if test $ac_verc_fail = yes; then
+ INTLBISON=:
+ fi
+])
+
+
+dnl Checks for special options needed on MacOS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+ dnl Check for API introduced in MacOS X 10.2.
+ AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+ gt_cv_func_CFPreferencesCopyAppValue,
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
+ [CFPreferencesCopyAppValue(NULL, NULL)],
+ [gt_cv_func_CFPreferencesCopyAppValue=yes],
+ [gt_cv_func_CFPreferencesCopyAppValue=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+ AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
+ [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+ fi
+ dnl Check for API introduced in MacOS X 10.3.
+ AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
+ [gt_cv_func_CFLocaleCopyCurrent=yes],
+ [gt_cv_func_CFLocaleCopyCurrent=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+ AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
+ [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+ fi
+ INTL_MACOSX_LIBS=
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+ fi
+ AC_SUBST([INTL_MACOSX_LIBS])
+])
+
+
+dnl gt_CHECK_DECL(FUNC, INCLUDES)
+dnl Check whether a function is declared.
+AC_DEFUN([gt_CHECK_DECL],
+[
+ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
+ [AC_TRY_COMPILE([$2], [
+#ifndef $1
+ char *p = (char *) $1;
+#endif
+], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
+ if test $ac_cv_have_decl_$1 = yes; then
+ gt_value=1
+ else
+ gt_value=0
+ fi
+ AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
+ [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/alsa-utils/m4/glibc2.m4 b/alsa-utils/m4/glibc2.m4
new file mode 100644
index 0000000..e8f5bfe
--- /dev/null
+++ b/alsa-utils/m4/glibc2.m4
@@ -0,0 +1,30 @@
+# glibc2.m4 serial 1
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.0 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([gt_GLIBC2],
+ [
+ AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer,
+ ac_cv_gnu_library_2,
+ [AC_EGREP_CPP([Lucky GNU user],
+ [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ >= 2)
+ Lucky GNU user
+ #endif
+#endif
+ ],
+ ac_cv_gnu_library_2=yes,
+ ac_cv_gnu_library_2=no)
+ ]
+ )
+ AC_SUBST(GLIBC2)
+ GLIBC2="$ac_cv_gnu_library_2"
+ ]
+)
diff --git a/alsa-utils/m4/glibc21.m4 b/alsa-utils/m4/glibc21.m4
new file mode 100644
index 0000000..d95fd98
--- /dev/null
+++ b/alsa-utils/m4/glibc21.m4
@@ -0,0 +1,30 @@
+# glibc21.m4 serial 3
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([gl_GLIBC21],
+ [
+ AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+ ac_cv_gnu_library_2_1,
+ [AC_EGREP_CPP([Lucky GNU user],
+ [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+ Lucky GNU user
+ #endif
+#endif
+ ],
+ ac_cv_gnu_library_2_1=yes,
+ ac_cv_gnu_library_2_1=no)
+ ]
+ )
+ AC_SUBST(GLIBC21)
+ GLIBC21="$ac_cv_gnu_library_2_1"
+ ]
+)
diff --git a/alsa-utils/m4/iconv.m4 b/alsa-utils/m4/iconv.m4
new file mode 100644
index 0000000..654c415
--- /dev/null
+++ b/alsa-utils/m4/iconv.m4
@@ -0,0 +1,101 @@
+# iconv.m4 serial AM4 (gettext-0.11.3)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed libiconv and not disabled its use
+ dnl via --without-libiconv-prefix, he wants to use it. The first
+ dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+ am_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ am_cv_func_iconv=yes)
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+ [iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);],
+ am_cv_lib_iconv=yes
+ am_cv_func_iconv=yes)
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+ dnl either.
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+ AC_SUBST(LIBICONV)
+ AC_SUBST(LTLIBICONV)
+])
+
+AC_DEFUN([AM_ICONV],
+[
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+ AC_MSG_CHECKING([for iconv declaration])
+ AC_CACHE_VAL(am_cv_proto_iconv, [
+ AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ AC_MSG_RESULT([$]{ac_t:-
+ }[$]am_cv_proto_iconv)
+ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+ [Define as const if the declaration of iconv() needs const.])
+ fi
+])
diff --git a/alsa-utils/m4/intdiv0.m4 b/alsa-utils/m4/intdiv0.m4
new file mode 100644
index 0000000..b8d7817
--- /dev/null
+++ b/alsa-utils/m4/intdiv0.m4
@@ -0,0 +1,70 @@
+# intdiv0.m4 serial 1 (gettext-0.11.3)
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gt_INTDIV0],
+[
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+ AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
+ gt_cv_int_divbyzero_sigfpe,
+ [
+ AC_TRY_RUN([
+#include <stdlib.h>
+#include <signal.h>
+
+static void
+#ifdef __cplusplus
+sigfpe_handler (int sig)
+#else
+sigfpe_handler (sig) int sig;
+#endif
+{
+ /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
+ exit (sig != SIGFPE);
+}
+
+int x = 1;
+int y = 0;
+int z;
+int nan;
+
+int main ()
+{
+ signal (SIGFPE, sigfpe_handler);
+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
+ signal (SIGTRAP, sigfpe_handler);
+#endif
+/* Linux/SPARC yields signal SIGILL. */
+#if defined (__sparc__) && defined (__linux__)
+ signal (SIGILL, sigfpe_handler);
+#endif
+
+ z = x / y;
+ nan = y / y;
+ exit (1);
+}
+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
+ [
+ # Guess based on the CPU.
+ case "$host_cpu" in
+ alpha* | i[34567]86 | m68k | s390*)
+ gt_cv_int_divbyzero_sigfpe="guessing yes";;
+ *)
+ gt_cv_int_divbyzero_sigfpe="guessing no";;
+ esac
+ ])
+ ])
+ case "$gt_cv_int_divbyzero_sigfpe" in
+ *yes) value=1;;
+ *) value=0;;
+ esac
+ AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
+ [Define if integer division by zero raises signal SIGFPE.])
+])
diff --git a/alsa-utils/m4/intmax.m4 b/alsa-utils/m4/intmax.m4
new file mode 100644
index 0000000..d99c999
--- /dev/null
+++ b/alsa-utils/m4/intmax.m4
@@ -0,0 +1,30 @@
+# intmax.m4 serial 2 (gettext-0.14.2)
+dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the system has the 'intmax_t' type, but don't attempt to
+dnl find a replacement if it is lacking.
+
+AC_DEFUN([gt_TYPE_INTMAX_T],
+[
+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
+ [AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdlib.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+#include <inttypes.h>
+#endif
+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+ if test $gt_cv_c_intmax_t = yes; then
+ AC_DEFINE(HAVE_INTMAX_T, 1,
+ [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+ fi
+])
diff --git a/alsa-utils/m4/inttypes-h.m4 b/alsa-utils/m4/inttypes-h.m4
new file mode 100644
index 0000000..d7ec94c
--- /dev/null
+++ b/alsa-utils/m4/inttypes-h.m4
@@ -0,0 +1,25 @@
+# inttypes-h.m4 serial 1 (gettext-0.15)
+dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
+# <sys/types.h>.
+
+AC_DEFUN([gl_HEADER_INTTYPES_H],
+[
+ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
+ [
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <inttypes.h>],
+ [], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)
+ ])
+ if test $gl_cv_header_inttypes_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
+ [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
+ fi
+])
diff --git a/alsa-utils/m4/inttypes-pri.m4 b/alsa-utils/m4/inttypes-pri.m4
new file mode 100644
index 0000000..ef00da7
--- /dev/null
+++ b/alsa-utils/m4/inttypes-pri.m4
@@ -0,0 +1,30 @@
+# inttypes-pri.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
+# macros to non-string values. This is the case on AIX 4.3.3.
+
+AC_DEFUN([gt_INTTYPES_PRI],
+[
+ AC_REQUIRE([gl_HEADER_INTTYPES_H])
+ if test $gl_cv_header_inttypes_h = yes; then
+ AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
+ gt_cv_inttypes_pri_broken,
+ [
+ AC_TRY_COMPILE([#include <inttypes.h>
+#ifdef PRId32
+char *p = PRId32;
+#endif
+], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
+ ])
+ fi
+ if test "$gt_cv_inttypes_pri_broken" = yes; then
+ AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
+ [Define if <inttypes.h> exists and defines unusable PRI* macros.])
+ fi
+])
diff --git a/alsa-utils/m4/inttypes_h.m4 b/alsa-utils/m4/inttypes_h.m4
new file mode 100644
index 0000000..a5d075d
--- /dev/null
+++ b/alsa-utils/m4/inttypes_h.m4
@@ -0,0 +1,26 @@
+# inttypes_h.m4 serial 6
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
+[
+ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <inttypes.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ gl_cv_header_inttypes_h=yes,
+ gl_cv_header_inttypes_h=no)])
+ if test $gl_cv_header_inttypes_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
+ [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
diff --git a/alsa-utils/m4/lcmessage.m4 b/alsa-utils/m4/lcmessage.m4
new file mode 100644
index 0000000..19aa77e
--- /dev/null
+++ b/alsa-utils/m4/lcmessage.m4
@@ -0,0 +1,30 @@
+# lcmessage.m4 serial 4 (gettext-0.14.2)
+dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+
+AC_DEFUN([gt_LC_MESSAGES],
+[
+ AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)])
+ if test $gt_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES, 1,
+ [Define if your <locale.h> file defines LC_MESSAGES.])
+ fi
+])
diff --git a/alsa-utils/m4/lib-ld.m4 b/alsa-utils/m4/lib-ld.m4
new file mode 100644
index 0000000..96c4e2c
--- /dev/null
+++ b/alsa-utils/m4/lib-ld.m4
@@ -0,0 +1,110 @@
+# lib-ld.m4 serial 3 (gettext-0.13)
+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes ;;
+*)
+ acl_cv_prog_gnu_ld=no ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ [re_direlt='/[^/][^/]*/\.\./']
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(acl_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break ;;
+ *)
+ test "$with_gnu_ld" != yes && break ;;
+ esac
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/alsa-utils/m4/lib-link.m4 b/alsa-utils/m4/lib-link.m4
new file mode 100644
index 0000000..9292919
--- /dev/null
+++ b/alsa-utils/m4/lib-link.m4
@@ -0,0 +1,630 @@
+# lib-link.m4 serial 8 (gettext-0.15)
+dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ(2.50)
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ define([Name],[translit([$1],[./-], [___])])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIB[]NAME"
+ AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ undefine([Name])
+ undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+ m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ libext="$acl_cv_libext"
+ shlibext="$acl_cv_shlibext"
+ hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ hardcode_direct="$acl_cv_hardcode_direct"
+ hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE(rpath,
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib$1-prefix],
+[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
+ --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ if test $use_additional = yes; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+ found_dir="$additional_libdir"
+ found_so="$additional_libdir/lib$name.$shlibext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ else
+ if test -f "$additional_libdir/lib$name.$libext"; then
+ found_dir="$additional_libdir"
+ found_a="$additional_libdir/lib$name.$libext"
+ if test -f "$additional_libdir/lib$name.la"; then
+ found_la="$additional_libdir/lib$name.la"
+ fi
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+ found_dir="$dir"
+ found_so="$dir/lib$name.$shlibext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ else
+ if test -f "$dir/lib$name.$libext"; then
+ found_dir="$dir"
+ found_a="$dir/lib$name.$libext"
+ if test -f "$dir/lib$name.la"; then
+ found_la="$dir/lib$name.la"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+ AC_REQUIRE([AC_LIB_RPATH])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ $1=
+ if test "$enable_rpath" != no; then
+ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode directories into the resulting
+ dnl binary.
+ rpathdirs=
+ next=
+ for opt in $2; do
+ if test -n "$next"; then
+ dir="$next"
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next=
+ else
+ case $opt in
+ -L) next=yes ;;
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next= ;;
+ *) next= ;;
+ esac
+ fi
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n ""$3""; then
+ dnl libtool is used for linking. Use -R options.
+ for dir in $rpathdirs; do
+ $1="${$1}${$1:+ }-R$dir"
+ done
+ else
+ dnl The linker is used for linking directly.
+ if test -n "$hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user
+ dnl must pass all path elements in one option.
+ alldirs=
+ for dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$dir"
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="${$1}${$1:+ }$flag"
+ done
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST([$1])
+])
diff --git a/alsa-utils/m4/lib-prefix.m4 b/alsa-utils/m4/lib-prefix.m4
new file mode 100644
index 0000000..a8684e1
--- /dev/null
+++ b/alsa-utils/m4/lib-prefix.m4
@@ -0,0 +1,185 @@
+# lib-prefix.m4 serial 5 (gettext-0.15)
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_LIB_ARG_WITH([lib-prefix],
+[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
+dnl the basename of the libdir, either "lib" or "lib64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib and lib64. The current
+ dnl practice is that on a system supporting 32-bit and 64-bit instruction
+ dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+ dnl libraries go under $prefix/lib. We determine the compiler's default
+ dnl mode by looking at the compiler's library search path. If at least
+ dnl of its elements ends in /lib64 or points to a directory whose absolute
+ dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+ dnl default, namely "lib".
+ acl_libdirstem=lib
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+])
diff --git a/alsa-utils/m4/lock.m4 b/alsa-utils/m4/lock.m4
new file mode 100644
index 0000000..d1ea1ca
--- /dev/null
+++ b/alsa-utils/m4/lock.m4
@@ -0,0 +1,289 @@
+# lock.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests for a multithreading library to be used.
+dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
+dnl USE_PTH_THREADS, USE_WIN32_THREADS
+dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
+dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
+dnl libtool).
+dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
+dnl programs that really need multithread functionality. The difference
+dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
+dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread".
+dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
+dnl multithread-safe programs.
+
+AC_DEFUN([gl_LOCK],
+[
+ AC_REQUIRE([gl_LOCK_BODY])
+])
+
+dnl The guts of gl_LOCK. Needs to be expanded only once.
+
+AC_DEFUN([gl_LOCK_BODY],
+[
+ dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
+ dnl influences the result of the autoconf tests that test for *_unlocked
+ dnl declarations, on AIX 5 at least. Therefore it must come early.
+ AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
+ AC_BEFORE([$0], [gl_ARGP])dnl
+
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
+ dnl Check for multithreading.
+ AC_ARG_ENABLE(threads,
+AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
+AC_HELP_STRING([--disable-threads], [build without multithread safety]),
+ gl_use_threads=$enableval, gl_use_threads=yes)
+ gl_threads_api=none
+ LIBTHREAD=
+ LTLIBTHREAD=
+ LIBMULTITHREAD=
+ LTLIBMULTITHREAD=
+ if test "$gl_use_threads" != no; then
+ dnl Check whether the compiler and linker support weak declarations.
+ AC_MSG_CHECKING([whether imported symbols can be declared weak])
+ gl_have_weak=no
+ AC_TRY_LINK([extern void xyzzy ();
+#pragma weak xyzzy], [xyzzy();], [gl_have_weak=yes])
+ AC_MSG_RESULT([$gl_have_weak])
+ if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
+ # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
+ # it groks <pthread.h>.
+ gl_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
+ CPPFLAGS="$gl_save_CPPFLAGS"
+ if test "$gl_have_pthread_h" = yes; then
+ # Other possible tests:
+ # -lpthreads (FSU threads, PCthreads)
+ # -lgthreads
+ case "$host_os" in
+ osf*)
+ # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
+ # groks <pthread.h>. cc also understands the flag -pthread, but
+ # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
+ # 2. putting a flag into CPPFLAGS that has an effect on the linker
+ # causes the AC_TRY_LINK test below to succeed unexpectedly,
+ # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
+ CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ ;;
+ esac
+ gl_have_pthread=
+ # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
+ # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
+ # the second one only in libpthread, and lock.c needs it.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_mutex_lock((pthread_mutex_t*)0);
+ pthread_mutexattr_init((pthread_mutexattr_t*)0);],
+ [gl_have_pthread=yes])
+ # Test for libpthread by looking for pthread_kill. (Not pthread_self,
+ # since it is defined as a macro on OSF/1.)
+ if test -n "$gl_have_pthread"; then
+ # The program links fine without libpthread. But it may actually
+ # need to link with libpthread in order to create multiple threads.
+ AC_CHECK_LIB(pthread, pthread_kill,
+ [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
+ # On Solaris and HP-UX, most pthread functions exist also in libc.
+ # Therefore pthread_in_use() needs to actually try to create a
+ # thread: pthread_create from libc will fail, whereas
+ # pthread_create will actually create a thread.
+ case "$host_os" in
+ solaris* | hpux*)
+ AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], 1,
+ [Define if the pthread_in_use() detection is hard.])
+ esac
+ ])
+ else
+ # Some library is needed. Try libpthread and libc_r.
+ AC_CHECK_LIB(pthread, pthread_kill,
+ [gl_have_pthread=yes
+ LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
+ LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread])
+ if test -z "$gl_have_pthread"; then
+ # For FreeBSD 4.
+ AC_CHECK_LIB(c_r, pthread_kill,
+ [gl_have_pthread=yes
+ LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
+ LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r])
+ fi
+ fi
+ if test -n "$gl_have_pthread"; then
+ gl_threads_api=posix
+ AC_DEFINE([USE_POSIX_THREADS], 1,
+ [Define if the POSIX multithreading library can be used.])
+ if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
+ if test $gl_have_weak = yes; then
+ AC_DEFINE([USE_POSIX_THREADS_WEAK], 1,
+ [Define if references to the POSIX multithreading library should be made weak.])
+ LIBTHREAD=
+ LTLIBTHREAD=
+ fi
+ fi
+ # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
+ # pthread_rwlock_* functions.
+ AC_CHECK_TYPE([pthread_rwlock_t],
+ [AC_DEFINE([HAVE_PTHREAD_RWLOCK], 1,
+ [Define if the POSIX multithreading library has read/write locks.])],
+ [],
+ [#include <pthread.h>])
+ # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
+ AC_TRY_COMPILE([#include <pthread.h>],
+ [#if __FreeBSD__ == 4
+error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
+#else
+int x = (int)PTHREAD_MUTEX_RECURSIVE;
+#endif],
+ [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
+ [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
+ # Some systems optimize for single-threaded programs by default, and
+ # need special flags to disable these optimizations. For example, the
+ # definition of 'errno' in <errno.h>.
+ case "$host_os" in
+ aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
+ solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
+ esac
+ fi
+ fi
+ fi
+ if test -z "$gl_have_pthread"; then
+ if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then
+ gl_have_solaristhread=
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS -lthread"
+ AC_TRY_LINK([#include <thread.h>
+#include <synch.h>],
+ [thr_self();],
+ [gl_have_solaristhread=yes])
+ LIBS="$gl_save_LIBS"
+ if test -n "$gl_have_solaristhread"; then
+ gl_threads_api=solaris
+ LIBTHREAD=-lthread
+ LTLIBTHREAD=-lthread
+ LIBMULTITHREAD="$LIBTHREAD"
+ LTLIBMULTITHREAD="$LTLIBTHREAD"
+ AC_DEFINE([USE_SOLARIS_THREADS], 1,
+ [Define if the old Solaris multithreading library can be used.])
+ if test $gl_have_weak = yes; then
+ AC_DEFINE([USE_SOLARIS_THREADS_WEAK], 1,
+ [Define if references to the old Solaris multithreading library should be made weak.])
+ LIBTHREAD=
+ LTLIBTHREAD=
+ fi
+ fi
+ fi
+ fi
+ if test "$gl_use_threads" = pth; then
+ gl_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_LINKFLAGS(pth)
+ gl_have_pth=
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS -lpth"
+ AC_TRY_LINK([#include <pth.h>], [pth_self();], gl_have_pth=yes)
+ LIBS="$gl_save_LIBS"
+ if test -n "$gl_have_pth"; then
+ gl_threads_api=pth
+ LIBTHREAD="$LIBPTH"
+ LTLIBTHREAD="$LTLIBPTH"
+ LIBMULTITHREAD="$LIBTHREAD"
+ LTLIBMULTITHREAD="$LTLIBTHREAD"
+ AC_DEFINE([USE_PTH_THREADS], 1,
+ [Define if the GNU Pth multithreading library can be used.])
+ if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
+ if test $gl_have_weak = yes; then
+ AC_DEFINE([USE_PTH_THREADS_WEAK], 1,
+ [Define if references to the GNU Pth multithreading library should be made weak.])
+ LIBTHREAD=
+ LTLIBTHREAD=
+ fi
+ fi
+ else
+ CPPFLAGS="$gl_save_CPPFLAGS"
+ fi
+ fi
+ if test -z "$gl_have_pthread"; then
+ if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then
+ if { case "$host_os" in
+ mingw*) true;;
+ *) false;;
+ esac
+ }; then
+ gl_threads_api=win32
+ AC_DEFINE([USE_WIN32_THREADS], 1,
+ [Define if the Win32 multithreading API can be used.])
+ fi
+ fi
+ fi
+ fi
+ AC_MSG_CHECKING([for multithread API to use])
+ AC_MSG_RESULT([$gl_threads_api])
+ AC_SUBST(LIBTHREAD)
+ AC_SUBST(LTLIBTHREAD)
+ AC_SUBST(LIBMULTITHREAD)
+ AC_SUBST(LTLIBMULTITHREAD)
+ gl_PREREQ_LOCK
+])
+
+# Prerequisites of lib/lock.c.
+AC_DEFUN([gl_PREREQ_LOCK], [
+ AC_REQUIRE([AC_C_INLINE])
+])
+
+dnl Survey of platforms:
+dnl
+dnl Platform Available Compiler Supports test-lock
+dnl flavours option weak result
+dnl --------------- --------- --------- -------- ---------
+dnl Linux 2.4/glibc posix -lpthread Y OK
+dnl
+dnl GNU Hurd/glibc posix
+dnl
+dnl FreeBSD 5.3 posix -lc_r Y
+dnl posix -lkse ? Y
+dnl posix -lpthread ? Y
+dnl posix -lthr Y
+dnl
+dnl FreeBSD 5.2 posix -lc_r Y
+dnl posix -lkse Y
+dnl posix -lthr Y
+dnl
+dnl FreeBSD 4.0,4.10 posix -lc_r Y OK
+dnl
+dnl NetBSD 1.6 --
+dnl
+dnl OpenBSD 3.4 posix -lpthread Y OK
+dnl
+dnl MacOS X 10.[123] posix -lpthread Y OK
+dnl
+dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK
+dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK
+dnl
+dnl HP-UX 11 posix -lpthread N (cc) OK
+dnl Y (gcc)
+dnl
+dnl IRIX 6.5 posix -lpthread Y 0.5
+dnl
+dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
+dnl
+dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
+dnl -lpthread (gcc) Y
+dnl
+dnl Cygwin posix -lpthread Y OK
+dnl
+dnl Any of the above pth -lpth 0.0
+dnl
+dnl Mingw win32 N OK
+dnl
+dnl BeOS 5 --
+dnl
+dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
+dnl turned off:
+dnl OK if all three tests terminate OK,
+dnl 0.5 if the first test terminates OK but the second one loops endlessly,
+dnl 0.0 if the first test already loops endlessly.
diff --git a/alsa-utils/m4/longdouble.m4 b/alsa-utils/m4/longdouble.m4
new file mode 100644
index 0000000..25590f4
--- /dev/null
+++ b/alsa-utils/m4/longdouble.m4
@@ -0,0 +1,31 @@
+# longdouble.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the compiler supports the 'long double' type.
+dnl Prerequisite: AC_PROG_CC
+
+dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
+dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
+
+AC_DEFUN([gt_TYPE_LONGDOUBLE],
+[
+ AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
+ [if test "$GCC" = yes; then
+ gt_cv_c_long_double=yes
+ else
+ AC_TRY_COMPILE([
+ /* The Stardent Vistra knows sizeof(long double), but does not support it. */
+ long double foo = 0.0;
+ /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
+ int array [2*(sizeof(long double) >= sizeof(double)) - 1];
+ ], ,
+ gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
+ fi])
+ if test $gt_cv_c_long_double = yes; then
+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
+ fi
+])
diff --git a/alsa-utils/m4/longlong.m4 b/alsa-utils/m4/longlong.m4
new file mode 100644
index 0000000..7b399e0
--- /dev/null
+++ b/alsa-utils/m4/longlong.m4
@@ -0,0 +1,23 @@
+# longlong.m4 serial 5
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_LONG_LONG if 'long long' works.
+
+AC_DEFUN([gl_AC_TYPE_LONG_LONG],
+[
+ AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
+ [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
+ [long long llmax = (long long) -1;
+ return ll << i | ll >> i | llmax / ll | llmax % ll;],
+ ac_cv_type_long_long=yes,
+ ac_cv_type_long_long=no)])
+ if test $ac_cv_type_long_long = yes; then
+ AC_DEFINE(HAVE_LONG_LONG, 1,
+ [Define if you have the 'long long' type.])
+ fi
+])
diff --git a/alsa-utils/m4/nls.m4 b/alsa-utils/m4/nls.m4
new file mode 100644
index 0000000..7967cc2
--- /dev/null
+++ b/alsa-utils/m4/nls.m4
@@ -0,0 +1,31 @@
+# nls.m4 serial 3 (gettext-0.15)
+dnl Copyright (C) 1995-2003, 2005-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ(2.50)
+
+AC_DEFUN([AM_NLS],
+[
+ AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE(nls,
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT($USE_NLS)
+ AC_SUBST(USE_NLS)
+])
diff --git a/alsa-utils/m4/po.m4 b/alsa-utils/m4/po.m4
new file mode 100644
index 0000000..00133ef
--- /dev/null
+++ b/alsa-utils/m4/po.m4
@@ -0,0 +1,428 @@
+# po.m4 serial 13 (gettext-0.15)
+dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ(2.50)
+
+dnl Checks for all prerequisites of the po subdirectory.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+ AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
+ AC_REQUIRE([AM_NLS])dnl
+
+ dnl Perform the following tests also if --disable-nls has been given,
+ dnl because they are needed for "make dist" to work.
+
+ dnl Search for GNU msgfmt in the PATH.
+ dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+ dnl The second test excludes FreeBSD msgfmt.
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+ dnl Test whether it is GNU msgfmt >= 0.15.
+changequote(,)dnl
+ case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
+ *) MSGFMT_015=$MSGFMT ;;
+ esac
+changequote([,])dnl
+ AC_SUBST([MSGFMT_015])
+changequote(,)dnl
+ case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+ *) GMSGFMT_015=$GMSGFMT ;;
+ esac
+changequote([,])dnl
+ AC_SUBST([GMSGFMT_015])
+
+ dnl Search for GNU xgettext 0.12 or newer in the PATH.
+ dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+ dnl The second test excludes FreeBSD xgettext.
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+ dnl Remove leftover from FreeBSD xgettext call.
+ rm -f messages.po
+
+ dnl Test whether it is GNU xgettext >= 0.15.
+changequote(,)dnl
+ case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+ *) XGETTEXT_015=$XGETTEXT ;;
+ esac
+changequote([,])dnl
+ AC_SUBST([XGETTEXT_015])
+
+ dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+ AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+ [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
+
+ dnl Installation directories.
+ dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
+ dnl have to define it here, so that it can be used in po/Makefile.
+ test -n "$localedir" || localedir='${datadir}/locale'
+ AC_SUBST([localedir])
+
+ AC_CONFIG_COMMANDS([po-directories], [[
+ for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ # Treat a directory as a PO directory if and only if it has a
+ # POTFILES.in file. This allows packages to have multiple PO
+ # directories under different names or in different locations.
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ POMAKEFILEDEPS="POTFILES.in"
+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+ # on $ac_dir but don't depend on user-specified configuration
+ # parameters.
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ # Hide the ALL_LINGUAS assigment from automake < 1.5.
+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # The set of available languages was given in configure.in.
+ # Hide the ALL_LINGUAS assigment from automake < 1.5.
+ eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+ fi
+ # Compute POFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+ # Compute UPDATEPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+ # Compute DUMMYPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+ # Compute GMOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ GMOFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+ fi
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+ if test -f "$f"; then
+ case "$f" in
+ *.orig | *.bak | *~) ;;
+ *) cat "$f" >> "$ac_dir/Makefile" ;;
+ esac
+ fi
+ done
+ fi
+ ;;
+ esac
+ done]],
+ [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+ # from automake < 1.5.
+ eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
+ LINGUAS="${LINGUAS-%UNSET%}"
+ ])
+])
+
+dnl Postprocesses a Makefile in a directory containing PO files.
+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
+[
+ # When this code is run, in config.status, two variables have already been
+ # set:
+ # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
+ # - LINGUAS is the value of the environment variable LINGUAS at configure
+ # time.
+
+changequote(,)dnl
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ # Find a way to echo strings without interpreting backslash.
+ if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
+ gt_echo='echo'
+ else
+ if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
+ gt_echo='printf %s\n'
+ else
+ echo_func () {
+ cat <<EOT
+$*
+EOT
+ }
+ gt_echo='echo_func'
+ fi
+ fi
+
+ # A sed script that extracts the value of VARIABLE from a Makefile.
+ sed_x_variable='
+# Test if the hold space is empty.
+x
+s/P/P/
+x
+ta
+# Yes it was empty. Look if we have the expected variable definition.
+/^[ ]*VARIABLE[ ]*=/{
+ # Seen the first line of the variable definition.
+ s/^[ ]*VARIABLE[ ]*=//
+ ba
+}
+bd
+:a
+# Here we are processing a line from the variable definition.
+# Remove comment, more precisely replace it with a space.
+s/#.*$/ /
+# See if the line ends in a backslash.
+tb
+:b
+s/\\$//
+# Print the line, without the trailing backslash.
+p
+tc
+# There was no trailing backslash. The end of the variable definition is
+# reached. Clear the hold space.
+s/^.*$//
+x
+bd
+:c
+# A trailing backslash means that the variable definition continues in the
+# next line. Put a nonempty string into the hold space to indicate this.
+s/^.*$/P/
+x
+:d
+'
+changequote([,])dnl
+
+ # Set POTFILES to the value of the Makefile variable POTFILES.
+ sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
+ POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
+ # Compute POTFILES_DEPS as
+ # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
+ POTFILES_DEPS=
+ for file in $POTFILES; do
+ POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
+ done
+ POMAKEFILEDEPS=""
+
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
+ sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
+ ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
+ fi
+ # Hide the ALL_LINGUAS assigment from automake < 1.5.
+ eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+ # Compute POFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+ # Compute UPDATEPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+ # Compute DUMMYPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+ # Compute GMOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+ # Compute PROPERTIESFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
+ # Compute CLASSFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
+ # Compute QMFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
+ # Compute MSGFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
+ # Compute RESOURCESDLLFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ GMOFILES=
+ PROPERTIESFILES=
+ CLASSFILES=
+ QMFILES=
+ MSGFILES=
+ RESOURCESDLLFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
+ CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
+ QMFILES="$QMFILES $srcdirpre$lang.qm"
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ JAVACATALOGS=
+ QTCATALOGS=
+ TCLCATALOGS=
+ CSHARPCATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
+ QTCATALOGS="$QTCATALOGS $lang.qm"
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
+ done
+ fi
+
+ sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+ if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
+ # Add dependencies that cannot be formulated as a simple suffix rule.
+ for lang in $ALL_LINGUAS; do
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ cat >> "$ac_file.tmp" <<EOF
+$frobbedlang.msg: $lang.po
+ @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+ \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+ done
+ fi
+ if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
+ # Add dependencies that cannot be formulated as a simple suffix rule.
+ for lang in $ALL_LINGUAS; do
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ cat >> "$ac_file.tmp" <<EOF
+$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
+ @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+ \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+ done
+ fi
+ if test -n "$POMAKEFILEDEPS"; then
+ cat >> "$ac_file.tmp" <<EOF
+Makefile: $POMAKEFILEDEPS
+EOF
+ fi
+ mv "$ac_file.tmp" "$ac_file"
+])
diff --git a/alsa-utils/m4/printf-posix.m4 b/alsa-utils/m4/printf-posix.m4
new file mode 100644
index 0000000..af10170
--- /dev/null
+++ b/alsa-utils/m4/printf-posix.m4
@@ -0,0 +1,44 @@
+# printf-posix.m4 serial 2 (gettext-0.13.1)
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the printf() function supports POSIX/XSI format strings with
+dnl positions.
+
+AC_DEFUN([gt_PRINTF_POSIX],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
+ gt_cv_func_printf_posix,
+ [
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <string.h>
+/* The string "%2$d %1$d", with dollar characters protected from the shell's
+ dollar expansion (possibly an autoconf bug). */
+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
+static char buf[100];
+int main ()
+{
+ sprintf (buf, format, 33, 55);
+ return (strcmp (buf, "55 33") != 0);
+}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
+ [
+ AC_EGREP_CPP(notposix, [
+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
+ notposix
+#endif
+ ], gt_cv_func_printf_posix="guessing no",
+ gt_cv_func_printf_posix="guessing yes")
+ ])
+ ])
+ case $gt_cv_func_printf_posix in
+ *yes)
+ AC_DEFINE(HAVE_POSIX_PRINTF, 1,
+ [Define if your printf() function supports format strings with positions.])
+ ;;
+ esac
+])
diff --git a/alsa-utils/m4/progtest.m4 b/alsa-utils/m4/progtest.m4
new file mode 100644
index 0000000..a56365c
--- /dev/null
+++ b/alsa-utils/m4/progtest.m4
@@ -0,0 +1,92 @@
+# progtest.m4 serial 4 (gettext-0.14.2)
+dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+AC_PREREQ(2.50)
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+ [[\\/]]* | ?:[[\\/]]*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+ AC_MSG_RESULT([$]$1)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
diff --git a/alsa-utils/m4/signed.m4 b/alsa-utils/m4/signed.m4
new file mode 100644
index 0000000..048f593
--- /dev/null
+++ b/alsa-utils/m4/signed.m4
@@ -0,0 +1,17 @@
+# signed.m4 serial 1 (gettext-0.10.40)
+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([bh_C_SIGNED],
+[
+ AC_CACHE_CHECK([for signed], bh_cv_c_signed,
+ [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
+ if test $bh_cv_c_signed = no; then
+ AC_DEFINE(signed, ,
+ [Define to empty if the C compiler doesn't support this keyword.])
+ fi
+])
diff --git a/alsa-utils/m4/size_max.m4 b/alsa-utils/m4/size_max.m4
new file mode 100644
index 0000000..029e471
--- /dev/null
+++ b/alsa-utils/m4/size_max.m4
@@ -0,0 +1,60 @@
+# size_max.m4 serial 4
+dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_SIZE_MAX],
+[
+ AC_CHECK_HEADERS(stdint.h)
+ dnl First test whether the system already has SIZE_MAX.
+ AC_MSG_CHECKING([for SIZE_MAX])
+ result=
+ AC_EGREP_CPP([Found it], [
+#include <limits.h>
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef SIZE_MAX
+Found it
+#endif
+], result=yes)
+ if test -z "$result"; then
+ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
+ dnl than the type 'unsigned long'. Try hard to find a definition that can
+ dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
+ _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1,
+ [#include <stddef.h>
+#include <limits.h>], size_t_bits_minus_1=)
+ _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
+ [#include <stddef.h>], fits_in_uint=)
+ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+ if test $fits_in_uint = 1; then
+ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
+ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
+ AC_TRY_COMPILE([#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+ ], [], fits_in_uint=0)
+ fi
+ dnl We cannot use 'expr' to simplify this expression, because 'expr'
+ dnl works only with 'long' integers in the host environment, while we
+ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
+ if test $fits_in_uint = 1; then
+ result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ else
+ result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
+ fi
+ else
+ dnl Shouldn't happen, but who knows...
+ result='((size_t)~(size_t)0)'
+ fi
+ fi
+ AC_MSG_RESULT([$result])
+ if test "$result" != yes; then
+ AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
+ [Define as the maximum value of type 'size_t', if the system doesn't define it.])
+ fi
+])
diff --git a/alsa-utils/m4/stdint_h.m4 b/alsa-utils/m4/stdint_h.m4
new file mode 100644
index 0000000..3355f35
--- /dev/null
+++ b/alsa-utils/m4/stdint_h.m4
@@ -0,0 +1,26 @@
+# stdint_h.m4 serial 5
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_STDINT_H],
+[
+ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <stdint.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ gl_cv_header_stdint_h=yes,
+ gl_cv_header_stdint_h=no)])
+ if test $gl_cv_header_stdint_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
+ [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
diff --git a/alsa-utils/m4/uintmax_t.m4 b/alsa-utils/m4/uintmax_t.m4
new file mode 100644
index 0000000..bf83ed7
--- /dev/null
+++ b/alsa-utils/m4/uintmax_t.m4
@@ -0,0 +1,30 @@
+# uintmax_t.m4 serial 9
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+AC_PREREQ(2.13)
+
+# Define uintmax_t to 'unsigned long' or 'unsigned long long'
+# if it is not already defined in <stdint.h> or <inttypes.h>.
+
+AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
+[
+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+ if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
+ AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
+ test $ac_cv_type_unsigned_long_long = yes \
+ && ac_type='unsigned long long' \
+ || ac_type='unsigned long'
+ AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
+ [Define to unsigned long or unsigned long long
+ if <stdint.h> and <inttypes.h> don't define.])
+ else
+ AC_DEFINE(HAVE_UINTMAX_T, 1,
+ [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
+ fi
+])
diff --git a/alsa-utils/m4/ulonglong.m4 b/alsa-utils/m4/ulonglong.m4
new file mode 100644
index 0000000..dee10cc
--- /dev/null
+++ b/alsa-utils/m4/ulonglong.m4
@@ -0,0 +1,23 @@
+# ulonglong.m4 serial 4
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
+
+AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
+[
+ AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
+ [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
+ [unsigned long long ullmax = (unsigned long long) -1;
+ return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
+ ac_cv_type_unsigned_long_long=yes,
+ ac_cv_type_unsigned_long_long=no)])
+ if test $ac_cv_type_unsigned_long_long = yes; then
+ AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+ [Define if you have the 'unsigned long long' type.])
+ fi
+])
diff --git a/alsa-utils/m4/visibility.m4 b/alsa-utils/m4/visibility.m4
new file mode 100644
index 0000000..2ff6330
--- /dev/null
+++ b/alsa-utils/m4/visibility.m4
@@ -0,0 +1,52 @@
+# visibility.m4 serial 1 (gettext-0.15)
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl Tests whether the compiler supports the command-line option
+dnl -fvisibility=hidden and the function and variable attributes
+dnl __attribute__((__visibility__("hidden"))) and
+dnl __attribute__((__visibility__("default"))).
+dnl Does *not* test for __visibility__("protected") - which has tricky
+dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
+dnl MacOS X.
+dnl Does *not* test for __visibility__("internal") - which has processor
+dnl dependent semantics.
+dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
+dnl "really only recommended for legacy code".
+dnl Set the variable CFLAG_VISIBILITY.
+dnl Defines and sets the variable HAVE_VISIBILITY.
+
+AC_DEFUN([gl_VISIBILITY],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ CFLAG_VISIBILITY=
+ HAVE_VISIBILITY=0
+ if test -n "$GCC"; then
+ AC_MSG_CHECKING([for simple visibility declarations])
+ AC_CACHE_VAL(gl_cv_cc_visibility, [
+ gl_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ AC_TRY_COMPILE(
+ [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+ extern __attribute__((__visibility__("default"))) int exportedvar;
+ extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+ extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
+ [],
+ gl_cv_cc_visibility=yes,
+ gl_cv_cc_visibility=no)
+ CFLAGS="$gl_save_CFLAGS"])
+ AC_MSG_RESULT([$gl_cv_cc_visibility])
+ if test $gl_cv_cc_visibility = yes; then
+ CFLAG_VISIBILITY="-fvisibility=hidden"
+ HAVE_VISIBILITY=1
+ fi
+ fi
+ AC_SUBST([CFLAG_VISIBILITY])
+ AC_SUBST([HAVE_VISIBILITY])
+ AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
+ [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
+])
diff --git a/alsa-utils/m4/wchar_t.m4 b/alsa-utils/m4/wchar_t.m4
new file mode 100644
index 0000000..cde2129
--- /dev/null
+++ b/alsa-utils/m4/wchar_t.m4
@@ -0,0 +1,20 @@
+# wchar_t.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether <stddef.h> has the 'wchar_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WCHAR_T],
+[
+ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
+ [AC_TRY_COMPILE([#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';], ,
+ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
+ if test $gt_cv_c_wchar_t = yes; then
+ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
+ fi
+])
diff --git a/alsa-utils/m4/wint_t.m4 b/alsa-utils/m4/wint_t.m4
new file mode 100644
index 0000000..b8fff9c
--- /dev/null
+++ b/alsa-utils/m4/wint_t.m4
@@ -0,0 +1,20 @@
+# wint_t.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether <wchar.h> has the 'wint_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WINT_T],
+[
+ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
+ [AC_TRY_COMPILE([#include <wchar.h>
+ wint_t foo = (wchar_t)'\0';], ,
+ gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
+ if test $gt_cv_c_wint_t = yes; then
+ AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
+ fi
+])
diff --git a/alsa-utils/m4/xsize.m4 b/alsa-utils/m4/xsize.m4
new file mode 100644
index 0000000..85bb721
--- /dev/null
+++ b/alsa-utils/m4/xsize.m4
@@ -0,0 +1,13 @@
+# xsize.m4 serial 3
+dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_XSIZE],
+[
+ dnl Prerequisites of lib/xsize.h.
+ AC_REQUIRE([gl_SIZE_MAX])
+ AC_REQUIRE([AC_C_INLINE])
+ AC_CHECK_HEADERS(stdint.h)
+])
diff --git a/alsa-utils/missing b/alsa-utils/missing
new file mode 100644
index 0000000..894e786
--- /dev/null
+++ b/alsa-utils/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/alsa-utils/po/LINGUAS b/alsa-utils/po/LINGUAS
new file mode 100644
index 0000000..bef7f4a
--- /dev/null
+++ b/alsa-utils/po/LINGUAS
@@ -0,0 +1 @@
+ja
diff --git a/alsa-utils/po/Makefile.in.in b/alsa-utils/po/Makefile.in.in
new file mode 100644
index 0000000..2ed49e6
--- /dev/null
+++ b/alsa-utils/po/Makefile.in.in
@@ -0,0 +1,393 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2006 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU General Public
+# License but which still want to provide support for the GNU gettext
+# functionality.
+# Please note that the actual code of GNU gettext is covered by the GNU
+# General Public License and is *not* in the public domain.
+#
+# Origin: gettext-0.15
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+datadir = @datadir@
+localedir = @localedir@
+gettextsrcdir = $(datadir)/gettext/po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+mkinstalldirs = $(SHELL) @install_sh@ -d
+mkdir_p = @mkdir_p@
+
+GMSGFMT_ = @GMSGFMT@
+GMSGFMT_no = @GMSGFMT@
+GMSGFMT_yes = @GMSGFMT_015@
+GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
+MSGFMT_ = @MSGFMT@
+MSGFMT_no = @MSGFMT@
+MSGFMT_yes = @MSGFMT_015@
+MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
+XGETTEXT_ = @XGETTEXT@
+XGETTEXT_no = @XGETTEXT@
+XGETTEXT_yes = @XGETTEXT_015@
+XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = @MSGMERGE@ --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+UPDATEPOFILES = @UPDATEPOFILES@
+DUMMYPOFILES = @DUMMYPOFILES@
+DISTFILES.common = Makefile.in.in remove-potcdate.sin \
+$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
+DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
+$(POFILES) $(GMOFILES) \
+$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+
+# Makevars gets inserted here. (Don't remove this line!)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+ @echo "$(MSGFMT) -c -o $@ $<"; \
+ $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+ @lang=`echo $* | sed -e 's,.*/,,'`; \
+ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+ echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
+ cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+ sed -e '/^#/d' $< > t-$@
+ mv t-$@ $@
+
+
+all: all-@USE_NLS@
+
+all-yes: stamp-po
+all-no:
+
+# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
+# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
+# we don't want to bother translators with empty POT files). We assume that
+# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
+# In this case, stamp-po is a nop (i.e. a phony target).
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+ test ! -f $(srcdir)/$(DOMAIN).pot || \
+ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+ @test ! -f $(srcdir)/$(DOMAIN).pot || { \
+ echo "touch stamp-po" && \
+ echo timestamp > stamp-poT && \
+ mv stamp-poT stamp-po; \
+ }
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+ if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
+ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
+ else \
+ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
+ fi; \
+ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+ --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+ --files-from=$(srcdir)/POTFILES.in \
+ --copyright-holder='$(COPYRIGHT_HOLDER)' \
+ --msgid-bugs-address="$$msgid_bugs_address"
+ test ! -f $(DOMAIN).po || { \
+ if test -f $(srcdir)/$(DOMAIN).pot; then \
+ sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+ sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+ if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+ rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+ else \
+ rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+ fi; \
+ else \
+ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+ fi; \
+ }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+ $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+ @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+ if test -f "$(srcdir)/$${lang}.po"; then \
+ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+ echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
+ cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+ else \
+ $(MAKE) $${lang}.po-create; \
+ fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+ if test "$(PACKAGE)" = "gettext-tools"; then \
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+ for file in $(DISTFILES.common) Makevars.template; do \
+ $(INSTALL_DATA) $(srcdir)/$$file \
+ $(DESTDIR)$(gettextsrcdir)/$$file; \
+ done; \
+ for file in Makevars; do \
+ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+ done; \
+ else \
+ : ; \
+ fi
+install-data-no: all
+install-data-yes: all
+ $(mkdir_p) $(DESTDIR)$(datadir)
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+ if test -n "$$lc"; then \
+ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+ for file in *; do \
+ if test -f $$file; then \
+ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+ fi; \
+ done); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ else \
+ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+ :; \
+ else \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ fi; \
+ fi; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+ fi; \
+ done; \
+ done
+
+install-strip: install
+
+installdirs: installdirs-exec installdirs-data
+installdirs-exec:
+installdirs-data: installdirs-data-@USE_NLS@
+ if test "$(PACKAGE)" = "gettext-tools"; then \
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+ else \
+ : ; \
+ fi
+installdirs-data-no:
+installdirs-data-yes:
+ $(mkdir_p) $(DESTDIR)$(datadir)
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+ if test -n "$$lc"; then \
+ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+ for file in *; do \
+ if test -f $$file; then \
+ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+ fi; \
+ done); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+ else \
+ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+ :; \
+ else \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+ fi; \
+ fi; \
+ fi; \
+ done; \
+ done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall: uninstall-exec uninstall-data
+uninstall-exec:
+uninstall-data: uninstall-data-@USE_NLS@
+ if test "$(PACKAGE)" = "gettext-tools"; then \
+ for file in $(DISTFILES.common) Makevars.template; do \
+ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+ done; \
+ else \
+ : ; \
+ fi
+uninstall-data-no:
+uninstall-data-yes:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+ done; \
+ done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+mostlyclean:
+ rm -f remove-potcdate.sed
+ rm -f stamp-poT
+ rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+ rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES *.mo
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ rm -f stamp-po $(GMOFILES)
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir:
+ $(MAKE) update-po
+ @$(MAKE) dist2
+# This is a separate target because 'update-po' must be executed before.
+dist2: stamp-po $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ if test "$(PACKAGE)" = "gettext-tools"; then \
+ dists="$$dists Makevars.template"; \
+ fi; \
+ if test -f $(srcdir)/$(DOMAIN).pot; then \
+ dists="$$dists $(DOMAIN).pot stamp-po"; \
+ fi; \
+ if test -f $(srcdir)/ChangeLog; then \
+ dists="$$dists ChangeLog"; \
+ fi; \
+ for i in 0 1 2 3 4 5 6 7 8 9; do \
+ if test -f $(srcdir)/ChangeLog.$$i; then \
+ dists="$$dists ChangeLog.$$i"; \
+ fi; \
+ done; \
+ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
+ for file in $$dists; do \
+ if test -f $$file; then \
+ cp -p $$file $(distdir) || exit 1; \
+ else \
+ cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+ fi; \
+ done
+
+update-po: Makefile
+ $(MAKE) $(DOMAIN).pot-update
+ test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+ $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+ @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+ echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+ exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+ @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+ if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+ tmpdir=`pwd`; \
+ echo "$$lang:"; \
+ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+ echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+ cd $(srcdir); \
+ if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+ rm -f $$tmpdir/$$lang.new.po; \
+ else \
+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+ :; \
+ else \
+ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+ exit 1; \
+ fi; \
+ fi; \
+ else \
+ echo "msgmerge for $$lang.po failed!" 1>&2; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+ @:
+
+Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
+ cd $(top_builddir) \
+ && $(SHELL) ./config.status $(subdir)/$@.in po-directories
+
+force:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/po/Makevars b/alsa-utils/po/Makevars
new file mode 100644
index 0000000..32692ab
--- /dev/null
+++ b/alsa-utils/po/Makevars
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
+# package. (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.) Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright. The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/alsa-utils/po/POTFILES.in b/alsa-utils/po/POTFILES.in
new file mode 100644
index 0000000..11a6a96
--- /dev/null
+++ b/alsa-utils/po/POTFILES.in
@@ -0,0 +1,4 @@
+aplay/aplay.c
+seq/aconnect/aconnect.c
+seq/aseqnet/aseqnet.c
+speaker-test/speaker-test.c
diff --git a/alsa-utils/po/Rules-quot b/alsa-utils/po/Rules-quot
new file mode 100644
index 0000000..9c2a995
--- /dev/null
+++ b/alsa-utils/po/Rules-quot
@@ -0,0 +1,47 @@
+# Special Makefile rules for English message catalogs with quotation marks.
+
+DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
+
+.SUFFIXES: .insert-header .po-update-en
+
+en@quot.po-create:
+ $(MAKE) en@quot.po-update
+en@boldquot.po-create:
+ $(MAKE) en@boldquot.po-update
+
+en@quot.po-update: en@quot.po-update-en
+en@boldquot.po-update: en@boldquot.po-update-en
+
+.insert-header.po-update-en:
+ @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
+ if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
+ tmpdir=`pwd`; \
+ echo "$$lang:"; \
+ ll=`echo $$lang | sed -e 's/@.*//'`; \
+ LC_ALL=C; export LC_ALL; \
+ cd $(srcdir); \
+ if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
+ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+ rm -f $$tmpdir/$$lang.new.po; \
+ else \
+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+ :; \
+ else \
+ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+ exit 1; \
+ fi; \
+ fi; \
+ else \
+ echo "creation of $$lang.po failed!" 1>&2; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ fi
+
+en@quot.insert-header: insert-header.sin
+ sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
+
+en@boldquot.insert-header: insert-header.sin
+ sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
+
+mostlyclean: mostlyclean-quot
+mostlyclean-quot:
+ rm -f *.insert-header
diff --git a/alsa-utils/po/alsa-utils.pot b/alsa-utils/po/alsa-utils.pot
new file mode 100644
index 0000000..93bf58e
--- /dev/null
+++ b/alsa-utils/po/alsa-utils.pot
@@ -0,0 +1,1108 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-01-19 12:24+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: aplay/aplay.c:136
+msgid "raw data"
+msgstr ""
+
+#: aplay/aplay.c:137
+msgid "VOC"
+msgstr ""
+
+#: aplay/aplay.c:139
+msgid "WAVE"
+msgstr ""
+
+#: aplay/aplay.c:140
+msgid "Sparc Audio"
+msgstr ""
+
+#: aplay/aplay.c:161
+#, c-format
+msgid ""
+"Usage: %s [OPTION]... [FILE]...\n"
+"\n"
+"-h, --help help\n"
+" --version print current version\n"
+"-l, --list-devices list all soundcards and digital audio devices\n"
+"-L, --list-pcms list device names\n"
+"-D, --device=NAME select PCM by name\n"
+"-q, --quiet quiet mode\n"
+"-t, --file-type TYPE file type (voc, wav, raw or au)\n"
+"-c, --channels=# channels\n"
+"-f, --format=FORMAT sample format (case insensitive)\n"
+"-r, --rate=# sample rate\n"
+"-d, --duration=# interrupt after # seconds\n"
+"-M, --mmap mmap stream\n"
+"-N, --nonblock nonblocking mode\n"
+"-F, --period-time=# distance between interrupts is # microseconds\n"
+"-B, --buffer-time=# buffer duration is # microseconds\n"
+" --period-size=# distance between interrupts is # frames\n"
+" --buffer-size=# buffer duration is # frames\n"
+"-A, --avail-min=# min available space for wakeup is # microseconds\n"
+"-R, --start-delay=# delay for automatic PCM start is # microseconds \n"
+" (relative to buffer size if <= 0)\n"
+"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from "
+"xrun\n"
+"-v, --verbose show PCM structure and setup (accumulative)\n"
+"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n"
+"-I, --separate-channels one file for each channel\n"
+" --disable-resample disable automatic rate resample\n"
+" --disable-channels disable automatic channel conversions\n"
+" --disable-format disable automatic format conversions\n"
+" --disable-softvol disable software volume control (softvol)\n"
+" --test-position test ring buffer position\n"
+msgstr ""
+
+#: aplay/aplay.c:193 speaker-test/speaker-test.c:783
+#, c-format
+msgid "Recognized sample formats are:"
+msgstr ""
+
+#: aplay/aplay.c:199
+#, c-format
+msgid ""
+"\n"
+"Some of these may not be available on selected hardware\n"
+msgstr ""
+
+#: aplay/aplay.c:200
+#, c-format
+msgid "The availabled format shortcuts are:\n"
+msgstr ""
+
+#: aplay/aplay.c:201
+#, c-format
+msgid "-f cd (16 bit little endian, 44100, stereo)\n"
+msgstr ""
+
+#: aplay/aplay.c:202
+#, c-format
+msgid "-f cdr (16 bit big endian, 44100, stereo)\n"
+msgstr ""
+
+#: aplay/aplay.c:203
+#, c-format
+msgid "-f dat (16 bit little endian, 48000, stereo)\n"
+msgstr ""
+
+#: aplay/aplay.c:217
+msgid "no soundcards found..."
+msgstr ""
+
+#: aplay/aplay.c:220
+#, c-format
+msgid "**** List of %s Hardware Devices ****\n"
+msgstr ""
+
+#: aplay/aplay.c:249
+#, c-format
+msgid "card %i: %s [%s], device %i: %s [%s]\n"
+msgstr ""
+
+#: aplay/aplay.c:255
+#, c-format
+msgid " Subdevices: %i/%i\n"
+msgstr ""
+
+#: aplay/aplay.c:262
+#, c-format
+msgid " Subdevice #%i: %s\n"
+msgstr ""
+
+#: aplay/aplay.c:326
+#, c-format
+msgid "Aborted by signal %s...\n"
+msgstr ""
+
+#: aplay/aplay.c:420
+msgid "command should be named either arecord or aplay"
+msgstr ""
+
+#: aplay/aplay.c:459
+#, c-format
+msgid "unrecognized file format %s"
+msgstr ""
+
+#: aplay/aplay.c:466
+#, c-format
+msgid "value %i for channels is invalid"
+msgstr ""
+
+#: aplay/aplay.c:485
+#, c-format
+msgid "wrong extended format '%s'"
+msgstr ""
+
+#: aplay/aplay.c:496
+#, c-format
+msgid "bad speed value %i"
+msgstr ""
+
+#: aplay/aplay.c:574
+#, c-format
+msgid "Try `%s --help' for more information.\n"
+msgstr ""
+
+#: aplay/aplay.c:590
+#, c-format
+msgid "audio open error: %s"
+msgstr ""
+
+#: aplay/aplay.c:595
+#, c-format
+msgid "info error: %s"
+msgstr ""
+
+#: aplay/aplay.c:602
+#, c-format
+msgid "nonblock setting error: %s"
+msgstr ""
+
+#: aplay/aplay.c:612 aplay/aplay.c:719 aplay/aplay.c:1073
+msgid "not enough memory"
+msgstr ""
+
+#: aplay/aplay.c:709
+#, c-format
+msgid "read error (called from line %i)"
+msgstr ""
+
+#: aplay/aplay.c:767
+#, c-format
+msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)"
+msgstr ""
+
+#: aplay/aplay.c:777
+#, c-format
+msgid ""
+"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"
+msgstr ""
+
+#: aplay/aplay.c:782
+msgid "wrong format tag in extensible 'fmt ' chunk"
+msgstr ""
+
+#: aplay/aplay.c:789
+#, c-format
+msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"
+msgstr ""
+
+#: aplay/aplay.c:793
+#, c-format
+msgid "can't play WAVE-files with %d tracks"
+msgstr ""
+
+#: aplay/aplay.c:801 aplay/aplay.c:901
+#, c-format
+msgid "Warning: format is changed to U8\n"
+msgstr ""
+
+#: aplay/aplay.c:807
+#, c-format
+msgid "Warning: format is changed to S16_LE\n"
+msgstr ""
+
+#: aplay/aplay.c:815
+#, c-format
+msgid "Warning: format is changed to S24_3LE\n"
+msgstr ""
+
+#: aplay/aplay.c:821
+#, c-format
+msgid "Warning: format is changed to S24_LE\n"
+msgstr ""
+
+#: aplay/aplay.c:825
+#, c-format
+msgid ""
+" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"
+msgstr ""
+
+#: aplay/aplay.c:837
+#, c-format
+msgid " can't play WAVE-files with sample %d bits wide"
+msgstr ""
+
+#: aplay/aplay.c:895
+#, c-format
+msgid "Warning: format is changed to MU_LAW\n"
+msgstr ""
+
+#: aplay/aplay.c:907
+#, c-format
+msgid "Warning: format is changed to S16_BE\n"
+msgstr ""
+
+#: aplay/aplay.c:920 aplay/aplay.c:1679 aplay/aplay.c:1686 aplay/aplay.c:2208
+#: aplay/aplay.c:2220
+msgid "read error"
+msgstr ""
+
+#: aplay/aplay.c:939
+msgid "Broken configuration for this PCM: no configurations available"
+msgstr ""
+
+#: aplay/aplay.c:956
+msgid "Access type not available"
+msgstr ""
+
+#: aplay/aplay.c:961
+msgid "Sample format non available"
+msgstr ""
+
+#: aplay/aplay.c:966
+msgid "Channels count non available"
+msgstr ""
+
+#: aplay/aplay.c:981
+#, c-format
+msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"
+msgstr ""
+
+#: aplay/aplay.c:987
+#, c-format
+msgid " please, try the plug plugin %s\n"
+msgstr ""
+
+#: aplay/aplay.c:1022
+msgid "Unable to install hw params:"
+msgstr ""
+
+#: aplay/aplay.c:1029
+#, c-format
+msgid "Can't use period equal to buffer size (%lu == %lu)"
+msgstr ""
+
+#: aplay/aplay.c:1060
+msgid "unable to install sw params:"
+msgstr ""
+
+#: aplay/aplay.c:1123
+#, c-format
+msgid "status error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1131
+#, c-format
+msgid "%s!!! (at least %.3f ms long)\n"
+msgstr ""
+
+#: aplay/aplay.c:1132
+msgid "underrun"
+msgstr ""
+
+#: aplay/aplay.c:1132
+msgid "overrun"
+msgstr ""
+
+#: aplay/aplay.c:1135
+#, c-format
+msgid "Status:\n"
+msgstr ""
+
+#: aplay/aplay.c:1139
+#, c-format
+msgid "xrun: prepare error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1145
+#, c-format
+msgid "Status(DRAINING):\n"
+msgstr ""
+
+#: aplay/aplay.c:1149
+#, c-format
+msgid "capture stream format change? attempting recover...\n"
+msgstr ""
+
+#: aplay/aplay.c:1151
+#, c-format
+msgid "xrun(DRAINING): prepare error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1158
+#, c-format
+msgid "Status(R/W):\n"
+msgstr ""
+
+#: aplay/aplay.c:1161
+#, c-format
+msgid "read/write error, state = %s"
+msgstr ""
+
+#: aplay/aplay.c:1171
+#, c-format
+msgid "Suspended. Trying resume. "
+msgstr ""
+
+#: aplay/aplay.c:1176
+#, c-format
+msgid "Failed. Restarting stream. "
+msgstr ""
+
+#: aplay/aplay.c:1178
+#, c-format
+msgid "suspend: prepare error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1183
+#, c-format
+msgid "Done.\n"
+msgstr ""
+
+#: aplay/aplay.c:1205
+#, c-format
+msgid " !clip "
+msgstr ""
+
+#: aplay/aplay.c:1352
+#, c-format
+msgid "Unsupported bit size %d.\n"
+msgstr ""
+
+#: aplay/aplay.c:1386
+#, c-format
+msgid "Max peak (%li samples): 0x%08x "
+msgstr ""
+
+#: aplay/aplay.c:1442
+#, c-format
+msgid "write error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1487
+#, c-format
+msgid "writev error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1529
+#, c-format
+msgid "read error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1571
+#, c-format
+msgid "readv error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1619
+msgid "can't allocate buffer for silence"
+msgstr ""
+
+#: aplay/aplay.c:1628 aplay/aplay.c:1854 aplay/aplay.c:1859 aplay/aplay.c:1906
+#: aplay/aplay.c:1915 aplay/aplay.c:1922 aplay/aplay.c:1932 aplay/aplay.c:1938
+#: aplay/aplay.c:2010 aplay/aplay.c:2040 aplay/aplay.c:2054
+msgid "write error"
+msgstr ""
+
+#: aplay/aplay.c:1641
+#, c-format
+msgid "voc_pcm_flush - silence error"
+msgstr ""
+
+#: aplay/aplay.c:1644
+msgid "voc_pcm_flush error"
+msgstr ""
+
+#: aplay/aplay.c:1670
+msgid "malloc error"
+msgstr ""
+
+#: aplay/aplay.c:1674
+#, c-format
+msgid "Playing Creative Labs Channel file '%s'...\n"
+msgstr ""
+
+#: aplay/aplay.c:1742 aplay/aplay.c:1834
+msgid "can't play packed .voc files"
+msgstr ""
+
+#: aplay/aplay.c:1794
+#, c-format
+msgid "can't play loops; %s isn't seekable\n"
+msgstr ""
+
+#: aplay/aplay.c:1843
+#, c-format
+msgid "unknown blocktype %d. terminate."
+msgstr ""
+
+#: aplay/aplay.c:1974
+#, c-format
+msgid "Wave doesn't support %s format..."
+msgstr ""
+
+#: aplay/aplay.c:2034
+#, c-format
+msgid "Sparc Audio doesn't support %s format..."
+msgstr ""
+
+#: aplay/aplay.c:2115
+msgid "Playing"
+msgstr ""
+
+#: aplay/aplay.c:2115
+msgid "Recording"
+msgstr ""
+
+#: aplay/aplay.c:2119
+#, c-format
+msgid "Rate %d Hz, "
+msgstr ""
+
+#: aplay/aplay.c:2121
+#, c-format
+msgid "Mono"
+msgstr ""
+
+#: aplay/aplay.c:2123
+#, c-format
+msgid "Stereo"
+msgstr ""
+
+#: aplay/aplay.c:2125
+#, c-format
+msgid "Channels %i"
+msgstr ""
+
+#: aplay/aplay.c:2484 aplay/aplay.c:2537
+#, c-format
+msgid "You need to specify %d files"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:49
+#, c-format
+msgid "aconnect - ALSA sequencer connection manager\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:50
+#, c-format
+msgid "Copyright (C) 1999-2000 Takashi Iwai\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:51
+#, c-format
+msgid "Usage:\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:52
+#, c-format
+msgid " * Connection/disconnection between two ports\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:53
+#, c-format
+msgid " aconnect [-options] sender receiver\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:54
+#, c-format
+msgid " sender, receiver = client:port pair\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:55
+#, c-format
+msgid " -d,--disconnect disconnect\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:56
+#, c-format
+msgid " -e,--exclusive exclusive connection\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:57
+#, c-format
+msgid " -r,--real # convert real-time-stamp on queue\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:58
+#, c-format
+msgid " -t,--tick # convert tick-time-stamp on queue\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:59
+#, c-format
+msgid " * List connected ports (no subscription action)\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:60
+#, c-format
+msgid " aconnect -i|-o [-options]\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:61
+#, c-format
+msgid " -i,--input list input (readable) ports\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:62
+#, c-format
+msgid " -o,--output list output (writable) ports\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:63
+#, c-format
+msgid " -l,--list list current connections of each port\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:64
+#, c-format
+msgid " * Remove all exported connections\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:65
+#, c-format
+msgid " -x, --removeall\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:132
+msgid "Connecting To"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:133
+msgid "Connected From"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:169
+#, c-format
+msgid "client %d: '%s' [type=%s]\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:173
+msgid "user"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:173
+msgid "kernel"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:326
+#, c-format
+msgid "can't open sequencer\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:354
+#, c-format
+msgid "can't get client id\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:361
+#, c-format
+msgid "can't set client info\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:368
+#, c-format
+msgid "invalid sender address %s\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:373 seq/aseqnet/aseqnet.c:290
+#, c-format
+msgid "invalid destination address %s\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:387
+#, c-format
+msgid "No subscription is found\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:392
+#, c-format
+msgid "Disconnection failed (%s)\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:398
+#, c-format
+msgid "Connection is already subscribed\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:403
+#, c-format
+msgid "Connection failed (%s)\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:164
+#, c-format
+msgid "aseqnet - network client/server on ALSA sequencer\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:165
+#, c-format
+msgid " Copyright (C) 1999 Takashi Iwai\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:166
+#, c-format
+msgid "usage:\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:167
+#, c-format
+msgid " server mode: aseqnet [-options]\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:168
+#, c-format
+msgid " client mode: aseqnet [-options] server_host\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:169
+#, c-format
+msgid "options:\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:170
+#, c-format
+msgid " -p,--port # : sepcify TCP port (digit or service name)\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:171
+#, c-format
+msgid " -s,--source addr : read from given addr (client:port)\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:172
+#, c-format
+msgid " -d,--dest addr : write to given addr (client:port)\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:173
+#, c-format
+msgid " -v, --verbose : print verbose messages\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:174
+#, c-format
+msgid " -i, --info : print certain received events\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:188
+#, c-format
+msgid "can't malloc\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:213
+#, c-format
+msgid "closing files..\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:272
+#, c-format
+msgid "sequencer opened: %d:%d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:279
+#, c-format
+msgid "invalid source address %s\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:309
+#, c-format
+msgid "service '%s' is not found in /etc/services\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:377
+#, c-format
+msgid "too many connections!\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:388
+#, c-format
+msgid "accepted[%d]\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:411
+#, c-format
+msgid "can't get address %s\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:422
+#, c-format
+msgid "ok.. connected\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:518
+#, c-format
+msgid "Channel %2d: Control event : %5d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:522
+#, c-format
+msgid "Channel %2d: Pitchbender : %5d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:526
+#, c-format
+msgid "Channel %2d: Note On event : %5d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:530
+#, c-format
+msgid "Channel %2d: Note Off event: %5d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:585
+#, c-format
+msgid "disconnected\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:88
+msgid "Front Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:89
+msgid "Front Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:90
+msgid "Rear Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:91
+msgid "Rear Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:92
+msgid "Center"
+msgstr ""
+
+#: speaker-test/speaker-test.c:93
+msgid "LFE"
+msgstr ""
+
+#: speaker-test/speaker-test.c:94
+msgid "Side Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:95
+msgid "Side Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:96
+msgid "Channel 9"
+msgstr ""
+
+#: speaker-test/speaker-test.c:97
+msgid "Channel 10"
+msgstr ""
+
+#: speaker-test/speaker-test.c:98
+msgid "Channel 11"
+msgstr ""
+
+#: speaker-test/speaker-test.c:99
+msgid "Channel 12"
+msgstr ""
+
+#: speaker-test/speaker-test.c:100
+msgid "Channel 13"
+msgstr ""
+
+#: speaker-test/speaker-test.c:101
+msgid "Channel 14"
+msgstr ""
+
+#: speaker-test/speaker-test.c:102
+msgid "Channel 15"
+msgstr ""
+
+#: speaker-test/speaker-test.c:103
+msgid "Channel 16"
+msgstr ""
+
+#: speaker-test/speaker-test.c:340
+#, c-format
+msgid "Broken configuration for playback: no configurations available: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:347
+#, c-format
+msgid "Access type not available for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:354
+#, c-format
+msgid "Sample format not available for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:361
+#, c-format
+msgid "Channels count (%i) not available for playbacks: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:369
+#, c-format
+msgid "Rate %iHz not available for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:374
+#, c-format
+msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:378
+#, c-format
+msgid "Rate set to %iHz (requested %iHz)\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:384
+#, c-format
+msgid "Buffer size range from %lu to %lu\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:385
+#, c-format
+msgid "Period size range from %lu to %lu\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:387
+#, c-format
+msgid "Requested period time %u us\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:390
+#, c-format
+msgid "Unable to set period time %u us for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:396
+#, c-format
+msgid "Requested buffer time %u us\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:399
+#, c-format
+msgid "Unable to set buffer time %u us for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:408
+#, c-format
+msgid "Using max buffer size %lu\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:411
+#, c-format
+msgid "Unable to set buffer size %lu for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:417
+#, c-format
+msgid "Periods = %u\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:420
+#, c-format
+msgid "Unable to set nperiods %u for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:429
+#, c-format
+msgid "Unable to set hw params for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:435
+#, c-format
+msgid "was set period_size = %lu\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:436
+#, c-format
+msgid "was set buffer_size = %lu\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:438
+#, c-format
+msgid "buffer to small, could not use\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:451
+#, c-format
+msgid "Unable to determine current swparams for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:458
+#, c-format
+msgid "Unable to set start threshold mode for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:465
+#, c-format
+msgid "Unable to set avail min for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:472
+#, c-format
+msgid "Unable to set sw params for playback: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:487
+#, c-format
+msgid "Can't recovery from underrun, prepare failed: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:498
+#, c-format
+msgid "Can't recovery from suspend, prepare failed: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:572 speaker-test/speaker-test.c:969
+#, c-format
+msgid "No enough memory\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:577
+#, c-format
+msgid "Cannot open WAV file %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:581 speaker-test/speaker-test.c:610
+#, c-format
+msgid "Invalid WAV file %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:586
+#, c-format
+msgid "Not a WAV file: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:590
+#, c-format
+msgid "Unsupported WAV format %d for %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:595
+#, c-format
+msgid "%s is not a mono stream (%d channels)\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:600
+#, c-format
+msgid "Sample rate doesn't match (%d) for %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:605
+#, c-format
+msgid "Unsupported sample format bits %d for %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:655
+#, c-format
+msgid "Undefined channel %d\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:706
+#, c-format
+msgid "Write error: %d,%s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:708
+#, c-format
+msgid "xrun_recovery failed: %d,%s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:766
+#, c-format
+msgid ""
+"Usage: speaker-test [OPTION]... \n"
+"-h,--help\thelp\n"
+"-D,--device\tplayback device\n"
+"-r,--rate\tstream rate in Hz\n"
+"-c,--channels\tcount of channels in stream\n"
+"-f,--frequency\tsine wave frequency in Hz\n"
+"-F,--format\tsample format\n"
+"-b,--buffer\tring buffer size in us\n"
+"-p,--period\tperiod size in us\n"
+"-P,--nperiods\tnumber of periods\n"
+"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n"
+"-l,--nloops\tspecify number of loops to test, 0 = infinite\n"
+"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n"
+"-w,--wavfile\tUse the given WAV file as a test sound\n"
+"-W,--wavdir\tSpecify the directory containing WAV files\n"
+"\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:878
+#, c-format
+msgid "Invalid number of periods %d\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:892 speaker-test/speaker-test.c:896
+#, c-format
+msgid "Invalid test type %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:908
+#, c-format
+msgid "Invalid parameter for -s option.\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:919
+#, c-format
+msgid "Unknown option '%c'\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:933
+#, c-format
+msgid "Playback device is %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:934
+#, c-format
+msgid "Stream parameters are %iHz, %s, %i channels\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:937
+#, c-format
+msgid "Using 16 octaves of pink noise\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:940
+#, c-format
+msgid "Sine wave rate is %.4fHz\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:943
+#, c-format
+msgid "WAV file(s)\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:949
+#, c-format
+msgid "Playback open error: %d,%s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:954
+#, c-format
+msgid "Setting of hwparams failed: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:959
+#, c-format
+msgid "Setting of swparams failed: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:1000 speaker-test/speaker-test.c:1022
+#, c-format
+msgid "Transfer failed: %s\n"
+msgstr ""
+
+#: speaker-test/speaker-test.c:1010
+#, c-format
+msgid "Time per period = %lf\n"
+msgstr ""
diff --git a/alsa-utils/po/boldquot.sed b/alsa-utils/po/boldquot.sed
new file mode 100644
index 0000000..4b937aa
--- /dev/null
+++ b/alsa-utils/po/boldquot.sed
@@ -0,0 +1,10 @@
+s/"\([^"]*\)"/“\1â€/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“â€/""/g
+s/“/“/g
+s/â€/â€/g
+s/‘/‘/g
+s/’/’/g
diff --git a/alsa-utils/po/en@boldquot.header b/alsa-utils/po/en@boldquot.header
new file mode 100644
index 0000000..fedb6a0
--- /dev/null
+++ b/alsa-utils/po/en@boldquot.header
@@ -0,0 +1,25 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
+# This catalog furthermore displays the text between the quotation marks in
+# bold face, assuming the VT100/XTerm escape sequences.
+#
diff --git a/alsa-utils/po/en@quot.header b/alsa-utils/po/en@quot.header
new file mode 100644
index 0000000..a9647fc
--- /dev/null
+++ b/alsa-utils/po/en@quot.header
@@ -0,0 +1,22 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
diff --git a/alsa-utils/po/insert-header.sin b/alsa-utils/po/insert-header.sin
new file mode 100644
index 0000000..b26de01
--- /dev/null
+++ b/alsa-utils/po/insert-header.sin
@@ -0,0 +1,23 @@
+# Sed script that inserts the file called HEADER before the header entry.
+#
+# At each occurrence of a line starting with "msgid ", we execute the following
+# commands. At the first occurrence, insert the file. At the following
+# occurrences, do nothing. The distinction between the first and the following
+# occurrences is achieved by looking at the hold space.
+/^msgid /{
+x
+# Test if the hold space is empty.
+s/m/m/
+ta
+# Yes it was empty. First occurrence. Read the file.
+r HEADER
+# Output the file's contents by reading the next line. But don't lose the
+# current line while doing this.
+g
+N
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/alsa-utils/po/ja.po b/alsa-utils/po/ja.po
new file mode 100644
index 0000000..4607a4c
--- /dev/null
+++ b/alsa-utils/po/ja.po
@@ -0,0 +1,1177 @@
+# Japanese translations for alsa-utils package
+# alsa-utils パッケージã«å¯¾ã™ã‚‹è‹±è¨³.
+# Copyright (C) 2005 Free Software Foundation, Inc.
+# This file is distributed under the same license as the alsa-utils package.
+# Takashi Iwai <tiwai@suse.de>, 2005.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: alsa-utils 1.0.9a\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-01-19 12:24+0100\n"
+"PO-Revision-Date: 2006-04-18 15:51+0200\n"
+"Last-Translator: Takashi Iwai <tiwai@suse.de>\n"
+"Language-Team: Japanese\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+#: aplay/aplay.c:136
+msgid "raw data"
+msgstr "raw データ"
+
+#: aplay/aplay.c:137
+msgid "VOC"
+msgstr "VOC"
+
+#: aplay/aplay.c:139
+msgid "WAVE"
+msgstr "WAVE"
+
+#: aplay/aplay.c:140
+msgid "Sparc Audio"
+msgstr "Sparc オーディオ"
+
+#: aplay/aplay.c:161
+#, fuzzy, c-format
+msgid ""
+"Usage: %s [OPTION]... [FILE]...\n"
+"\n"
+"-h, --help help\n"
+" --version print current version\n"
+"-l, --list-devices list all soundcards and digital audio devices\n"
+"-L, --list-pcms list device names\n"
+"-D, --device=NAME select PCM by name\n"
+"-q, --quiet quiet mode\n"
+"-t, --file-type TYPE file type (voc, wav, raw or au)\n"
+"-c, --channels=# channels\n"
+"-f, --format=FORMAT sample format (case insensitive)\n"
+"-r, --rate=# sample rate\n"
+"-d, --duration=# interrupt after # seconds\n"
+"-M, --mmap mmap stream\n"
+"-N, --nonblock nonblocking mode\n"
+"-F, --period-time=# distance between interrupts is # microseconds\n"
+"-B, --buffer-time=# buffer duration is # microseconds\n"
+" --period-size=# distance between interrupts is # frames\n"
+" --buffer-size=# buffer duration is # frames\n"
+"-A, --avail-min=# min available space for wakeup is # microseconds\n"
+"-R, --start-delay=# delay for automatic PCM start is # microseconds \n"
+" (relative to buffer size if <= 0)\n"
+"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from "
+"xrun\n"
+"-v, --verbose show PCM structure and setup (accumulative)\n"
+"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n"
+"-I, --separate-channels one file for each channel\n"
+" --disable-resample disable automatic rate resample\n"
+" --disable-channels disable automatic channel conversions\n"
+" --disable-format disable automatic format conversions\n"
+" --disable-softvol disable software volume control (softvol)\n"
+" --test-position test ring buffer position\n"
+msgstr ""
+"使用法: %s [オプション]... [ファイル]...\n"
+"\n"
+"-h, --help ヘルプ\n"
+" --version ç¾åœ¨ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示\n"
+"-l, --list-devices å…¨ã¦ã®ã‚µã‚¦ãƒ³ãƒ‰ã‚«ãƒ¼ãƒ‰ã¨ã‚ªãƒ¼ãƒ‡ã‚£ã‚ªãƒ‡ãƒã‚¤ã‚¹ã‚’表示\n"
+"-L, --list-pcms å…¨ã¦ã®å®šç¾©ã•れ㟠PCM を表示\n"
+"-D, --device=NAME 使用ã™ã‚‹ PCM を指定\n"
+"-q, --quiet quiet モード\n"
+"-t, --file-type TYPE ファイルタイプ (voc, wav, raw ã¾ãŸã¯ au)\n"
+"-c, --channels=# ãƒãƒ£ãƒãƒ«æ•°\n"
+"-f, --format=FORMAT サンプルフォーマット (大ï¼å°æ–‡å­—区別)\n"
+"-r, --rate=# サンプルレート\n"
+"-d, --duration=# 指定ã®ç§’数後ã«çµ‚了\n"
+"-s, --sleep-min=# sleep ã™ã‚‹æœ€å°‘ tick æ•°\n"
+"-M, --mmap mmap ストリーム\n"
+"-N, --nonblock éžãƒ–ロックモード\n"
+"-F, --period-time=# 割り込ã¿é–“éš”ã‚’Î¼ç§’ã§æŒ‡å®š\n"
+"-B, --buffer-time=# ãƒãƒƒãƒ•ã‚¡ã®å¤§ãã•ã‚’Î¼ç§’ã§æŒ‡å®š\n"
+" --period-size=# 割り込ã¿é–“éš”ã‚’ãƒ•ãƒ¬ãƒ¼ãƒ æ•°ã§æŒ‡å®š\n"
+" --buffer-size=# ãƒãƒƒãƒ•ã‚¡ã®å¤§ãã•ã‚’ãƒ•ãƒ¬ãƒ¼ãƒ æ•°ã§æŒ‡å®š\n"
+"-A, --avail-min=# wakeup ã®æœ€å°‘ã‚¹ãƒšãƒ¼ã‚¹ã‚’Î¼ç§’ã§æŒ‡å®š\n"
+"-R, --start-delay=# 指定ã®Î¼ç§’後㫠PCM を自動スタート\n"
+" (0 以下ã®å ´åˆã¯ãƒãƒƒãƒ•ァサイズより)\n"
+"-T, --stop-delay=# XRUN ã‹ã‚‰æŒ‡å®šã®Î¼ç§’後㫠PCM ã®è‡ªå‹•åœæ­¢\n"
+"-v, --verbose PCM ã®è¨­å®šã‚’表示 (複数指定å¯èƒ½)\n"
+"-I, --separate-channels å„ãƒãƒ£ãƒãƒ«ã«ä¸€ã¤ã®ãƒ•ァイルを用ã„ã‚‹\n"
+
+#: aplay/aplay.c:193 speaker-test/speaker-test.c:783
+#, c-format
+msgid "Recognized sample formats are:"
+msgstr "èªè­˜ã•れるサンプルフォーマット:"
+
+#: aplay/aplay.c:199
+#, c-format
+msgid ""
+"\n"
+"Some of these may not be available on selected hardware\n"
+msgstr ""
+"\n"
+"ã“れらã®ã„ãã¤ã‹ã¯æŒ‡å®šã®ãƒãƒ¼ãƒ‰ã‚¦ã‚§ã‚¢ã§ä½¿ç”¨ä¸å¯èƒ½ãªå ´åˆãŒã‚りã¾ã™\n"
+
+#: aplay/aplay.c:200
+#, c-format
+msgid "The availabled format shortcuts are:\n"
+msgstr "å¯èƒ½ãªãƒ•ォーマットã®çœç•¥å½¢:\n"
+
+#: aplay/aplay.c:201
+#, c-format
+msgid "-f cd (16 bit little endian, 44100, stereo)\n"
+msgstr "-f cd (16 ビットã€ãƒªãƒˆãƒ«ã‚¨ãƒ³ãƒ‡ã‚£ã‚¢ãƒ³ã€44100ã€ã‚¹ãƒ†ãƒ¬ã‚ª)\n"
+
+#: aplay/aplay.c:202
+#, c-format
+msgid "-f cdr (16 bit big endian, 44100, stereo)\n"
+msgstr "-f cdr (16 ビットã€ãƒ“ッグエンディアンã€44100ã€ã‚¹ãƒ†ãƒ¬ã‚ª)\n"
+
+#: aplay/aplay.c:203
+#, c-format
+msgid "-f dat (16 bit little endian, 48000, stereo)\n"
+msgstr "-f dat (16 ビットã€ãƒªãƒˆãƒ«ã‚¨ãƒ³ãƒ‡ã‚£ã‚¢ãƒ³ã€48000ã€ã‚¹ãƒ†ãƒ¬ã‚ª)\n"
+
+#: aplay/aplay.c:217
+msgid "no soundcards found..."
+msgstr "サウンドカードãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“..."
+
+#: aplay/aplay.c:220
+#, c-format
+msgid "**** List of %s Hardware Devices ****\n"
+msgstr "**** ãƒãƒ¼ãƒ‰ã‚¦ã‚§ã‚¢ãƒ‡ãƒã‚¤ã‚¹ %s ã®ãƒªã‚¹ãƒˆ ****\n"
+
+#: aplay/aplay.c:249
+#, c-format
+msgid "card %i: %s [%s], device %i: %s [%s]\n"
+msgstr "カード %i: %s [%s], デãƒã‚¤ã‚¹ %i: %s [%s]\n"
+
+#: aplay/aplay.c:255
+#, c-format
+msgid " Subdevices: %i/%i\n"
+msgstr " サブデãƒã‚¤ã‚¹: %i/%i\n"
+
+#: aplay/aplay.c:262
+#, c-format
+msgid " Subdevice #%i: %s\n"
+msgstr " サブデãƒã‚¤ã‚¹ #%i: %s\n"
+
+#: aplay/aplay.c:326
+#, c-format
+msgid "Aborted by signal %s...\n"
+msgstr "シグナル %s ã§ä¸­æ–­...\n"
+
+#: aplay/aplay.c:420
+msgid "command should be named either arecord or aplay"
+msgstr "arecord ã¾ãŸã¯ aplay コマンドã®ã¿å¯èƒ½"
+
+#: aplay/aplay.c:459
+#, c-format
+msgid "unrecognized file format %s"
+msgstr "䏿­£ãªãƒ•ァイルフォーマット %s"
+
+#: aplay/aplay.c:466
+#, c-format
+msgid "value %i for channels is invalid"
+msgstr "䏿­£ãªãƒãƒ£ãƒãƒ«æ•° %i"
+
+#: aplay/aplay.c:485
+#, c-format
+msgid "wrong extended format '%s'"
+msgstr "䏿­£ãªæ‹¡å¼µãƒ•ォーマット '%s'"
+
+#: aplay/aplay.c:496
+#, c-format
+msgid "bad speed value %i"
+msgstr "䏿­£ãªãƒ¬ãƒ¼ãƒˆå€¤ %i"
+
+#: aplay/aplay.c:574
+#, c-format
+msgid "Try `%s --help' for more information.\n"
+msgstr "より詳ã—ã„æƒ…å ±ã¯ã€Œ%s --helpã€ã‚’実行ã—ã¦ãã ã•ã„\n"
+
+#: aplay/aplay.c:590
+#, c-format
+msgid "audio open error: %s"
+msgstr ""
+
+#: aplay/aplay.c:595
+#, c-format
+msgid "info error: %s"
+msgstr ""
+
+#: aplay/aplay.c:602
+#, c-format
+msgid "nonblock setting error: %s"
+msgstr ""
+
+#: aplay/aplay.c:612 aplay/aplay.c:719 aplay/aplay.c:1073
+msgid "not enough memory"
+msgstr "メモリãŒè¶³ã‚Šã¾ã›ã‚“"
+
+#: aplay/aplay.c:709
+#, c-format
+msgid "read error (called from line %i)"
+msgstr "リードエラー (%i 行)"
+
+#: aplay/aplay.c:767
+#, c-format
+msgid "unknown length of 'fmt ' chunk (read %u, should be %u at least)"
+msgstr ""
+
+#: aplay/aplay.c:777
+#, c-format
+msgid ""
+"unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"
+msgstr ""
+
+#: aplay/aplay.c:782
+msgid "wrong format tag in extensible 'fmt ' chunk"
+msgstr ""
+
+#: aplay/aplay.c:789
+#, c-format
+msgid "can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"
+msgstr ""
+
+#: aplay/aplay.c:793
+#, c-format
+msgid "can't play WAVE-files with %d tracks"
+msgstr "%d トラックをå«ã‚€ WAVE ファイルã¯å†ç”Ÿã§ãã¾ã›ã‚“"
+
+#: aplay/aplay.c:801 aplay/aplay.c:901
+#, c-format
+msgid "Warning: format is changed to U8\n"
+msgstr "警告: フォーマット㯠U8 ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:807
+#, c-format
+msgid "Warning: format is changed to S16_LE\n"
+msgstr "警告: フォーマット㯠S16_LE ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:815
+#, c-format
+msgid "Warning: format is changed to S24_3LE\n"
+msgstr "警告: フォーマット㯠S24_3LE ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:821
+#, c-format
+msgid "Warning: format is changed to S24_LE\n"
+msgstr "警告: フォーマット㯠S24_LE ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:825
+#, c-format
+msgid ""
+" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"
+msgstr ""
+"%2$d ãƒã‚¤ãƒˆé•· %1$d サンプルビット (%3$d ãƒãƒ£ãƒãƒ«) ã® WAVE ファイルã¯å†ç”Ÿã§ã"
+"ã¾ã›ã‚“"
+
+#: aplay/aplay.c:837
+#, c-format
+msgid " can't play WAVE-files with sample %d bits wide"
+msgstr "%d ビット長ã®ã‚µãƒ³ãƒ—ル㮠WAVE ファイルã¯å†ç”Ÿã§ãã¾ã›ã‚“"
+
+#: aplay/aplay.c:895
+#, c-format
+msgid "Warning: format is changed to MU_LAW\n"
+msgstr "警告: フォーマット㯠MU_LAW ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:907
+#, c-format
+msgid "Warning: format is changed to S16_BE\n"
+msgstr "警告: フォーマット㯠S16_BE ã«å¤‰æ›´ã•れã¾ã™\n"
+
+#: aplay/aplay.c:920 aplay/aplay.c:1679 aplay/aplay.c:1686 aplay/aplay.c:2208
+#: aplay/aplay.c:2220
+msgid "read error"
+msgstr "リードエラー"
+
+#: aplay/aplay.c:939
+msgid "Broken configuration for this PCM: no configurations available"
+msgstr "指定㮠PCM を使用ã§ãã¾ã›ã‚“: 設定ãŒã‚りã¾ã›ã‚“"
+
+#: aplay/aplay.c:956
+msgid "Access type not available"
+msgstr "アクセスタイプãŒä½¿ç”¨ä¸å¯èƒ½"
+
+#: aplay/aplay.c:961
+msgid "Sample format non available"
+msgstr "サンプルフォーマットãŒä½¿ç”¨ä¸å¯èƒ½"
+
+#: aplay/aplay.c:966
+msgid "Channels count non available"
+msgstr "ãƒãƒ£ãƒãƒ«æ•°ãŒä½¿ç”¨ä¸å¯èƒ½"
+
+#: aplay/aplay.c:981
+#, c-format
+msgid "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"
+msgstr "警告: レートãŒä¸æ­£ç¢ºã§ã™ (è¦æ±‚値 = %iHz, 使用値 = %iHz)\n"
+
+#: aplay/aplay.c:987
+#, c-format
+msgid " please, try the plug plugin %s\n"
+msgstr " plug プラグイン%s を使用ã—ã¦ãã ã•ã„\n"
+
+#: aplay/aplay.c:1022
+msgid "Unable to install hw params:"
+msgstr "hw params ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã«å¤±æ•—ã—ã¾ã—ãŸ:"
+
+#: aplay/aplay.c:1029
+#, c-format
+msgid "Can't use period equal to buffer size (%lu == %lu)"
+msgstr "period 㨠buffer サイズã«ã¯åŒã˜å€¤ã‚’使用ã§ãã¾ã›ã‚“ (%lu == %lu)"
+
+#: aplay/aplay.c:1060
+msgid "unable to install sw params:"
+msgstr "sw params ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã«å¤±æ•—ã—ã¾ã—ãŸ:"
+
+#: aplay/aplay.c:1123
+#, c-format
+msgid "status error: %s"
+msgstr "ステータスエラー: %s"
+
+#: aplay/aplay.c:1131
+#, c-format
+msgid "%s!!! (at least %.3f ms long)\n"
+msgstr "%s!!! (å°‘ãªãã¨ã‚‚ %.3f ms)\n"
+
+#: aplay/aplay.c:1132
+msgid "underrun"
+msgstr "アンダーラン"
+
+#: aplay/aplay.c:1132
+msgid "overrun"
+msgstr "オーãƒãƒ¼ãƒ©ãƒ³"
+
+#: aplay/aplay.c:1135
+#, c-format
+msgid "Status:\n"
+msgstr "ステータス:\n"
+
+#: aplay/aplay.c:1139
+#, c-format
+msgid "xrun: prepare error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1145
+#, c-format
+msgid "Status(DRAINING):\n"
+msgstr "ステータス(DRAINING):\n"
+
+#: aplay/aplay.c:1149
+#, c-format
+msgid "capture stream format change? attempting recover...\n"
+msgstr "録音ストリームã®ãƒ•ォーマットãŒå¤‰æ›´ï¼Ÿ 修復を試ã¿ã¾ã™...\n"
+
+#: aplay/aplay.c:1151
+#, c-format
+msgid "xrun(DRAINING): prepare error: %s"
+msgstr ""
+
+#: aplay/aplay.c:1158
+#, c-format
+msgid "Status(R/W):\n"
+msgstr "ステータス(R/W):\n"
+
+#: aplay/aplay.c:1161
+#, c-format
+msgid "read/write error, state = %s"
+msgstr "èª­ã¿æ›¸ãエラー, ステータス = %s"
+
+#: aplay/aplay.c:1171
+#, c-format
+msgid "Suspended. Trying resume. "
+msgstr "サスペンド中ã§ã™ã€‚レジュームã—ã¾ã™ã€‚"
+
+#: aplay/aplay.c:1176
+#, c-format
+msgid "Failed. Restarting stream. "
+msgstr "失敗ã—ã¾ã—ãŸã€‚ストリームをå†ã‚¹ã‚¿ãƒ¼ãƒˆã—ã¾ã™ã€‚"
+
+#: aplay/aplay.c:1178
+#, c-format
+msgid "suspend: prepare error: %s"
+msgstr "サスペンド: prepare エラー: %s"
+
+#: aplay/aplay.c:1183
+#, c-format
+msgid "Done.\n"
+msgstr "終了\n"
+
+#: aplay/aplay.c:1205
+#, c-format
+msgid " !clip "
+msgstr ""
+
+#: aplay/aplay.c:1352
+#, c-format
+msgid "Unsupported bit size %d.\n"
+msgstr ""
+
+#: aplay/aplay.c:1386
+#, c-format
+msgid "Max peak (%li samples): 0x%08x "
+msgstr "最大ピーク (%li サンプル): 0x%08x "
+
+#: aplay/aplay.c:1442
+#, c-format
+msgid "write error: %s"
+msgstr "書込エラー: %s"
+
+#: aplay/aplay.c:1487
+#, c-format
+msgid "writev error: %s"
+msgstr "書込(writev)エラー: %s"
+
+#: aplay/aplay.c:1529
+#, c-format
+msgid "read error: %s"
+msgstr "読込エラー: %s"
+
+#: aplay/aplay.c:1571
+#, c-format
+msgid "readv error: %s"
+msgstr "読込(readv)エラー: %s"
+
+#: aplay/aplay.c:1619
+msgid "can't allocate buffer for silence"
+msgstr "サイレンス用ã®ãƒãƒƒãƒ•ã‚¡ã®å–å¾—ã«å¤±æ•—ã—ã¾ã—ãŸ"
+
+#: aplay/aplay.c:1628 aplay/aplay.c:1854 aplay/aplay.c:1859 aplay/aplay.c:1906
+#: aplay/aplay.c:1915 aplay/aplay.c:1922 aplay/aplay.c:1932 aplay/aplay.c:1938
+#: aplay/aplay.c:2010 aplay/aplay.c:2040 aplay/aplay.c:2054
+msgid "write error"
+msgstr "書込エラー"
+
+#: aplay/aplay.c:1641
+#, c-format
+msgid "voc_pcm_flush - silence error"
+msgstr ""
+
+#: aplay/aplay.c:1644
+msgid "voc_pcm_flush error"
+msgstr ""
+
+#: aplay/aplay.c:1670
+msgid "malloc error"
+msgstr "malloc エラー"
+
+#: aplay/aplay.c:1674
+#, c-format
+msgid "Playing Creative Labs Channel file '%s'...\n"
+msgstr "Creative Labs Channel ファイル '%s' ã‚’æ¼”å¥ä¸­...\n"
+
+#: aplay/aplay.c:1742 aplay/aplay.c:1834
+msgid "can't play packed .voc files"
+msgstr "packed .voc ãƒ•ã‚¡ã‚¤ãƒ«ã¯æ¼”å¥ã§ãã¾ã›ã‚“"
+
+#: aplay/aplay.c:1794
+#, c-format
+msgid "can't play loops; %s isn't seekable\n"
+msgstr "ループ演å¥ã§ãã¾ã›ã‚“。%s ã¯ã‚·ãƒ¼ã‚¯ä¸å¯èƒ½ã§ã™\n"
+
+#: aplay/aplay.c:1843
+#, c-format
+msgid "unknown blocktype %d. terminate."
+msgstr "未知ã®ãƒ–ロックタイプ %d: 終了ã—ã¾ã™ã€‚"
+
+#: aplay/aplay.c:1974
+#, c-format
+msgid "Wave doesn't support %s format..."
+msgstr "WAVE 㯠%s フォーマットをサãƒãƒ¼ãƒˆã—ã¾ã›ã‚“..."
+
+#: aplay/aplay.c:2034
+#, c-format
+msgid "Sparc Audio doesn't support %s format..."
+msgstr "Sparc オーディオ㯠%s フォーマットをサãƒãƒ¼ãƒˆã—ã¾ã›ã‚“..."
+
+#: aplay/aplay.c:2115
+msgid "Playing"
+msgstr "å†ç”Ÿä¸­"
+
+#: aplay/aplay.c:2115
+msgid "Recording"
+msgstr "録音中"
+
+#: aplay/aplay.c:2119
+#, c-format
+msgid "Rate %d Hz, "
+msgstr "レート %d Hz, "
+
+#: aplay/aplay.c:2121
+#, c-format
+msgid "Mono"
+msgstr "モノラル"
+
+#: aplay/aplay.c:2123
+#, c-format
+msgid "Stereo"
+msgstr "ステレオ"
+
+#: aplay/aplay.c:2125
+#, c-format
+msgid "Channels %i"
+msgstr "ãƒãƒ£ãƒãƒ«æ•° %i"
+
+#: aplay/aplay.c:2484 aplay/aplay.c:2537
+#, c-format
+msgid "You need to specify %d files"
+msgstr "%d 個ã®ãƒ•ァイルを指定ã—ã¦ãã ã•ã„"
+
+#: seq/aconnect/aconnect.c:49
+#, c-format
+msgid "aconnect - ALSA sequencer connection manager\n"
+msgstr "aconnect - ALSA sequencer 接続マãƒãƒ¼ã‚¸ãƒ£\n"
+
+#: seq/aconnect/aconnect.c:50
+#, c-format
+msgid "Copyright (C) 1999-2000 Takashi Iwai\n"
+msgstr ""
+
+#: seq/aconnect/aconnect.c:51
+#, c-format
+msgid "Usage:\n"
+msgstr "使用法:\n"
+
+#: seq/aconnect/aconnect.c:52
+#, c-format
+msgid " * Connection/disconnection between two ports\n"
+msgstr " * 二ã¤ã®ãƒãƒ¼ãƒˆã®æŽ¥ç¶šï¼åˆ‡ã‚Šé›¢ã—\n"
+
+#: seq/aconnect/aconnect.c:53
+#, c-format
+msgid " aconnect [-options] sender receiver\n"
+msgstr " aconnect [-オプション] é€ä¿¡ å—ä¿¡\n"
+
+#: seq/aconnect/aconnect.c:54
+#, c-format
+msgid " sender, receiver = client:port pair\n"
+msgstr " é€ä¿¡, å—ä¿¡ = クライアント:ãƒãƒ¼ãƒˆã®çµ„\n"
+
+#: seq/aconnect/aconnect.c:55
+#, c-format
+msgid " -d,--disconnect disconnect\n"
+msgstr " -d,--disconnect 切り離ã—\n"
+
+#: seq/aconnect/aconnect.c:56
+#, c-format
+msgid " -e,--exclusive exclusive connection\n"
+msgstr " -e,--exclusive 排他接続\n"
+
+#: seq/aconnect/aconnect.c:57
+#, c-format
+msgid " -r,--real # convert real-time-stamp on queue\n"
+msgstr " -r,--real # キューã®ãƒªã‚¢ãƒ«ã‚¿ã‚¤ãƒ ã‚¹ã‚¿ãƒ³ãƒ—ã«å¤‰æ›\n"
+
+#: seq/aconnect/aconnect.c:58
+#, c-format
+msgid " -t,--tick # convert tick-time-stamp on queue\n"
+msgstr " -t,--tick # キューã®ãƒ†ã‚£ãƒƒã‚¯ã‚¿ã‚¤ãƒ ã‚¹ã‚¿ãƒ³ãƒ—ã«å¤‰æ›\n"
+
+#: seq/aconnect/aconnect.c:59
+#, c-format
+msgid " * List connected ports (no subscription action)\n"
+msgstr " * 接続済ã¿ã®ãƒãƒ¼ãƒˆã®ä¸€è¦§\n"
+
+#: seq/aconnect/aconnect.c:60
+#, c-format
+msgid " aconnect -i|-o [-options]\n"
+msgstr " aconnect -i|-o [-オプション]\n"
+
+#: seq/aconnect/aconnect.c:61
+#, c-format
+msgid " -i,--input list input (readable) ports\n"
+msgstr " -i,--input 入力 (読込) ãƒãƒ¼ãƒˆã®ä¸€è¦§\n"
+
+#: seq/aconnect/aconnect.c:62
+#, c-format
+msgid " -o,--output list output (writable) ports\n"
+msgstr " -o,--output 主力 (書込) ãƒãƒ¼ãƒˆã®ä¸€è¦§\n"
+
+#: seq/aconnect/aconnect.c:63
+#, c-format
+msgid " -l,--list list current connections of each port\n"
+msgstr " -l,--list å„ãƒãƒ¼ãƒˆã®ç¾åœ¨ã®æŽ¥ç¶šã‚’表示\n"
+
+#: seq/aconnect/aconnect.c:64
+#, c-format
+msgid " * Remove all exported connections\n"
+msgstr " * å…¨ã¦ã®ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã•ã‚ŒãŸæŽ¥ç¶šã‚’åˆ‡ã‚Šé›¢ã™\n"
+
+#: seq/aconnect/aconnect.c:65
+#, c-format
+msgid " -x, --removeall\n"
+msgstr " -x, --removall\n"
+
+#: seq/aconnect/aconnect.c:132
+msgid "Connecting To"
+msgstr "接続先"
+
+#: seq/aconnect/aconnect.c:133
+msgid "Connected From"
+msgstr "接続元"
+
+#: seq/aconnect/aconnect.c:169
+#, c-format
+msgid "client %d: '%s' [type=%s]\n"
+msgstr "クライアント %d: '%s' [タイプ=%s]\n"
+
+#: seq/aconnect/aconnect.c:173
+msgid "user"
+msgstr "ユーザ"
+
+#: seq/aconnect/aconnect.c:173
+msgid "kernel"
+msgstr "カーãƒãƒ«"
+
+#: seq/aconnect/aconnect.c:326
+#, c-format
+msgid "can't open sequencer\n"
+msgstr "sequencer をオープンã§ãã¾ã›ã‚“\n"
+
+#: seq/aconnect/aconnect.c:354
+#, c-format
+msgid "can't get client id\n"
+msgstr "クライアント ID ã‚’å–å¾—ã§ãã¾ã›ã‚“\n"
+
+#: seq/aconnect/aconnect.c:361
+#, c-format
+msgid "can't set client info\n"
+msgstr "クライアント情報をå–å¾—ã§ãã¾ã›ã‚“\n"
+
+#: seq/aconnect/aconnect.c:368
+#, c-format
+msgid "invalid sender address %s\n"
+msgstr "é€ä¿¡ã‚¢ãƒ‰ãƒ¬ã‚¹ãŒä¸æ­£ã§ã™: %s\n"
+
+#: seq/aconnect/aconnect.c:373 seq/aseqnet/aseqnet.c:290
+#, c-format
+msgid "invalid destination address %s\n"
+msgstr "å—信アドレスãŒä¸æ­£ã§ã™: %s\n"
+
+#: seq/aconnect/aconnect.c:387
+#, c-format
+msgid "No subscription is found\n"
+msgstr "接続ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“\n"
+
+#: seq/aconnect/aconnect.c:392
+#, c-format
+msgid "Disconnection failed (%s)\n"
+msgstr "切り離ã—ã«å¤±æ•— (%s)\n"
+
+#: seq/aconnect/aconnect.c:398
+#, c-format
+msgid "Connection is already subscribed\n"
+msgstr "æ—¢ã«æŽ¥ç¶šã•れã¦ã„ã¾ã™\n"
+
+#: seq/aconnect/aconnect.c:403
+#, c-format
+msgid "Connection failed (%s)\n"
+msgstr "接続ã«å¤±æ•— (%s)\n"
+
+#: seq/aseqnet/aseqnet.c:164
+#, c-format
+msgid "aseqnet - network client/server on ALSA sequencer\n"
+msgstr "aseqnet - ALSA sequencer 上ã®ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆï¼ã‚µãƒ¼ãƒ\n"
+
+#: seq/aseqnet/aseqnet.c:165
+#, c-format
+msgid " Copyright (C) 1999 Takashi Iwai\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:166
+#, c-format
+msgid "usage:\n"
+msgstr "使用法:\n"
+
+#: seq/aseqnet/aseqnet.c:167
+#, c-format
+msgid " server mode: aseqnet [-options]\n"
+msgstr " サーãƒãƒ¢ãƒ¼ãƒ‰: aseqnet [-オプション]\n"
+
+#: seq/aseqnet/aseqnet.c:168
+#, c-format
+msgid " client mode: aseqnet [-options] server_host\n"
+msgstr " クライアントモード: aseqnet [-オプション] サーãƒãƒ›ã‚¹ãƒˆ\n"
+
+#: seq/aseqnet/aseqnet.c:169
+#, c-format
+msgid "options:\n"
+msgstr "オプション:\n"
+
+#: seq/aseqnet/aseqnet.c:170
+#, c-format
+msgid " -p,--port # : sepcify TCP port (digit or service name)\n"
+msgstr " -p,--port # : TCP ãƒãƒ¼ãƒˆã®æŒ‡å®š (æ•°å­—ã¾ãŸã¯ã‚µãƒ¼ãƒ“スå)\n"
+
+#: seq/aseqnet/aseqnet.c:171
+#, c-format
+msgid " -s,--source addr : read from given addr (client:port)\n"
+msgstr " -s,--source addr : 指定ã®ã‚¢ãƒ‰ãƒ¬ã‚¹(クライアント:ãƒãƒ¼ãƒˆ)ã‹ã‚‰èª­ã¿è¾¼ã‚€\n"
+
+#: seq/aseqnet/aseqnet.c:172
+#, c-format
+msgid " -d,--dest addr : write to given addr (client:port)\n"
+msgstr " -d,--dest addr : 指定ã®ã‚¢ãƒ‰ãƒ¬ã‚¹(クライアント:ãƒãƒ¼ãƒˆ)ã«æ›¸ã込む\n"
+
+#: seq/aseqnet/aseqnet.c:173
+#, c-format
+msgid " -v, --verbose : print verbose messages\n"
+msgstr " -v,--verbose : 冗長メッセージ表示\n"
+
+#: seq/aseqnet/aseqnet.c:174
+#, c-format
+msgid " -i, --info : print certain received events\n"
+msgstr " -i,--info : å—信イベントを表示ã™ã‚‹\n"
+
+#: seq/aseqnet/aseqnet.c:188
+#, c-format
+msgid "can't malloc\n"
+msgstr "malloc ã§ãã¾ã›ã‚“\n"
+
+#: seq/aseqnet/aseqnet.c:213
+#, c-format
+msgid "closing files..\n"
+msgstr "ファイルを閉ã˜ã¾ã™..\n"
+
+#: seq/aseqnet/aseqnet.c:272
+#, c-format
+msgid "sequencer opened: %d:%d\n"
+msgstr ""
+
+#: seq/aseqnet/aseqnet.c:279
+#, c-format
+msgid "invalid source address %s\n"
+msgstr "䏿­£ãªé€ä¿¡ã‚¢ãƒ‰ãƒ¬ã‚¹ %s\n"
+
+#: seq/aseqnet/aseqnet.c:309
+#, c-format
+msgid "service '%s' is not found in /etc/services\n"
+msgstr "サービス '%s' ㌠/etc/services ã«è¦‹ã¤ã‹ã‚Šã¾ã›ã‚“\n"
+
+#: seq/aseqnet/aseqnet.c:377
+#, c-format
+msgid "too many connections!\n"
+msgstr "接続ãŒå¤šã™ãŽã¾ã™!\n"
+
+#: seq/aseqnet/aseqnet.c:388
+#, c-format
+msgid "accepted[%d]\n"
+msgstr "了解[%d]\n"
+
+#: seq/aseqnet/aseqnet.c:411
+#, c-format
+msgid "can't get address %s\n"
+msgstr "アドレス %s ã‚’å–å¾—ã§ãã¾ã›ã‚“\n"
+
+#: seq/aseqnet/aseqnet.c:422
+#, c-format
+msgid "ok.. connected\n"
+msgstr "ok.. 接続\n"
+
+#: seq/aseqnet/aseqnet.c:518
+#, c-format
+msgid "Channel %2d: Control event : %5d\n"
+msgstr "ãƒãƒ£ãƒãƒ« %2d: コントロール : %5d\n"
+
+#: seq/aseqnet/aseqnet.c:522
+#, c-format
+msgid "Channel %2d: Pitchbender : %5d\n"
+msgstr "ãƒãƒ£ãƒãƒ« %2d: ピッãƒãƒ™ãƒ³ãƒ‰ : %5d\n"
+
+#: seq/aseqnet/aseqnet.c:526
+#, c-format
+msgid "Channel %2d: Note On event : %5d\n"
+msgstr "ãƒãƒ£ãƒãƒ« %2d: ノートオン : %5d\n"
+
+#: seq/aseqnet/aseqnet.c:530
+#, c-format
+msgid "Channel %2d: Note Off event: %5d\n"
+msgstr "ãƒãƒ£ãƒãƒ« %2d: ノートオフ : %5d\n"
+
+#: seq/aseqnet/aseqnet.c:585
+#, c-format
+msgid "disconnected\n"
+msgstr "切り離ã—\n"
+
+#: speaker-test/speaker-test.c:88
+msgid "Front Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:89
+msgid "Front Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:90
+msgid "Rear Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:91
+msgid "Rear Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:92
+msgid "Center"
+msgstr ""
+
+#: speaker-test/speaker-test.c:93
+msgid "LFE"
+msgstr ""
+
+#: speaker-test/speaker-test.c:94
+msgid "Side Left"
+msgstr ""
+
+#: speaker-test/speaker-test.c:95
+msgid "Side Right"
+msgstr ""
+
+#: speaker-test/speaker-test.c:96
+msgid "Channel 9"
+msgstr ""
+
+#: speaker-test/speaker-test.c:97
+msgid "Channel 10"
+msgstr ""
+
+#: speaker-test/speaker-test.c:98
+msgid "Channel 11"
+msgstr ""
+
+#: speaker-test/speaker-test.c:99
+msgid "Channel 12"
+msgstr ""
+
+#: speaker-test/speaker-test.c:100
+msgid "Channel 13"
+msgstr ""
+
+#: speaker-test/speaker-test.c:101
+msgid "Channel 14"
+msgstr ""
+
+#: speaker-test/speaker-test.c:102
+msgid "Channel 15"
+msgstr ""
+
+#: speaker-test/speaker-test.c:103
+msgid "Channel 16"
+msgstr ""
+
+#: speaker-test/speaker-test.c:340
+#, c-format
+msgid "Broken configuration for playback: no configurations available: %s\n"
+msgstr "å†ç”Ÿç”¨ã«è¨­å®šã§ãã¾ã›ã‚“: 設定ãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:347
+#, c-format
+msgid "Access type not available for playback: %s\n"
+msgstr "アクセスタイプãŒä¸æ­£ã§ã™: %s\n"
+
+#: speaker-test/speaker-test.c:354
+#, c-format
+msgid "Sample format not available for playback: %s\n"
+msgstr "指定ã®ã‚µãƒ³ãƒ—ルフォーマットを使用ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:361
+#, c-format
+msgid "Channels count (%i) not available for playbacks: %s\n"
+msgstr "ãƒãƒ£ãƒãƒ«æ•° (%i) を使用ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:369
+#, c-format
+msgid "Rate %iHz not available for playback: %s\n"
+msgstr "レート %iHz を使用ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:374
+#, c-format
+msgid "Rate doesn't match (requested %iHz, get %iHz, err %d)\n"
+msgstr "設定レートãŒä¸€è‡´ã—ã¾ã›ã‚“< (è¦æ±‚値 %iHz, å–得値 %iHz, エラー %d)\n"
+
+#: speaker-test/speaker-test.c:378
+#, c-format
+msgid "Rate set to %iHz (requested %iHz)\n"
+msgstr "レート %iHz (è¦æ±‚値 %iHz)\n"
+
+#: speaker-test/speaker-test.c:384
+#, c-format
+msgid "Buffer size range from %lu to %lu\n"
+msgstr "ãƒãƒƒãƒ•ァサイズ範囲 %lu 〜 %lu\n"
+
+#: speaker-test/speaker-test.c:385
+#, c-format
+msgid "Period size range from %lu to %lu\n"
+msgstr "ピリオドサイズ範囲 %lu 〜 %lu\n"
+
+#: speaker-test/speaker-test.c:387
+#, c-format
+msgid "Requested period time %u us\n"
+msgstr "è¦æ±‚ã•れãŸãƒ”リオド長 %u us\n"
+
+#: speaker-test/speaker-test.c:390
+#, c-format
+msgid "Unable to set period time %u us for playback: %s\n"
+msgstr "ピリオド長 %u us を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:396
+#, c-format
+msgid "Requested buffer time %u us\n"
+msgstr "è¦æ±‚ã•れãŸãƒãƒƒãƒ•ã‚¡é•· %u us\n"
+
+#: speaker-test/speaker-test.c:399
+#, c-format
+msgid "Unable to set buffer time %u us for playback: %s\n"
+msgstr "ãƒãƒƒãƒ•ã‚¡é•· %u us を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:408
+#, c-format
+msgid "Using max buffer size %lu\n"
+msgstr "最大ãƒãƒƒãƒ•ァサイズ %lu を使用\n"
+
+#: speaker-test/speaker-test.c:411
+#, c-format
+msgid "Unable to set buffer size %lu for playback: %s\n"
+msgstr "ãƒãƒƒãƒ•ァサイズ %lu を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:417
+#, c-format
+msgid "Periods = %u\n"
+msgstr "ピリオド数 = %u\n"
+
+#: speaker-test/speaker-test.c:420
+#, c-format
+msgid "Unable to set nperiods %u for playback: %s\n"
+msgstr "ピリオド数 %u を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:429
+#, c-format
+msgid "Unable to set hw params for playback: %s\n"
+msgstr "hw params を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:435
+#, c-format
+msgid "was set period_size = %lu\n"
+msgstr "period_size = %lu ã§è¨­å®š\n"
+
+#: speaker-test/speaker-test.c:436
+#, c-format
+msgid "was set buffer_size = %lu\n"
+msgstr "buffer_size = %lu ã§è¨­å®š\n"
+
+#: speaker-test/speaker-test.c:438
+#, c-format
+msgid "buffer to small, could not use\n"
+msgstr "ãƒãƒƒãƒ•ã‚¡ãŒå°ã•ã™ãŽã¾ã™\n"
+
+#: speaker-test/speaker-test.c:451
+#, c-format
+msgid "Unable to determine current swparams for playback: %s\n"
+msgstr "ç¾åœ¨ã® swparams ã‚’å–å¾—ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:458
+#, c-format
+msgid "Unable to set start threshold mode for playback: %s\n"
+msgstr "start_threshold モードを設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:465
+#, c-format
+msgid "Unable to set avail min for playback: %s\n"
+msgstr "avail_min を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:472
+#, c-format
+msgid "Unable to set sw params for playback: %s\n"
+msgstr "å†ç”Ÿç”¨ã® sw params を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:487
+#, c-format
+msgid "Can't recovery from underrun, prepare failed: %s\n"
+msgstr "アンダーランã‹ã‚‰å¾©å¸°å¤±æ•—: %s\n"
+
+#: speaker-test/speaker-test.c:498
+#, c-format
+msgid "Can't recovery from suspend, prepare failed: %s\n"
+msgstr "サスペンドã‹ã‚‰å¾©å¸°å¤±æ•—: %s\n"
+
+#: speaker-test/speaker-test.c:572 speaker-test/speaker-test.c:969
+#, c-format
+msgid "No enough memory\n"
+msgstr "メモリãŒè¶³ã‚Šã¾ã›ã‚“\n"
+
+#: speaker-test/speaker-test.c:577
+#, c-format
+msgid "Cannot open WAV file %s\n"
+msgstr "WAVファイルãŒã‚ªãƒ¼ãƒ—ンã§ãã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:581 speaker-test/speaker-test.c:610
+#, c-format
+msgid "Invalid WAV file %s\n"
+msgstr "䏿­£ãªWAVファイルã§ã™: %s\n"
+
+#: speaker-test/speaker-test.c:586
+#, c-format
+msgid "Not a WAV file: %s\n"
+msgstr "WAVファイルã§ã¯ã‚りã¾ã›ã‚“: %s\n"
+
+#: speaker-test/speaker-test.c:590
+#, c-format
+msgid "Unsupported WAV format %d for %s\n"
+msgstr "未サãƒãƒ¼ãƒˆã®WAVフォーマット %d: %s\n"
+
+#: speaker-test/speaker-test.c:595
+#, c-format
+msgid "%s is not a mono stream (%d channels)\n"
+msgstr "%s ã¯ãƒ¢ãƒŽã‚¹ãƒˆãƒªãƒ¼ãƒ ã§ã¯ã‚りã¾ã›ã‚“ (%d ãƒãƒ£ãƒãƒ«)\n"
+
+#: speaker-test/speaker-test.c:600
+#, c-format
+msgid "Sample rate doesn't match (%d) for %s\n"
+msgstr "サンプルレートãŒä¸ä¸€è‡´ã§ã™(%d): %s\n"
+
+#: speaker-test/speaker-test.c:605
+#, c-format
+msgid "Unsupported sample format bits %d for %s\n"
+msgstr "未サãƒãƒ¼ãƒˆã®ã‚µãƒ³ãƒ—ルフォーマットビット %d: %s\n"
+
+#: speaker-test/speaker-test.c:655
+#, c-format
+msgid "Undefined channel %d\n"
+msgstr "未定義ã®ãƒãƒ£ãƒãƒ« %d\n"
+
+#: speaker-test/speaker-test.c:706
+#, c-format
+msgid "Write error: %d,%s\n"
+msgstr "書込エラー: %d,%s\n"
+
+#: speaker-test/speaker-test.c:708
+#, c-format
+msgid "xrun_recovery failed: %d,%s\n"
+msgstr "xrun_recovery 失敗: %d,%s\n"
+
+#: speaker-test/speaker-test.c:766
+#, c-format
+msgid ""
+"Usage: speaker-test [OPTION]... \n"
+"-h,--help\thelp\n"
+"-D,--device\tplayback device\n"
+"-r,--rate\tstream rate in Hz\n"
+"-c,--channels\tcount of channels in stream\n"
+"-f,--frequency\tsine wave frequency in Hz\n"
+"-F,--format\tsample format\n"
+"-b,--buffer\tring buffer size in us\n"
+"-p,--period\tperiod size in us\n"
+"-P,--nperiods\tnumber of periods\n"
+"-t,--test\tpink=use pink noise, sine=use sine wave, wav=WAV file\n"
+"-l,--nloops\tspecify number of loops to test, 0 = infinite\n"
+"-s,--speaker\tsingle speaker test. Values 1=Left, 2=right, etc\n"
+"-w,--wavfile\tUse the given WAV file as a test sound\n"
+"-W,--wavdir\tSpecify the directory containing WAV files\n"
+"\n"
+msgstr ""
+"使用法: speaker-test [オプション]...\n"
+"-h,--help ヘルプ\n"
+"-D,--device å†ç”Ÿãƒ‡ãƒã‚¤ã‚¹\n"
+"-r,--rate ストリームレート (Hz)\n"
+"-c,--channels ãƒãƒ£ãƒãƒ«æ•°\n"
+"-f,--frequency 正弦波周波数 (hz)\n"
+"-F,--format サンプルフォーマット\n"
+"-b,--buffer リングãƒãƒƒãƒ•ァサイズ (μs)\n"
+"-p,--period ピリオドサイズ (μs)\n"
+"-P,--nperiods ピリオド数\n"
+"-t,--test pink=ピンクノイズを使用, sine=正弦波を使用, wav=WAVファ"
+"イルå†ç”Ÿ\n"
+"-l,--nloops 繰り返ã—テスト数, 0 = 無制é™\n"
+"-s,--speaker å˜ä¸€ã‚¹ãƒ”ーカーテスト 1=å·¦ ã¾ãŸã¯ 2=å³\n"
+"-w,--wavfile 指定ã®WAVファイルをテスト音æºã¨ã—ã¦ä½¿ç”¨\n"
+"-W,--wavdir WAVファイルã®ã‚るディレクトリを指定\n"
+"\n"
+
+#: speaker-test/speaker-test.c:878
+#, c-format
+msgid "Invalid number of periods %d\n"
+msgstr "䏿­£ãªãƒ”リオド数 %d\n"
+
+#: speaker-test/speaker-test.c:892 speaker-test/speaker-test.c:896
+#, c-format
+msgid "Invalid test type %s\n"
+msgstr "䏿­£ãªãƒ†ã‚¹ãƒˆã‚¿ã‚¤ãƒ— %s\n"
+
+#: speaker-test/speaker-test.c:908
+#, c-format
+msgid "Invalid parameter for -s option.\n"
+msgstr "-s オプションã®å€¤ãŒä¸æ­£ã§ã™\n"
+
+#: speaker-test/speaker-test.c:919
+#, c-format
+msgid "Unknown option '%c'\n"
+msgstr "未知ã®ã‚ªãƒ—ション '%c'\n"
+
+#: speaker-test/speaker-test.c:933
+#, c-format
+msgid "Playback device is %s\n"
+msgstr "å†ç”Ÿãƒ‡ãƒã‚¤ã‚¹: %s\n"
+
+#: speaker-test/speaker-test.c:934
+#, c-format
+msgid "Stream parameters are %iHz, %s, %i channels\n"
+msgstr "ストリームパラメータ: %iHz, %s, %i ãƒãƒ£ãƒãƒ«\n"
+
+#: speaker-test/speaker-test.c:937
+#, c-format
+msgid "Using 16 octaves of pink noise\n"
+msgstr "16 オクターブã®ãƒ”ンクノイズを使用\n"
+
+#: speaker-test/speaker-test.c:940
+#, c-format
+msgid "Sine wave rate is %.4fHz\n"
+msgstr "正弦波レート: %.4fHz\n"
+
+#: speaker-test/speaker-test.c:943
+#, c-format
+msgid "WAV file(s)\n"
+msgstr "WAV ファイル\n"
+
+#: speaker-test/speaker-test.c:949
+#, c-format
+msgid "Playback open error: %d,%s\n"
+msgstr "å†ç”Ÿã‚ªãƒ¼ãƒ—ンエラー: %d,%s\n"
+
+#: speaker-test/speaker-test.c:954
+#, c-format
+msgid "Setting of hwparams failed: %s\n"
+msgstr "hwparams ã®è¨­å®šã«å¤±æ•—: %s\n"
+
+#: speaker-test/speaker-test.c:959
+#, c-format
+msgid "Setting of swparams failed: %s\n"
+msgstr "swparams ã®è¨­å®šã«å¤±æ•—: %s\n"
+
+#: speaker-test/speaker-test.c:1000 speaker-test/speaker-test.c:1022
+#, c-format
+msgid "Transfer failed: %s\n"
+msgstr "転é€ã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: speaker-test/speaker-test.c:1010
+#, c-format
+msgid "Time per period = %lf\n"
+msgstr "ピリオド時間 = %lf\n"
+
+#~ msgid "can't play not PCM-coded WAVE-files"
+#~ msgstr "PCM 以外㮠WAVE ファイルã¯å†ç”Ÿã§ãã¾ã›ã‚“"
+
+#~ msgid "Unable to obtain xfer align\n"
+#~ msgstr "xfer align 値を得るã“ã¨ãŒã§ãã¾ã›ã‚“\n"
+
+#~ msgid "Unable to set transfer align for playback: %s\n"
+#~ msgstr "è»¢é€ align を設定ã§ãã¾ã›ã‚“: %s\n"
+
+#~ msgid "snd_names_list error: %s"
+#~ msgstr "snd_names_list エラー: %s"
+
+#~ msgid "PCM list:\n"
+#~ msgstr "PCM リスト:\n"
+
+#~ msgid "Output failed: %s\n"
+#~ msgstr "出力失敗: %s\n"
+
+#~ msgid "Pausing\n"
+#~ msgstr "åœæ­¢ä¸­\n"
diff --git a/alsa-utils/po/quot.sed b/alsa-utils/po/quot.sed
new file mode 100644
index 0000000..0122c46
--- /dev/null
+++ b/alsa-utils/po/quot.sed
@@ -0,0 +1,6 @@
+s/"\([^"]*\)"/“\1â€/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“â€/""/g
diff --git a/alsa-utils/po/remove-potcdate.sin b/alsa-utils/po/remove-potcdate.sin
new file mode 100644
index 0000000..2436c49
--- /dev/null
+++ b/alsa-utils/po/remove-potcdate.sin
@@ -0,0 +1,19 @@
+# Sed script that remove the POT-Creation-Date line in the header entry
+# from a POT file.
+#
+# The distinction between the first and the following occurrences of the
+# pattern is achieved by looking at the hold space.
+/^"POT-Creation-Date: .*"$/{
+x
+# Test if the hold space is empty.
+s/P/P/
+ta
+# Yes it was empty. First occurrence. Remove the line.
+g
+d
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/alsa-utils/po/stamp-po b/alsa-utils/po/stamp-po
new file mode 100644
index 0000000..9788f70
--- /dev/null
+++ b/alsa-utils/po/stamp-po
@@ -0,0 +1 @@
+timestamp
diff --git a/alsa-utils/seq/Makefile.am b/alsa-utils/seq/Makefile.am
new file mode 100644
index 0000000..2c84cee
--- /dev/null
+++ b/alsa-utils/seq/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=aconnect aplaymidi aseqdump aseqnet
diff --git a/alsa-utils/seq/Makefile.in b/alsa-utils/seq/Makefile.in
new file mode 100644
index 0000000..8c7c0ba
--- /dev/null
+++ b/alsa-utils/seq/Makefile.in
@@ -0,0 +1,485 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = seq
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+SUBDIRS = aconnect aplaymidi aseqdump aseqnet
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign seq/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-recursive ctags ctags-recursive \
+ distclean distclean-generic distclean-recursive distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/seq/aconnect/Makefile.am b/alsa-utils/seq/aconnect/Makefile.am
new file mode 100644
index 0000000..507b9fe
--- /dev/null
+++ b/alsa-utils/seq/aconnect/Makefile.am
@@ -0,0 +1,7 @@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = README.aconnect aconnect.1
+LDADD = $(LIBINTL)
+
+bin_PROGRAMS = aconnect
+aconnect_SOURCES = aconnect.c
+man_MANS = aconnect.1
diff --git a/alsa-utils/seq/aconnect/Makefile.in b/alsa-utils/seq/aconnect/Makefile.in
new file mode 100644
index 0000000..ccf0aeb
--- /dev/null
+++ b/alsa-utils/seq/aconnect/Makefile.in
@@ -0,0 +1,502 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aconnect$(EXEEXT)
+subdir = seq/aconnect
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_aconnect_OBJECTS = aconnect.$(OBJEXT)
+aconnect_OBJECTS = $(am_aconnect_OBJECTS)
+aconnect_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+aconnect_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(aconnect_SOURCES)
+DIST_SOURCES = $(aconnect_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = README.aconnect aconnect.1
+LDADD = $(LIBINTL)
+aconnect_SOURCES = aconnect.c
+man_MANS = aconnect.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aconnect/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign seq/aconnect/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+aconnect$(EXEEXT): $(aconnect_OBJECTS) $(aconnect_DEPENDENCIES)
+ @rm -f aconnect$(EXEEXT)
+ $(LINK) $(aconnect_LDFLAGS) $(aconnect_OBJECTS) $(aconnect_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aconnect.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/seq/aconnect/README.aconnect b/alsa-utils/seq/aconnect/README.aconnect
new file mode 100644
index 0000000..1f6237a
--- /dev/null
+++ b/alsa-utils/seq/aconnect/README.aconnect
@@ -0,0 +1,46 @@
+================================================================
+ aconnect - control subscriptions
+ ver.0.1.3
+ Copyright (C) 1999-2000 Takashi Iwai
+================================================================
+
+aconnect is a utility to control subscriptions of two ports as the
+third "manager" client.
+
+For example, the following connects two ports, from 64:0 to 65:0.
+
+ % aconnect 64:0 65:0
+
+To disconnect the existing subscription, use -d option.
+
+ % aconnect -d 64:0 65:0
+
+To see which port is available as input port, run the following
+command:
+
+ % aconnect -i
+ client 0: 'System' [type=kernel]
+ 0 'Timer '
+ 1 'Announce '
+ client 64: '0: MIDI Synth' [type=kernel]
+ 0 'card 0: synth-midi: 0'
+
+Similary, to see the output ports, use -o flag.
+
+ % aconnect -o
+ client 64: '0: MIDI Synth' [type=kernel]
+ 0 'card 0: synth-midi: 0'
+ client 65: 'AWE Wave Table Synth : 0' [type=kernel]
+ 0 'Emu8000 port 0 '
+ 1 'Emu8000 port 1 '
+ 2 'Emu8000 port 2 '
+ 3 'Emu8000 port 3 '
+
+The option -l together with -i or -o shows subscribers for each port.
+
+Ports are connected exclusively when the option -e is specified.
+
+For modifying time-stamp with a queue, use -r or -t option followed by
+a queue index which updates the time-stamp. Former uses real-time queue,
+while the latter uses tick queue. The queue must be used (not necessarily
+owned) by the receiver client.
diff --git a/alsa-utils/seq/aconnect/aconnect.1 b/alsa-utils/seq/aconnect/aconnect.1
new file mode 100644
index 0000000..2050187
--- /dev/null
+++ b/alsa-utils/seq/aconnect/aconnect.1
@@ -0,0 +1,145 @@
+.TH aconnect 1 "August 31, 2000"
+.de EX
+.nf
+.ft CW
+..
+.de EE
+.ft R
+.fi
+..
+.SH NAME
+aconnect \- ALSA sequencer connection manager
+
+.SH SYNOPSIS
+.B aconnect
+[\-d] [\-options] sender receiver
+.br
+.B aconnect
+\-i|\-o [\-options]
+.br
+.B aconnect
+\-x
+
+.SH DESCRIPTION
+.B aconnect
+is a utility to connect and disconnect two existing ports on ALSA sequencer
+system.
+The ports with the arbitrary subscription permission, such as created
+by
+.B aseqview(1),
+can be connected to any (MIDI) device ports using
+.B aconnect.
+For example, to connect from port 64:0 to 65:0, run as follows:
+.IP "" 4
+% aconnect 64:0 65:0
+.PP
+The connection is one-way, and the whole data to the sender port (64:0)
+is redirected to the receiver port (65:0). When another port (e.g. 65:1)
+is attached to the same sender port, the data is sent to both receiver
+ports.
+For disconnection, use
+.B \-d
+option.
+.sp
+.EX
+% aconnect \-d 64:0 65:0
+.EE
+.PP
+The address can be given using the client's name.
+.sp
+.EX
+% aconnect External:0 Emu8000:1
+.EE
+.PP
+Then the port 0 of the client matching with the string "External" is
+connected to the port 1 of the client matching with the "Emu8000".
+.PP
+Another function of
+.B aconnect
+is to list the present ports
+on the given condition.
+The input ports, which may become
+.I sender
+ports, can be listed with
+.B \-i
+option.
+.sp
+.EX
+% aconnect \-i
+client 0: 'System' [type=kernel]
+ 0 'Timer '
+ 1 'Announce '
+client 64: 'External MIDI\-0' [type=kernel]
+ 0 'MIDI 0\-0 '
+.EE
+.PP
+Similarly, to see the output ports, use
+.B \-o
+flag.
+.PP
+You can remove all existing exported connections using
+.B \-x
+option. This function is useful for terminating the ALSA drivers,
+because the modules with sequencer connections cannot be unloaded
+unless their connections are removed.
+
+.SH OPTIONS
+.SS CONNECTION MANAGEMENT
+.TP
+.B \-d, \-\-disconnect
+Disconnect the given subscription.
+.TP
+.B \-e, \-\-exclusive
+Connect ports with exclusive mode.
+Both sender and receiver ports can be no longer connected by any other ports.
+.TP
+.B \-r, \-\-real queue
+Convert time-stamps of event packets to the current value of the given
+.I real-time
+queue.
+This is option is, however, not so useful, since
+the receiver port must use (not necessarily own) the specified queue.
+.TP
+.B \-t, \-\-tick queue
+Like
+.B \-r
+option, but
+time-stamps are converted to the current value of the given
+.I tick
+queue.
+
+.SS LIST PORTS
+.TP
+.B \-i, \-\-input
+List existing input (readable) ports.
+This option is exclusive to
+.B \-o.
+.TP
+.B \-o, \-\-output
+List existing output (writable) ports.
+This option is exclusive to
+.B \-i.
+.TP
+.B \-l, \-\-list
+List the current connection status. The connected and connecting ports
+from/to each port are listed together.
+The suffix flag
+.B [ex]
+means the connection is exclusive.
+The suffix flag
+.B [real:#]
+and
+.B [tick:#]
+mean the connection includes real-time and tick conversion on the listed
+queue, respectively.
+
+.SS REMOVE ALL CONNECTIONS
+.TP
+.B \-x, \-\-removeall
+Remove all exported connections.
+
+.SH "SEE ALSO"
+aseqnet(1), aseqview(1)
+
+.SH AUTHOR
+Takashi Iwai <tiwai@suse.de>
diff --git a/alsa-utils/seq/aconnect/aconnect.c b/alsa-utils/seq/aconnect/aconnect.c
new file mode 100644
index 0000000..1a50666
--- /dev/null
+++ b/alsa-utils/seq/aconnect/aconnect.c
@@ -0,0 +1,411 @@
+/*
+ * connect / disconnect two subscriber ports
+ * ver.0.1.3
+ *
+ * Copyright (C) 1999 Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <stdarg.h>
+#include <locale.h>
+#include <sys/ioctl.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "gettext.h"
+
+static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
+{
+ va_list arg;
+
+ if (err == ENOENT) /* Ignore those misleading "warnings" */
+ return;
+ va_start(arg, fmt);
+ fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
+ vfprintf(stderr, fmt, arg);
+ if (err)
+ fprintf(stderr, ": %s", snd_strerror(err));
+ putc('\n', stderr);
+ va_end(arg);
+}
+
+static void usage(void)
+{
+ printf(_("aconnect - ALSA sequencer connection manager\n"));
+ printf(_("Copyright (C) 1999-2000 Takashi Iwai\n"));
+ printf(_("Usage:\n"));
+ printf(_(" * Connection/disconnection between two ports\n"));
+ printf(_(" aconnect [-options] sender receiver\n"));
+ printf(_(" sender, receiver = client:port pair\n"));
+ printf(_(" -d,--disconnect disconnect\n"));
+ printf(_(" -e,--exclusive exclusive connection\n"));
+ printf(_(" -r,--real # convert real-time-stamp on queue\n"));
+ printf(_(" -t,--tick # convert tick-time-stamp on queue\n"));
+ printf(_(" * List connected ports (no subscription action)\n"));
+ printf(_(" aconnect -i|-o [-options]\n"));
+ printf(_(" -i,--input list input (readable) ports\n"));
+ printf(_(" -o,--output list output (writable) ports\n"));
+ printf(_(" -l,--list list current connections of each port\n"));
+ printf(_(" * Remove all exported connections\n"));
+ printf(_(" -x, --removeall\n"));
+}
+
+/*
+ * check permission (capability) of specified port
+ */
+
+#define LIST_INPUT 1
+#define LIST_OUTPUT 2
+
+#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits))
+
+static int check_permission(snd_seq_port_info_t *pinfo, int perm)
+{
+ if (perm) {
+ if (perm & LIST_INPUT) {
+ if (perm_ok(pinfo, SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ))
+ goto __ok;
+ }
+ if (perm & LIST_OUTPUT) {
+ if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE))
+ goto __ok;
+ }
+ return 0;
+ }
+ __ok:
+ if (snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)
+ return 0;
+ return 1;
+}
+
+/*
+ * list subscribers of specified type
+ */
+static void list_each_subs(snd_seq_t *seq, snd_seq_query_subscribe_t *subs, int type, const char *msg)
+{
+ int count = 0;
+ snd_seq_query_subscribe_set_type(subs, type);
+ snd_seq_query_subscribe_set_index(subs, 0);
+ while (snd_seq_query_port_subscribers(seq, subs) >= 0) {
+ const snd_seq_addr_t *addr;
+ if (count++ == 0)
+ printf("\t%s: ", msg);
+ else
+ printf(", ");
+ addr = snd_seq_query_subscribe_get_addr(subs);
+ printf("%d:%d", addr->client, addr->port);
+ if (snd_seq_query_subscribe_get_exclusive(subs))
+ printf("[ex]");
+ if (snd_seq_query_subscribe_get_time_update(subs))
+ printf("[%s:%d]",
+ (snd_seq_query_subscribe_get_time_real(subs) ? "real" : "tick"),
+ snd_seq_query_subscribe_get_queue(subs));
+ snd_seq_query_subscribe_set_index(subs, snd_seq_query_subscribe_get_index(subs) + 1);
+ }
+ if (count > 0)
+ printf("\n");
+}
+
+/*
+ * list subscribers
+ */
+static void list_subscribers(snd_seq_t *seq, const snd_seq_addr_t *addr)
+{
+ snd_seq_query_subscribe_t *subs;
+ snd_seq_query_subscribe_alloca(&subs);
+ snd_seq_query_subscribe_set_root(subs, addr);
+ list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_READ, _("Connecting To"));
+ list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_WRITE, _("Connected From"));
+}
+
+/*
+ * search all ports
+ */
+typedef void (*action_func_t)(snd_seq_t *seq, snd_seq_client_info_t *cinfo, snd_seq_port_info_t *pinfo, int count);
+
+static void do_search_port(snd_seq_t *seq, int perm, action_func_t do_action)
+{
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+ int count;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+ /* reset query info */
+ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
+ snd_seq_port_info_set_port(pinfo, -1);
+ count = 0;
+ while (snd_seq_query_next_port(seq, pinfo) >= 0) {
+ if (check_permission(pinfo, perm)) {
+ do_action(seq, cinfo, pinfo, count);
+ count++;
+ }
+ }
+ }
+}
+
+
+static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
+ snd_seq_port_info_t *pinfo, int count)
+{
+ if (! count) {
+ printf(_("client %d: '%s' [type=%s]\n"),
+ snd_seq_client_info_get_client(cinfo),
+ snd_seq_client_info_get_name(cinfo),
+ (snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
+ _("user") : _("kernel")));
+ }
+ printf(" %3d '%-16s'\n",
+ snd_seq_port_info_get_port(pinfo),
+ snd_seq_port_info_get_name(pinfo));
+}
+
+static void print_port_and_subs(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
+ snd_seq_port_info_t *pinfo, int count)
+{
+ print_port(seq, cinfo, pinfo, count);
+ list_subscribers(seq, snd_seq_port_info_get_addr(pinfo));
+}
+
+
+/*
+ * remove all (exported) connections
+ */
+static void remove_connection(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
+ snd_seq_port_info_t *pinfo, int count)
+{
+ snd_seq_query_subscribe_t *query;
+
+ snd_seq_query_subscribe_alloca(&query);
+ snd_seq_query_subscribe_set_root(query, snd_seq_port_info_get_addr(pinfo));
+
+ snd_seq_query_subscribe_set_type(query, SND_SEQ_QUERY_SUBS_READ);
+ snd_seq_query_subscribe_set_index(query, 0);
+ for (; snd_seq_query_port_subscribers(seq, query) >= 0;
+ snd_seq_query_subscribe_set_index(query, snd_seq_query_subscribe_get_index(query) + 1)) {
+ snd_seq_port_info_t *port;
+ snd_seq_port_subscribe_t *subs;
+ const snd_seq_addr_t *sender = snd_seq_query_subscribe_get_root(query);
+ const snd_seq_addr_t *dest = snd_seq_query_subscribe_get_addr(query);
+ snd_seq_port_info_alloca(&port);
+ if (snd_seq_get_any_port_info(seq, dest->client, dest->port, port) < 0)
+ continue;
+ if (!(snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_SUBS_WRITE))
+ continue;
+ if (snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_NO_EXPORT)
+ continue;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_queue(subs, snd_seq_query_subscribe_get_queue(query));
+ snd_seq_port_subscribe_set_sender(subs, sender);
+ snd_seq_port_subscribe_set_dest(subs, dest);
+ snd_seq_unsubscribe_port(seq, subs);
+ }
+
+ snd_seq_query_subscribe_set_type(query, SND_SEQ_QUERY_SUBS_WRITE);
+ snd_seq_query_subscribe_set_index(query, 0);
+ for (; snd_seq_query_port_subscribers(seq, query) >= 0;
+ snd_seq_query_subscribe_set_index(query, snd_seq_query_subscribe_get_index(query) + 1)) {
+ snd_seq_port_info_t *port;
+ snd_seq_port_subscribe_t *subs;
+ const snd_seq_addr_t *dest = snd_seq_query_subscribe_get_root(query);
+ const snd_seq_addr_t *sender = snd_seq_query_subscribe_get_addr(query);
+ snd_seq_port_info_alloca(&port);
+ if (snd_seq_get_any_port_info(seq, sender->client, sender->port, port) < 0)
+ continue;
+ if (!(snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_SUBS_READ))
+ continue;
+ if (snd_seq_port_info_get_capability(port) & SND_SEQ_PORT_CAP_NO_EXPORT)
+ continue;
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_queue(subs, snd_seq_query_subscribe_get_queue(query));
+ snd_seq_port_subscribe_set_sender(subs, sender);
+ snd_seq_port_subscribe_set_dest(subs, dest);
+ snd_seq_unsubscribe_port(seq, subs);
+ }
+}
+
+static void remove_all_connections(snd_seq_t *seq)
+{
+ do_search_port(seq, 0, remove_connection);
+}
+
+
+/*
+ * main..
+ */
+
+enum {
+ SUBSCRIBE, UNSUBSCRIBE, LIST, REMOVE_ALL
+};
+
+static const struct option long_option[] = {
+ {"disconnect", 0, NULL, 'd'},
+ {"input", 0, NULL, 'i'},
+ {"output", 0, NULL, 'o'},
+ {"real", 1, NULL, 'r'},
+ {"tick", 1, NULL, 't'},
+ {"exclusive", 0, NULL, 'e'},
+ {"list", 0, NULL, 'l'},
+ {"removeall", 0, NULL, 'x'},
+ {NULL, 0, NULL, 0},
+};
+
+int main(int argc, char **argv)
+{
+ int c;
+ snd_seq_t *seq;
+ int queue = 0, convert_time = 0, convert_real = 0, exclusive = 0;
+ int command = SUBSCRIBE;
+ int list_perm = 0;
+ int client;
+ int list_subs = 0;
+ snd_seq_port_subscribe_t *subs;
+ snd_seq_addr_t sender, dest;
+
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ textdomain(PACKAGE);
+#endif
+
+ while ((c = getopt_long(argc, argv, "dior:t:elx", long_option, NULL)) != -1) {
+ switch (c) {
+ case 'd':
+ command = UNSUBSCRIBE;
+ break;
+ case 'i':
+ command = LIST;
+ list_perm |= LIST_INPUT;
+ break;
+ case 'o':
+ command = LIST;
+ list_perm |= LIST_OUTPUT;
+ break;
+ case 'e':
+ exclusive = 1;
+ break;
+ case 'r':
+ queue = atoi(optarg);
+ convert_time = 1;
+ convert_real = 1;
+ break;
+ case 't':
+ queue = atoi(optarg);
+ convert_time = 1;
+ convert_real = 0;
+ break;
+ case 'l':
+ list_subs = 1;
+ break;
+ case 'x':
+ command = REMOVE_ALL;
+ break;
+ default:
+ usage();
+ exit(1);
+ }
+ }
+
+ if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
+ fprintf(stderr, _("can't open sequencer\n"));
+ return 1;
+ }
+
+ snd_lib_error_set_handler(error_handler);
+
+ switch (command) {
+ case LIST:
+ do_search_port(seq, list_perm,
+ list_subs ? print_port_and_subs : print_port);
+ snd_seq_close(seq);
+ return 0;
+ case REMOVE_ALL:
+ remove_all_connections(seq);
+ snd_seq_close(seq);
+ return 0;
+ }
+
+ /* connection or disconnection */
+
+ if (optind + 2 > argc) {
+ snd_seq_close(seq);
+ usage();
+ exit(1);
+ }
+
+ if ((client = snd_seq_client_id(seq)) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("can't get client id\n"));
+ return 1;
+ }
+
+ /* set client info */
+ if (snd_seq_set_client_name(seq, "ALSA Connector") < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("can't set client info\n"));
+ return 1;
+ }
+
+ /* set subscription */
+ if (snd_seq_parse_address(seq, &sender, argv[optind]) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("invalid sender address %s\n"), argv[optind]);
+ return 1;
+ }
+ if (snd_seq_parse_address(seq, &dest, argv[optind + 1]) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("invalid destination address %s\n"), argv[optind + 1]);
+ return 1;
+ }
+ snd_seq_port_subscribe_alloca(&subs);
+ snd_seq_port_subscribe_set_sender(subs, &sender);
+ snd_seq_port_subscribe_set_dest(subs, &dest);
+ snd_seq_port_subscribe_set_queue(subs, queue);
+ snd_seq_port_subscribe_set_exclusive(subs, exclusive);
+ snd_seq_port_subscribe_set_time_update(subs, convert_time);
+ snd_seq_port_subscribe_set_time_real(subs, convert_real);
+
+ if (command == UNSUBSCRIBE) {
+ if (snd_seq_get_port_subscription(seq, subs) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("No subscription is found\n"));
+ return 1;
+ }
+ if (snd_seq_unsubscribe_port(seq, subs) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("Disconnection failed (%s)\n"), snd_strerror(errno));
+ return 1;
+ }
+ } else {
+ if (snd_seq_get_port_subscription(seq, subs) == 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("Connection is already subscribed\n"));
+ return 1;
+ }
+ if (snd_seq_subscribe_port(seq, subs) < 0) {
+ snd_seq_close(seq);
+ fprintf(stderr, _("Connection failed (%s)\n"), snd_strerror(errno));
+ return 1;
+ }
+ }
+
+ snd_seq_close(seq);
+
+ return 0;
+}
diff --git a/alsa-utils/seq/aplaymidi/Makefile.am b/alsa-utils/seq/aplaymidi/Makefile.am
new file mode 100644
index 0000000..bed2a0e
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = aplaymidi.1 arecordmidi.1
+
+bin_PROGRAMS = aplaymidi arecordmidi
+man_MANS = aplaymidi.1 arecordmidi.1
diff --git a/alsa-utils/seq/aplaymidi/Makefile.in b/alsa-utils/seq/aplaymidi/Makefile.in
new file mode 100644
index 0000000..4e623db
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/Makefile.in
@@ -0,0 +1,505 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aplaymidi$(EXEEXT) arecordmidi$(EXEEXT)
+subdir = seq/aplaymidi
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+aplaymidi_SOURCES = aplaymidi.c
+aplaymidi_OBJECTS = aplaymidi.$(OBJEXT)
+aplaymidi_LDADD = $(LDADD)
+arecordmidi_SOURCES = arecordmidi.c
+arecordmidi_OBJECTS = arecordmidi.$(OBJEXT)
+arecordmidi_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = aplaymidi.c arecordmidi.c
+DIST_SOURCES = aplaymidi.c arecordmidi.c
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = aplaymidi.1 arecordmidi.1
+man_MANS = aplaymidi.1 arecordmidi.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aplaymidi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign seq/aplaymidi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+aplaymidi$(EXEEXT): $(aplaymidi_OBJECTS) $(aplaymidi_DEPENDENCIES)
+ @rm -f aplaymidi$(EXEEXT)
+ $(LINK) $(aplaymidi_LDFLAGS) $(aplaymidi_OBJECTS) $(aplaymidi_LDADD) $(LIBS)
+arecordmidi$(EXEEXT): $(arecordmidi_OBJECTS) $(arecordmidi_DEPENDENCIES)
+ @rm -f arecordmidi$(EXEEXT)
+ $(LINK) $(arecordmidi_LDFLAGS) $(arecordmidi_OBJECTS) $(arecordmidi_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aplaymidi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arecordmidi.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/seq/aplaymidi/aplaymidi.1 b/alsa-utils/seq/aplaymidi/aplaymidi.1
new file mode 100644
index 0000000..0134129
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/aplaymidi.1
@@ -0,0 +1,55 @@
+.TH APLAYMIDI 1 "15 Feb 2004"
+
+.SH NAME
+aplaymidi \- play Standard MIDI Files
+
+.SH SYNOPSIS
+.B aplaymidi
+\-p client:port[,...] [\-d delay] midifile ...
+
+.SH DESCRIPTION
+.B aplaymidi
+is a command-line utility that plays the specified MIDI file(s) to one
+or more ALSA sequencer ports.
+
+.SH OPTIONS
+
+.TP
+.I \-h, \-\-help
+Prints a list of options.
+
+.TP
+.I \-V, \-\-version
+Prints the current version.
+
+.TP
+.I \-l, \-\-list
+Prints a list of possible output ports.
+
+.TP
+.I \-p, \-\-port=client:port,...
+Sets the sequencer port(s) to which the events in the MIDI file(s) are
+sent.
+
+A client can be specified by its number, its name, or a prefix of its
+name. A port is specified by its number; for port 0 of a client, the
+":0" part of the port specification can be omitted.
+
+For compatibility with
+.B pmidi(1),
+the port specification is taken from the
+.I ALSA_OUTPUT_PORTS
+environment variable if none is given on the command line.
+
+.TP
+.I \-d, \-\-delay=seconds
+Specifies how long to wait after the end of each MIDI file,
+to allow the last notes to die away.
+
+.SH SEE ALSO
+pmidi(1)
+.br
+playmidi(1)
+
+.SH AUTHOR
+Clemens Ladisch <clemens@ladisch.de>
diff --git a/alsa-utils/seq/aplaymidi/aplaymidi.c b/alsa-utils/seq/aplaymidi/aplaymidi.c
new file mode 100644
index 0000000..5ed7bab
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/aplaymidi.c
@@ -0,0 +1,927 @@
+/*
+ * aplaymidi.c - play Standard MIDI Files to sequencer port(s)
+ *
+ * Copyright (c) 2004-2006 Clemens Ladisch <clemens@ladisch.de>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* TODO: sequencer queue timer selection */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "version.h"
+
+#define MIDI_BYTES_PER_SEC 3125
+
+/*
+ * A MIDI event after being parsed/loaded from the file.
+ * There could be made a case for using snd_seq_event_t instead.
+ */
+struct event {
+ struct event *next; /* linked list */
+
+ unsigned char type; /* SND_SEQ_EVENT_xxx */
+ unsigned char port; /* port index */
+ unsigned int tick;
+ union {
+ unsigned char d[3]; /* channel and data bytes */
+ int tempo;
+ unsigned int length; /* length of sysex data */
+ } data;
+ unsigned char sysex[0];
+};
+
+struct track {
+ struct event *first_event; /* list of all events in this track */
+ int end_tick; /* length of this track */
+
+ struct event *current_event; /* used while loading and playing */
+};
+
+static snd_seq_t *seq;
+static int client;
+static int port_count;
+static snd_seq_addr_t *ports;
+static int queue;
+static int end_delay = 2;
+static const char *file_name;
+static FILE *file;
+static int file_offset; /* current offset in input file */
+static int num_tracks;
+static struct track *tracks;
+static int smpte_timing;
+
+/* prints an error message to stderr */
+static void errormsg(const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+}
+
+/* prints an error message to stderr, and dies */
+static void fatal(const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+ exit(EXIT_FAILURE);
+}
+
+/* memory allocation error handling */
+static void check_mem(void *p)
+{
+ if (!p)
+ fatal("Out of memory");
+}
+
+/* error handling for ALSA functions */
+static void check_snd(const char *operation, int err)
+{
+ if (err < 0)
+ fatal("Cannot %s - %s", operation, snd_strerror(err));
+}
+
+static void init_seq(void)
+{
+ int err;
+
+ /* open sequencer */
+ err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
+ check_snd("open sequencer", err);
+
+ /* set our name (otherwise it's "Client-xxx") */
+ err = snd_seq_set_client_name(seq, "aplaymidi");
+ check_snd("set client name", err);
+
+ /* find out who we actually are */
+ client = snd_seq_client_id(seq);
+ check_snd("get client id", client);
+}
+
+/* parses one or more port addresses from the string */
+static void parse_ports(const char *arg)
+{
+ char *buf, *s, *port_name;
+ int err;
+
+ /* make a copy of the string because we're going to modify it */
+ buf = strdup(arg);
+ check_mem(buf);
+
+ for (port_name = s = buf; s; port_name = s + 1) {
+ /* Assume that ports are separated by commas. We don't use
+ * spaces because those are valid in client names. */
+ s = strchr(port_name, ',');
+ if (s)
+ *s = '\0';
+
+ ++port_count;
+ ports = realloc(ports, port_count * sizeof(snd_seq_addr_t));
+ check_mem(ports);
+
+ err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name);
+ if (err < 0)
+ fatal("Invalid port %s - %s", port_name, snd_strerror(err));
+ }
+
+ free(buf);
+}
+
+static void create_source_port(void)
+{
+ snd_seq_port_info_t *pinfo;
+ int err;
+
+ snd_seq_port_info_alloca(&pinfo);
+
+ /* the first created port is 0 anyway, but let's make sure ... */
+ snd_seq_port_info_set_port(pinfo, 0);
+ snd_seq_port_info_set_port_specified(pinfo, 1);
+
+ snd_seq_port_info_set_name(pinfo, "aplaymidi");
+
+ snd_seq_port_info_set_capability(pinfo, 0); /* sic */
+ snd_seq_port_info_set_type(pinfo,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC |
+ SND_SEQ_PORT_TYPE_APPLICATION);
+
+ err = snd_seq_create_port(seq, pinfo);
+ check_snd("create port", err);
+}
+
+static void create_queue(void)
+{
+ queue = snd_seq_alloc_named_queue(seq, "aplaymidi");
+ check_snd("create queue", queue);
+ /* the queue is now locked, which is just fine */
+}
+
+static void connect_ports(void)
+{
+ int i, err;
+
+ /*
+ * We send MIDI events with explicit destination addresses, so we don't
+ * need any connections to the playback ports. But we connect to those
+ * anyway to force any underlying RawMIDI ports to remain open while
+ * we're playing - otherwise, ALSA would reset the port after every
+ * event.
+ */
+ for (i = 0; i < port_count; ++i) {
+ err = snd_seq_connect_to(seq, 0, ports[i].client, ports[i].port);
+ if (err < 0)
+ fatal("Cannot connect to port %d:%d - %s",
+ ports[i].client, ports[i].port, snd_strerror(err));
+ }
+}
+
+static int read_byte(void)
+{
+ ++file_offset;
+ return getc(file);
+}
+
+/* reads a little-endian 32-bit integer */
+static int read_32_le(void)
+{
+ int value;
+ value = read_byte();
+ value |= read_byte() << 8;
+ value |= read_byte() << 16;
+ value |= read_byte() << 24;
+ return !feof(file) ? value : -1;
+}
+
+/* reads a 4-character identifier */
+static int read_id(void)
+{
+ return read_32_le();
+}
+#define MAKE_ID(c1, c2, c3, c4) ((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24))
+
+/* reads a fixed-size big-endian number */
+static int read_int(int bytes)
+{
+ int c, value = 0;
+
+ do {
+ c = read_byte();
+ if (c == EOF)
+ return -1;
+ value = (value << 8) | c;
+ } while (--bytes);
+ return value;
+}
+
+/* reads a variable-length number */
+static int read_var(void)
+{
+ int value, c;
+
+ c = read_byte();
+ value = c & 0x7f;
+ if (c & 0x80) {
+ c = read_byte();
+ value = (value << 7) | (c & 0x7f);
+ if (c & 0x80) {
+ c = read_byte();
+ value = (value << 7) | (c & 0x7f);
+ if (c & 0x80) {
+ c = read_byte();
+ value = (value << 7) | c;
+ if (c & 0x80)
+ return -1;
+ }
+ }
+ }
+ return !feof(file) ? value : -1;
+}
+
+/* allocates a new event */
+static struct event *new_event(struct track *track, int sysex_length)
+{
+ struct event *event;
+
+ event = malloc(sizeof(struct event) + sysex_length);
+ check_mem(event);
+
+ event->next = NULL;
+
+ /* append at the end of the track's linked list */
+ if (track->current_event)
+ track->current_event->next = event;
+ else
+ track->first_event = event;
+ track->current_event = event;
+
+ return event;
+}
+
+static void skip(int bytes)
+{
+ while (bytes > 0)
+ read_byte(), --bytes;
+}
+
+/* reads one complete track from the file */
+static int read_track(struct track *track, int track_end)
+{
+ int tick = 0;
+ unsigned char last_cmd = 0;
+ unsigned char port = 0;
+
+ /* the current file position is after the track ID and length */
+ while (file_offset < track_end) {
+ unsigned char cmd;
+ struct event *event;
+ int delta_ticks, len, c;
+
+ delta_ticks = read_var();
+ if (delta_ticks < 0)
+ break;
+ tick += delta_ticks;
+
+ c = read_byte();
+ if (c < 0)
+ break;
+
+ if (c & 0x80) {
+ /* have command */
+ cmd = c;
+ if (cmd < 0xf0)
+ last_cmd = cmd;
+ } else {
+ /* running status */
+ ungetc(c, file);
+ file_offset--;
+ cmd = last_cmd;
+ if (!cmd)
+ goto _error;
+ }
+
+ switch (cmd >> 4) {
+ /* maps SMF events to ALSA sequencer events */
+ static const unsigned char cmd_type[] = {
+ [0x8] = SND_SEQ_EVENT_NOTEOFF,
+ [0x9] = SND_SEQ_EVENT_NOTEON,
+ [0xa] = SND_SEQ_EVENT_KEYPRESS,
+ [0xb] = SND_SEQ_EVENT_CONTROLLER,
+ [0xc] = SND_SEQ_EVENT_PGMCHANGE,
+ [0xd] = SND_SEQ_EVENT_CHANPRESS,
+ [0xe] = SND_SEQ_EVENT_PITCHBEND
+ };
+
+ case 0x8: /* channel msg with 2 parameter bytes */
+ case 0x9:
+ case 0xa:
+ case 0xb:
+ case 0xe:
+ event = new_event(track, 0);
+ event->type = cmd_type[cmd >> 4];
+ event->port = port;
+ event->tick = tick;
+ event->data.d[0] = cmd & 0x0f;
+ event->data.d[1] = read_byte() & 0x7f;
+ event->data.d[2] = read_byte() & 0x7f;
+ break;
+
+ case 0xc: /* channel msg with 1 parameter byte */
+ case 0xd:
+ event = new_event(track, 0);
+ event->type = cmd_type[cmd >> 4];
+ event->port = port;
+ event->tick = tick;
+ event->data.d[0] = cmd & 0x0f;
+ event->data.d[1] = read_byte() & 0x7f;
+ break;
+
+ case 0xf:
+ switch (cmd) {
+ case 0xf0: /* sysex */
+ case 0xf7: /* continued sysex, or escaped commands */
+ len = read_var();
+ if (len < 0)
+ goto _error;
+ if (cmd == 0xf0)
+ ++len;
+ event = new_event(track, len);
+ event->type = SND_SEQ_EVENT_SYSEX;
+ event->port = port;
+ event->tick = tick;
+ event->data.length = len;
+ if (cmd == 0xf0) {
+ event->sysex[0] = 0xf0;
+ c = 1;
+ } else {
+ c = 0;
+ }
+ for (; c < len; ++c)
+ event->sysex[c] = read_byte();
+ break;
+
+ case 0xff: /* meta event */
+ c = read_byte();
+ len = read_var();
+ if (len < 0)
+ goto _error;
+
+ switch (c) {
+ case 0x21: /* port number */
+ if (len < 1)
+ goto _error;
+ port = read_byte() % port_count;
+ skip(len - 1);
+ break;
+
+ case 0x2f: /* end of track */
+ track->end_tick = tick;
+ skip(track_end - file_offset);
+ return 1;
+
+ case 0x51: /* tempo */
+ if (len < 3)
+ goto _error;
+ if (smpte_timing) {
+ /* SMPTE timing doesn't change */
+ skip(len);
+ } else {
+ event = new_event(track, 0);
+ event->type = SND_SEQ_EVENT_TEMPO;
+ event->port = port;
+ event->tick = tick;
+ event->data.tempo = read_byte() << 16;
+ event->data.tempo |= read_byte() << 8;
+ event->data.tempo |= read_byte();
+ skip(len - 3);
+ }
+ break;
+
+ default: /* ignore all other meta events */
+ skip(len);
+ break;
+ }
+ break;
+
+ default: /* invalid Fx command */
+ goto _error;
+ }
+ break;
+
+ default: /* cannot happen */
+ goto _error;
+ }
+ }
+_error:
+ errormsg("%s: invalid MIDI data (offset %#x)", file_name, file_offset);
+ return 0;
+}
+
+/* reads an entire MIDI file */
+static int read_smf(void)
+{
+ int header_len, type, time_division, i, err;
+ snd_seq_queue_tempo_t *queue_tempo;
+
+ /* the curren position is immediately after the "MThd" id */
+ header_len = read_int(4);
+ if (header_len < 6) {
+invalid_format:
+ errormsg("%s: invalid file format", file_name);
+ return 0;
+ }
+
+ type = read_int(2);
+ if (type != 0 && type != 1) {
+ errormsg("%s: type %d format is not supported", file_name, type);
+ return 0;
+ }
+
+ num_tracks = read_int(2);
+ if (num_tracks < 1 || num_tracks > 1000) {
+ errormsg("%s: invalid number of tracks (%d)", file_name, num_tracks);
+ num_tracks = 0;
+ return 0;
+ }
+ tracks = calloc(num_tracks, sizeof(struct track));
+ if (!tracks) {
+ errormsg("out of memory");
+ num_tracks = 0;
+ return 0;
+ }
+
+ time_division = read_int(2);
+ if (time_division < 0)
+ goto invalid_format;
+
+ /* interpret and set tempo */
+ snd_seq_queue_tempo_alloca(&queue_tempo);
+ smpte_timing = !!(time_division & 0x8000);
+ if (!smpte_timing) {
+ /* time_division is ticks per quarter */
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 500000); /* default: 120 bpm */
+ snd_seq_queue_tempo_set_ppq(queue_tempo, time_division);
+ } else {
+ /* upper byte is negative frames per second */
+ i = 0x80 - ((time_division >> 8) & 0x7f);
+ /* lower byte is ticks per frame */
+ time_division &= 0xff;
+ /* now pretend that we have quarter-note based timing */
+ switch (i) {
+ case 24:
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 500000);
+ snd_seq_queue_tempo_set_ppq(queue_tempo, 12 * time_division);
+ break;
+ case 25:
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 400000);
+ snd_seq_queue_tempo_set_ppq(queue_tempo, 10 * time_division);
+ break;
+ case 29: /* 30 drop-frame */
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 100000000);
+ snd_seq_queue_tempo_set_ppq(queue_tempo, 2997 * time_division);
+ break;
+ case 30:
+ snd_seq_queue_tempo_set_tempo(queue_tempo, 500000);
+ snd_seq_queue_tempo_set_ppq(queue_tempo, 15 * time_division);
+ break;
+ default:
+ errormsg("%s: invalid number of SMPTE frames per second (%d)",
+ file_name, i);
+ return 0;
+ }
+ }
+ err = snd_seq_set_queue_tempo(seq, queue, queue_tempo);
+ if (err < 0) {
+ errormsg("Cannot set queue tempo (%u/%i)",
+ snd_seq_queue_tempo_get_tempo(queue_tempo),
+ snd_seq_queue_tempo_get_ppq(queue_tempo));
+ return 0;
+ }
+
+ /* read tracks */
+ for (i = 0; i < num_tracks; ++i) {
+ int len;
+
+ /* search for MTrk chunk */
+ for (;;) {
+ int id = read_id();
+ len = read_int(4);
+ if (feof(file)) {
+ errormsg("%s: unexpected end of file", file_name);
+ return 0;
+ }
+ if (len < 0 || len >= 0x10000000) {
+ errormsg("%s: invalid chunk length %d", file_name, len);
+ return 0;
+ }
+ if (id == MAKE_ID('M', 'T', 'r', 'k'))
+ break;
+ skip(len);
+ }
+ if (!read_track(&tracks[i], file_offset + len))
+ return 0;
+ }
+ return 1;
+}
+
+static int read_riff(void)
+{
+ /* skip file length */
+ read_byte();
+ read_byte();
+ read_byte();
+ read_byte();
+
+ /* check file type ("RMID" = RIFF MIDI) */
+ if (read_id() != MAKE_ID('R', 'M', 'I', 'D')) {
+invalid_format:
+ errormsg("%s: invalid file format", file_name);
+ return 0;
+ }
+ /* search for "data" chunk */
+ for (;;) {
+ int id = read_id();
+ int len = read_32_le();
+ if (feof(file)) {
+data_not_found:
+ errormsg("%s: data chunk not found", file_name);
+ return 0;
+ }
+ if (id == MAKE_ID('d', 'a', 't', 'a'))
+ break;
+ if (len < 0)
+ goto data_not_found;
+ skip((len + 1) & ~1);
+ }
+ /* the "data" chunk must contain data in SMF format */
+ if (read_id() != MAKE_ID('M', 'T', 'h', 'd'))
+ goto invalid_format;
+ return read_smf();
+}
+
+static void cleanup_file_data(void)
+{
+ int i;
+ struct event *event;
+
+ for (i = 0; i < num_tracks; ++i) {
+ event = tracks[i].first_event;
+ while (event) {
+ struct event *next = event->next;
+ free(event);
+ event = next;
+ }
+ }
+ num_tracks = 0;
+ free(tracks);
+ tracks = NULL;
+}
+
+static void handle_big_sysex(snd_seq_event_t *ev)
+{
+ unsigned int length;
+ ssize_t event_size;
+ int err;
+
+ length = ev->data.ext.len;
+ if (length > MIDI_BYTES_PER_SEC)
+ ev->data.ext.len = MIDI_BYTES_PER_SEC;
+ event_size = snd_seq_event_length(ev);
+ if (event_size + 1 > snd_seq_get_output_buffer_size(seq)) {
+ err = snd_seq_drain_output(seq);
+ check_snd("drain output", err);
+ err = snd_seq_set_output_buffer_size(seq, event_size + 1);
+ check_snd("set output buffer size", err);
+ }
+ while (length > MIDI_BYTES_PER_SEC) {
+ err = snd_seq_event_output(seq, ev);
+ check_snd("output event", err);
+ err = snd_seq_drain_output(seq);
+ check_snd("drain output", err);
+ err = snd_seq_sync_output_queue(seq);
+ check_snd("sync output", err);
+ if (sleep(1))
+ fatal("aborted");
+ ev->data.ext.ptr += MIDI_BYTES_PER_SEC;
+ length -= MIDI_BYTES_PER_SEC;
+ }
+ ev->data.ext.len = length;
+}
+
+static void play_midi(void)
+{
+ snd_seq_event_t ev;
+ int i, max_tick, err;
+
+ /* calculate length of the entire file */
+ max_tick = -1;
+ for (i = 0; i < num_tracks; ++i) {
+ if (tracks[i].end_tick > max_tick)
+ max_tick = tracks[i].end_tick;
+ }
+
+ /* initialize current position in each track */
+ for (i = 0; i < num_tracks; ++i)
+ tracks[i].current_event = tracks[i].first_event;
+
+ /* common settings for all our events */
+ snd_seq_ev_clear(&ev);
+ ev.queue = queue;
+ ev.source.port = 0;
+ ev.flags = SND_SEQ_TIME_STAMP_TICK;
+
+ err = snd_seq_start_queue(seq, queue, NULL);
+ check_snd("start queue", err);
+ /* The queue won't be started until the START_QUEUE event is
+ * actually drained to the kernel, which is exactly what we want. */
+
+ for (;;) {
+ struct event* event = NULL;
+ struct track* event_track = NULL;
+ int i, min_tick = max_tick + 1;
+
+ /* search next event */
+ for (i = 0; i < num_tracks; ++i) {
+ struct track *track = &tracks[i];
+ struct event *e2 = track->current_event;
+ if (e2 && e2->tick < min_tick) {
+ min_tick = e2->tick;
+ event = e2;
+ event_track = track;
+ }
+ }
+ if (!event)
+ break; /* end of song reached */
+
+ /* advance pointer to next event */
+ event_track->current_event = event->next;
+
+ /* output the event */
+ ev.type = event->type;
+ ev.time.tick = event->tick;
+ ev.dest = ports[event->port];
+ switch (ev.type) {
+ case SND_SEQ_EVENT_NOTEON:
+ case SND_SEQ_EVENT_NOTEOFF:
+ case SND_SEQ_EVENT_KEYPRESS:
+ snd_seq_ev_set_fixed(&ev);
+ ev.data.note.channel = event->data.d[0];
+ ev.data.note.note = event->data.d[1];
+ ev.data.note.velocity = event->data.d[2];
+ break;
+ case SND_SEQ_EVENT_CONTROLLER:
+ snd_seq_ev_set_fixed(&ev);
+ ev.data.control.channel = event->data.d[0];
+ ev.data.control.param = event->data.d[1];
+ ev.data.control.value = event->data.d[2];
+ break;
+ case SND_SEQ_EVENT_PGMCHANGE:
+ case SND_SEQ_EVENT_CHANPRESS:
+ snd_seq_ev_set_fixed(&ev);
+ ev.data.control.channel = event->data.d[0];
+ ev.data.control.value = event->data.d[1];
+ break;
+ case SND_SEQ_EVENT_PITCHBEND:
+ snd_seq_ev_set_fixed(&ev);
+ ev.data.control.channel = event->data.d[0];
+ ev.data.control.value =
+ ((event->data.d[1]) |
+ ((event->data.d[2]) << 7)) - 0x2000;
+ break;
+ case SND_SEQ_EVENT_SYSEX:
+ snd_seq_ev_set_variable(&ev, event->data.length,
+ event->sysex);
+ handle_big_sysex(&ev);
+ break;
+ case SND_SEQ_EVENT_TEMPO:
+ snd_seq_ev_set_fixed(&ev);
+ ev.dest.client = SND_SEQ_CLIENT_SYSTEM;
+ ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER;
+ ev.data.queue.queue = queue;
+ ev.data.queue.param.value = event->data.tempo;
+ break;
+ default:
+ fatal("Invalid event type %d!", ev.type);
+ }
+
+ /* this blocks when the output pool has been filled */
+ err = snd_seq_event_output(seq, &ev);
+ check_snd("output event", err);
+ }
+
+ /* schedule queue stop at end of song */
+ snd_seq_ev_set_fixed(&ev);
+ ev.type = SND_SEQ_EVENT_STOP;
+ ev.time.tick = max_tick;
+ ev.dest.client = SND_SEQ_CLIENT_SYSTEM;
+ ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER;
+ ev.data.queue.queue = queue;
+ err = snd_seq_event_output(seq, &ev);
+ check_snd("output event", err);
+
+ /* make sure that the sequencer sees all our events */
+ err = snd_seq_drain_output(seq);
+ check_snd("drain output", err);
+
+ /*
+ * There are three possibilities how to wait until all events have
+ * been played:
+ * 1) send an event back to us (like pmidi does), and wait for it;
+ * 2) wait for the EVENT_STOP notification for our queue which is sent
+ * by the system timer port (this would require a subscription);
+ * 3) wait until the output pool is empty.
+ * The last is the simplest.
+ */
+ err = snd_seq_sync_output_queue(seq);
+ check_snd("sync output", err);
+
+ /* give the last notes time to die away */
+ if (end_delay > 0)
+ sleep(end_delay);
+}
+
+static void play_file(void)
+{
+ int ok;
+
+ if (!strcmp(file_name, "-"))
+ file = stdin;
+ else
+ file = fopen(file_name, "rb");
+ if (!file) {
+ errormsg("Cannot open %s - %s", file_name, strerror(errno));
+ return;
+ }
+
+ file_offset = 0;
+ ok = 0;
+
+ switch (read_id()) {
+ case MAKE_ID('M', 'T', 'h', 'd'):
+ ok = read_smf();
+ break;
+ case MAKE_ID('R', 'I', 'F', 'F'):
+ ok = read_riff();
+ break;
+ default:
+ errormsg("%s is not a Standard MIDI File", file_name);
+ break;
+ }
+
+ if (file != stdin)
+ fclose(file);
+
+ if (ok)
+ play_midi();
+
+ cleanup_file_data();
+}
+
+static void list_ports(void)
+{
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+
+ puts(" Port Client name Port name");
+
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+ int client = snd_seq_client_info_get_client(cinfo);
+
+ snd_seq_port_info_set_client(pinfo, client);
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (snd_seq_query_next_port(seq, pinfo) >= 0) {
+ /* port must understand MIDI messages */
+ if (!(snd_seq_port_info_get_type(pinfo)
+ & SND_SEQ_PORT_TYPE_MIDI_GENERIC))
+ continue;
+ /* we need both WRITE and SUBS_WRITE */
+ if ((snd_seq_port_info_get_capability(pinfo)
+ & (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE))
+ != (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE))
+ continue;
+ printf("%3d:%-3d %-32.32s %s\n",
+ snd_seq_port_info_get_client(pinfo),
+ snd_seq_port_info_get_port(pinfo),
+ snd_seq_client_info_get_name(cinfo),
+ snd_seq_port_info_get_name(pinfo));
+ }
+ }
+}
+
+static void usage(const char *argv0)
+{
+ printf(
+ "Usage: %s -p client:port[,...] [-d delay] midifile ...\n"
+ "-h, --help this help\n"
+ "-V, --version print current version\n"
+ "-l, --list list all possible output ports\n"
+ "-p, --port=client:port,... set port(s) to play to\n"
+ "-d, --delay=seconds delay after song ends\n",
+ argv0);
+}
+
+static void version(void)
+{
+ puts("aplaymidi version " SND_UTIL_VERSION_STR);
+}
+
+int main(int argc, char *argv[])
+{
+ static const char short_options[] = "hVlp:d:";
+ static const struct option long_options[] = {
+ {"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 'V'},
+ {"list", 0, NULL, 'l'},
+ {"port", 1, NULL, 'p'},
+ {"delay", 1, NULL, 'd'},
+ {}
+ };
+ int c;
+ int do_list = 0;
+
+ init_seq();
+
+ while ((c = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (c) {
+ case 'h':
+ usage(argv[0]);
+ return 0;
+ case 'V':
+ version();
+ return 0;
+ case 'l':
+ do_list = 1;
+ break;
+ case 'p':
+ parse_ports(optarg);
+ break;
+ case 'd':
+ end_delay = atoi(optarg);
+ break;
+ default:
+ usage(argv[0]);
+ return 1;
+ }
+ }
+
+ if (do_list) {
+ list_ports();
+ } else {
+ if (port_count < 1) {
+ /* use env var for compatibility with pmidi */
+ const char *ports_str = getenv("ALSA_OUTPUT_PORTS");
+ if (ports_str)
+ parse_ports(ports_str);
+ if (port_count < 1) {
+ errormsg("Please specify at least one port with --port.");
+ return 1;
+ }
+ }
+ if (optind >= argc) {
+ errormsg("Please specify a file to play.");
+ return 1;
+ }
+
+ create_source_port();
+ create_queue();
+ connect_ports();
+
+ for (; optind < argc; ++optind) {
+ file_name = argv[optind];
+ play_file();
+ }
+ }
+ snd_seq_close(seq);
+ return 0;
+}
diff --git a/alsa-utils/seq/aplaymidi/arecordmidi.1 b/alsa-utils/seq/aplaymidi/arecordmidi.1
new file mode 100644
index 0000000..78b3a3a
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/arecordmidi.1
@@ -0,0 +1,82 @@
+.TH ARECORDMIDI 1 "17 Sep 2007"
+
+.SH NAME
+arecordmidi \- record Standard MIDI Files
+
+.SH SYNOPSIS
+.B arecordmidi
+\-p client:port[,...] [options] midifile
+
+.SH DESCRIPTION
+.B arecordmidi
+is a command-line utility that records a Standard MIDI File from one or
+more ALSA sequencer ports.
+
+To stop recording, press Ctrl+C.
+
+.SH OPTIONS
+
+.TP
+.I \-h,\-\-help
+Prints a list of options.
+
+.TP
+.I \-V,\-\-version
+Prints the current version.
+
+.TP
+.I \-l,\-\-list
+Prints a list of possible input ports.
+
+.TP
+.I \-p,\-\-port=client:port,...
+Sets the sequencer port(s) from which events are recorded.
+
+A client can be specified by its number, its name, or a prefix of its
+name. A port is specified by its number; for port 0 of a client, the
+":0" part of the port specification can be omitted.
+
+.TP
+.I \-b,\-\-bpm=beats
+Sets the musical tempo of the MIDI file, in beats per minute.
+The default value is 120 BPM.
+
+.TP
+.I \-f,\-\-fps=frames
+Sets the SMPTE resolution, in frames per second.
+Possible values are 24, 25, 29.97 (for 30 drop-frame), and 30.
+
+.TP
+.I \-t,\-\-ticks=ticks
+Sets the resolution of timestamps (ticks) in the MIDI file,
+in ticks per beat (when using musical tempo) or ticks per frame
+(when using SMPTE timing).
+The default value is 384 ticks/beat or 40 ticks/frame, respectively.
+
+.TP
+.I \-s,\-\-split\-channels
+Specifies that the data for each MIDI channel should be written to a
+separate track in the MIDI file.
+This will result in a "format 1" file.
+Otherwise, when there is only one track,
+.B arecordmidi
+will generate a "format 0" file.
+
+.TP
+.I \-m,\-\-metronome=client:port
+Plays a metronome signal on the specified sequencer port.
+
+Metronome sounds are played on channel 10, MIDI notes 33 & 34 (GM2/GS/XG
+metronome standard notes), with velocity 100 and duration 1.
+
+.TP
+.I \-i,\-\-timesig=numerator:denominator
+Sets the time signature for the MIDI file and metronome.
+
+The time signature is specified as usual with two numbers, representing
+the numerator and denominator of the time signature as it would be
+notated. The denominator must be a power of two. Both numbers should be
+separated by a colon. The time signature is 4:4 by default.
+
+.SH AUTHOR
+Clemens Ladisch <clemens@ladisch.de>
diff --git a/alsa-utils/seq/aplaymidi/arecordmidi.c b/alsa-utils/seq/aplaymidi/arecordmidi.c
new file mode 100644
index 0000000..9628086
--- /dev/null
+++ b/alsa-utils/seq/aplaymidi/arecordmidi.c
@@ -0,0 +1,880 @@
+/*
+ * arecordmidi.c - record standard MIDI files from sequencer ports
+ *
+ * Copyright (c) 2004-2005 Clemens Ladisch <clemens@ladisch.de>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* TODO: sequencer queue timer selection */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <signal.h>
+#include <getopt.h>
+#include <sys/poll.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "version.h"
+
+#define BUFFER_SIZE 4088
+
+/* linked list of buffers, stores data as in the .mid file */
+struct buffer {
+ struct buffer *next;
+ unsigned char buf[BUFFER_SIZE];
+};
+
+struct smf_track {
+ int size; /* size of entire data */
+ int cur_buf_size; /* size of cur_buf */
+ struct buffer *cur_buf;
+ snd_seq_tick_time_t last_tick; /* end of track */
+ unsigned char last_command; /* used for running status */
+ int used; /* anything record on this track */
+ struct buffer first_buf; /* list head */
+};
+
+/* timing/sysex + 16 channels */
+#define TRACKS_PER_PORT 17
+
+/* metronome settings */
+/* TODO: create options for this */
+#define METRONOME_CHANNEL 9
+#define METRONOME_STRONG_NOTE 34
+#define METRONOME_WEAK_NOTE 33
+#define METRONOME_VELOCITY 100
+#define METRONOME_PROGRAM 0
+
+static snd_seq_t *seq;
+static int client;
+static int port_count;
+static snd_seq_addr_t *ports;
+static int queue;
+static int smpte_timing = 0;
+static int beats = 120;
+static int frames;
+static int ticks = 0;
+static FILE *file;
+static int channel_split;
+static int num_tracks;
+static struct smf_track *tracks;
+static volatile sig_atomic_t stop = 0;
+static int use_metronome = 0;
+static snd_seq_addr_t metronome_port;
+static int metronome_weak_note = METRONOME_WEAK_NOTE;
+static int metronome_strong_note = METRONOME_STRONG_NOTE;
+static int metronome_velocity = METRONOME_VELOCITY;
+static int metronome_program = METRONOME_PROGRAM;
+static int metronome_channel = METRONOME_CHANNEL;
+static int ts_num = 4; /* time signature: numerator */
+static int ts_div = 4; /* time signature: denominator */
+static int ts_dd = 2; /* time signature: denominator as a power of two */
+
+
+/* prints an error message to stderr, and dies */
+static void fatal(const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+ exit(EXIT_FAILURE);
+}
+
+/* memory allocation error handling */
+static void check_mem(void *p)
+{
+ if (!p)
+ fatal("Out of memory");
+}
+
+/* error handling for ALSA functions */
+static void check_snd(const char *operation, int err)
+{
+ if (err < 0)
+ fatal("Cannot %s - %s", operation, snd_strerror(err));
+}
+
+static void init_seq(void)
+{
+ int err;
+
+ /* open sequencer */
+ err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
+ check_snd("open sequencer", err);
+
+ /* find out our client's id */
+ client = snd_seq_client_id(seq);
+ check_snd("get client id", client);
+
+ /* set our client's name */
+ err = snd_seq_set_client_name(seq, "arecordmidi");
+ check_snd("set client name", err);
+}
+
+/* parses one or more port addresses from the string */
+static void parse_ports(const char *arg)
+{
+ char *buf, *s, *port_name;
+ int err;
+
+ /* make a copy of the string because we're going to modify it */
+ buf = strdup(arg);
+ check_mem(buf);
+
+ for (port_name = s = buf; s; port_name = s + 1) {
+ /* Assume that ports are separated by commas. We don't use
+ * spaces because those are valid in client names. */
+ s = strchr(port_name, ',');
+ if (s)
+ *s = '\0';
+
+ ++port_count;
+ ports = realloc(ports, port_count * sizeof(snd_seq_addr_t));
+ check_mem(ports);
+
+ err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name);
+ if (err < 0)
+ fatal("Invalid port %s - %s", port_name, snd_strerror(err));
+ }
+
+ free(buf);
+}
+
+/* parses the metronome port address */
+static void init_metronome(const char *arg)
+{
+ int err;
+
+ err = snd_seq_parse_address(seq, &metronome_port, arg);
+ if (err < 0)
+ fatal("Invalid port %s - %s", arg, snd_strerror(err));
+ use_metronome = 1;
+}
+
+/* parses time signature specification */
+static void time_signature(const char *arg)
+{
+ long x = 0;
+ char *sep;
+
+ x = strtol(arg, &sep, 10);
+ if (x < 1 || x > 64 || *sep != ':')
+ fatal("Invalid time signature (%s)", arg);
+ ts_num = x;
+ x = strtol(++sep, NULL, 10);
+ if (x < 1 || x > 64)
+ fatal("Invalid time signature (%s)", arg);
+ ts_div = x;
+ for (ts_dd = 0; x > 1; x /= 2)
+ ++ts_dd;
+}
+
+/*
+ * Metronome implementation
+ */
+static void metronome_note(unsigned char note, unsigned int tick)
+{
+ snd_seq_event_t ev;
+ snd_seq_ev_clear(&ev);
+ snd_seq_ev_set_note(&ev, metronome_channel, note, metronome_velocity, 1);
+ snd_seq_ev_schedule_tick(&ev, queue, 0, tick);
+ snd_seq_ev_set_source(&ev, port_count);
+ snd_seq_ev_set_subs(&ev);
+ snd_seq_event_output(seq, &ev);
+}
+
+static void metronome_echo(unsigned int tick)
+{
+ snd_seq_event_t ev;
+ snd_seq_ev_clear(&ev);
+ ev.type = SND_SEQ_EVENT_USR0;
+ snd_seq_ev_schedule_tick(&ev, queue, 0, tick);
+ snd_seq_ev_set_source(&ev, port_count);
+ snd_seq_ev_set_dest(&ev, client, port_count);
+ snd_seq_event_output(seq, &ev);
+}
+
+static void metronome_pattern(unsigned int tick)
+{
+ int j, t, duration;
+
+ t = tick;
+ duration = ticks * 4 / ts_div;
+ for (j = 0; j < ts_num; j++) {
+ metronome_note(j ? metronome_weak_note : metronome_strong_note, t);
+ t += duration;
+ }
+ metronome_echo(t);
+ snd_seq_drain_output(seq);
+}
+
+static void metronome_set_program(void)
+{
+ snd_seq_event_t ev;
+
+ snd_seq_ev_clear(&ev);
+ snd_seq_ev_set_pgmchange(&ev, metronome_channel, metronome_program);
+ snd_seq_ev_set_source(&ev, port_count);
+ snd_seq_ev_set_subs(&ev);
+ snd_seq_event_output(seq, &ev);
+}
+
+static void init_tracks(void)
+{
+ int i;
+
+ /* MIDI RP-019 says we need at least one track per port */
+ num_tracks = port_count;
+ /* Allocate one track for each possible channel.
+ * Empty tracks won't be written to the file. */
+ if (channel_split)
+ num_tracks *= TRACKS_PER_PORT;
+
+ tracks = calloc(num_tracks, sizeof(struct smf_track));
+ check_mem(tracks);
+ for (i = 0; i < num_tracks; ++i)
+ tracks[i].cur_buf = &tracks[i].first_buf;
+}
+
+static void create_queue(void)
+{
+ snd_seq_queue_tempo_t *tempo;
+ int err;
+
+ queue = snd_seq_alloc_named_queue(seq, "arecordmidi");
+ check_snd("create queue", queue);
+
+ snd_seq_queue_tempo_alloca(&tempo);
+ if (!smpte_timing) {
+ snd_seq_queue_tempo_set_tempo(tempo, 60000000 / beats);
+ snd_seq_queue_tempo_set_ppq(tempo, ticks);
+ } else {
+ /*
+ * ALSA doesn't know about the SMPTE time divisions, so
+ * we pretend to have a musical tempo with the equivalent
+ * number of ticks/s.
+ */
+ switch (frames) {
+ case 24:
+ snd_seq_queue_tempo_set_tempo(tempo, 500000);
+ snd_seq_queue_tempo_set_ppq(tempo, 12 * ticks);
+ break;
+ case 25:
+ snd_seq_queue_tempo_set_tempo(tempo, 400000);
+ snd_seq_queue_tempo_set_ppq(tempo, 10 * ticks);
+ break;
+ case 29:
+ snd_seq_queue_tempo_set_tempo(tempo, 100000000);
+ snd_seq_queue_tempo_set_ppq(tempo, 2997 * ticks);
+ break;
+ case 30:
+ snd_seq_queue_tempo_set_tempo(tempo, 500000);
+ snd_seq_queue_tempo_set_ppq(tempo, 15 * ticks);
+ break;
+ default:
+ fatal("Invalid SMPTE frames %d", frames);
+ }
+ }
+ err = snd_seq_set_queue_tempo(seq, queue, tempo);
+ if (err < 0)
+ fatal("Cannot set queue tempo (%u/%i)",
+ snd_seq_queue_tempo_get_tempo(tempo),
+ snd_seq_queue_tempo_get_ppq(tempo));
+}
+
+static void create_ports(void)
+{
+ snd_seq_port_info_t *pinfo;
+ int i, err;
+ char name[32];
+
+ snd_seq_port_info_alloca(&pinfo);
+
+ /* common information for all our ports */
+ snd_seq_port_info_set_capability(pinfo,
+ SND_SEQ_PORT_CAP_WRITE |
+ SND_SEQ_PORT_CAP_SUBS_WRITE);
+ snd_seq_port_info_set_type(pinfo,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC |
+ SND_SEQ_PORT_TYPE_APPLICATION);
+ snd_seq_port_info_set_midi_channels(pinfo, 16);
+
+ /* we want to know when the events got delivered to us */
+ snd_seq_port_info_set_timestamping(pinfo, 1);
+ snd_seq_port_info_set_timestamp_queue(pinfo, queue);
+
+ /* our port number is the same as our port index */
+ snd_seq_port_info_set_port_specified(pinfo, 1);
+ for (i = 0; i < port_count; ++i) {
+ snd_seq_port_info_set_port(pinfo, i);
+
+ sprintf(name, "arecordmidi port %i", i);
+ snd_seq_port_info_set_name(pinfo, name);
+
+ err = snd_seq_create_port(seq, pinfo);
+ check_snd("create port", err);
+ }
+
+ /* create an optional metronome port */
+ if (use_metronome) {
+ snd_seq_port_info_set_port(pinfo, port_count);
+ snd_seq_port_info_set_name(pinfo, "arecordmidi metronome");
+ snd_seq_port_info_set_capability(pinfo,
+ SND_SEQ_PORT_CAP_READ |
+ SND_SEQ_PORT_CAP_WRITE);
+ snd_seq_port_info_set_type(pinfo, SND_SEQ_PORT_TYPE_APPLICATION);
+ snd_seq_port_info_set_midi_channels(pinfo, 0);
+ snd_seq_port_info_set_timestamping(pinfo, 0);
+ err = snd_seq_create_port(seq, pinfo);
+ check_snd("create metronome port", err);
+ }
+}
+
+static void connect_ports(void)
+{
+ int i, err;
+
+ for (i = 0; i < port_count; ++i) {
+ err = snd_seq_connect_from(seq, i, ports[i].client, ports[i].port);
+ if (err < 0)
+ fatal("Cannot connect from port %d:%d - %s",
+ ports[i].client, ports[i].port, snd_strerror(err));
+ }
+
+ /* subscribe the metronome port */
+ if (use_metronome) {
+ err = snd_seq_connect_to(seq, port_count, metronome_port.client, metronome_port.port);
+ if (err < 0)
+ fatal("Cannot connect to port %d:%d - %s",
+ metronome_port.client, metronome_port.port, snd_strerror(err));
+ }
+}
+
+/* records a byte to be written to the .mid file */
+static void add_byte(struct smf_track *track, unsigned char byte)
+{
+ /* make sure we have enough room in the current buffer */
+ if (track->cur_buf_size >= BUFFER_SIZE) {
+ track->cur_buf->next = calloc(1, sizeof(struct buffer));
+ if (!track->cur_buf->next)
+ fatal("out of memory");
+ track->cur_buf = track->cur_buf->next;
+ track->cur_buf_size = 0;
+ }
+
+ track->cur_buf->buf[track->cur_buf_size++] = byte;
+ track->size++;
+}
+
+/* record a variable-length quantity */
+static void var_value(struct smf_track *track, int v)
+{
+ if (v >= (1 << 28))
+ add_byte(track, 0x80 | ((v >> 28) & 0x03));
+ if (v >= (1 << 21))
+ add_byte(track, 0x80 | ((v >> 21) & 0x7f));
+ if (v >= (1 << 14))
+ add_byte(track, 0x80 | ((v >> 14) & 0x7f));
+ if (v >= (1 << 7))
+ add_byte(track, 0x80 | ((v >> 7) & 0x7f));
+ add_byte(track, v & 0x7f);
+}
+
+/* record the delta time from the last event */
+static void delta_time(struct smf_track *track, const snd_seq_event_t *ev)
+{
+ int diff = ev->time.tick - track->last_tick;
+ if (diff < 0)
+ diff = 0;
+ var_value(track, diff);
+ track->last_tick = ev->time.tick;
+}
+
+/* record a status byte (or not if we can use running status) */
+static void command(struct smf_track *track, unsigned char cmd)
+{
+ if (cmd != track->last_command)
+ add_byte(track, cmd);
+ track->last_command = cmd < 0xf0 ? cmd : 0;
+}
+
+/* put port numbers into all tracks */
+static void record_port_numbers(void)
+{
+ int i;
+
+ for (i = 0; i < num_tracks; ++i) {
+ var_value(&tracks[i], 0);
+ add_byte(&tracks[i], 0xff);
+ add_byte(&tracks[i], 0x21);
+ var_value(&tracks[i], 1);
+ if (channel_split)
+ add_byte(&tracks[i], i / TRACKS_PER_PORT);
+ else
+ add_byte(&tracks[i], i);
+ }
+}
+
+static void record_event(const snd_seq_event_t *ev)
+{
+ unsigned int i;
+ struct smf_track *track;
+
+ /* ignore events without proper timestamps */
+ if (ev->queue != queue || !snd_seq_ev_is_tick(ev))
+ return;
+
+ /* determine which track to record to */
+ i = ev->dest.port;
+ if (i == port_count) {
+ if (ev->type == SND_SEQ_EVENT_USR0)
+ metronome_pattern(ev->time.tick);
+ return;
+ }
+ if (channel_split) {
+ i *= TRACKS_PER_PORT;
+ if (snd_seq_ev_is_channel_type(ev))
+ i += 1 + (ev->data.note.channel & 0xf);
+ }
+ if (i >= num_tracks)
+ return;
+ track = &tracks[i];
+
+ switch (ev->type) {
+ case SND_SEQ_EVENT_NOTEON:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_NOTE_ON | (ev->data.note.channel & 0xf));
+ add_byte(track, ev->data.note.note & 0x7f);
+ add_byte(track, ev->data.note.velocity & 0x7f);
+ break;
+ case SND_SEQ_EVENT_NOTEOFF:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_NOTE_OFF | (ev->data.note.channel & 0xf));
+ add_byte(track, ev->data.note.note & 0x7f);
+ add_byte(track, ev->data.note.velocity & 0x7f);
+ break;
+ case SND_SEQ_EVENT_KEYPRESS:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_NOTE_PRESSURE | (ev->data.note.channel & 0xf));
+ add_byte(track, ev->data.note.note & 0x7f);
+ add_byte(track, ev->data.note.velocity & 0x7f);
+ break;
+ case SND_SEQ_EVENT_CONTROLLER:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf));
+ add_byte(track, ev->data.control.param & 0x7f);
+ add_byte(track, ev->data.control.value & 0x7f);
+ break;
+ case SND_SEQ_EVENT_PGMCHANGE:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_PGM_CHANGE | (ev->data.control.channel & 0xf));
+ add_byte(track, ev->data.control.value & 0x7f);
+ break;
+ case SND_SEQ_EVENT_CHANPRESS:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_CHANNEL_PRESSURE | (ev->data.control.channel & 0xf));
+ add_byte(track, ev->data.control.value & 0x7f);
+ break;
+ case SND_SEQ_EVENT_PITCHBEND:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_BENDER | (ev->data.control.channel & 0xf));
+ add_byte(track, (ev->data.control.value + 8192) & 0x7f);
+ add_byte(track, ((ev->data.control.value + 8192) >> 7) & 0x7f);
+ break;
+ case SND_SEQ_EVENT_CONTROL14:
+ /* create two commands for MSB and LSB */
+ delta_time(track, ev);
+ command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf));
+ add_byte(track, ev->data.control.param & 0x7f);
+ add_byte(track, (ev->data.control.value >> 7) & 0x7f);
+ if ((ev->data.control.param & 0x7f) < 0x20) {
+ delta_time(track, ev);
+ /* running status */
+ add_byte(track, (ev->data.control.param & 0x7f) + 0x20);
+ add_byte(track, ev->data.control.value & 0x7f);
+ }
+ break;
+ case SND_SEQ_EVENT_NONREGPARAM:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf));
+ add_byte(track, MIDI_CTL_NONREG_PARM_NUM_LSB);
+ add_byte(track, ev->data.control.param & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_NONREG_PARM_NUM_MSB);
+ add_byte(track, (ev->data.control.param >> 7) & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_MSB_DATA_ENTRY);
+ add_byte(track, (ev->data.control.value >> 7) & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_LSB_DATA_ENTRY);
+ add_byte(track, ev->data.control.value & 0x7f);
+ break;
+ case SND_SEQ_EVENT_REGPARAM:
+ delta_time(track, ev);
+ command(track, MIDI_CMD_CONTROL | (ev->data.control.channel & 0xf));
+ add_byte(track, MIDI_CTL_REGIST_PARM_NUM_LSB);
+ add_byte(track, ev->data.control.param & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_REGIST_PARM_NUM_MSB);
+ add_byte(track, (ev->data.control.param >> 7) & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_MSB_DATA_ENTRY);
+ add_byte(track, (ev->data.control.value >> 7) & 0x7f);
+ delta_time(track, ev);
+ add_byte(track, MIDI_CTL_LSB_DATA_ENTRY);
+ add_byte(track, ev->data.control.value & 0x7f);
+ break;
+#if 0 /* ignore */
+ case SND_SEQ_EVENT_SONGPOS:
+ case SND_SEQ_EVENT_SONGSEL:
+ case SND_SEQ_EVENT_QFRAME:
+ case SND_SEQ_EVENT_START:
+ case SND_SEQ_EVENT_CONTINUE:
+ case SND_SEQ_EVENT_STOP:
+ case SND_SEQ_EVENT_TUNE_REQUEST:
+ case SND_SEQ_EVENT_RESET:
+ case SND_SEQ_EVENT_SENSING:
+ break;
+#endif
+ case SND_SEQ_EVENT_SYSEX:
+ if (ev->data.ext.len == 0)
+ break;
+ delta_time(track, ev);
+ if (*(unsigned char*)ev->data.ext.ptr == 0xf0)
+ command(track, 0xf0), i = 1;
+ else
+ command(track, 0xf7), i = 0;
+ var_value(track, ev->data.ext.len - i);
+ for (; i < ev->data.ext.len; ++i)
+ add_byte(track, ((unsigned char*)ev->data.ext.ptr)[i]);
+ break;
+ default:
+ return;
+ }
+ track->used = 1;
+}
+
+static void finish_tracks(void)
+{
+ snd_seq_queue_status_t *queue_status;
+ int tick, i, err;
+
+ snd_seq_queue_status_alloca(&queue_status);
+
+ err = snd_seq_get_queue_status(seq, queue, queue_status);
+ check_snd("get queue status", err);
+ tick = snd_seq_queue_status_get_tick_time(queue_status);
+
+ /* make length of first track the recording length */
+ var_value(&tracks[0], tick - tracks[0].last_tick);
+ add_byte(&tracks[0], 0xff);
+ add_byte(&tracks[0], 0x2f);
+ var_value(&tracks[0], 0);
+
+ /* finish other tracks */
+ for (i = 1; i < num_tracks; ++i) {
+ var_value(&tracks[i], 0);
+ add_byte(&tracks[i], 0xff);
+ add_byte(&tracks[i], 0x2f);
+ var_value(&tracks[i], 0);
+ }
+}
+
+static void write_file(void)
+{
+ int used_tracks, time_division, i;
+ struct buffer *buf;
+
+ used_tracks = 0;
+ for (i = 0; i < num_tracks; ++i)
+ used_tracks += !!tracks[i].used;
+
+ /* header id and length */
+ fwrite("MThd\0\0\0\6", 1, 8, file);
+ /* type 0 or 1 */
+ fputc(0, file);
+ fputc(used_tracks > 1, file);
+ /* number of tracks */
+ fputc((used_tracks >> 8) & 0xff, file);
+ fputc(used_tracks & 0xff, file);
+ /* time division */
+ time_division = ticks;
+ if (smpte_timing)
+ time_division |= (0x100 - frames) << 8;
+ fputc(time_division >> 8, file);
+ fputc(time_division & 0xff, file);
+
+ for (i = 0; i < num_tracks; ++i) {
+ if (!tracks[i].used)
+ continue;
+ /* track id */
+ fwrite("MTrk", 1, 4, file);
+ /* data length */
+ fputc((tracks[i].size >> 24) & 0xff, file);
+ fputc((tracks[i].size >> 16) & 0xff, file);
+ fputc((tracks[i].size >> 8) & 0xff, file);
+ fputc(tracks[i].size & 0xff, file);
+ /* track contents */
+ for (buf = &tracks[i].first_buf; buf; buf = buf->next)
+ fwrite(buf->buf, 1, buf == tracks[i].cur_buf
+ ? tracks[i].cur_buf_size : BUFFER_SIZE, file);
+ }
+}
+
+static void list_ports(void)
+{
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+
+ puts(" Port Client name Port name");
+
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+ int client = snd_seq_client_info_get_client(cinfo);
+
+ if (client == SND_SEQ_CLIENT_SYSTEM)
+ continue; /* don't show system timer and announce ports */
+ snd_seq_port_info_set_client(pinfo, client);
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (snd_seq_query_next_port(seq, pinfo) >= 0) {
+ /* port must understand MIDI messages */
+ if (!(snd_seq_port_info_get_type(pinfo)
+ & SND_SEQ_PORT_TYPE_MIDI_GENERIC))
+ continue;
+ /* we need both READ and SUBS_READ */
+ if ((snd_seq_port_info_get_capability(pinfo)
+ & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ))
+ != (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ))
+ continue;
+ printf("%3d:%-3d %-32.32s %s\n",
+ snd_seq_port_info_get_client(pinfo),
+ snd_seq_port_info_get_port(pinfo),
+ snd_seq_client_info_get_name(cinfo),
+ snd_seq_port_info_get_name(pinfo));
+ }
+ }
+}
+
+static void help(const char *argv0)
+{
+ fprintf(stderr, "Usage: %s [options] outputfile\n"
+ "\nAvailable options:\n"
+ " -h,--help this help\n"
+ " -V,--version show version\n"
+ " -l,--list list input ports\n"
+ " -p,--port=client:port,... source port(s)\n"
+ " -b,--bpm=beats tempo in beats per minute\n"
+ " -f,--fps=frames resolution in frames per second (SMPTE)\n"
+ " -t,--ticks=ticks resolution in ticks per beat or frame\n"
+ " -s,--split-channels create a track for each channel\n"
+ " -m,--metronome=client:port play a metronome signal\n"
+ " -i,--timesig=nn:dd time signature\n",
+ argv0);
+}
+
+static void version(void)
+{
+ fputs("arecordmidi version " SND_UTIL_VERSION_STR "\n", stderr);
+}
+
+static void sighandler(int sig)
+{
+ stop = 1;
+}
+
+int main(int argc, char *argv[])
+{
+ static const char short_options[] = "hVlp:b:f:t:sdm:i:";
+ static const struct option long_options[] = {
+ {"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 'V'},
+ {"list", 0, NULL, 'l'},
+ {"port", 1, NULL, 'p'},
+ {"bpm", 1, NULL, 'b'},
+ {"fps", 1, NULL, 'f'},
+ {"ticks", 1, NULL, 't'},
+ {"split-channels", 0, NULL, 's'},
+ {"dump", 0, NULL, 'd'},
+ {"metronome", 1, NULL, 'm'},
+ {"timesig", 1, NULL, 'i'},
+ { }
+ };
+
+ char *filename = NULL;
+ int do_list = 0;
+ struct pollfd *pfds;
+ int npfds;
+ int c, err;
+
+ init_seq();
+
+ while ((c = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (c) {
+ case 'h':
+ help(argv[0]);
+ return 0;
+ case 'V':
+ version();
+ return 0;
+ case 'l':
+ do_list = 1;
+ break;
+ case 'p':
+ parse_ports(optarg);
+ break;
+ case 'b':
+ beats = atoi(optarg);
+ if (beats < 4 || beats > 6000)
+ fatal("Invalid tempo");
+ smpte_timing = 0;
+ break;
+ case 'f':
+ frames = atoi(optarg);
+ if (frames != 24 && frames != 25 &&
+ frames != 29 && frames != 30)
+ fatal("Invalid number of frames/s");
+ smpte_timing = 1;
+ break;
+ case 't':
+ ticks = atoi(optarg);
+ if (ticks < 1 || ticks > 0x7fff)
+ fatal("Invalid number of ticks");
+ break;
+ case 's':
+ channel_split = 1;
+ break;
+ case 'd':
+ fputs("The --dump option isn't supported anymore, use aseqdump instead.\n", stderr);
+ break;
+ case 'm':
+ init_metronome(optarg);
+ break;
+ case 'i':
+ time_signature(optarg);
+ break;
+ default:
+ help(argv[0]);
+ return 1;
+ }
+ }
+
+ if (do_list) {
+ list_ports();
+ return 0;
+ }
+
+ if (port_count < 1) {
+ fputs("Pleast specify a source port with --port.\n", stderr);
+ return 1;
+ }
+
+ if (!ticks)
+ ticks = smpte_timing ? 40 : 384;
+ if (smpte_timing && ticks > 0xff)
+ ticks = 0xff;
+
+ if (optind >= argc) {
+ fputs("Please specify a file to record to.\n", stderr);
+ return 1;
+ }
+ filename = argv[optind];
+
+ init_tracks();
+ create_queue();
+ create_ports();
+ connect_ports();
+ if (port_count > 1)
+ record_port_numbers();
+
+ /* record tempo */
+ if (!smpte_timing) {
+ int usecs_per_quarter = 60000000 / beats;
+ var_value(&tracks[0], 0); /* delta time */
+ add_byte(&tracks[0], 0xff);
+ add_byte(&tracks[0], 0x51);
+ var_value(&tracks[0], 3);
+ add_byte(&tracks[0], usecs_per_quarter >> 16);
+ add_byte(&tracks[0], usecs_per_quarter >> 8);
+ add_byte(&tracks[0], usecs_per_quarter);
+
+ /* time signature */
+ var_value(&tracks[0], 0); /* delta time */
+ add_byte(&tracks[0], 0xff);
+ add_byte(&tracks[0], 0x58);
+ var_value(&tracks[0], 4);
+ add_byte(&tracks[0], ts_num);
+ add_byte(&tracks[0], ts_dd);
+ add_byte(&tracks[0], 24); /* MIDI clocks per metronome click */
+ add_byte(&tracks[0], 8); /* notated 32nd-notes per MIDI quarter note */
+ }
+
+ /* always write at least one track */
+ tracks[0].used = 1;
+
+ file = fopen(filename, "wb");
+ if (!file)
+ fatal("Cannot open %s - %s", filename, strerror(errno));
+
+ err = snd_seq_start_queue(seq, queue, NULL);
+ check_snd("start queue", err);
+ snd_seq_drain_output(seq);
+
+ err = snd_seq_nonblock(seq, 1);
+ check_snd("set nonblock mode", err);
+
+ if (use_metronome) {
+ metronome_set_program();
+ metronome_pattern(0);
+ }
+
+ signal(SIGINT, sighandler);
+ signal(SIGTERM, sighandler);
+
+ npfds = snd_seq_poll_descriptors_count(seq, POLLIN);
+ pfds = alloca(sizeof(*pfds) * npfds);
+ for (;;) {
+ snd_seq_poll_descriptors(seq, pfds, npfds, POLLIN);
+ if (poll(pfds, npfds, -1) < 0)
+ break;
+ do {
+ snd_seq_event_t *event;
+ err = snd_seq_event_input(seq, &event);
+ if (err < 0)
+ break;
+ if (event)
+ record_event(event);
+ } while (err > 0);
+ if (stop)
+ break;
+ }
+
+ finish_tracks();
+ write_file();
+
+ fclose(file);
+ snd_seq_close(seq);
+ return 0;
+}
diff --git a/alsa-utils/seq/aseqdump/Makefile.am b/alsa-utils/seq/aseqdump/Makefile.am
new file mode 100644
index 0000000..d918d9f
--- /dev/null
+++ b/alsa-utils/seq/aseqdump/Makefile.am
@@ -0,0 +1,5 @@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = aseqdump.1
+
+bin_PROGRAMS = aseqdump
+man_MANS = aseqdump.1
diff --git a/alsa-utils/seq/aseqdump/Makefile.in b/alsa-utils/seq/aseqdump/Makefile.in
new file mode 100644
index 0000000..f2971a5
--- /dev/null
+++ b/alsa-utils/seq/aseqdump/Makefile.in
@@ -0,0 +1,498 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aseqdump$(EXEEXT)
+subdir = seq/aseqdump
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+aseqdump_SOURCES = aseqdump.c
+aseqdump_OBJECTS = aseqdump.$(OBJEXT)
+aseqdump_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = aseqdump.c
+DIST_SOURCES = aseqdump.c
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = aseqdump.1
+man_MANS = aseqdump.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aseqdump/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign seq/aseqdump/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+aseqdump$(EXEEXT): $(aseqdump_OBJECTS) $(aseqdump_DEPENDENCIES)
+ @rm -f aseqdump$(EXEEXT)
+ $(LINK) $(aseqdump_LDFLAGS) $(aseqdump_OBJECTS) $(aseqdump_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aseqdump.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/seq/aseqdump/aseqdump.1 b/alsa-utils/seq/aseqdump/aseqdump.1
new file mode 100644
index 0000000..f6f2aa9
--- /dev/null
+++ b/alsa-utils/seq/aseqdump/aseqdump.1
@@ -0,0 +1,39 @@
+.TH ASEQDUMP 1 "19 Feb 2005"
+
+.SH NAME
+aseqdump \- show the events received at an ALSA sequencer port
+
+.SH SYNOPSIS
+.B aseqdump
+[\fI\-p client:port,...\fP]
+
+.SH DESCRIPTION
+.B aseqdump
+is a command-line utility that prints the sequencer events it receives as text.
+
+To stop receiving, press Ctrl+C.
+
+.SH OPTIONS
+
+.TP
+.I \-h,\-\-help
+Prints a list of options.
+
+.TP
+.I \-V,\-\-version
+Prints the current version.
+
+.TP
+.I \-l,\-\-list
+Prints a list of possible input ports.
+
+.TP
+.I \-p,\-\-port=client:port,...
+Sets the sequencer port(s) from which events are received.
+
+A client can be specified by its number, its name, or a prefix of its
+name. A port is specified by its number; for port 0 of a client, the
+":0" part of the port specification can be omitted.
+
+.SH AUTHOR
+Clemens Ladisch <clemens@ladisch.de>
diff --git a/alsa-utils/seq/aseqdump/aseqdump.c b/alsa-utils/seq/aseqdump/aseqdump.c
new file mode 100644
index 0000000..24c5d21
--- /dev/null
+++ b/alsa-utils/seq/aseqdump/aseqdump.c
@@ -0,0 +1,438 @@
+/*
+ * aseqdump.c - show the events received at an ALSA sequencer port
+ *
+ * Copyright (c) 2005 Clemens Ladisch <clemens@ladisch.de>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <signal.h>
+#include <getopt.h>
+#include <sys/poll.h>
+#include <alsa/asoundlib.h>
+#include "aconfig.h"
+#include "version.h"
+
+static snd_seq_t *seq;
+static int port_count;
+static snd_seq_addr_t *ports;
+static volatile sig_atomic_t stop = 0;
+
+
+/* prints an error message to stderr, and dies */
+static void fatal(const char *msg, ...)
+{
+ va_list ap;
+
+ va_start(ap, msg);
+ vfprintf(stderr, msg, ap);
+ va_end(ap);
+ fputc('\n', stderr);
+ exit(EXIT_FAILURE);
+}
+
+/* memory allocation error handling */
+static void check_mem(void *p)
+{
+ if (!p)
+ fatal("Out of memory");
+}
+
+/* error handling for ALSA functions */
+static void check_snd(const char *operation, int err)
+{
+ if (err < 0)
+ fatal("Cannot %s - %s", operation, snd_strerror(err));
+}
+
+static void init_seq(void)
+{
+ int err;
+
+ /* open sequencer */
+ err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);
+ check_snd("open sequencer", err);
+
+ /* set our client's name */
+ err = snd_seq_set_client_name(seq, "aseqdump");
+ check_snd("set client name", err);
+}
+
+/* parses one or more port addresses from the string */
+static void parse_ports(const char *arg)
+{
+ char *buf, *s, *port_name;
+ int err;
+
+ /* make a copy of the string because we're going to modify it */
+ buf = strdup(arg);
+ check_mem(buf);
+
+ for (port_name = s = buf; s; port_name = s + 1) {
+ /* Assume that ports are separated by commas. We don't use
+ * spaces because those are valid in client names. */
+ s = strchr(port_name, ',');
+ if (s)
+ *s = '\0';
+
+ ++port_count;
+ ports = realloc(ports, port_count * sizeof(snd_seq_addr_t));
+ check_mem(ports);
+
+ err = snd_seq_parse_address(seq, &ports[port_count - 1], port_name);
+ if (err < 0)
+ fatal("Invalid port %s - %s", port_name, snd_strerror(err));
+ }
+
+ free(buf);
+}
+
+static void create_port(void)
+{
+ int err;
+
+ err = snd_seq_create_simple_port(seq, "aseqdump",
+ SND_SEQ_PORT_CAP_WRITE |
+ SND_SEQ_PORT_CAP_SUBS_WRITE,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC |
+ SND_SEQ_PORT_TYPE_APPLICATION);
+ check_snd("create port", err);
+}
+
+static void connect_ports(void)
+{
+ int i, err;
+
+ for (i = 0; i < port_count; ++i) {
+ err = snd_seq_connect_from(seq, 0, ports[i].client, ports[i].port);
+ if (err < 0)
+ fatal("Cannot connect from port %d:%d - %s",
+ ports[i].client, ports[i].port, snd_strerror(err));
+ }
+}
+
+static void dump_event(const snd_seq_event_t *ev)
+{
+ printf("%3d:%-3d ", ev->source.client, ev->source.port);
+ switch (ev->type) {
+ case SND_SEQ_EVENT_NOTEON:
+ if (ev->data.note.velocity)
+ printf("Note on %2d, note %d, velocity %d\n",
+ ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
+ else
+ printf("Note off %2d, note %d\n",
+ ev->data.note.channel, ev->data.note.note);
+ break;
+ case SND_SEQ_EVENT_NOTEOFF:
+ printf("Note off %2d, note %d, velocity %d\n",
+ ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
+ break;
+ case SND_SEQ_EVENT_KEYPRESS:
+ printf("Polyphonic aftertouch %2d, note %d, value %d\n",
+ ev->data.note.channel, ev->data.note.note, ev->data.note.velocity);
+ break;
+ case SND_SEQ_EVENT_CONTROLLER:
+ printf("Control change %2d, controller %d, value %d\n",
+ ev->data.control.channel, ev->data.control.param, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_PGMCHANGE:
+ printf("Program change %2d, program %d\n",
+ ev->data.control.channel, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_CHANPRESS:
+ printf("Channel aftertouch %2d, value %d\n",
+ ev->data.control.channel, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_PITCHBEND:
+ printf("Pitch bend %2d, value %d\n",
+ ev->data.control.channel, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_CONTROL14:
+ printf("Control change %2d, controller %d, value %5d\n",
+ ev->data.control.channel, ev->data.control.param, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_NONREGPARAM:
+ printf("Non-reg. parameter %2d, parameter %d, value %d\n",
+ ev->data.control.channel, ev->data.control.param, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_REGPARAM:
+ printf("Reg. parameter %2d, parameter %d, value %d\n",
+ ev->data.control.channel, ev->data.control.param, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_SONGPOS:
+ printf("Song position pointer value %d\n",
+ ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_SONGSEL:
+ printf("Song select value %d\n",
+ ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_QFRAME:
+ printf("MTC quarter frame %02xh\n",
+ ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_TIMESIGN:
+ // XXX how is this encoded?
+ printf("SMF time signature (%#010x)\n",
+ ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_KEYSIGN:
+ // XXX how is this encoded?
+ printf("SMF key signature (%#010x)\n",
+ ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_START:
+ if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
+ ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
+ printf("Queue start queue %d\n",
+ ev->data.queue.queue);
+ else
+ printf("Start\n");
+ break;
+ case SND_SEQ_EVENT_CONTINUE:
+ if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
+ ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
+ printf("Queue continue queue %d\n",
+ ev->data.queue.queue);
+ else
+ printf("Continue\n");
+ break;
+ case SND_SEQ_EVENT_STOP:
+ if (ev->source.client == SND_SEQ_CLIENT_SYSTEM &&
+ ev->source.port == SND_SEQ_PORT_SYSTEM_TIMER)
+ printf("Queue stop queue %d\n",
+ ev->data.queue.queue);
+ else
+ printf("Stop\n");
+ break;
+ case SND_SEQ_EVENT_SETPOS_TICK:
+ printf("Set tick queue pos. queue %d\n", ev->data.queue.queue);
+ break;
+ case SND_SEQ_EVENT_SETPOS_TIME:
+ printf("Set rt queue pos. queue %d\n", ev->data.queue.queue);
+ break;
+ case SND_SEQ_EVENT_TEMPO:
+ printf("Set queue tempo queue %d\n", ev->data.queue.queue);
+ break;
+ case SND_SEQ_EVENT_CLOCK:
+ printf("Clock\n");
+ break;
+ case SND_SEQ_EVENT_TICK:
+ printf("Tick\n");
+ break;
+ case SND_SEQ_EVENT_QUEUE_SKEW:
+ printf("Queue timer skew queue %d\n", ev->data.queue.queue);
+ break;
+ case SND_SEQ_EVENT_TUNE_REQUEST:
+ printf("Tune request\n");
+ break;
+ case SND_SEQ_EVENT_RESET:
+ printf("Reset\n");
+ break;
+ case SND_SEQ_EVENT_SENSING:
+ printf("Active Sensing\n");
+ break;
+ case SND_SEQ_EVENT_CLIENT_START:
+ printf("Client start client %d\n",
+ ev->data.addr.client);
+ break;
+ case SND_SEQ_EVENT_CLIENT_EXIT:
+ printf("Client exit client %d\n",
+ ev->data.addr.client);
+ break;
+ case SND_SEQ_EVENT_CLIENT_CHANGE:
+ printf("Client changed client %d\n",
+ ev->data.addr.client);
+ break;
+ case SND_SEQ_EVENT_PORT_START:
+ printf("Port start %d:%d\n",
+ ev->data.addr.client, ev->data.addr.port);
+ break;
+ case SND_SEQ_EVENT_PORT_EXIT:
+ printf("Port exit %d:%d\n",
+ ev->data.addr.client, ev->data.addr.port);
+ break;
+ case SND_SEQ_EVENT_PORT_CHANGE:
+ printf("Port changed %d:%d\n",
+ ev->data.addr.client, ev->data.addr.port);
+ break;
+ case SND_SEQ_EVENT_PORT_SUBSCRIBED:
+ printf("Port subscribed %d:%d -> %d:%d\n",
+ ev->data.connect.sender.client, ev->data.connect.sender.port,
+ ev->data.connect.dest.client, ev->data.connect.dest.port);
+ break;
+ case SND_SEQ_EVENT_PORT_UNSUBSCRIBED:
+ printf("Port unsubscribed %d:%d -> %d:%d\n",
+ ev->data.connect.sender.client, ev->data.connect.sender.port,
+ ev->data.connect.dest.client, ev->data.connect.dest.port);
+ break;
+ case SND_SEQ_EVENT_SYSEX:
+ {
+ unsigned int i;
+ printf("System exclusive ");
+ for (i = 0; i < ev->data.ext.len; ++i)
+ printf(" %02X", ((unsigned char*)ev->data.ext.ptr)[i]);
+ printf("\n");
+ }
+ break;
+ default:
+ printf("Event type %d\n", ev->type);
+ }
+}
+
+static void list_ports(void)
+{
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+
+ puts(" Port Client name Port name");
+
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(seq, cinfo) >= 0) {
+ int client = snd_seq_client_info_get_client(cinfo);
+
+ snd_seq_port_info_set_client(pinfo, client);
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (snd_seq_query_next_port(seq, pinfo) >= 0) {
+ /* we need both READ and SUBS_READ */
+ if ((snd_seq_port_info_get_capability(pinfo)
+ & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ))
+ != (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ))
+ continue;
+ printf("%3d:%-3d %-32.32s %s\n",
+ snd_seq_port_info_get_client(pinfo),
+ snd_seq_port_info_get_port(pinfo),
+ snd_seq_client_info_get_name(cinfo),
+ snd_seq_port_info_get_name(pinfo));
+ }
+ }
+}
+
+static void help(const char *argv0)
+{
+ printf("Usage: %s [options]\n"
+ "\nAvailable options:\n"
+ " -h,--help this help\n"
+ " -V,--version show version\n"
+ " -l,--list list input ports\n"
+ " -p,--port=client:port,... source port(s)\n",
+ argv0);
+}
+
+static void version(void)
+{
+ puts("aseqdump version " SND_UTIL_VERSION_STR);
+}
+
+static void sighandler(int sig)
+{
+ stop = 1;
+}
+
+int main(int argc, char *argv[])
+{
+ static const char short_options[] = "hVlp:";
+ static const struct option long_options[] = {
+ {"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 'V'},
+ {"list", 0, NULL, 'l'},
+ {"port", 1, NULL, 'p'},
+ { }
+ };
+
+ int do_list = 0;
+ struct pollfd *pfds;
+ int npfds;
+ int c, err;
+
+ init_seq();
+
+ while ((c = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (c) {
+ case 'h':
+ help(argv[0]);
+ return 0;
+ case 'V':
+ version();
+ return 0;
+ case 'l':
+ do_list = 1;
+ break;
+ case 'p':
+ parse_ports(optarg);
+ break;
+ default:
+ help(argv[0]);
+ return 1;
+ }
+ }
+ if (optind < argc) {
+ help(argv[0]);
+ return 1;
+ }
+
+ if (do_list) {
+ list_ports();
+ return 0;
+ }
+
+ create_port();
+ connect_ports();
+
+ err = snd_seq_nonblock(seq, 1);
+ check_snd("set nonblock mode", err);
+
+ if (port_count > 0)
+ printf("Waiting for data.");
+ else
+ printf("Waiting for data at port %d:0.",
+ snd_seq_client_id(seq));
+ printf(" Press Ctrl+C to end.\n");
+ printf("Source Event Ch Data\n");
+
+ signal(SIGINT, sighandler);
+ signal(SIGTERM, sighandler);
+
+ npfds = snd_seq_poll_descriptors_count(seq, POLLIN);
+ pfds = alloca(sizeof(*pfds) * npfds);
+ for (;;) {
+ snd_seq_poll_descriptors(seq, pfds, npfds, POLLIN);
+ if (poll(pfds, npfds, -1) < 0)
+ break;
+ do {
+ snd_seq_event_t *event;
+ err = snd_seq_event_input(seq, &event);
+ if (err < 0)
+ break;
+ if (event)
+ dump_event(event);
+ } while (err > 0);
+ fflush(stdout);
+ if (stop)
+ break;
+ }
+
+ snd_seq_close(seq);
+ return 0;
+}
diff --git a/alsa-utils/seq/aseqnet/Makefile.am b/alsa-utils/seq/aseqnet/Makefile.am
new file mode 100644
index 0000000..2ebc4a5
--- /dev/null
+++ b/alsa-utils/seq/aseqnet/Makefile.am
@@ -0,0 +1,7 @@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = README.aseqnet aseqnet.1
+
+bin_PROGRAMS = aseqnet
+aseqnet_SOURCES = aseqnet.c
+aseqnet_LDADD = $(INTLLIBS)
+man_MANS = aseqnet.1
diff --git a/alsa-utils/seq/aseqnet/Makefile.in b/alsa-utils/seq/aseqnet/Makefile.in
new file mode 100644
index 0000000..9169d65
--- /dev/null
+++ b/alsa-utils/seq/aseqnet/Makefile.in
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = aseqnet$(EXEEXT)
+subdir = seq/aseqnet
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_aseqnet_OBJECTS = aseqnet.$(OBJEXT)
+aseqnet_OBJECTS = $(am_aseqnet_OBJECTS)
+am__DEPENDENCIES_1 =
+aseqnet_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(aseqnet_SOURCES)
+DIST_SOURCES = $(aseqnet_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+EXTRA_DIST = README.aseqnet aseqnet.1
+aseqnet_SOURCES = aseqnet.c
+aseqnet_LDADD = $(INTLLIBS)
+man_MANS = aseqnet.1
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign seq/aseqnet/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign seq/aseqnet/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+aseqnet$(EXEEXT): $(aseqnet_OBJECTS) $(aseqnet_DEPENDENCIES)
+ @rm -f aseqnet$(EXEEXT)
+ $(LINK) $(aseqnet_LDFLAGS) $(aseqnet_OBJECTS) $(aseqnet_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aseqnet.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/seq/aseqnet/README.aseqnet b/alsa-utils/seq/aseqnet/README.aseqnet
new file mode 100644
index 0000000..bd0b68e
--- /dev/null
+++ b/alsa-utils/seq/aseqnet/README.aseqnet
@@ -0,0 +1,53 @@
+================================================================
+ ALSA sequencer connectors over network
+ ver.0.1
+ Copyright (C) 1999-2000 Takashi Iwai
+================================================================
+
+* ASEQNET
+
+aseqnet is a sequencer client which sends/receives events over
+network. Suppose two hosts (hostA and hostB) connected by network.
+You need to run ALSA system on both hosts. Then, start aseqnet as a
+server on hostA:
+
+ hostA% aseqnet
+ sequencer opened: 128:0
+
+A user client 128 with port 0 was opened. (The client number may
+vary.) At next, start client on hostB. The argument is the hostname
+where server is running.
+
+ hostB% aseqnet hostA
+ sequencer opened: 132:0
+
+Now events sent to hostA:128:0 is transferred to hostB:132:0, and vice
+versa.
+
+You can connect these ports arbitrary to other sequencer ports.
+For example, connect hostB:132:0 to a MIDI output device 65:0. The
+aconnect utility can be used for this:
+
+ hostB% aconnect 132:0 65:0
+
+Events to hostA:128:0 will be delivered indirectly to hostB:65:0.
+You'll hear MIDI sounds as following:
+
+ hostA% pmidi -p 128:0 foo.mid
+
+The multiple clients may exist simultaneously. If hostC is connected
+as a client to hostA, events from from hostA are sent to all connected
+network clients, hostB and hostC. However, only one connection is
+allowed from a client to a server.
+
+To disconnect network, stop all clients before server by ctrl-C or
+sending signal to them. The server will automatically quit.
+
+The available options are:
+
+ -p port : specify the TCP port number or TCP service name.
+ Default value is 40002.
+ -s addr : explicit read-subscription to the given address
+ (client:addr).
+ -d addr : explicit write-subscription to the given address.
+ -v : verbose mode.
diff --git a/alsa-utils/seq/aseqnet/aseqnet.1 b/alsa-utils/seq/aseqnet/aseqnet.1
new file mode 100644
index 0000000..a1dc1d3
--- /dev/null
+++ b/alsa-utils/seq/aseqnet/aseqnet.1
@@ -0,0 +1,81 @@
+.TH aseqnet 1 "January 1, 2000"
+.LO 1
+.SH NAME
+aseqnet \- ALSA sequencer connectors over network
+
+.SH SYNOPSIS
+.B aseqnet
+[remotehost]
+
+.SH DESCRIPTION
+.B aseqnet
+is an ALSA sequencer client which sends and receives event packets
+over network.
+Suppose two hosts connected by network,
+.I hostA
+as a server
+and
+.I hostB
+as a client.
+The ALSA sequencer system must be running on both hosts.
+For creating the server port, run the following on hostA:
+.IP "" 4
+hostA% aseqnet
+.br
+sequencer opened: 128:0
+.PP
+Then a user client 128 with port 0 was opened on hostA.
+(The client number may vary.)
+For creating the (network-)client port, run
+.B aseqnet
+with the hostname of the server:
+.IP "" 4
+hostB% aseqnet hostA
+.br
+sequencer opened: 132:0
+.PP
+Now all events sent to hostA:128:0 are transferred to hostB:132:0, and vice
+versa.
+.PP
+The ports created by
+.B aseqnet
+can be connected arbitrary to other sequencer ports via
+.B aconnect(1).
+For example, to connect hostB:132:0 to a MIDI output device 65:0:
+.IP "" 4
+hostB% aconnect 132:0 65:0
+.PP
+Then events to hostA:128:0 will be delivered to hostB:65:0.
+The following command plays MIDI on
+.I hostB.
+.IP "" 4
+hostA% pmidi \-p 128:0 foo.mid
+.PP
+The multiple clients may exist simultaneously. If
+.I hostC
+is connected as a client to hostA, events from from hostA are sent
+to all connected network clients, i.e. hostB and hostC.
+However, only one connection is allowed from a client to a server.
+.PP
+To disconnect network, stop all clients before server by ctrl-C or
+sending signal to them. The server will automatically quit.
+
+.SH OPTIONS
+.TP
+.B \-p port
+Specify the TCP port number or TCP service name.
+.TP
+.B \-s addr
+Subscribe to the given address for read automatically.
+.TP
+.B \-d addr
+Subscribe to the given address for write automatically.
+.TP
+.B \-v
+Verbose mode.
+
+.SH "SEE ALSO"
+aconnect(1), pmidi(1)
+
+.SH AUTHOR
+Takashi Iwai <tiwai@suse.de>.
diff --git a/alsa-utils/seq/aseqnet/aseqnet.c b/alsa-utils/seq/aseqnet/aseqnet.c
new file mode 100644
index 0000000..e071ad9
--- /dev/null
+++ b/alsa-utils/seq/aseqnet/aseqnet.c
@@ -0,0 +1,609 @@
+/*
+ * network server/client for ALSA sequencer
+ * ver.0.1
+ *
+ * Copyright (C) 1999-2000 Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <locale.h>
+#include <alsa/asoundlib.h>
+#include <getopt.h>
+#include <signal.h>
+#include <assert.h>
+#include "aconfig.h"
+#include "gettext.h"
+
+/*
+ * prototypes
+ */
+static void usage(void);
+static void init_buf(void);
+static void init_pollfds(void);
+static void close_files(void);
+static void init_seq(char *source, char *dest);
+static int get_port(char *service);
+static void sigterm_exit(int sig);
+static void init_server(int port);
+static void init_client(char *server, int port);
+static void do_loop(void);
+static int copy_local_to_remote(void);
+static int copy_remote_to_local(int fd);
+
+/*
+ * default TCP port number
+ */
+#define DEFAULT_PORT 40002
+
+/*
+ * local input buffer
+ */
+static char *readbuf;
+static int max_rdlen;
+static char *writebuf;
+static int cur_wrlen, max_wrlen;
+
+#define MAX_BUF_EVENTS 200
+#define MAX_CONNECTION 10
+
+static snd_seq_t *handle;
+static struct pollfd *seqifds = NULL;
+static struct pollfd *seqofds = NULL;
+static struct pollfd *pollfds = NULL;
+static int seqifds_count = 0;
+static int seqofds_count = 0;
+static int pollfds_count = 0;
+static int sockfd, netfd[MAX_CONNECTION] = {[0 ... MAX_CONNECTION-1] = -1};
+static int max_connection;
+static int cur_connected;
+static int seq_port;
+
+static int server_mode;
+static int verbose = 0;
+static int info = 0;
+
+
+/*
+ * main routine
+ */
+
+static const struct option long_option[] = {
+ {"port", 1, NULL, 'p'},
+ {"source", 1, NULL, 's'},
+ {"dest", 1, NULL, 'd'},
+ {"help", 0, NULL, 'h'},
+ {"verbose", 0, NULL, 'v'},
+ {"info", 0, NULL, 'i'},
+ {NULL, 0, NULL, 0},
+};
+
+int main(int argc, char **argv)
+{
+ int c;
+ int port = DEFAULT_PORT;
+ char *source = NULL, *dest = NULL;
+
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ textdomain(PACKAGE);
+#endif
+
+ while ((c = getopt_long(argc, argv, "p:s:d:vi", long_option, NULL)) != -1) {
+ switch (c) {
+ case 'p':
+ if (isdigit(*optarg))
+ port = atoi(optarg);
+ else
+ port = get_port(optarg);
+ break;
+ case 's':
+ source = optarg;
+ break;
+ case 'd':
+ dest = optarg;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'i':
+ info++;
+ break;
+ default:
+ usage();
+ exit(1);
+ }
+ }
+
+ signal(SIGINT, sigterm_exit);
+ signal(SIGTERM, sigterm_exit);
+
+ init_buf();
+ init_seq(source, dest);
+
+ if (optind >= argc) {
+ server_mode = 1;
+ max_connection = MAX_CONNECTION;
+ init_pollfds();
+ init_server(port);
+ } else {
+ server_mode = 0;
+ max_connection = 1;
+ init_pollfds();
+ init_client(argv[optind], port);
+ }
+
+ do_loop();
+
+ close_files();
+
+ return 0;
+}
+
+
+/*
+ * print usage
+ */
+static void usage(void)
+{
+ printf(_("aseqnet - network client/server on ALSA sequencer\n"));
+ printf(_(" Copyright (C) 1999 Takashi Iwai\n"));
+ printf(_("usage:\n"));
+ printf(_(" server mode: aseqnet [-options]\n"));
+ printf(_(" client mode: aseqnet [-options] server_host\n"));
+ printf(_("options:\n"));
+ printf(_(" -p,--port # : sepcify TCP port (digit or service name)\n"));
+ printf(_(" -s,--source addr : read from given addr (client:port)\n"));
+ printf(_(" -d,--dest addr : write to given addr (client:port)\n"));
+ printf(_(" -v, --verbose : print verbose messages\n"));
+ printf(_(" -i, --info : print certain received events\n"));
+}
+
+
+/*
+ * allocate and initialize buffers
+ */
+static void init_buf(void)
+{
+ max_wrlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t);
+ max_rdlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t);
+ writebuf = malloc(max_wrlen);
+ readbuf = malloc(max_rdlen);
+ if (writebuf == NULL || readbuf == NULL) {
+ fprintf(stderr, _("can't malloc\n"));
+ exit(1);
+ }
+ memset(writebuf, 0, max_wrlen);
+ memset(readbuf, 0, max_rdlen);
+ cur_wrlen = 0;
+}
+
+/*
+ * allocate and initialize poll array
+ */
+static void init_pollfds(void)
+{
+ pollfds_count = seqifds_count + seqofds_count + 1 + max_connection;
+ pollfds = (struct pollfd *)calloc(pollfds_count, sizeof(struct pollfd));
+ assert(pollfds);
+}
+
+/*
+ * close all files
+ */
+static void close_files(void)
+{
+ int i;
+ if (verbose)
+ fprintf(stderr, _("closing files..\n"));
+ for (i = 0; i < max_connection; i++) {
+ if (netfd[i] >= 0)
+ close(netfd[i]);
+ }
+ if (sockfd >= 0)
+ close(sockfd);
+}
+
+
+/*
+ * initialize sequencer
+ */
+static void init_seq(char *source, char *dest)
+{
+ snd_seq_addr_t addr;
+ int err, counti, counto;
+
+ if (snd_seq_open(&handle, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
+ perror("snd_seq_open");
+ exit(1);
+ }
+ if (seqifds)
+ free(seqifds);
+ if (seqofds)
+ free(seqofds);
+ counti = seqifds_count = snd_seq_poll_descriptors_count(handle, POLLIN);
+ assert(counti > 0);
+ counto = seqofds_count = snd_seq_poll_descriptors_count(handle, POLLOUT);
+ assert(counto > 0);
+ seqifds = (struct pollfd *)calloc(counti, sizeof(struct pollfd));
+ assert(seqifds);
+ seqofds = (struct pollfd *)calloc(counto, sizeof(struct pollfd));
+ assert(seqofds);
+ err = snd_seq_poll_descriptors(handle, seqifds, counti, POLLIN);
+ assert(err == counti);
+ err = snd_seq_poll_descriptors(handle, seqofds, counto, POLLOUT);
+ assert(err == counto);
+
+ snd_seq_nonblock(handle, 1);
+
+ /* set client info */
+ if (server_mode)
+ snd_seq_set_client_name(handle, "Net Server");
+ else
+ snd_seq_set_client_name(handle, "Net Client");
+
+ /* create a port */
+ seq_port = snd_seq_create_simple_port(handle, "Network",
+ SND_SEQ_PORT_CAP_READ |
+ SND_SEQ_PORT_CAP_WRITE |
+ SND_SEQ_PORT_CAP_SUBS_READ |
+ SND_SEQ_PORT_CAP_SUBS_WRITE,
+ SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+ if (seq_port < 0) {
+ perror("create seq port");
+ exit(1);
+ }
+ if (verbose)
+ fprintf(stderr, _("sequencer opened: %d:%d\n"),
+ snd_seq_client_id(handle), seq_port);
+
+ /* explicit subscriptions */
+ if (source) {
+ /* read subscription */
+ if (snd_seq_parse_address(handle, &addr, source) < 0) {
+ fprintf(stderr, _("invalid source address %s\n"), source);
+ exit(1);
+ }
+ if (snd_seq_connect_from(handle, seq_port, addr.client, addr.port)) {
+ perror("read subscription");
+ exit(1);
+ }
+ }
+ if (dest) {
+ /* write subscription */
+ if (snd_seq_parse_address(handle, &addr, dest) < 0) {
+ fprintf(stderr, _("invalid destination address %s\n"), dest);
+ exit(1);
+ }
+ if (snd_seq_connect_to(handle, seq_port, addr.client, addr.port)) {
+ perror("write subscription");
+ exit(1);
+ }
+ }
+}
+
+
+/*
+ * convert from string to TCP port number
+ */
+static int get_port(char *service)
+{
+ struct servent *sp;
+
+ if ((sp = getservbyname(service, "tcp")) == NULL){
+ fprintf(stderr, _("service '%s' is not found in /etc/services\n"), service);
+ return -1;
+ }
+ return sp->s_port;
+}
+
+/*
+ * signal handler
+ */
+static void sigterm_exit(int sig)
+{
+ close_files();
+ exit(1);
+}
+
+
+/*
+ * initialize network server
+ */
+static void init_server(int port)
+{
+ int i;
+ int curstate = 1;
+ struct sockaddr_in addr;
+
+ memset(&addr, 0, sizeof(addr));
+
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = INADDR_ANY;
+ addr.sin_port = htons(port);
+
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if (sockfd < 0) {
+ perror("create socket");
+ exit(1);
+ }
+ setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate));
+ /* the return value is ignored.. */
+
+ if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ perror("can't bind");
+ exit(1);
+ }
+
+ if (listen(sockfd, 5) < 0) {
+ perror("can't listen");
+ exit(1);
+ }
+
+ cur_connected = 0;
+ for (i = 0; i < max_connection; i++)
+ netfd[i] = -1;
+}
+
+/*
+ * start connection on server
+ */
+static void start_connection(void)
+{
+ struct sockaddr_in addr;
+ int i;
+ socklen_t addr_len;
+
+ for (i = 0; i < max_connection; i++) {
+ if (netfd[i] < 0)
+ break;
+ }
+ if (i >= max_connection) {
+ fprintf(stderr, _("too many connections!\n"));
+ exit(1);
+ }
+ memset(&addr, 0, sizeof(addr));
+ addr_len = sizeof(addr);
+ netfd[i] = accept(sockfd, (struct sockaddr *)&addr, &addr_len);
+ if (netfd[i] < 0) {
+ perror("accept");
+ exit(1);
+ }
+ if (verbose)
+ fprintf(stderr, _("accepted[%d]\n"), netfd[i]);
+ cur_connected++;
+}
+
+/*
+ * initialize network client
+ */
+static void init_client(char *server, int port)
+{
+ struct sockaddr_in addr;
+ struct hostent *host;
+ int curstate = 1;
+ int fd;
+
+ if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0){
+ perror("create socket");
+ exit(1);
+ }
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) {
+ perror("setsockopt");
+ exit(1);
+ }
+ if ((host = gethostbyname(server)) == NULL){
+ fprintf(stderr, _("can't get address %s\n"), server);
+ exit(1);
+ }
+ addr.sin_port = htons(port);
+ addr.sin_family = AF_INET;
+ memcpy(&addr.sin_addr, host->h_addr, host->h_length);
+ if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ perror("connect");
+ exit(1);
+ }
+ if (verbose)
+ fprintf(stderr, _("ok.. connected\n"));
+ netfd[0] = fd;
+ cur_connected = 1;
+}
+
+/*
+ * event loop
+ */
+static void do_loop(void)
+{
+ int i, rc, width;
+ int seqifd_ptr, sockfd_ptr = -1, netfd_ptr;
+
+ for (;;) {
+ memset(pollfds, 0, pollfds_count * sizeof(struct pollfd));
+ seqifd_ptr = 0;
+ memcpy(pollfds, seqifds, sizeof(*seqifds)*(width = seqifds_count));
+ if (server_mode) {
+ sockfd_ptr = width;
+ pollfds[width].fd = sockfd;
+ pollfds[width].events = POLLIN;
+ width++;
+ }
+ netfd_ptr = width;
+ for (i = 0; i < max_connection; i++) {
+ if (netfd[i] >= 0) {
+ pollfds[width].fd = netfd[i];
+ pollfds[width].events = POLLIN;
+ width++;
+ }
+ }
+ do {
+ rc = poll(pollfds, width, -1);
+ } while (rc <= 0 && errno == EINTR);
+ if (rc <= 0) {
+ perror("poll");
+ exit(1);
+ }
+ if (server_mode) {
+ if (pollfds[sockfd_ptr].revents & (POLLIN|POLLOUT))
+ start_connection();
+ }
+ for (i = 0; i < seqifds_count; i++)
+ if (pollfds[seqifd_ptr + i].revents & (POLLIN|POLLOUT)) {
+ if (copy_local_to_remote())
+ return;
+ break;
+ }
+ for (i = 0; i < max_connection; i++) {
+ if (netfd[i] < 0)
+ continue;
+ if (pollfds[netfd_ptr + i].revents & (POLLIN|POLLOUT)) {
+ if (copy_remote_to_local(netfd[i])) {
+ netfd[i] = -1;
+ cur_connected--;
+ if (cur_connected <= 0)
+ return;
+ }
+ }
+ }
+ }
+}
+
+
+/*
+ * flush write buffer - send data to the socket
+ */
+static void flush_writebuf(void)
+{
+ if (cur_wrlen) {
+ int i;
+ for (i = 0; i < max_connection; i++) {
+ if (netfd[i] >= 0)
+ write(netfd[i], writebuf, cur_wrlen);
+ }
+ cur_wrlen = 0;
+ }
+}
+
+/*
+ * get space from write buffer
+ */
+static char *get_writebuf(int len)
+{
+ char *buf;
+ if (cur_wrlen + len >= max_wrlen)
+ flush_writebuf();
+ buf = writebuf + cur_wrlen;
+ cur_wrlen += len;
+ return buf;
+}
+
+static void print_event(snd_seq_event_t *ev)
+{
+ switch (ev->type) {
+ case SND_SEQ_EVENT_CONTROLLER:
+ printf(_("Channel %2d: Control event : %5d\n"),
+ ev->data.control.channel, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_PITCHBEND:
+ printf(_("Channel %2d: Pitchbender : %5d\n"),
+ ev->data.control.channel, ev->data.control.value);
+ break;
+ case SND_SEQ_EVENT_NOTEON:
+ printf(_("Channel %2d: Note On event : %5d\n"),
+ ev->data.control.channel, ev->data.note.note);
+ break;
+ case SND_SEQ_EVENT_NOTEOFF:
+ printf(_("Channel %2d: Note Off event: %5d\n"),
+ ev->data.control.channel, ev->data.note.note);
+ break;
+ }
+}
+
+#define EVENT_PACKET_SIZE 32
+
+/*
+ * copy events from sequencer to port(s)
+ */
+static int copy_local_to_remote(void)
+{
+ int rc;
+ snd_seq_event_t *ev;
+ char *buf;
+
+ while ((rc = snd_seq_event_input(handle, &ev)) >= 0 && ev) {
+ if (ev->type >= SND_SEQ_EVENT_CLIENT_START &&
+ ! snd_seq_ev_is_variable_type(ev)) {
+ snd_seq_free_event(ev);
+ continue;
+ }
+ if (snd_seq_ev_is_variable(ev)) {
+ int len;
+ len = EVENT_PACKET_SIZE + ev->data.ext.len;
+ buf = get_writebuf(len);
+ memcpy(buf, ev, sizeof(snd_seq_event_t));
+ memcpy(buf + EVENT_PACKET_SIZE, ev->data.ext.ptr, ev->data.ext.len);
+ } else {
+ buf = get_writebuf(EVENT_PACKET_SIZE);
+ memcpy(buf, ev, EVENT_PACKET_SIZE);
+ }
+ if (info)
+ print_event(ev);
+ snd_seq_free_event(ev);
+ }
+ flush_writebuf();
+ return 0;
+}
+
+/*
+ * copy events from a port to sequencer
+ */
+static int copy_remote_to_local(int fd)
+{
+ int count;
+ char *buf;
+ snd_seq_event_t *ev;
+
+ count = read(fd, readbuf, MAX_BUF_EVENTS * sizeof(snd_seq_event_t));
+ buf = readbuf;
+
+ if (count == 0) {
+ if (verbose)
+ fprintf(stderr, _("disconnected\n"));
+ return 1;
+ }
+
+ while (count > 0) {
+ ev = (snd_seq_event_t*)buf;
+ buf += EVENT_PACKET_SIZE;
+ count -= EVENT_PACKET_SIZE;
+ if (snd_seq_ev_is_variable(ev) && ev->data.ext.len > 0) {
+ ev->data.ext.ptr = buf;
+ buf += ev->data.ext.len;
+ count -= ev->data.ext.len;
+ }
+ snd_seq_ev_set_direct(ev);
+ snd_seq_ev_set_source(ev, seq_port);
+ snd_seq_ev_set_subs(ev);
+ if (info)
+ print_event(ev);
+ snd_seq_event_output(handle, ev);
+ }
+
+ snd_seq_drain_output(handle);
+ return 0;
+}
+
diff --git a/alsa-utils/speaker-test/Makefile.am b/alsa-utils/speaker-test/Makefile.am
new file mode 100644
index 0000000..e3551bc
--- /dev/null
+++ b/alsa-utils/speaker-test/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = -I$(top_srcdir)/include
+SUBDIRS= samples
+LDADD = $(LIBINTL) -lm
+
+bin_PROGRAMS = speaker-test
+speaker_test_SOURCES = speaker-test.c pink.c
+man_MANS = speaker-test.1
+EXTRA_DIST = readme.txt speaker-test.1 pink.h
+
diff --git a/alsa-utils/speaker-test/Makefile.in b/alsa-utils/speaker-test/Makefile.in
new file mode 100644
index 0000000..2ad0c75
--- /dev/null
+++ b/alsa-utils/speaker-test/Makefile.in
@@ -0,0 +1,616 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = speaker-test$(EXEEXT)
+subdir = speaker-test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_speaker_test_OBJECTS = speaker-test.$(OBJEXT) pink.$(OBJEXT)
+speaker_test_OBJECTS = $(am_speaker_test_OBJECTS)
+speaker_test_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+speaker_test_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(speaker_test_SOURCES)
+DIST_SOURCES = $(speaker_test_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+INCLUDES = -I$(top_srcdir)/include
+SUBDIRS = samples
+LDADD = $(LIBINTL) -lm
+speaker_test_SOURCES = speaker-test.c pink.c
+man_MANS = speaker-test.1
+EXTRA_DIST = readme.txt speaker-test.1 pink.h
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign speaker-test/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign speaker-test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+speaker-test$(EXEEXT): $(speaker_test_OBJECTS) $(speaker_test_DEPENDENCIES)
+ @rm -f speaker-test$(EXEEXT)
+ $(LINK) $(speaker_test_LDFLAGS) $(speaker_test_OBJECTS) $(speaker_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speaker-test.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-recursive
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
+
+uninstall-info: uninstall-info-recursive
+
+uninstall-man: uninstall-man1
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-binPROGRAMS clean-generic clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-man1 \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am uninstall-man \
+ uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/speaker-test/pink.c b/alsa-utils/speaker-test/pink.c
new file mode 100644
index 0000000..ef30755
--- /dev/null
+++ b/alsa-utils/speaker-test/pink.c
@@ -0,0 +1,96 @@
+/*
+ patest_pink.c
+
+ generate Pink Noise using Gardner method.
+ Optimization suggested by James McCartney uses a tree
+ to select which random value to replace.
+
+ x x x x x x x x x x x x x x x x
+ x x x x x x x x
+ x x x x
+ x x
+ x
+
+ Tree is generated by counting trailing zeros in an increasing index.
+ When the index is zero, no random number is selected.
+
+ This program uses the Portable Audio library which is under development.
+ For more information see: http://www.audiomulch.com/portaudio/
+
+ Author: Phil Burk, http://www.softsynth.com
+
+ Revision History:
+
+ Copyleft 1999 Phil Burk - No rights reserved.
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "pink.h"
+
+/************************************************************/
+/* Calculate pseudo-random 32 bit number based on linear congruential method. */
+static unsigned long generate_random_number( void )
+{
+ static unsigned long rand_seed = 22222; /* Change this for different random sequences. */
+ rand_seed = (rand_seed * 196314165) + 907633515;
+ return rand_seed;
+}
+
+/* Setup PinkNoise structure for N rows of generators. */
+void initialize_pink_noise( pink_noise_t *pink, int num_rows )
+{
+ int i;
+ long pmax;
+ pink->pink_index = 0;
+ pink->pink_index_mask = (1<<num_rows) - 1;
+/* Calculate maximum possible signed random value. Extra 1 for white noise always added. */
+ pmax = (num_rows + 1) * (1<<(PINK_RANDOM_BITS-1));
+ pink->pink_scalar = 1.0f / pmax;
+/* Initialize rows. */
+ for( i=0; i<num_rows; i++ ) pink->pink_rows[i] = 0;
+ pink->pink_running_sum = 0;
+}
+
+/* generate Pink noise values between -1.0 and +1.0 */
+float generate_pink_noise_sample( pink_noise_t *pink )
+{
+ long new_random;
+ long sum;
+ float output;
+
+/* Increment and mask index. */
+ pink->pink_index = (pink->pink_index + 1) & pink->pink_index_mask;
+
+/* If index is zero, don't update any random values. */
+ if( pink->pink_index != 0 )
+ {
+ /* Determine how many trailing zeros in PinkIndex. */
+ /* This algorithm will hang if n==0 so test first. */
+ int num_zeros = 0;
+ int n = pink->pink_index;
+ while( (n & 1) == 0 )
+ {
+ n = n >> 1;
+ num_zeros++;
+ }
+
+ /* Replace the indexed ROWS random value.
+ * Subtract and add back to Running_sum instead of adding all the random
+ * values together. Only one changes each time.
+ */
+ pink->pink_running_sum -= pink->pink_rows[num_zeros];
+ new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT;
+ pink->pink_running_sum += new_random;
+ pink->pink_rows[num_zeros] = new_random;
+ }
+
+/* Add extra white noise value. */
+ new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT;
+ sum = pink->pink_running_sum + new_random;
+
+/* Scale to range of -1.0 to 0.9999. */
+ output = pink->pink_scalar * sum;
+
+ return output;
+}
diff --git a/alsa-utils/speaker-test/pink.h b/alsa-utils/speaker-test/pink.h
new file mode 100644
index 0000000..0d17f7a
--- /dev/null
+++ b/alsa-utils/speaker-test/pink.h
@@ -0,0 +1,15 @@
+#define PINK_MAX_RANDOM_ROWS (30)
+#define PINK_RANDOM_BITS (24)
+#define PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS)
+
+typedef struct
+{
+ long pink_rows[PINK_MAX_RANDOM_ROWS];
+ long pink_running_sum; /* Used to optimize summing of generators. */
+ int pink_index; /* Incremented each sample. */
+ int pink_index_mask; /* Index wrapped by ANDing with this mask. */
+ float pink_scalar; /* Used to scale within range of -1.0 to +1.0 */
+} pink_noise_t;
+
+void initialize_pink_noise( pink_noise_t *pink, int num_rows );
+float generate_pink_noise_sample( pink_noise_t *pink );
diff --git a/alsa-utils/speaker-test/readme.txt b/alsa-utils/speaker-test/readme.txt
new file mode 100644
index 0000000..6774fe0
--- /dev/null
+++ b/alsa-utils/speaker-test/readme.txt
@@ -0,0 +1,12 @@
+To make or build just type
+
+make
+
+To test: -
+1) Just stereo sound from one stereo jack: -
+./speaker-test -Dplug:front -c2
+2) A 4 speaker setup from two stereo jacks: -
+./speaker-test -Dplug:surround40 -c4
+3) A 5.1 speaker setup from three stereo jacks: -
+./speaker-test -Dplug:surround51 -c6
+
diff --git a/alsa-utils/speaker-test/samples/Makefile.am b/alsa-utils/speaker-test/samples/Makefile.am
new file mode 100644
index 0000000..8cc3546
--- /dev/null
+++ b/alsa-utils/speaker-test/samples/Makefile.am
@@ -0,0 +1,20 @@
+sounddir = $(datadir)/sounds/alsa
+wav_files = Front_Left.wav \
+ Rear_Center.wav \
+ Rear_Right.wav \
+ Side_Right.wav \
+ Front_Center.wav \
+ Front_Right.wav \
+ Noise.wav \
+ Rear_Left.wav \
+ Side_Left.wav
+sound_DATA = $(wav_files)
+
+alsadir = $(datadir)/alsa/speaker-test
+cfg_files = sample_map.csv
+
+alsa_DATA = $(cfg_files)
+
+EXTRA_DIST = \
+ $(wav_files) \
+ $(cfg_files)
diff --git a/alsa-utils/speaker-test/samples/Makefile.in b/alsa-utils/speaker-test/samples/Makefile.in
new file mode 100644
index 0000000..2240d2e
--- /dev/null
+++ b/alsa-utils/speaker-test/samples/Makefile.in
@@ -0,0 +1,396 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = speaker-test/samples
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(alsadir)" "$(DESTDIR)$(sounddir)"
+alsaDATA_INSTALL = $(INSTALL_DATA)
+soundDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(alsa_DATA) $(sound_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+sounddir = $(datadir)/sounds/alsa
+wav_files = Front_Left.wav \
+ Rear_Center.wav \
+ Rear_Right.wav \
+ Side_Right.wav \
+ Front_Center.wav \
+ Front_Right.wav \
+ Noise.wav \
+ Rear_Left.wav \
+ Side_Left.wav
+
+sound_DATA = $(wav_files)
+alsadir = $(datadir)/alsa/speaker-test
+cfg_files = sample_map.csv
+alsa_DATA = $(cfg_files)
+EXTRA_DIST = \
+ $(wav_files) \
+ $(cfg_files)
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign speaker-test/samples/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign speaker-test/samples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-alsaDATA: $(alsa_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(alsadir)" || $(mkdir_p) "$(DESTDIR)$(alsadir)"
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(alsaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(alsadir)/$$f'"; \
+ $(alsaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+
+uninstall-alsaDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(alsa_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(alsadir)/$$f'"; \
+ rm -f "$(DESTDIR)$(alsadir)/$$f"; \
+ done
+install-soundDATA: $(sound_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(sounddir)" || $(mkdir_p) "$(DESTDIR)$(sounddir)"
+ @list='$(sound_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(soundDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sounddir)/$$f'"; \
+ $(soundDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sounddir)/$$f"; \
+ done
+
+uninstall-soundDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sound_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sounddir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sounddir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(alsadir)" "$(DESTDIR)$(sounddir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-alsaDATA install-soundDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-alsaDATA uninstall-info-am uninstall-soundDATA
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-alsaDATA install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-soundDATA install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-alsaDATA uninstall-am \
+ uninstall-info-am uninstall-soundDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/speaker-test/samples/sample_map.csv b/alsa-utils/speaker-test/samples/sample_map.csv
new file mode 100644
index 0000000..20d8ed2
--- /dev/null
+++ b/alsa-utils/speaker-test/samples/sample_map.csv
@@ -0,0 +1,2 @@
+0, "Front Left", "/usr/share/alsa/samples/Front_Left.wav"
+1, "Front Right", "/usr/share/alsa/samples/Front_Right.wav"
diff --git a/alsa-utils/speaker-test/speaker-test.1 b/alsa-utils/speaker-test/speaker-test.1
new file mode 100644
index 0000000..f0948a6
--- /dev/null
+++ b/alsa-utils/speaker-test/speaker-test.1
@@ -0,0 +1,125 @@
+.\" -*- nroff -*-
+.\" macros
+.de EX \" Begin Example
+. IP
+. ft CW
+. nf
+. ne \\$1
+..
+.de EE \" End Example
+. ft P
+. fi
+. PP
+..
+.TH SPEAKER\-TEST 1 "20 September 2004" speaker-test
+.SH NAME
+speaker\-test \- command-line speaker test tone generator for ALSA
+.SH SYNOPSIS
+.B speaker\-test [\-options]
+
+.SH DESCRIPTION
+\fBspeaker\-test\fP generates a tone that can be used to test the speakers of a computer.
+
+.SH OPTIONS
+
+.TP
+\fB\-c\fP | \fB\-\-channels\fP \fINUM\fP
+\fINUM\fP channels in stream
+
+.TP
+\fB\-D\fP | \fB\-\-device\fP \fINAME\fP
+PCM device name \fINAME\fP
+
+.TP
+\fB\-f\fP | \fB\-\-frequency\fP \fIFREQ\fP
+sine wave of \fIFREQ\fP Hz
+
+.TP
+\fB\-\-help\fP
+Print usage help
+
+.TP
+\fB\-b\fP | \fB\-\-buffer\fP \fITIME\fP
+Use buffer size of \fITIME\fP microseconds.
+When 0 is given, use the maximal buffer size.
+The default value is 0.
+
+.TP
+\fB\-p\fP | \fB\-\-period\fP \fITIME\fP
+Use period size of \fITIME\fP microseconds.
+When 0 is given, the periods given by \fB\-P\fP option is used.
+The default value is 0.
+
+.TP
+\fB\-P\fP | \fB\-\-nperiods\fP \fPERIODS\fP
+Use number of periods. The default value is 4.
+
+.TP
+\fB\-r\fP | \fB\-\-rate\fP \fIRATE\fP
+stream of \fIRATE\fP Hz
+
+.TP
+\fB\-t\fP | \fB\-\-test\fP \fBpink\fP|\fBsine\fP|\fBwav\fP
+\fB\-t pink\fP means use pink noise (default).
+
+Pink noise is perceptually uniform noise -- that is, it sounds like every frequency at once. If you can hear any tone it may indicate resonances in your speaker system or room.
+
+\fB\-t sine\fP means to use sine wave.
+
+\fB\-t wav\fP means to play WAV files, either pre-defined files or given via \fB\-w\fP option.
+
+You can pass the number from 1 to 3 as a backward compatibility.
+
+.TP
+\fB\-l\fP | \fB\-\-nloops\fP \fBCOUNT\fP
+
+Specifies the number of loops. Zero means to run infinitely.
+
+When \fB\-s\fP option below with a valid channel is given, \fBspeaker\-test\fP will perform
+always a single-shot without looping.
+
+.TP
+\fB\-s\fP | \fB\-\-speaker\fP \fBCHANNEL\fP
+Do a single-shot speaker test for the given channel. The channel number starts from 1.
+The channel number corresponds to left, right, rear-left, rear-right, center, LFE,
+side-left, side-right, and so on.
+
+For example, when 1 is passed, it tests the left channel only once rather than both channels
+with looping.
+
+.TP
+\fB\-w\fP | \fB\-\-wavfile\fP
+Use the given WAV file for the playback instead of pre-defined WAV files.
+
+.TP
+\fB\-W\fP | \fB\-\-wavdir\fP
+Specify the directory containing WAV files for playback.
+The default path is \fI/usr/share/sounds/alsa\fP.
+
+
+.SH USAGE EXAMPLES
+
+Produce stereo sound from one stereo jack:
+.EX
+ speaker-test -Dplug:front -c2
+.EE
+
+Produce 4 speaker sound from two stereo jacks:
+.EX
+ speaker-test -Dplug:surround40 -c4
+.EE
+
+Produce 5.1 speaker sound from three stereo jacks:
+.EX
+ speaker-test -Dplug:surround51 -c6
+.EE
+
+To send a nice low 75Hz tone to the Woofer and then exit without touching any other speakers:
+.EX
+ speaker-test -Dplug:surround51 -c6 -s1 -f75
+.EE
+
+.SH AUTHOR
+The speaker-test program was written by James Courtier-Dutton.
+Pink noise support was added by Nathan Hurst.
+Further extensions by Takashi Iwai.
diff --git a/alsa-utils/speaker-test/speaker-test.c b/alsa-utils/speaker-test/speaker-test.c
new file mode 100644
index 0000000..75a4bed
--- /dev/null
+++ b/alsa-utils/speaker-test/speaker-test.c
@@ -0,0 +1,1031 @@
+/*
+ * Copyright (C) 2000-2004 James Courtier-Dutton
+ * Copyright (C) 2005 Nathan Hurst
+ *
+ * This file is part of the speaker-test tool.
+ *
+ * This small program sends a simple sinusoidal wave to your speakers.
+ *
+ * speaker-test is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * speaker-test is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ *
+ * Main program by James Courtier-Dutton (including some source code fragments from the alsa project.)
+ * Some cleanup from Daniel Caujolle-Bert <segfault@club-internet.fr>
+ * Pink noise option added Nathan Hurst,
+ * based on generator by Phil Burk (pink.c)
+ *
+ * Changelog:
+ * 0.0.8 Added support for pink noise output.
+ * Changelog:
+ * 0.0.7 Added support for more than 6 channels.
+ * Changelog:
+ * 0.0.6 Added support for different sample formats.
+ *
+ * $Id: speaker_test.c,v 1.00 2003/11/26 19:43:38 jcdutton Exp $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sched.h>
+#include <errno.h>
+#include <getopt.h>
+#include <inttypes.h>
+#include <ctype.h>
+#include <byteswap.h>
+
+#define ALSA_PCM_NEW_HW_PARAMS_API
+#define ALSA_PCM_NEW_SW_PARAMS_API
+#include <alsa/asoundlib.h>
+#include <sys/time.h>
+#include <math.h>
+#include "pink.h"
+#include "aconfig.h"
+#include "gettext.h"
+#include "version.h"
+
+#ifdef ENABLE_NLS
+#include <locale.h>
+#endif
+
+enum {
+ TEST_PINK_NOISE = 1,
+ TEST_SINE,
+ TEST_WAV
+};
+
+#define MAX_CHANNELS 16
+
+static char *device = "default"; /* playback device */
+static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
+static unsigned int rate = 48000; /* stream rate */
+static unsigned int channels = 1; /* count of channels */
+static unsigned int speaker = 0; /* count of channels */
+static unsigned int buffer_time = 0; /* ring buffer length in us */
+static unsigned int period_time = 0; /* period time in us */
+static unsigned int nperiods = 4; /* number of periods */
+static double freq = 440; /* sinusoidal wave frequency in Hz */
+static int test_type = TEST_PINK_NOISE; /* Test type. 1 = noise, 2 = sine wave */
+static pink_noise_t pink;
+static snd_pcm_uframes_t buffer_size;
+static snd_pcm_uframes_t period_size;
+static const char *given_test_wav_file = NULL;
+static char *wav_file_dir = SOUNDSDIR;
+
+static const char *const channel_name[MAX_CHANNELS] = {
+ N_("Front Left"),
+ N_("Front Right"),
+ N_("Rear Left"),
+ N_("Rear Right"),
+ N_("Center"),
+ N_("LFE"),
+ N_("Side Left"),
+ N_("Side Right"),
+ N_("Channel 9"),
+ N_("Channel 10"),
+ N_("Channel 11"),
+ N_("Channel 12"),
+ N_("Channel 13"),
+ N_("Channel 14"),
+ N_("Channel 15"),
+ N_("Channel 16")
+};
+
+static const int channels4[] = {
+ 0,
+ 1,
+ 3,
+ 2
+};
+static const int channels6[] = {
+ 0,
+ 4,
+ 1,
+ 3,
+ 2,
+ 5
+};
+static const int channels8[] = {
+ 0,
+ 4,
+ 1,
+ 7,
+ 3,
+ 2,
+ 6,
+ 5
+};
+
+static void generate_sine(uint8_t *frames, int channel, int count, double *_phase) {
+ double phase = *_phase;
+ double max_phase = 1.0 / freq;
+ double step = 1.0 / (double)rate;
+ double res;
+ float fres;
+ int chn;
+ int32_t ires;
+ int8_t *samp8 = (int8_t*) frames;
+ int16_t *samp16 = (int16_t*) frames;
+ int32_t *samp32 = (int32_t*) frames;
+ float *samp_f = (float*) frames;
+
+ while (count-- > 0) {
+ //res = sin((phase * 2 * M_PI) / max_phase - M_PI) * 32767;
+ //res = sin((phase * 2 * M_PI) / max_phase - M_PI) * 32767;
+ //res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ //if (res > 0) res = 10000;
+ //if (res < 0) res = -10000;
+
+ /* printf("%e\n",res); */
+ //ires = res;
+ //ires = ((16 - (count & 0xf)) <<24);
+ //ires = 0;
+
+ for(chn=0;chn<channels;chn++) {
+ switch (format) {
+ case SND_PCM_FORMAT_S8:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+ *samp8++ = ires >> 24;
+ } else {
+ *samp8++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S16_LE:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp16++ = ires >> 16;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ *samp16++ = bswap_16(ires >> 16);
+#endif
+ } else {
+ *samp16++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S16_BE:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ *samp16++ = ires >> 16;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp16++ = bswap_16(ires >> 16);
+#endif
+ } else {
+ *samp16++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_FLOAT_LE:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0.75 ; /* Don't use MAX volume */
+ fres = res;
+ *samp_f++ = fres;
+ //*samp32++ = 0xF2345678;
+ //printf("res=%lf, ires=%d 0x%x, samp32=0x%x\n",res,ires, ires, samp32[-1]);
+ } else {
+ //*samp32++ = ires+0x10000;
+ //*samp32++ = ires;
+ *samp_f++ = 0.0;
+ }
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp32++ = ires;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ *samp32++ = bswap_32(ires);
+#endif
+ } else {
+ *samp32++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S32_BE:
+ if (chn==channel) {
+ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ *samp32++ = ires;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp32++ = bswap_32(ires);
+#endif
+ } else {
+ *samp32++ = 0;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+
+ phase += step;
+ if (phase >= max_phase)
+ phase -= max_phase;
+ }
+
+ *_phase = phase;
+}
+
+/* Pink noise is a better test than sine wave because we can tell
+ * where pink noise is coming from more easily that a sine wave.
+ */
+
+
+static void generate_pink_noise( uint8_t *frames, int channel, int count) {
+ double res;
+ int chn;
+ int32_t ires;
+ int8_t *samp8 = (int8_t*) frames;
+ int16_t *samp16 = (int16_t*) frames;
+ int32_t *samp32 = (int32_t*) frames;
+
+ while (count-- > 0) {
+ for(chn=0;chn<channels;chn++) {
+ switch (format) {
+ case SND_PCM_FORMAT_S8:
+ if (chn==channel) {
+ res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+ *samp8++ = ires >> 24;
+ } else {
+ *samp8++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S16_LE:
+ if (chn==channel) {
+ res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp16++ = ires >> 16;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ *samp16++ = bswap_16(ires >> 16);
+#endif
+ } else {
+ *samp16++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S16_BE:
+ if (chn==channel) {
+ res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ *samp16++ = ires >> 16;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp16++ = bswap_16(ires >> 16);
+#endif
+ } else {
+ *samp16++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S32_LE:
+ if (chn==channel) {
+ res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp32++ = ires;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ *samp32++ = bswap_32(ires);
+#endif
+ } else {
+ *samp32++ = 0;
+ }
+ break;
+ case SND_PCM_FORMAT_S32_BE:
+ if (chn==channel) {
+ res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */
+ ires = res;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ *samp32++ = ires;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ *samp32++ = bswap_32(ires);
+#endif
+ } else {
+ *samp32++ = 0;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ }
+}
+
+static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access) {
+ unsigned int rrate;
+ int err;
+ snd_pcm_uframes_t period_size_min;
+ snd_pcm_uframes_t period_size_max;
+ snd_pcm_uframes_t buffer_size_min;
+ snd_pcm_uframes_t buffer_size_max;
+
+ /* choose all parameters */
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0) {
+ fprintf(stderr, _("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* set the interleaved read/write format */
+ err = snd_pcm_hw_params_set_access(handle, params, access);
+ if (err < 0) {
+ fprintf(stderr, _("Access type not available for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* set the sample format */
+ err = snd_pcm_hw_params_set_format(handle, params, format);
+ if (err < 0) {
+ fprintf(stderr, _("Sample format not available for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* set the count of channels */
+ err = snd_pcm_hw_params_set_channels(handle, params, channels);
+ if (err < 0) {
+ fprintf(stderr, _("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
+ return err;
+ }
+
+ /* set the stream rate */
+ rrate = rate;
+ err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
+ if (err < 0) {
+ fprintf(stderr, _("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
+ return err;
+ }
+
+ if (rrate != rate) {
+ fprintf(stderr, _("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
+ return -EINVAL;
+ }
+
+ printf(_("Rate set to %iHz (requested %iHz)\n"), rrate, rate);
+ /* set the buffer time */
+ err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min);
+ err = snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size_max);
+ err = snd_pcm_hw_params_get_period_size_min(params, &period_size_min, NULL);
+ err = snd_pcm_hw_params_get_period_size_max(params, &period_size_max, NULL);
+ printf(_("Buffer size range from %lu to %lu\n"),buffer_size_min, buffer_size_max);
+ printf(_("Period size range from %lu to %lu\n"),period_size_min, period_size_max);
+ if (period_time > 0) {
+ printf(_("Requested period time %u us\n"), period_time);
+ err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, NULL);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set period time %u us for playback: %s\n"),
+ period_time, snd_strerror(err));
+ return err;
+ }
+ }
+ if (buffer_time > 0) {
+ printf(_("Requested buffer time %u us\n"), buffer_time);
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, NULL);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set buffer time %u us for playback: %s\n"),
+ buffer_time, snd_strerror(err));
+ return err;
+ }
+ }
+ if (! buffer_time && ! period_time) {
+ buffer_size = buffer_size_max;
+ if (! period_time)
+ buffer_size = (buffer_size / nperiods) * nperiods;
+ printf(_("Using max buffer size %lu\n"), buffer_size);
+ err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set buffer size %lu for playback: %s\n"),
+ buffer_size, snd_strerror(err));
+ return err;
+ }
+ }
+ if (! buffer_time || ! period_time) {
+ printf(_("Periods = %u\n"), nperiods);
+ err = snd_pcm_hw_params_set_periods_near(handle, params, &nperiods, NULL);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set nperiods %u for playback: %s\n"),
+ nperiods, snd_strerror(err));
+ return err;
+ }
+ }
+
+ /* write the parameters to device */
+ err = snd_pcm_hw_params(handle, params);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set hw params for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
+ snd_pcm_hw_params_get_period_size(params, &period_size, NULL);
+ printf(_("was set period_size = %lu\n"),period_size);
+ printf(_("was set buffer_size = %lu\n"),buffer_size);
+ if (2*period_size > buffer_size) {
+ fprintf(stderr, _("buffer to small, could not use\n"));
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) {
+ int err;
+
+ /* get the current swparams */
+ err = snd_pcm_sw_params_current(handle, swparams);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* start the transfer when a buffer is full */
+ err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* allow the transfer when at least period_size frames can be processed */
+ err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set avail min for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ /* write the parameters to the playback device */
+ err = snd_pcm_sw_params(handle, swparams);
+ if (err < 0) {
+ fprintf(stderr, _("Unable to set sw params for playback: %s\n"), snd_strerror(err));
+ return err;
+ }
+
+ return 0;
+}
+
+/*
+ * Underrun and suspend recovery
+ */
+
+static int xrun_recovery(snd_pcm_t *handle, int err) {
+ if (err == -EPIPE) { /* under-run */
+ err = snd_pcm_prepare(handle);
+ if (err < 0)
+ fprintf(stderr, _("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
+ return 0;
+ }
+ else if (err == -ESTRPIPE) {
+
+ while ((err = snd_pcm_resume(handle)) == -EAGAIN)
+ sleep(1); /* wait until the suspend flag is released */
+
+ if (err < 0) {
+ err = snd_pcm_prepare(handle);
+ if (err < 0)
+ fprintf(stderr, _("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
+ }
+
+ return 0;
+ }
+
+ return err;
+}
+
+/*
+ * Handle WAV files
+ */
+
+static const char *wav_file[MAX_CHANNELS];
+static int wav_file_size[MAX_CHANNELS];
+
+struct wave_header {
+ struct {
+ uint32_t magic;
+ uint32_t length;
+ uint32_t type;
+ } hdr;
+ struct {
+ uint32_t type;
+ uint32_t length;
+ } chunk1;
+ struct {
+ uint16_t format;
+ uint16_t channels;
+ uint32_t rate;
+ uint32_t bytes_per_sec;
+ uint16_t sample_size;
+ uint16_t sample_bits;
+ } body;
+ struct {
+ uint32_t type;
+ uint32_t length;
+ } chunk;
+};
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
+#define LE_SHORT(v) (v)
+#define LE_INT(v) (v)
+#else
+#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
+#define LE_SHORT(v) bswap_16(v)
+#define LE_INT(v) bswap_32(v)
+#endif
+
+#define WAV_RIFF COMPOSE_ID('R','I','F','F')
+#define WAV_WAVE COMPOSE_ID('W','A','V','E')
+#define WAV_FMT COMPOSE_ID('f','m','t',' ')
+#define WAV_DATA COMPOSE_ID('d','a','t','a')
+#define WAV_PCM_CODE 1
+
+static const char *search_for_file(const char *name)
+{
+ char *file;
+ if (*name == '/')
+ return strdup(name);
+ file = malloc(strlen(wav_file_dir) + strlen(name) + 2);
+ if (file)
+ sprintf(file, "%s/%s", wav_file_dir, name);
+ return file;
+}
+
+static int check_wav_file(int channel, const char *name)
+{
+ struct wave_header header;
+ int fd;
+
+ wav_file[channel] = search_for_file(name);
+ if (! wav_file[channel]) {
+ fprintf(stderr, _("No enough memory\n"));
+ return -ENOMEM;
+ }
+
+ if ((fd = open(wav_file[channel], O_RDONLY)) < 0) {
+ fprintf(stderr, _("Cannot open WAV file %s\n"), wav_file[channel]);
+ return -EINVAL;
+ }
+ if (read(fd, &header, sizeof(header)) < (int)sizeof(header)) {
+ fprintf(stderr, _("Invalid WAV file %s\n"), wav_file[channel]);
+ goto error;
+ }
+
+ if (header.hdr.magic != WAV_RIFF || header.hdr.type != WAV_WAVE) {
+ fprintf(stderr, _("Not a WAV file: %s\n"), wav_file[channel]);
+ goto error;
+ }
+ if (header.body.format != LE_SHORT(WAV_PCM_CODE)) {
+ fprintf(stderr, _("Unsupported WAV format %d for %s\n"),
+ LE_SHORT(header.body.format), wav_file[channel]);
+ goto error;
+ }
+ if (header.body.channels != LE_SHORT(1)) {
+ fprintf(stderr, _("%s is not a mono stream (%d channels)\n"),
+ wav_file[channel], LE_SHORT(header.body.channels));
+ goto error;
+ }
+ if (header.body.rate != LE_INT(rate)) {
+ fprintf(stderr, _("Sample rate doesn't match (%d) for %s\n"),
+ LE_INT(header.body.rate), wav_file[channel]);
+ goto error;
+ }
+ if (header.body.sample_bits != LE_SHORT(16)) {
+ fprintf(stderr, _("Unsupported sample format bits %d for %s\n"),
+ LE_SHORT(header.body.sample_bits), wav_file[channel]);
+ goto error;
+ }
+ if (header.chunk.type != WAV_DATA) {
+ fprintf(stderr, _("Invalid WAV file %s\n"), wav_file[channel]);
+ goto error;
+ }
+ wav_file_size[channel] = LE_INT(header.chunk.length);
+ close(fd);
+ return 0;
+
+ error:
+ close(fd);
+ return -EINVAL;
+}
+
+static int setup_wav_file(int chn)
+{
+ static const char *const wavs[MAX_CHANNELS] = {
+ "Front_Left.wav",
+ "Front_Right.wav",
+ "Rear_Left.wav",
+ "Rear_Right.wav",
+ "Front_Center.wav",
+ "Rear_Center.wav", /* FIXME: should be "Bass" or so */
+ "Side_Left.wav",
+ "Side_Right.wav",
+ "Channel_9.wav",
+ "Channel_10.wav",
+ "Channel_11.wav",
+ "Channel_12.wav",
+ "Channel_13.wav",
+ "Channel_14.wav",
+ "Channel_15.wav",
+ "Channel_16.wav"
+ };
+
+ if (given_test_wav_file)
+ return check_wav_file(chn, given_test_wav_file);
+ else
+ return check_wav_file(chn, wavs[chn]);
+}
+
+static int read_wav(uint16_t *buf, int channel, int offset, int bufsize)
+{
+ static FILE *wavfp = NULL;
+ int size;
+
+ if (! wav_file[channel]) {
+ fprintf(stderr, _("Undefined channel %d\n"), channel);
+ return -EINVAL;
+ }
+
+ if (offset >= wav_file_size[channel])
+ return 0; /* finished */
+
+ if (! offset) {
+ if (wavfp)
+ fclose(wavfp);
+ wavfp = fopen(wav_file[channel], "r");
+ if (! wavfp)
+ return -errno;
+ if (fseek(wavfp, sizeof(struct wave_header), SEEK_SET) < 0)
+ return -errno;
+ }
+ if (offset + bufsize > wav_file_size[channel])
+ bufsize = wav_file_size[channel] - offset;
+ bufsize /= channels;
+ for (size = 0; size < bufsize; size += 2) {
+ int chn;
+ for (chn = 0; chn < channels; chn++) {
+ if (chn == channel) {
+ if (fread(buf, 2, 1, wavfp) != 1)
+ return size;
+ }
+ else
+ *buf = 0;
+ buf++;
+ }
+ }
+ return size;
+}
+
+
+/*
+ * Transfer method - write only
+ */
+
+static int write_buffer(snd_pcm_t *handle, uint8_t *ptr, int cptr)
+{
+ int err;
+
+ while (cptr > 0) {
+
+ err = snd_pcm_writei(handle, ptr, cptr);
+
+ if (err == -EAGAIN)
+ continue;
+
+ if (err < 0) {
+ fprintf(stderr, _("Write error: %d,%s\n"), err, snd_strerror(err));
+ if (xrun_recovery(handle, err) < 0) {
+ fprintf(stderr, _("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
+ return -1;
+ }
+ break; /* skip one period */
+ }
+
+ ptr += snd_pcm_frames_to_bytes(handle, err);
+ cptr -= err;
+ }
+ return 0;
+}
+
+static int write_loop(snd_pcm_t *handle, int channel, int periods, uint8_t *frames)
+{
+ double phase = 0;
+ int err, n;
+
+ if (test_type == TEST_WAV) {
+ int bufsize = snd_pcm_frames_to_bytes(handle, period_size);
+ n = 0;
+ while ((err = read_wav((uint16_t *)frames, channel, n, bufsize)) > 0) {
+ n += err;
+ if ((err = write_buffer(handle, frames,
+ snd_pcm_bytes_to_frames(handle, err * channels))) < 0)
+ break;
+ }
+ if (buffer_size > n) {
+ snd_pcm_drain(handle);
+ snd_pcm_prepare(handle);
+ }
+ return err;
+ }
+
+
+ if (periods <= 0)
+ periods = 1;
+
+ for(n = 0; n < periods; n++) {
+ if (test_type == TEST_PINK_NOISE)
+ generate_pink_noise(frames, channel, period_size);
+ else
+ generate_sine(frames, channel, period_size, &phase);
+
+ if ((err = write_buffer(handle, frames, period_size)) < 0)
+ return err;
+ }
+ if (buffer_size > n * period_size) {
+ snd_pcm_drain(handle);
+ snd_pcm_prepare(handle);
+ }
+ return 0;
+}
+
+static void help(void)
+{
+ int k;
+
+ printf(
+ _("Usage: speaker-test [OPTION]... \n"
+ "-h,--help help\n"
+ "-D,--device playback device\n"
+ "-r,--rate stream rate in Hz\n"
+ "-c,--channels count of channels in stream\n"
+ "-f,--frequency sine wave frequency in Hz\n"
+ "-F,--format sample format\n"
+ "-b,--buffer ring buffer size in us\n"
+ "-p,--period period size in us\n"
+ "-P,--nperiods number of periods\n"
+ "-t,--test pink=use pink noise, sine=use sine wave, wav=WAV file\n"
+ "-l,--nloops specify number of loops to test, 0 = infinite\n"
+ "-s,--speaker single speaker test. Values 1=Left, 2=right, etc\n"
+ "-w,--wavfile Use the given WAV file as a test sound\n"
+ "-W,--wavdir Specify the directory containing WAV files\n"
+ "\n"));
+#if 1
+ printf(_("Recognized sample formats are:"));
+ for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
+ const char *s = snd_pcm_format_name(k);
+ if (s)
+ printf(" %s", s);
+ }
+
+ printf("\n\n");
+#endif
+
+}
+
+int main(int argc, char *argv[]) {
+ snd_pcm_t *handle;
+ int err, morehelp;
+ snd_pcm_hw_params_t *hwparams;
+ snd_pcm_sw_params_t *swparams;
+ uint8_t *frames;
+ int chn;
+ double time1,time2,time3;
+ unsigned int n, nloops;
+ struct timeval tv1,tv2;
+
+ static const struct option long_option[] = {
+ {"help", 0, NULL, 'h'},
+ {"device", 1, NULL, 'D'},
+ {"rate", 1, NULL, 'r'},
+ {"channels", 1, NULL, 'c'},
+ {"frequency", 1, NULL, 'f'},
+ {"format", 1, NULL, 'F'},
+ {"buffer", 1, NULL, 'b'},
+ {"period", 1, NULL, 'p'},
+ {"nperiods", 1, NULL, 'P'},
+ {"test", 1, NULL, 't'},
+ {"nloops", 1, NULL, 'l'},
+ {"speaker", 1, NULL, 's'},
+ {"wavfile", 1, NULL, 'w'},
+ {"wavdir", 1, NULL, 'W'},
+ {NULL, 0, NULL, 0 },
+ };
+
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ textdomain(PACKAGE);
+#endif
+
+ snd_pcm_hw_params_alloca(&hwparams);
+ snd_pcm_sw_params_alloca(&swparams);
+
+ nloops = 0;
+ morehelp = 0;
+
+ printf("\nspeaker-test %s\n\n", SND_UTIL_VERSION_STR);
+ while (1) {
+ int c;
+
+ if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:", long_option, NULL)) < 0)
+ break;
+
+ switch (c) {
+ case 'h':
+ morehelp++;
+ break;
+ case 'D':
+ device = strdup(optarg);
+ break;
+ case 'F':
+ format = snd_pcm_format_value(optarg);
+ break;
+ case 'r':
+ rate = atoi(optarg);
+ rate = rate < 4000 ? 4000 : rate;
+ rate = rate > 196000 ? 196000 : rate;
+ break;
+ case 'c':
+ channels = atoi(optarg);
+ channels = channels < 1 ? 1 : channels;
+ channels = channels > 1024 ? 1024 : channels;
+ break;
+ case 'f':
+ freq = atoi(optarg);
+ freq = freq < 50 ? 50 : freq;
+ freq = freq > 5000 ? 5000 : freq;
+ break;
+ case 'b':
+ buffer_time = atoi(optarg);
+ buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time;
+ break;
+ case 'p':
+ period_time = atoi(optarg);
+ period_time = period_time > 1000000 ? 1000000 : period_time;
+ break;
+ case 'P':
+ nperiods = atoi(optarg);
+ if (nperiods < 2 || nperiods > 1024) {
+ fprintf(stderr, _("Invalid number of periods %d\n"), nperiods);
+ exit(1);
+ }
+ break;
+ case 't':
+ if (*optarg == 'p')
+ test_type = TEST_PINK_NOISE;
+ else if (*optarg == 's')
+ test_type = TEST_SINE;
+ else if (*optarg == 'w')
+ test_type = TEST_WAV;
+ else if (isdigit(*optarg)) {
+ test_type = atoi(optarg);
+ if (test_type < TEST_PINK_NOISE || test_type > TEST_WAV) {
+ fprintf(stderr, _("Invalid test type %s\n"), optarg);
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, _("Invalid test type %s\n"), optarg);
+ exit(1);
+ }
+ break;
+ case 'l':
+ nloops = atoi(optarg);
+ break;
+ case 's':
+ speaker = atoi(optarg);
+ speaker = speaker < 1 ? 0 : speaker;
+ speaker = speaker > channels ? 0 : speaker;
+ if (speaker==0) {
+ fprintf(stderr, _("Invalid parameter for -s option.\n"));
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'w':
+ given_test_wav_file = optarg;
+ break;
+ case 'W':
+ wav_file_dir = optarg;
+ break;
+ default:
+ fprintf(stderr, _("Unknown option '%c'\n"), c);
+ exit(EXIT_FAILURE);
+ break;
+ }
+ }
+
+ if (morehelp) {
+ help();
+ exit(EXIT_SUCCESS);
+ }
+
+ if (test_type == TEST_WAV)
+ format = SND_PCM_FORMAT_S16_LE; /* fixed format */
+
+ printf(_("Playback device is %s\n"), device);
+ printf(_("Stream parameters are %iHz, %s, %i channels\n"), rate, snd_pcm_format_name(format), channels);
+ switch (test_type) {
+ case TEST_PINK_NOISE:
+ printf(_("Using 16 octaves of pink noise\n"));
+ break;
+ case TEST_SINE:
+ printf(_("Sine wave rate is %.4fHz\n"), freq);
+ break;
+ case TEST_WAV:
+ printf(_("WAV file(s)\n"));
+ break;
+
+ }
+
+ while ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+ printf(_("Playback open error: %d,%s\n"), err,snd_strerror(err));
+ sleep(1);
+ }
+
+ if ((err = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+ printf(_("Setting of hwparams failed: %s\n"), snd_strerror(err));
+ snd_pcm_close(handle);
+ exit(EXIT_FAILURE);
+ }
+ if ((err = set_swparams(handle, swparams)) < 0) {
+ printf(_("Setting of swparams failed: %s\n"), snd_strerror(err));
+ snd_pcm_close(handle);
+ exit(EXIT_FAILURE);
+ }
+
+ frames = malloc(snd_pcm_frames_to_bytes(handle, period_size));
+ if (test_type == TEST_PINK_NOISE)
+ initialize_pink_noise(&pink, 16);
+
+ if (frames == NULL) {
+ fprintf(stderr, _("No enough memory\n"));
+ exit(EXIT_FAILURE);
+ }
+ if (speaker==0) {
+
+ if (test_type == TEST_WAV) {
+ for (chn = 0; chn < channels; chn++) {
+ if (setup_wav_file(chn) < 0)
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ for (n = 0; ! nloops || n < nloops; n++) {
+
+ gettimeofday(&tv1, NULL);
+ for(chn = 0; chn < channels; chn++) {
+ int channel=chn;
+ if (channels == 4) {
+ channel=channels4[chn];
+ }
+ if (channels == 6) {
+ channel=channels6[chn];
+ }
+ if (channels == 8) {
+ channel=channels8[chn];
+ }
+ printf(" %d - %s\n", channel, gettext(channel_name[channel]));
+
+ err = write_loop(handle, channel, ((rate*3)/period_size), frames);
+
+ if (err < 0) {
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
+ free(frames);
+ snd_pcm_close(handle);
+ exit(EXIT_SUCCESS);
+ }
+ }
+ gettimeofday(&tv2, NULL);
+ time1 = (double)tv1.tv_sec + ((double)tv1.tv_usec / 1000000.0);
+ time2 = (double)tv2.tv_sec + ((double)tv2.tv_usec / 1000000.0);
+ time3 = time2 - time1;
+ printf(_("Time per period = %lf\n"), time3 );
+ }
+ } else {
+ if (test_type == TEST_WAV) {
+ if (setup_wav_file(speaker - 1) < 0)
+ exit(EXIT_FAILURE);
+ }
+
+ printf(" - %s\n", gettext(channel_name[speaker-1]));
+ err = write_loop(handle, speaker-1, ((rate*5)/period_size), frames);
+
+ if (err < 0) {
+ fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
+ }
+ }
+
+
+ free(frames);
+ snd_pcm_close(handle);
+
+ exit(EXIT_SUCCESS);
+}
diff --git a/alsa-utils/utils/Makefile.am b/alsa-utils/utils/Makefile.am
new file mode 100644
index 0000000..083e5b4
--- /dev/null
+++ b/alsa-utils/utils/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST = buildrpm
+
+rpm: buildrpm alsa-lib.spec
+ VERSION=$(VERSION) $(srcdir)/buildrpm
diff --git a/alsa-utils/utils/Makefile.in b/alsa-utils/utils/Makefile.in
new file mode 100644
index 0000000..f337a26
--- /dev/null
+++ b/alsa-utils/utils/Makefile.in
@@ -0,0 +1,335 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = utils
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/alsa-utils.spec.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/aconfig.h
+CONFIG_CLEAN_FILES = alsa-utils.spec
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSACONF_FALSE = @ALSACONF_FALSE@
+ALSACONF_TRUE = @ALSACONF_TRUE@
+ALSAMIXER_FALSE = @ALSAMIXER_FALSE@
+ALSAMIXER_TRUE = @ALSAMIXER_TRUE@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURSESINC = @CURSESINC@
+CURSESLIB = @CURSESLIB@
+CURSES_CFLAGS = @CURSES_CFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SND_UTIL_MAJOR = @SND_UTIL_MAJOR@
+SND_UTIL_MINOR = @SND_UTIL_MINOR@
+SND_UTIL_SUBMINOR = @SND_UTIL_SUBMINOR@
+SND_UTIL_VERSION = @SND_UTIL_VERSION@
+STRIP = @STRIP@
+TESTSOUND = @TESTSOUND@
+USE_NLS = @USE_NLS@
+USE_XMLTO_FALSE = @USE_XMLTO_FALSE@
+USE_XMLTO_TRUE = @USE_XMLTO_TRUE@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ncurses5_config = @ncurses5_config@
+ncursesw5_config = @ncursesw5_config@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+xmlto = @xmlto@
+EXTRA_DIST = buildrpm
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign utils/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+alsa-utils.spec: $(top_builddir)/config.status $(srcdir)/alsa-utils.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+rpm: buildrpm alsa-lib.spec
+ VERSION=$(VERSION) $(srcdir)/buildrpm
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/alsa-utils/utils/alsa-utils.spec.in b/alsa-utils/utils/alsa-utils.spec.in
new file mode 100644
index 0000000..8daf3ba
--- /dev/null
+++ b/alsa-utils/utils/alsa-utils.spec.in
@@ -0,0 +1,76 @@
+%define ver @VERSION@
+%define rel 1
+
+Summary: Advanced Linux Sound Architecture (ALSA) - Utils
+Name: alsa-utils
+Version: %ver
+Release: %rel
+Copyright: GPL
+Group: System/Libraries
+Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{ver}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+URL: http://www.alsa-project.org
+Requires: alsa-lib ncurses
+BuildRequires: alsa-lib-devel ncurses-devel gettext
+
+%description
+
+Advanced Linux Sound Architecture (ALSA) - Utils
+
+%changelog
+* Sun Oct 1 2006 Jaroslav Kysela <perex@perex.cz>
+- add gettext to BuildRequires
+- add more files (see alsa bug#2139)
+
+* Tue Nov 25 2003 Ronny V. Vindenes <sublett@amigascne.org>
+- include all manpages
+
+* Thu Mar 6 2003 Ronny V. Vindenes <sublett@dc-s.com>
+
+- removed wrongly included doc file
+- changed BuildRoot from /var/tmp to _tmppath
+- use standard rpm macros for build & install section
+- updated dependencies
+
+* Tue Nov 20 2001 Jaroslav Kysela <perex@perex.cz>
+
+- changed BuildRoot from /tmp to /var/tmp
+- _prefix and _mandir macros are used for configure and mkdir
+- DESTDIR is used for make install
+
+* Sun Nov 11 2001 Miroslav Benes <mbenes@tenez.cz>
+
+- dangerous command "rpm -rf $RPM_BUILD_ROOT" checks $RPM_BUILD_ROOT variable
+- unset key "Docdir" - on some new systems are documentation in /usr/share/doc
+
+* Mon May 28 1998 Helge Jensen <slog@slog.dk>
+
+- Made SPEC file
+
+%prep
+%setup
+%build
+%configure
+make
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+%makeinstall
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+
+%doc ChangeLog COPYING README
+
+%{_prefix}/sbin/*
+%{_prefix}/bin/*
+%{_mandir}/man?/*
+%{_mandir}/fr/man?/*
+%{_prefix}/share/alsa/speaker-test/*
+%{_prefix}/share/locale/ja/LC_MESSAGES/*
+%{_prefix}/share/locale/ru/LC_MESSAGES/*
+%{_prefix}/share/man/fr/man8/alsaconf.8.gz
+%{_prefix}/share/sounds/alsa/*
diff --git a/alsa-utils/utils/buildrpm b/alsa-utils/utils/buildrpm
new file mode 100644
index 0000000..3a9ab86
--- /dev/null
+++ b/alsa-utils/utils/buildrpm
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+source=.
+version=`cat $source/../version`
+package=$source/../alsa-utils-$version.tar.bz2
+packagedir=/usr/src/redhat
+xrpmbuild=rpm
+rpmbuild --usage 2> /dev/null > /dev/null && xrpmbuild=rpmbuild
+
+# SuSE path
+if [ -d /usr/src/packages ]; then
+ packagedir=/usr/src/packages
+fi
+
+make -C .. clean
+make -C .. dist
+
+if [ ! -r $package ]; then
+ echo "Error: wrong package: $package"
+ exit 1
+fi
+
+cp -fv $package ${packagedir}/SOURCES
+
+if [ ! -r $source/buildrpm ]; then
+ echo "Error: invalid directory: $source"
+ exit 1
+fi
+
+if [ ! -d ${packagedir} ]; then
+ echo "Error: ${packagedir} directory not found"
+ exit 1
+fi
+
+if [ ! -r $source/alsadriver.spec ]; then
+ cd $source/..
+ ./configure
+ cd utils
+fi
+
+cp -fv $source/alsa-utils.spec ${packagedir}/SPECS
+cd ${packagedir}/SPECS
+$xrpmbuild -ba alsa-utils.spec
+cd ${packagedir}
diff --git a/libaudio/Android.mk b/libaudio/Android.mk
new file mode 100644
index 0000000..efe16f2
--- /dev/null
+++ b/libaudio/Android.mk
@@ -0,0 +1,82 @@
+# hardware/libaudio-alsa/Android.mk
+#
+# Copyright 2008 Wind River Systems
+#
+
+ifeq ($(filter-out s5pc110 s5pc100 s5p6440,$(TARGET_BOARD_PLATFORM)),)
+ifeq ($(BOARD_USES_GENERIC_AUDIO),false)
+
+ LOCAL_PATH := $(call my-dir)
+
+ include $(CLEAR_VARS)
+
+ LOCAL_ARM_MODE := arm
+ LOCAL_CFLAGS := -D_POSIX_SOURCE
+ LOCAL_WHOLE_STATIC_LIBRARIES := libasound
+
+ ifneq ($(ALSA_DEFAULT_SAMPLE_RATE),)
+ LOCAL_CFLAGS += -DALSA_DEFAULT_SAMPLE_RATE=$(ALSA_DEFAULT_SAMPLE_RATE)
+ endif
+
+# Samsung Feature
+ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
+ LOCAL_CFLAGS += -DSLSI_S5PC110
+
+# Samsung Driver Feature
+# LOCAL_CFLAGS += -DSEC_SWP_SOUND -DSEC_IPC -DPOWER_GATING -DSYNCHRONIZE_CP -DBT_NR_EC_ONOFF
+ LOCAL_CFLAGS += -DSEC_SWP_SOUND -DSEC_IPC
+ LOCAL_CFLAGS += -DTURN_ON_DEVICE_ONLY_USE
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM),s5pc100)
+ LOCAL_CFLAGS += -DSLSI_S5PC100
+endif
+
+ LOCAL_C_INCLUDES += external/alsa-lib/include
+
+ LOCAL_SRC_FILES := AudioHardwareALSA.cpp
+
+ LOCAL_MODULE := libaudio
+
+ LOCAL_STATIC_LIBRARIES += libaudiointerface
+
+ LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libmedia \
+ libhardware_legacy \
+ libdl \
+ libc
+
+ifeq ($(BOARD_HAVE_BLUETOOTH),true)
+ LOCAL_SHARED_LIBRARIES += liba2dp
+endif
+
+ifneq ($(NO_IPC_ALSA_RILD),true)
+ LOCAL_SHARED_LIBRARIES += libsecril-client
+ LOCAL_CFLAGS += -DIPC_ALSA_RILD
+endif
+ include $(BUILD_SHARED_LIBRARY)
+
+# To build audiopolicy library
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ AudioPolicyManager.cpp \
+ AudioPolicyManagerBase.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libmedia
+
+LOCAL_MODULE:= libaudiopolicy
+
+ifeq ($(BOARD_HAVE_BLUETOOTH),true)
+ LOCAL_CFLAGS += -DWITH_A2DP
+endif
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
+endif
diff --git a/libaudio/AudioHardwareALSA.cpp b/libaudio/AudioHardwareALSA.cpp
new file mode 100644
index 0000000..bb6a8fc
--- /dev/null
+++ b/libaudio/AudioHardwareALSA.cpp
@@ -0,0 +1,2361 @@
+/* AudioHardwareALSA.cpp
+ **
+ ** Copyright 2008-2009 Wind River Systems
+ **
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
+ **
+ ** http://www.apache.org/licenses/LICENSE-2.0
+ **
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
+ ** limitations under the License.
+ */
+#include <errno.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define LOG_TAG "AudioHardwareALSA"
+#include <utils/Log.h>
+#include <utils/String8.h>
+
+#include <cutils/properties.h>
+#include <media/AudioRecord.h>
+#include <hardware_legacy/power.h>
+
+#include <alsa/asoundlib.h>
+#include "AudioHardwareALSA.h"
+
+#if defined SEC_IPC
+// sangsu fix : headers for IPC
+#include <telephony/ril.h>
+#endif
+#ifndef ALSA_DEFAULT_SAMPLE_RATE
+#define ALSA_DEFAULT_SAMPLE_RATE 44100 // in Hz
+#endif
+
+#define SND_MIXER_VOL_RANGE_MIN (0)
+#define SND_MIXER_VOL_RANGE_MAX (100)
+
+#define ALSA_NAME_MAX 128
+
+#define ALSA_STRCAT(x,y) \
+ if (strlen(x) + strlen(y) < ALSA_NAME_MAX) \
+ strcat(x, y);
+
+#define PERIOD_PLAYBACK 4
+#define PERIOD_CAPTURE 4
+#define PLAYBACK 0
+#define CAPTURE 1
+
+// If you want to dump PCM data, activate this feature
+//#define PCM_INPUT_DUMP
+//#define PCM_OUTPUT_DUMP
+
+#ifdef PCM_INPUT_DUMP
+#define PCM_INPUT_DUMP_PATH "/data/Read_PCM_Dump.dat"
+FILE *fpInput = NULL ;
+#endif
+
+#ifdef PCM_OUTPUT_DUMP
+#define PCM_OUTPUT_DUMP_PATH "/data/Write_PCM_Dump.dat"
+FILE *fpOutput = NULL ;
+#endif
+
+extern "C"
+{
+ extern int ffs(int i);
+
+ //
+ // Make sure this prototype is consistent with what's in
+ // external/libasound/alsa-lib-1.0.16/src/pcm/pcm_null.c!
+ //
+ extern int snd_pcm_null_open(snd_pcm_t **pcmp,
+ const char *name,
+ snd_pcm_stream_t stream,
+ int mode);
+
+ //
+ // Function for dlsym() to look up for creating a new AudioHardwareInterface.
+ //
+ android::AudioHardwareInterface *createAudioHardware(void) {
+ return new android::AudioHardwareALSA();
+ }
+} // extern "C"
+
+namespace android
+{
+
+#if 0
+typedef AudioSystem::audio_routes audio_routes;
+#define ROUTE_ALL AudioSystem::ROUTE_ALL
+#define ROUTE_EARPIECE AudioSystem::ROUTE_EARPIECE
+#define ROUTE_SPEAKER AudioSystem::ROUTE_SPEAKER
+#define ROUTE_BLUETOOTH_SCO AudioSystem::ROUTE_BLUETOOTH_SCO
+#define ROUTE_HEADSET AudioSystem::ROUTE_HEADSET
+#define ROUTE_BLUETOOTH_A2DP AudioSystem::ROUTE_BLUETOOTH_A2DP
+#elif defined SEC_SWP_SOUND
+typedef AudioSystem::audio_devices audio_routes;
+#define ROUTE_ALL AudioSystem::DEVICE_OUT_ALL
+#define ROUTE_EARPIECE AudioSystem::DEVICE_OUT_EARPIECE
+#define ROUTE_HEADSET AudioSystem::DEVICE_OUT_WIRED_HEADSET
+#define ROUTE_HEADPHONE AudioSystem::DEVICE_OUT_WIRED_HEADPHONE
+#define ROUTE_SPEAKER AudioSystem::DEVICE_OUT_SPEAKER
+#define ROUTE_BLUETOOTH_SCO AudioSystem::DEVICE_OUT_BLUETOOTH_SCO
+#define ROUTE_BLUETOOTH_SCO_HEADSET AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET
+#define ROUTE_BLUETOOTH_SCO_CARKIT AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT
+#define ROUTE_BLUETOOTH_A2DP AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP
+#define ROUTE_BLUETOOTH_A2DP_HEADPHONES AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES
+#define ROUTE_BLUETOOTH_A2DP_SPEAKER AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER
+#else
+typedef AudioSystem::audio_devices audio_routes;
+#define ROUTE_ALL AudioSystem::DEVICE_OUT_ALL
+#define ROUTE_EARPIECE AudioSystem::DEVICE_OUT_EARPIECE
+#define ROUTE_SPEAKER AudioSystem::DEVICE_OUT_SPEAKER
+#define ROUTE_BLUETOOTH_SCO AudioSystem::DEVICE_OUT_BLUETOOTH_SCO
+#define ROUTE_HEADSET AudioSystem::DEVICE_OUT_WIRED_HEADSET
+#define ROUTE_BLUETOOTH_A2DP AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP
+#endif
+// ----------------------------------------------------------------------------
+
+static const int DEFAULT_SAMPLE_RATE = ALSA_DEFAULT_SAMPLE_RATE;
+
+static const char _nullALSADeviceName[] = "NULL_Device";
+
+static void ALSAErrorHandler(const char *file,
+ int line,
+ const char *function,
+ int err,
+ const char *fmt,
+ ...)
+{
+ char buf[BUFSIZ];
+ va_list arg;
+ int l;
+
+ va_start(arg, fmt);
+ l = snprintf(buf, BUFSIZ, "%s:%i:(%s) ", file, line, function);
+ vsnprintf(buf + l, BUFSIZ - l, fmt, arg);
+ buf[BUFSIZ-1] = '\0';
+ LOGE("ALSALib %s.", buf);
+ va_end(arg);
+}
+
+// ----------------------------------------------------------------------------
+
+/* The following table(s) need to match in order of the route bits
+ */
+#if defined SEC_SWP_SOUND
+static const char *deviceSuffix[] = {
+ // output devices
+ /* ROUTE_EARPIECE */ "_Earpiece",
+ /* ROUTE_SPEAKER */ "_Speaker",
+ /* ROUTE_HEADSET */ "_Headset",
+ /* ROUTE_HEADPHONE */ "_Headset",
+ /* ROUTE_BLUETOOTH_SCO */ "_Bluetooth",
+ /* ROUTE_BLUETOOTH_SCO_HEADSET */ "_Bluetooth",
+ /* ROUTE_BLUETOOTH_SCO_CARKIT */ "_Bluetooth", //"_Bluetooth_Carkit"
+ /* ROUTE_BLUETOOTH_A2DP */ "_Bluetooth", //"_Bluetooth-A2DP"
+ /* ROUTE_BLUETOOTH_A2DP_HEADPHONES */ "_Bluetooth", //"_Bluetooth-A2DP_HeadPhone"
+ /* ROUTE_BLUETOOTH_A2DP_SPEAKER */ "_Bluetooth", // "_Bluetooth-A2DP_Speaker"
+ /* ROUTE_AUX_DIGITAL */ "_AuxDigital",
+ /* ROUTE_TV_OUT */ "_TvOut",
+ /* ROUTE_AUX_DIGITAL */ "_ExtraDockSpeaker",
+ /* ROUTE_NULL */ "_Null",
+ /* ROUTE_NULL */ "_Null",
+ /* ROUTE_DEFAULT */ "_OutDefault",
+
+ // input devices
+ /* ROUTE_COMMUNICATION */ "_Communication",
+ /* ROUTE_AMBIENT */ "_Ambient",
+ /* ROUTE_BUILTIN_MIC */ "_Speaker",
+ /* ROUTE_BLUETOOTH_SCO_HEADSET */ "_Bluetooth",
+ /* ROUTE_WIRED_HEADSET */ "_Headset",
+ /* ROUTE_AUX_DIGITAL */ "_AuxDigital",
+ /* ROUTE_VOICE_CALL */ "_VoiceCall",
+ /* ROUTE_BACK_MIC */ "_BackMic",
+ /* ROUTE_IN_DEFAULT */ "_InDefault",
+};
+#else
+static const char *deviceSuffix[] = {
+ /* ROUTE_EARPIECE */ "_Earpiece",
+ /* ROUTE_SPEAKER */ "_Speaker",
+ /* ROUTE_BLUETOOTH_SCO */ "_Bluetooth",
+ /* ROUTE_HEADSET */ "_Headset",
+ /* ROUTE_BLUETOOTH_A2DP */ "_Bluetooth-A2DP",
+};
+#endif
+
+static const int deviceSuffixLen = (sizeof(deviceSuffix) / sizeof(char *));
+
+struct mixer_info_t;
+
+struct alsa_properties_t
+{
+ const audio_routes routes;
+ const char *propName;
+ const char *propDefault;
+ mixer_info_t *mInfo;
+};
+
+static alsa_properties_t masterPlaybackProp = {
+ ROUTE_ALL, "alsa.mixer.playback.master", "PCM", NULL
+};
+
+static alsa_properties_t masterCaptureProp = {
+ ROUTE_ALL, "alsa.mixer.capture.master", "Capture", NULL
+};
+
+static alsa_properties_t
+mixerMasterProp[SND_PCM_STREAM_LAST+1] = {
+ { ROUTE_ALL, "alsa.mixer.playback.master", "PCM", NULL},
+ { ROUTE_ALL, "alsa.mixer.capture.master", "Capture", NULL}
+};
+
+static alsa_properties_t
+mixerProp[][SND_PCM_STREAM_LAST+1] = {
+ {
+ {ROUTE_EARPIECE, "alsa.mixer.playback.earpiece", "Earpiece", NULL},
+ {ROUTE_EARPIECE, "alsa.mixer.capture.earpiece", "Capture", NULL}
+ },
+ {
+ {ROUTE_SPEAKER, "alsa.mixer.playback.speaker", "Speaker", NULL},
+ {ROUTE_SPEAKER, "alsa.mixer.capture.speaker", "", NULL}
+ },
+ {
+ {ROUTE_BLUETOOTH_SCO, "alsa.mixer.playback.bluetooth.sco", "Bluetooth", NULL},
+ {ROUTE_BLUETOOTH_SCO, "alsa.mixer.capture.bluetooth.sco", "Bluetooth Capture", NULL}
+ },
+ {
+ {ROUTE_HEADSET, "alsa.mixer.playback.headset", "Headphone", NULL},
+ {ROUTE_HEADSET, "alsa.mixer.capture.headset", "Capture", NULL}
+ },
+ {
+ {ROUTE_BLUETOOTH_A2DP, "alsa.mixer.playback.bluetooth.a2dp", "Bluetooth A2DP", NULL},
+ {ROUTE_BLUETOOTH_A2DP, "alsa.mixer.capture.bluetooth.a2dp", "Bluetooth A2DP Capture", NULL}
+ },
+ {
+ {static_cast<audio_routes>(0), NULL, NULL, NULL},
+ {static_cast<audio_routes>(0), NULL, NULL, NULL}
+ }
+};
+
+// ----------------------------------------------------------------------------
+
+AudioHardwareALSA::AudioHardwareALSA() :
+ mOutput(0),
+ mInput(0)
+#if defined SEC_IPC
+ ,mIPC(0) //for IPC
+#endif
+#if defined TURN_ON_DEVICE_ONLY_USE
+ ,mActivatedInputDevice(false)
+#endif
+#if defined SYNCHRONIZE_CP
+ ,mActivatedCP(false)
+#endif
+
+{
+ snd_lib_error_set_handler(&ALSAErrorHandler);
+ mMixer = new ALSAMixer;
+#if defined SEC_IPC
+ mIPC = new AudioHardwareIPC; // IPC init
+#endif
+}
+
+AudioHardwareALSA::~AudioHardwareALSA()
+{
+ if (mOutput) delete mOutput;
+ if (mInput) delete mInput;
+ if (mMixer) delete mMixer;
+#if defined SEC_IPC
+ if (mIPC) delete mIPC; // for IPC
+#endif
+}
+
+status_t AudioHardwareALSA::initCheck()
+{
+ if (mMixer && mMixer->isValid())
+ return NO_ERROR;
+ else
+ return NO_INIT;
+}
+
+status_t AudioHardwareALSA::standby()
+{
+ if (mOutput)
+ return mOutput->standby();
+
+ return NO_ERROR;
+}
+
+status_t AudioHardwareALSA::setVoiceVolume(float volume)
+{
+ LOGI("### setVoiceVolume");
+#if defined SEC_IPC
+ // sangsu fix : transmic volume level IPC to modem
+ if (AudioSystem::MODE_IN_CALL == mMode)
+ {
+ uint32_t routes = mRoutes[mMode];
+
+ LOGI("### route(%d) call volume(%f)", routes, volume);
+ switch (routes){
+ case AudioSystem::ROUTE_EARPIECE:
+ case AudioSystem::ROUTE_HEADPHONE: // Use receive path with 3 pole headset.
+ LOGI("### earpiece call volume");
+ mIPC->transmitVolumeIPC(OEM_SOUND_TYPE_VOICE, volume);
+ break;
+
+ case AudioSystem::ROUTE_SPEAKER:
+ LOGI("### speaker call volume");
+ mIPC->transmitVolumeIPC(OEM_SOUND_TYPE_SPEAKER, volume);
+ break;
+
+ case AudioSystem::ROUTE_BLUETOOTH_SCO:
+ case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
+ case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
+ case AudioSystem::ROUTE_BLUETOOTH_A2DP:
+ LOGI("### bluetooth call volume");
+ mIPC->transmitVolumeIPC(OEM_SOUND_TYPE_BTVOICE, volume);
+ break;
+
+ case AudioSystem::ROUTE_HEADSET:
+ LOGI("### headset call volume");
+ mIPC->transmitVolumeIPC(OEM_SOUND_TYPE_HEADSET, volume);
+ break;
+
+ default:
+ LOGE("### Call volume setting error!!!0x%08x \n", routes);
+ break;
+ }
+ }
+ // sangsu fix end
+#endif
+
+ // The voice volume is used by the VOICE_CALL audio stream.
+ if (mMixer)
+ return mMixer->setVolume(ROUTE_EARPIECE, volume);
+ else
+ return INVALID_OPERATION;
+}
+
+status_t AudioHardwareALSA::setMasterVolume(float volume)
+{
+ if (mMixer)
+ return mMixer->setMasterVolume(volume);
+ else
+ return INVALID_OPERATION;
+}
+
+#if defined TURN_ON_DEVICE_ONLY_USE
+int AudioHardwareALSA::setMicStatus(int on)
+{
+ LOGI("[%s], on=%d", __func__, on);
+ ALSAControl *mALSAControl = new ALSAControl();
+ status_t ret = mALSAControl->set("Mic Status", on);
+ delete mALSAControl;
+ return NO_ERROR;
+}
+#endif
+
+
+#if 0
+AudioStreamOut *
+AudioHardwareALSA::AudioStreamOut* openOutputStream(
+ int format=0,
+ int channelCount=0,
+ uint32_t sampleRate=0,
+ status_t *status=0)
+#else
+AudioStreamOut *
+AudioHardwareALSA::openOutputStream(
+ uint32_t devices,
+ int *format,
+ uint32_t *channels,
+ uint32_t *sampleRate,
+ status_t *status)
+#endif
+{
+ AutoMutex lock(mLock);
+
+ // only one output stream allowed
+ if (mOutput) {
+ *status = ALREADY_EXISTS;
+ return 0;
+ }
+
+ LOGV("[[[[[[[[\n%s - format = %d, channels = %d, sampleRate = %d, devices = %d]]]]]]]]\n", __func__, *format, *channels, *sampleRate,devices);
+
+ AudioStreamOutALSA *out = new AudioStreamOutALSA(this);
+
+ *status = out->set(format, channels, sampleRate);
+
+#ifdef PCM_OUTPUT_DUMP
+ if(fpOutput == NULL)
+ {
+ fpOutput = fopen(PCM_OUTPUT_DUMP_PATH, "w");
+ if (fpOutput == NULL)
+ LOGE("fpOutput File Open Error!!");
+ }
+#endif
+
+ if (*status == NO_ERROR) {
+ mOutput = out;
+ // Some information is expected to be available immediately after
+ // the device is open.
+ /* Tushar - Sets the current device output here - we may set device here */
+ //uint32_t routes = mRoutes[mMode];
+ //mOutput->setDevice(mMode, routes);
+ LOGI("%s] Setting ALSA device.", __func__);
+ mOutput->setDevice(mMode, devices, PLAYBACK); /* tushar - Enable all devices as of now */
+ }
+ else {
+ delete out;
+ }
+
+ return mOutput;
+}
+
+void
+AudioHardwareALSA::closeOutputStream(AudioStreamOut* out)
+{
+ /* TODO:Tushar: May lead to segmentation fault - check*/
+ //delete out;
+ AutoMutex lock(mLock);
+
+#ifdef PCM_OUTPUT_DUMP
+ fclose(fpOutput);
+ fpOutput = NULL;
+#endif
+
+ if (mOutput == 0 || mOutput != out) {
+ LOGW("Attempt to close invalid output stream");
+ }
+ else {
+ delete mOutput;
+ mOutput = 0;
+ }
+
+}
+
+#if 0
+AudioStreamIn *
+AudioHardwareALSA::openInputStream(int format,
+ int channelCount,
+ uint32_t sampleRate,
+ status_t *status,
+ AudioSystem::audio_in_acoustics acoustics)
+#else
+AudioStreamIn*
+AudioHardwareALSA::openInputStream(
+ uint32_t devices,
+ int *format,
+ uint32_t *channels,
+ uint32_t *sampleRate,
+ status_t *status,
+ AudioSystem::audio_in_acoustics acoustics)
+#endif
+{
+ AutoMutex lock(mLock);
+
+ // only one input stream allowed
+ if (mInput) {
+ *status = ALREADY_EXISTS;
+ return 0;
+ }
+
+ AudioStreamInALSA *in = new AudioStreamInALSA(this);
+
+ *status = in->set(format, channels, sampleRate);
+ if (*status == NO_ERROR) {
+ mInput = in;
+ // Some information is expected to be available immediately after
+ // the device is open.
+ //uint32_t routes = mRoutes[mMode];
+ //mInput->setDevice(mMode, routes);
+ mInput->setDevice(mMode, devices, CAPTURE); /* Tushar - as per modified arch */
+#if defined TURN_ON_DEVICE_ONLY_USE
+ mActivatedInputDevice = true;
+ setMicStatus(1);
+
+#ifdef PCM_INPUT_DUMP
+ if(fpInput == NULL)
+ {
+ fpInput = fopen(PCM_INPUT_DUMP_PATH, "w");
+ if (fpInput == NULL)
+ LOGE("fpInput File Open Error!!");
+ }
+#endif
+
+#endif
+ return mInput;
+ }
+ else {
+ delete in;
+ }
+ return mInput;
+}
+
+void
+AudioHardwareALSA::closeInputStream(AudioStreamIn* in)
+{
+ /* TODO:Tushar: May lead to segmentation fault - check*/
+ //delete in;
+ AutoMutex lock(mLock);
+
+ if (mInput == 0 || mInput != in) {
+ LOGW("Attempt to close invalid input stream");
+ }
+ else {
+ delete mInput;
+ mInput = 0;
+#ifdef PCM_INPUT_DUMP
+ fclose(fpInput);
+ fpInput = NULL;
+#endif
+#if defined TURN_ON_DEVICE_ONLY_USE
+ mActivatedInputDevice = false;
+ setMicStatus(0);
+#endif
+
+ }
+}
+
+#if defined SEC_SWP_SOUND
+status_t AudioHardwareALSA::doRouting(uint32_t device)
+{
+ uint32_t routes;
+ status_t ret;
+
+ AutoMutex lock(mLock);
+ int mode = mMode; // Prevent to changing mode on setup sequence.
+
+ if (mOutput) {
+ routes = device;
+ //routes = 0; /* Tushar - temp implementation */
+
+ // Setup sound path for CP clocking
+
+#if defined SEC_IPC
+
+ if (AudioSystem::MODE_IN_CALL == mode)
+ {
+
+ LOGI("### incall mode route (%d)", routes);
+ switch(routes){
+ case AudioSystem::ROUTE_EARPIECE:
+ LOGI("### incall mode earpiece route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_HANDSET);
+ break;
+
+ case AudioSystem::ROUTE_SPEAKER:
+ LOGI("### incall mode speaker route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_SPEAKER);
+ break;
+
+ case AudioSystem::ROUTE_BLUETOOTH_SCO:
+ case AudioSystem::ROUTE_BLUETOOTH_SCO_HEADSET:
+ case AudioSystem::ROUTE_BLUETOOTH_SCO_CARKIT:
+#if defined BT_NR_EC_ONOFF
+ if(mBluetoothECOff)
+ {
+ LOGI("### incall mode bluetooth EC OFF route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_BT_NSEC_OFF);
+ }
+ else
+ {
+#endif
+ LOGI("### incall mode bluetooth route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_BLUETOOTH);
+#if defined BT_NR_EC_ONOFF
+ }
+#endif
+ break;
+
+ case AudioSystem::ROUTE_HEADSET :
+ case AudioSystem::ROUTE_HEADPHONE :
+ LOGI("### incall mode headset route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_HEADSET);
+ break;
+
+ case AudioSystem::ROUTE_BLUETOOTH_A2DP:
+ LOGI("### incall mode bluetooth route");
+ mIPC->transmitAudioPathIPC(OEM_SOUND_AUDIO_PATH_BLUETOOTH);
+ break;
+
+ default:
+ LOGE("### incall mode Error!! route = [%d]", routes);
+ break;
+ }
+ }
+#endif// end of #if defined SEC_IPC
+
+ ret = mOutput->setDevice(mode, routes, PLAYBACK);
+
+#if defined SEC_IPC
+ if (AudioSystem::MODE_IN_CALL == mode)
+ {
+#if defined SYNCHRONIZE_CP
+ if(!mActivatedCP)
+ {
+ mIPC->transmitClock_IPC(OEM_SOUND_CLOCK_START);
+ mActivatedCP = true;
+ }
+#endif
+ }
+
+ if (AudioSystem::MODE_NORMAL== mode) // Call stop.
+ {
+#if defined SYNCHRONIZE_CP
+ if(mActivatedCP)
+ mActivatedCP = false;
+#endif
+
+ }
+#endif // end of #if defined SEC_IPC
+
+#ifndef SYNCHRONIZE_CP
+ ret = mOutput->setDevice(mode, routes, PLAYBACK);
+#endif
+ return ret;
+ }
+
+ return NO_INIT;
+}
+
+#else
+/** This function is no more used */
+status_t AudioHardwareALSA::doRouting()
+{
+ uint32_t routes;
+ AutoMutex lock(mLock);
+
+ LOGD("Inside AudioHardwareALSA::doRouting \n");
+ if (mOutput) {
+ //routes = mRoutes[mMode];
+ routes = 0; /* Tushar - temp implementation */
+ return mOutput->setDevice(mMode, routes, PLAYBACK);
+ }
+ return NO_INIT;
+
+}
+#endif
+
+status_t AudioHardwareALSA::setMicMute(bool state)
+{
+ if (mMixer)
+ return mMixer->setCaptureMuteState(ROUTE_EARPIECE, state);
+
+ return NO_INIT;
+}
+
+status_t AudioHardwareALSA::getMicMute(bool *state)
+{
+ if (mMixer)
+ return mMixer->getCaptureMuteState(ROUTE_EARPIECE, state);
+
+ return NO_ERROR;
+}
+
+status_t AudioHardwareALSA::dump(int fd, const Vector<String16>& args)
+{
+ return NO_ERROR;
+}
+
+// ----------------------------------------------------------------------------
+
+ALSAStreamOps::ALSAStreamOps() :
+ mHandle(0),
+ mHardwareParams(0),
+ mSoftwareParams(0),
+ mMode(-1),
+ mDevice(0)
+{
+ if (snd_pcm_hw_params_malloc(&mHardwareParams) < 0) {
+ LOG_ALWAYS_FATAL("Failed to allocate ALSA hardware parameters!");
+ }
+
+ if (snd_pcm_sw_params_malloc(&mSoftwareParams) < 0) {
+ LOG_ALWAYS_FATAL("Failed to allocate ALSA software parameters!");
+ }
+}
+
+ALSAStreamOps::~ALSAStreamOps()
+{
+ AutoMutex lock(mLock);
+
+ close();
+
+ if (mHardwareParams)
+ snd_pcm_hw_params_free(mHardwareParams);
+
+ if (mSoftwareParams)
+ snd_pcm_sw_params_free(mSoftwareParams);
+}
+
+
+status_t ALSAStreamOps::set(int *pformat,
+ uint32_t *pchannels,
+ uint32_t *prate)
+{
+ int lformat = pformat ? *pformat : 0;
+ unsigned int lchannels = pchannels ? *pchannels : 0;
+ unsigned int lrate = prate ? *prate : 0;
+
+
+ LOGD("ALSAStreamOps - input - format = %d, channels = %d, rate = %d\n", lformat, lchannels, lrate);
+ LOGD("ALSAStreamOps - default - format = %d, channels = %d, rate = %d\n", mDefaults->format, mDefaults->channels, mDefaults->sampleRate);
+
+ if(lformat == 0) lformat = getAndroidFormat(mDefaults->format);//format();
+ if(lchannels == 0) lchannels = getAndroidChannels(mDefaults->channels);// channelCount();
+ if(lrate == 0) lrate = mDefaults->sampleRate;
+
+ if((lformat != getAndroidFormat(mDefaults->format)) ||
+ (lchannels != getAndroidChannels(mDefaults->channels)) ||
+ (lrate != mDefaults->sampleRate)){
+ if(pformat) *pformat = getAndroidFormat(mDefaults->format);
+ if(pchannels) *pchannels = getAndroidChannels(mDefaults->channels);
+ if(prate) *prate = mDefaults->sampleRate;
+ return BAD_VALUE;
+ }
+
+ if(pformat) *pformat = getAndroidFormat(mDefaults->format);
+ if(pchannels) *pchannels = getAndroidChannels(mDefaults->channels);
+ if(prate) *prate = mDefaults->sampleRate;
+
+ return NO_ERROR;
+}
+
+
+uint32_t ALSAStreamOps::sampleRate() const
+{
+ unsigned int rate;
+ int err;
+
+ if (! mHandle)
+ return NO_INIT;
+
+ return snd_pcm_hw_params_get_rate(mHardwareParams, &rate, 0) < 0
+ ? 0 : static_cast<uint32_t>(rate);
+}
+
+status_t ALSAStreamOps::sampleRate(uint32_t rate)
+{
+ const char *stream;
+ unsigned int requestedRate;
+ int err;
+
+ if (!mHandle)
+ return NO_INIT;
+
+ stream = streamName();
+ requestedRate = rate;
+ err = snd_pcm_hw_params_set_rate_near(mHandle,
+ mHardwareParams,
+ &requestedRate,
+ 0);
+
+ if (err < 0) {
+ LOGE("Unable to set %s sample rate to %u: %s",
+ stream, rate, snd_strerror(err));
+ return BAD_VALUE;
+ }
+ if (requestedRate != rate) {
+ // Some devices have a fixed sample rate, and can not be changed.
+ // This may cause resampling problems; i.e. PCM playback will be too
+ // slow or fast.
+ LOGW("Requested rate (%u HZ) does not match actual rate (%u HZ)",
+ rate, requestedRate);
+ }
+ else {
+ LOGD("Set %s sample rate to %u HZ", stream, requestedRate);
+ }
+ return NO_ERROR;
+}
+
+//
+// Return the number of bytes (not frames)
+//
+size_t ALSAStreamOps::bufferSize() const
+{
+ int err;
+
+ if (!mHandle)
+ return -1;
+
+ snd_pcm_uframes_t bufferSize = 0;
+ snd_pcm_uframes_t periodSize = 0;
+
+ err = snd_pcm_get_params(mHandle, &bufferSize, &periodSize);
+
+ if (err < 0)
+ return -1;
+
+ return static_cast<size_t>(snd_pcm_frames_to_bytes(mHandle, bufferSize));
+}
+
+int ALSAStreamOps::getAndroidFormat(snd_pcm_format_t format)
+{
+ int pcmFormatBitWidth;
+ int audioSystemFormat;
+
+ pcmFormatBitWidth = snd_pcm_format_physical_width(format);
+ audioSystemFormat = AudioSystem::DEFAULT;
+ switch(pcmFormatBitWidth) {
+ case 8:
+ audioSystemFormat = AudioSystem::PCM_8_BIT;
+ break;
+
+ case 16:
+ audioSystemFormat = AudioSystem::PCM_16_BIT;
+ break;
+
+ default:
+ LOG_FATAL("Unknown AudioSystem bit width %i!", pcmFormatBitWidth);
+ }
+
+ return audioSystemFormat;
+
+}
+
+int ALSAStreamOps::format() const
+{
+ snd_pcm_format_t ALSAFormat;
+ int pcmFormatBitWidth;
+ int audioSystemFormat;
+
+ if (!mHandle)
+ return -1;
+
+ if (snd_pcm_hw_params_get_format(mHardwareParams, &ALSAFormat) < 0) {
+ return -1;
+ }
+
+ pcmFormatBitWidth = snd_pcm_format_physical_width(ALSAFormat);
+ audioSystemFormat = AudioSystem::DEFAULT;
+ switch(pcmFormatBitWidth) {
+ case 8:
+ audioSystemFormat = AudioSystem::PCM_8_BIT;
+ break;
+
+ case 16:
+ audioSystemFormat = AudioSystem::PCM_16_BIT;
+ break;
+
+ default:
+ LOG_FATAL("Unknown AudioSystem bit width %i!", pcmFormatBitWidth);
+ }
+
+ return audioSystemFormat;
+}
+
+uint32_t ALSAStreamOps::getAndroidChannels(int channels)
+{
+ int AudioSystemChannels = AudioSystem::DEFAULT;
+
+ switch(channels){
+ case 1:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_FRONT_RIGHT;
+ break;
+ case 2:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_STEREO;
+ break;
+ case 4:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_QUAD;
+ break;
+ case 6:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_5POINT1;
+ break;
+ defualt:
+ LOGE("FATAL: AudioSystem does not support %d channels.", channels);
+ }
+ return AudioSystemChannels;
+}
+
+int ALSAStreamOps::channelCount() const
+{
+ unsigned int val;
+ int err;
+
+ int AudioSystemChannels;
+
+ if (!mHandle)
+ return -1;
+
+ err = snd_pcm_hw_params_get_channels(mHardwareParams, &val);
+ if (err < 0) {
+ LOGE("Unable to get device channel count: %s",
+ snd_strerror(err));
+ return -1;
+ }
+
+ AudioSystemChannels = AudioSystem::DEFAULT;
+
+ switch(val){
+ case 1:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_FRONT_RIGHT;
+ break;
+ case 2:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_STEREO;
+ break;
+ case 4:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_QUAD;
+ break;
+ case 6:
+ AudioSystemChannels = AudioSystem::CHANNEL_OUT_5POINT1;
+ break;
+ defualt:
+ LOGE("FATAL: AudioSystem does not support %d channels.", val);
+ }
+
+
+ return AudioSystemChannels;
+}
+
+status_t ALSAStreamOps::channelCount(int channels) {
+ int err;
+
+ if (!mHandle)
+ return NO_INIT;
+
+ // if(channels == 1) channels = 2; //Kamat: This is a fix added to avoid audioflinger crash (current audio driver does not support mono). Please check and modify suitably later.
+
+ err = snd_pcm_hw_params_set_channels(mHandle, mHardwareParams, channels);
+ if (err < 0) {
+ LOGE("Unable to set channel count to %i: %s",
+ channels, snd_strerror(err));
+ return BAD_VALUE;
+ }
+
+ LOGD("Using %i %s for %s.",
+ channels, channels == 1 ? "channel" : "channels", streamName());
+
+ return NO_ERROR;
+}
+
+status_t ALSAStreamOps::open(int mode, uint32_t device)
+{
+ const char *stream = streamName();
+ const char *devName = deviceName(mode, device);
+
+ int err;
+
+ LOGI("Try to open ALSA %s device %s", stream, devName);
+
+ for(;;) {
+ // The PCM stream is opened in blocking mode, per ALSA defaults. The
+ // AudioFlinger seems to assume blocking mode too, so asynchronous mode
+ // should not be used.
+ err = snd_pcm_open(&mHandle, devName, mDefaults->direction, 0);
+ if (err == 0) break;
+
+ // See if there is a less specific name we can try.
+ // Note: We are changing the contents of a const char * here.
+ char *tail = strrchr(devName, '_');
+ if (! tail) break;
+ *tail = 0;
+ }
+
+ if (err < 0) {
+ // None of the Android defined audio devices exist. Open a generic one.
+ devName = "hw:00,1"; // 090507 SMDKC110 Froyo
+
+ err = snd_pcm_open(&mHandle, devName, mDefaults->direction, 0);
+ if (err < 0) {
+ // Last resort is the NULL device (i.e. the bit bucket).
+ devName = _nullALSADeviceName;
+ err = snd_pcm_open(&mHandle, devName, mDefaults->direction, 0);
+ }
+ }
+
+ mMode = mode;
+ mDevice = device;
+
+ LOGI("Initialized ALSA %s device %s", stream, devName);
+ return err;
+}
+
+void ALSAStreamOps::close()
+{
+ snd_pcm_t *handle = mHandle;
+ mHandle = NULL;
+
+ if (handle) {
+ snd_pcm_close(handle);
+ mMode = -1;
+ mDevice = 0;
+ }
+}
+
+status_t ALSAStreamOps::setSoftwareParams()
+{
+ if (!mHandle)
+ return NO_INIT;
+
+ int err;
+
+ // Get the current software parameters
+ err = snd_pcm_sw_params_current(mHandle, mSoftwareParams);
+ if (err < 0) {
+ LOGE("Unable to get software parameters: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+
+ snd_pcm_uframes_t bufferSize = 0;
+ snd_pcm_uframes_t periodSize = 0;
+ snd_pcm_uframes_t startThreshold;
+
+ // Configure ALSA to start the transfer when the buffer is almost full.
+ snd_pcm_get_params(mHandle, &bufferSize, &periodSize);
+ LOGE("bufferSize %d, periodSize %d\n", bufferSize, periodSize);
+
+ if (mDefaults->direction == SND_PCM_STREAM_PLAYBACK) {
+ // For playback, configure ALSA to start the transfer when the
+ // buffer is almost full.
+ startThreshold = (bufferSize / periodSize) * periodSize;
+ //startThreshold = 1;
+ }
+ else {
+ // For recording, configure ALSA to start the transfer on the
+ // first frame.
+ startThreshold = 1;
+ }
+
+ err = snd_pcm_sw_params_set_start_threshold(mHandle,
+ mSoftwareParams,
+ startThreshold);
+ if (err < 0) {
+ LOGE("Unable to set start threshold to %lu frames: %s",
+ startThreshold, snd_strerror(err));
+ return NO_INIT;
+ }
+
+ // Stop the transfer when the buffer is full.
+ err = snd_pcm_sw_params_set_stop_threshold(mHandle,
+ mSoftwareParams,
+ bufferSize);
+ if (err < 0) {
+ LOGE("Unable to set stop threshold to %lu frames: %s",
+ bufferSize, snd_strerror(err));
+ return NO_INIT;
+ }
+
+ // Allow the transfer to start when at least periodSize samples can be
+ // processed.
+ err = snd_pcm_sw_params_set_avail_min(mHandle,
+ mSoftwareParams,
+ periodSize);
+ if (err < 0) {
+ LOGE("Unable to configure available minimum to %lu: %s",
+ periodSize, snd_strerror(err));
+ return NO_INIT;
+ }
+
+ // Commit the software parameters back to the device.
+ err = snd_pcm_sw_params(mHandle, mSoftwareParams);
+ if (err < 0) {
+ LOGE("Unable to configure software parameters: %s",
+ snd_strerror(err));
+ return NO_INIT;
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAStreamOps::setPCMFormat(snd_pcm_format_t format)
+{
+ const char *formatDesc;
+ const char *formatName;
+ bool validFormat;
+ int err;
+
+ // snd_pcm_format_description() and snd_pcm_format_name() do not perform
+ // proper bounds checking.
+ validFormat = (static_cast<int>(format) > SND_PCM_FORMAT_UNKNOWN) &&
+ (static_cast<int>(format) <= SND_PCM_FORMAT_LAST);
+ formatDesc = validFormat ?
+ snd_pcm_format_description(format) : "Invalid Format";
+ formatName = validFormat ?
+ snd_pcm_format_name(format) : "UNKNOWN";
+
+ err = snd_pcm_hw_params_set_format(mHandle, mHardwareParams, format);
+ if (err < 0) {
+ LOGE("Unable to configure PCM format %s (%s): %s",
+ formatName, formatDesc, snd_strerror(err));
+ return NO_INIT;
+ }
+
+ LOGD("Set %s PCM format to %s (%s)", streamName(), formatName, formatDesc);
+ return NO_ERROR;
+}
+
+status_t ALSAStreamOps::setHardwareResample(bool resample)
+{
+ int err;
+
+ err = snd_pcm_hw_params_set_rate_resample(mHandle,
+ mHardwareParams,
+ static_cast<int>(resample));
+ if (err < 0) {
+ LOGE("Unable to %s hardware resampling: %s",
+ resample ? "enable" : "disable",
+ snd_strerror(err));
+ return NO_INIT;
+ }
+ return NO_ERROR;
+}
+
+const char *ALSAStreamOps::streamName()
+{
+ // Don't use snd_pcm_stream(mHandle), as the PCM stream may not be
+ // opened yet. In such case, snd_pcm_stream() will abort().
+ return snd_pcm_stream_name(mDefaults->direction);
+}
+
+//
+// Set playback or capture PCM device. It's possible to support audio output
+// or input from multiple devices by using the ALSA plugins, but this is
+// not supported for simplicity.
+//
+// The AudioHardwareALSA API does not allow one to set the input routing.
+//
+// If the "routes" value does not map to a valid device, the default playback
+// device is used.
+//
+status_t ALSAStreamOps::setDevice(int mode, uint32_t device, uint audio_mode)
+{
+ // Close off previously opened device.
+ // It would be nice to determine if the underlying device actually
+ // changes, but we might be manipulating mixer settings (see asound.conf).
+ //
+ close();
+
+ const char *stream = streamName();
+
+
+ LOGD("\n------------------------>>>>>> ALSA OPEN mode %d,device %d \n",mode,device);
+
+ status_t status = open (mode, device);
+ int err;
+ unsigned int period_val;
+
+ if (status != NO_ERROR)
+ return status;
+
+ err = snd_pcm_hw_params_any(mHandle, mHardwareParams);
+ if (err < 0) {
+ LOGE("Unable to configure hardware: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+
+ status = setPCMFormat(mDefaults->format);
+
+ // Set the interleaved read and write format.
+ err = snd_pcm_hw_params_set_access(mHandle, mHardwareParams,
+ SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (err < 0) {
+ LOGE("Unable to configure PCM read/write format: %s",
+ snd_strerror(err));
+ return NO_INIT;
+ }
+
+ //
+ // Some devices do not have the default two channels. Force an error to
+ // prevent AudioMixer from crashing and taking the whole system down.
+ //
+ // Note that some devices will return an -EINVAL if the channel count
+ // is queried before it has been set. i.e. calling channelCount()
+ // before channelCount(channels) may return -EINVAL.
+ //
+ status = channelCount(mDefaults->channels);
+ if (status != NO_ERROR)
+ return status;
+
+ // Don't check for failure; some devices do not support the default
+ // sample rate.
+
+ sampleRate(mDefaults->sampleRate);
+
+ // Disable hardware resampling.
+ status = setHardwareResample(false);
+ if (status != NO_ERROR)
+ return status;
+
+ snd_pcm_uframes_t bufferSize = mDefaults->bufferSize;
+
+ unsigned int latency = mDefaults->latency;
+
+ // Make sure we have at least the size we originally wanted
+ err = snd_pcm_hw_params_set_buffer_size(mHandle, mHardwareParams, bufferSize);
+ if (err < 0) {
+ LOGE("Unable to set buffer size to %d: %s",
+ (int)bufferSize, snd_strerror(err));
+ return NO_INIT;
+ }
+
+ // Setup buffers for latency
+ err = snd_pcm_hw_params_set_buffer_time_near (mHandle, mHardwareParams,
+ &latency, NULL);
+ if(audio_mode == PLAYBACK) {
+ period_val = PERIOD_PLAYBACK;
+ if(snd_pcm_hw_params_set_periods(mHandle, mHardwareParams, period_val, 0) < 0)
+ LOGE("Fail to set period size %d for playback", period_val);
+ }
+ else
+ period_val = PERIOD_CAPTURE;
+
+ if (err < 0) {
+ /* That didn't work, set the period instead */
+ unsigned int periodTime = latency / period_val;
+ err = snd_pcm_hw_params_set_period_time_near (mHandle, mHardwareParams,
+ &periodTime, NULL);
+ if (err < 0) {
+ LOGE("Unable to set the period time for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ snd_pcm_uframes_t periodSize;
+ err = snd_pcm_hw_params_get_period_size (mHardwareParams, &periodSize, NULL);
+ if (err < 0) {
+ LOGE("Unable to get the period size for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ bufferSize = periodSize * period_val;
+ if (bufferSize < mDefaults->bufferSize)
+ bufferSize = mDefaults->bufferSize;
+ err = snd_pcm_hw_params_set_buffer_size_near (mHandle, mHardwareParams, &bufferSize);
+ if (err < 0) {
+ LOGE("Unable to set the buffer size for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ } else {
+ // OK, we got buffer time near what we expect. See what that did for bufferSize.
+ err = snd_pcm_hw_params_get_buffer_size (mHardwareParams, &bufferSize);
+ if (err < 0) {
+ LOGE("Unable to get the buffer size for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ // Does set_buffer_time_near change the passed value? It should.
+ err = snd_pcm_hw_params_get_buffer_time (mHardwareParams, &latency, NULL);
+ if (err < 0) {
+ LOGE("Unable to get the buffer time for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ unsigned int periodTime = latency / period_val;
+ err = snd_pcm_hw_params_set_period_time_near (mHandle, mHardwareParams,
+ &periodTime, NULL);
+ if (err < 0) {
+ LOGE("Unable to set the period time for latency: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+ }
+
+ LOGD("Buffer size: %d", (int)bufferSize);
+ LOGD("Latency: %d", (int)latency);
+
+ mDefaults->bufferSize = bufferSize;
+ mDefaults->latency = latency;
+
+ // Commit the hardware parameters back to the device.
+ err = snd_pcm_hw_params(mHandle, mHardwareParams);
+ if (err < 0) {
+ LOGE("Unable to set hardware parameters: %s", snd_strerror(err));
+ return NO_INIT;
+ }
+
+ status = setSoftwareParams();
+
+ return status;
+}
+
+const char *ALSAStreamOps::deviceName(int mode, uint32_t device)
+{
+ static char devString[ALSA_NAME_MAX];
+ int dev;
+ int hasDevExt = 0;
+
+ strcpy (devString, mDefaults->devicePrefix);
+
+ for (dev=0; device; dev++)
+ if (device & (1 << dev)) {
+ /* Don't go past the end of our list */
+ if (dev >= deviceSuffixLen)
+ break;
+ ALSA_STRCAT (devString, deviceSuffix[dev]);
+ device &= ~(1 << dev);
+ hasDevExt = 1;
+ }
+
+ if (hasDevExt)
+ switch (mode) {
+ case AudioSystem::MODE_NORMAL:
+ ALSA_STRCAT (devString, "_normal");
+ break;
+ case AudioSystem::MODE_RINGTONE:
+ ALSA_STRCAT (devString, "_ringtone");
+ break;
+ case AudioSystem::MODE_IN_CALL:
+ ALSA_STRCAT (devString, "_incall");
+ break;
+ };
+
+ return devString;
+}
+
+// ----------------------------------------------------------------------------
+
+AudioStreamOutALSA::AudioStreamOutALSA(AudioHardwareALSA *parent) :
+ mParent(parent),
+ mPowerLock(false)
+{
+ static StreamDefaults _defaults = {
+ devicePrefix : "AndroidPlayback",
+ direction : SND_PCM_STREAM_PLAYBACK,
+ format : SND_PCM_FORMAT_S16_LE, // AudioSystem::PCM_16_BIT
+ channels : 2,
+ sampleRate : DEFAULT_SAMPLE_RATE,
+ latency : 250000, // Desired Delay in usec
+ bufferSize : 4096, // Desired Number of samples
+};
+
+ setStreamDefaults(&_defaults);
+}
+
+AudioStreamOutALSA::~AudioStreamOutALSA()
+{
+ standby();
+ mParent->mOutput = NULL;
+}
+
+//int AudioStreamOutALSA::channelCount() const
+uint32_t AudioStreamOutALSA::channels() const
+{
+ uint32_t c = ALSAStreamOps::channelCount();
+
+ // AudioMixer will seg fault if it doesn't have two channels.
+ LOGW_IF(c != AudioSystem::CHANNEL_OUT_STEREO,
+ "AudioMixer expects two channels, but only %i found!", c);
+ return c;
+}
+
+/* New arch */
+status_t AudioStreamOutALSA::setVolume(float left, float right)
+{
+ if (! mParent->mMixer || ! mDevice)
+ return NO_INIT;
+
+ /** Tushar - Need to decide on the volume value
+ * that we pass onto the mixer. */
+ return mParent->mMixer->setVolume (mDevice, (left + right)/2);
+}
+
+status_t AudioStreamOutALSA::setVolume(float volume)
+{
+ if (! mParent->mMixer || ! mDevice)
+ return NO_INIT;
+
+ return mParent->mMixer->setVolume (mDevice, volume);
+}
+
+/* New Arch */
+status_t AudioStreamOutALSA::setParameters(const String8& keyValuePairs)
+{
+#if defined SLSI_S5PC110
+ AudioParameter param = AudioParameter(keyValuePairs);
+ status_t status = NO_ERROR;
+ int device;
+ int value;
+ LOGD("AudioStreamOutALSA::setParameters() %s", keyValuePairs.string());
+
+ if (param.getInt(String8(AudioParameter::keyRouting), device) == NO_ERROR)
+ {
+ mDevice = device;
+
+ if (mParent->mInput) mParent->mInput->mDevice = device;
+ mParent->mRoutes[mParent->mMode] = mDevice;
+ mParent->doRouting(mDevice);
+
+ param.remove(String8(AudioParameter::keyRouting));
+ }
+ else if (param.getInt(String8(AudioParameter::keySamplingRate), value) == NO_ERROR)
+ {
+ mParent->mOutput->mDefaults->sampleRate = value;
+ mParent->doRouting(mDevice);
+ param.remove(String8(AudioParameter::keySamplingRate));
+ }
+
+ if (param.size()) {
+ status = BAD_VALUE;
+ }
+ return status;
+#else
+ /* TODO: Implement as per new arch */
+
+ LOGD("AudioStreamOutAlsa::setParameters... %s \n\n",keyValuePairs.string());
+ if (! mParent->mOutput )//|| ! mMode)
+ return NO_INIT;
+
+
+ int device = keyValuePairs.string()[keyValuePairs.length()-1] - 48 -1 ; //easy conversion frm ascii to int and then to required number
+ LOGV("\n\n-------->> ALSA SET PARAMS device %d \n\n",(1<<device));
+ mParent->mOutput->setDevice(mMode, 1<<device, PLAYBACK);
+ return NO_ERROR;
+#endif
+}
+String8 AudioStreamOutALSA::getParameters(const String8& keys)
+{
+#if defined SLSI_S5PC110
+ AudioParameter param = AudioParameter(keys);
+ String8 value;
+ String8 key = String8(AudioParameter::keyRouting);
+
+ if (param.get(key, value) == NO_ERROR) {
+ param.addInt(key, (int)mDevice);
+ }
+
+ LOGD("AudioStreamOutALSA::getParameters() %s", param.toString().string());
+ return param.toString();
+#else
+ /* TODO: Implement as per new arch */
+ return keys;
+#endif
+}
+
+status_t AudioStreamOutALSA::getRenderPosition(uint32_t *dspFrames)
+{
+
+ //TODO: enable when supported by driver
+ return INVALID_OPERATION;
+}
+
+#if 1 // Fix for underrun error
+ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes)
+{
+ snd_pcm_sframes_t n;
+ size_t sent = 0;
+ status_t err;
+
+ AutoMutex lock(mLock);
+
+ if (!mPowerLock) {
+ ALSAStreamOps::setDevice(mMode, mDevice, PLAYBACK);
+ acquire_wake_lock (PARTIAL_WAKE_LOCK, "AudioOutLock");
+ mPowerLock = true;
+ }
+ // if (isStandby())
+ // return 0;
+
+#ifdef PCM_OUTPUT_DUMP
+ fwrite(buffer, bytes, 1, fpOutput);
+ LOGD("Output PCM dumped!!");
+#endif
+ if (!mHandle){
+ LOGD("Calling setDevice from write @..%d.\n",__LINE__);
+ ALSAStreamOps::setDevice(mMode, mDevice, PLAYBACK);
+ }
+ do {
+ // write correct number of bytes per attempt
+ n = snd_pcm_writei(mHandle,
+ (char *)buffer + sent,
+ snd_pcm_bytes_to_frames(mHandle, bytes-sent));
+ if (n == -EBADFD) {
+ LOGD("Calling setDevice.. pcm_write returned error @..%d.\n",__LINE__);
+ // Somehow the stream is in a bad state. The driver probably
+ // has a bug and snd_pcm_recover() doesn't seem to handle this.
+ ALSAStreamOps::setDevice(mMode, mDevice, PLAYBACK);
+ }
+ else if (n < 0) {
+ if (mHandle) {
+ // snd_pcm_recover() will return 0 if successful in recovering from
+ // // an error, or -errno if the error was unrecoverable.
+ // We can make silent bit on as we are now handling the under-run and there will not be any data loss due to under-run
+ n = snd_pcm_recover(mHandle, n, 1);
+ if (n)
+ return static_cast<ssize_t>(n);
+ }
+ }
+ else
+ sent += static_cast<ssize_t>(snd_pcm_frames_to_bytes(mHandle, n));
+ } while (mHandle && sent < bytes);
+ //LOGI("Request Bytes=%d, Actual Written=%d",bytes,sent);
+ return sent;
+}
+#else
+ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes)
+{
+ snd_pcm_sframes_t n;
+ status_t err;
+
+ AutoMutex lock(mLock);
+#if 0
+ if (isStandby())
+ return 0;
+#endif
+ if (!mPowerLock) {
+ acquire_wake_lock (PARTIAL_WAKE_LOCK, "AudioLock");
+ ALSAStreamOps::setDevice(mMode, mDevice,PLAYBACK);
+ mPowerLock = true;
+ }
+
+ n = snd_pcm_writei(mHandle,
+ buffer,
+ snd_pcm_bytes_to_frames(mHandle, bytes));
+ if (n < 0 && mHandle) {
+ // snd_pcm_recover() will return 0 if successful in recovering from
+ // an error, or -errno if the error was unrecoverable.
+ //device driver sometimes does not recover -vladi
+ n = snd_pcm_recover(mHandle, n, 0);
+ if(n < 0) //if recover fails
+ ALSAStreamOps::setDevice(mMode, mDevice, PLAYBACK);
+ }
+
+ return static_cast<ssize_t>(n);
+}
+#endif
+
+
+
+status_t AudioStreamOutALSA::dump(int fd, const Vector<String16>& args)
+{
+ return NO_ERROR;
+}
+
+status_t AudioStreamOutALSA::setDevice(int mode, uint32_t newDevice, uint32_t audio_mode)
+{
+ AutoMutex lock(mLock);
+
+ return ALSAStreamOps::setDevice(mode, newDevice, audio_mode);
+}
+
+status_t AudioStreamOutALSA::standby()
+{
+ AutoMutex lock(mLock);
+ LOGD("Inside AudioStreamOutALSA::standby\n");
+ if (mHandle)
+ snd_pcm_drain (mHandle);
+
+ if (mPowerLock) {
+ if(!mParent->mActivatedInputDevice){ // Let PCM device alive on activating input stream.
+ snd_pcm_close(mHandle);
+ mHandle = NULL;
+#if 1 // Fix for underrun error
+ release_wake_lock ("AudioOutLock");
+#else
+ release_wake_lock ("AudioLock");
+#endif
+ mPowerLock = false;
+ }
+ }
+// close(); //Don't call this as this function will reset the mode also
+ return NO_ERROR;
+}
+
+bool AudioStreamOutALSA::isStandby()
+{
+ return (!mHandle);
+}
+
+#define USEC_TO_MSEC(x) ((x + 999) / 1000)
+
+uint32_t AudioStreamOutALSA::latency() const
+{
+ // Android wants latency in milliseconds.
+ return USEC_TO_MSEC (mDefaults->latency);
+}
+
+// ----------------------------------------------------------------------------
+
+AudioStreamInALSA::AudioStreamInALSA(AudioHardwareALSA *parent) :
+ mParent(parent),
+ mPowerLock(false)
+{
+ static StreamDefaults _defaults = {
+ devicePrefix : "AndroidRecord",
+ direction : SND_PCM_STREAM_CAPTURE,
+ format : SND_PCM_FORMAT_S16_LE, // AudioSystem::PCM_16_BIT
+ channels : 1,
+ sampleRate : AudioRecord::DEFAULT_SAMPLE_RATE,
+ latency : 250000, // Desired Delay in usec
+ bufferSize : 4096, // Desired Number of samples
+ };
+
+ setStreamDefaults(&_defaults);
+}
+
+AudioStreamInALSA::~AudioStreamInALSA()
+{
+ if (mPowerLock) {
+ snd_pcm_close(mHandle);
+ mHandle = NULL;
+ release_wake_lock ("AudioInLock");
+ mPowerLock = false;
+ }
+ mParent->mInput = NULL;
+}
+
+status_t AudioStreamInALSA::setGain(float gain)
+{
+ if (mParent->mMixer)
+ return mParent->mMixer->setMasterGain (gain);
+ else
+ return NO_INIT;
+}
+
+ssize_t AudioStreamInALSA::read(void *buffer, ssize_t bytes)
+{
+ snd_pcm_sframes_t n;
+ status_t err;
+
+ AutoMutex lock(mLock);
+
+ if (!mPowerLock) {
+ acquire_wake_lock (PARTIAL_WAKE_LOCK, "AudioInLock");
+
+#ifdef PCM_INPUT_DUMP
+ fwrite(buffer, readBytes, 1, fpInput);
+ LOGD("Input PCM dumped!!");
+#endif
+
+ LOGD("Calling setDevice from read@..%d.\n",__LINE__);
+ ALSAStreamOps::setDevice(mMode, mDevice,CAPTURE);
+ mPowerLock = true;
+ }
+ n = snd_pcm_readi(mHandle,
+ buffer,
+ snd_pcm_bytes_to_frames(mHandle, bytes));
+ if (n < 0 && mHandle) {
+ n = snd_pcm_recover(mHandle, n, 0);
+ }
+
+#ifdef PCM_INPUT_DUMP
+ fwrite(buffer, bytes, 1, fpInput);
+ LOGD("Input PCM dumped!!");
+#endif
+
+ return static_cast<ssize_t>(n);
+}
+
+status_t AudioStreamInALSA::dump(int fd, const Vector<String16>& args)
+{
+ return NO_ERROR;
+}
+
+status_t AudioStreamInALSA::setDevice(int mode, uint32_t newDevice, uint32_t audio_mode)
+{
+ AutoMutex lock(mLock);
+
+ return ALSAStreamOps::setDevice(mode, newDevice, audio_mode);
+}
+
+status_t AudioStreamInALSA::standby()
+{
+ AutoMutex lock(mLock);
+
+ LOGD("Entering AudioStreamInALSA::standby\n");
+ if (mPowerLock) {
+ mParent->mActivatedInputDevice = false;
+ snd_pcm_close(mHandle);
+ mHandle = NULL;
+ release_wake_lock ("AudioInLock");
+ mPowerLock = false;
+ }
+
+ return NO_ERROR;
+}
+
+/* New Arch */
+status_t AudioStreamInALSA::setParameters(const String8& keyValuePairs)
+{
+#if defined SLSI_S5PC110
+ AudioParameter param = AudioParameter(keyValuePairs);
+ String8 key = String8(AudioParameter::keyRouting);
+ status_t status = NO_ERROR;
+ int device;
+ LOGD("AudioStreamInALSA::setParameters() %s", keyValuePairs.string());
+
+ if (param.getInt(key, device) == NO_ERROR) {
+ mDevice = device;
+ if(mDevice != 0)
+ setDevice(mMode, mDevice, CAPTURE);
+ param.remove(key);
+ }
+
+ if (param.size()) {
+ status = BAD_VALUE;
+ }
+ return status;
+#else
+ /* TODO: Implement as per new arch */
+
+ if (! mParent->mInput )//|| ! mMode)
+ return NO_INIT;
+
+ // yman.seo use setDevice temp.
+ int device = keyValuePairs.string()[keyValuePairs.length()-1] - 48 -1 ; //easy conversion frm ascii to int and then to required number
+ LOGD("\n\n-------->> ALSA AudioStreamIn SET PARAMS device %d \n\n",(1<<device));
+ if(mParent->mActivatedInputDevice )//Recording stopped with Alarm ,then don't call setDevice() of record, just return
+ return mParent->mInput->setDevice(mMode, 1<<device, CAPTURE);
+
+ return NO_ERROR;
+// yman.seo return NO_ERROR;
+#endif
+}
+
+String8 AudioStreamInALSA::getParameters(const String8& keys)
+{
+#if defined SLSI_S5PC110
+ AudioParameter param = AudioParameter(keys);
+ String8 value;
+ String8 key = String8(AudioParameter::keyRouting);
+
+ if (param.get(key, value) == NO_ERROR) {
+ param.addInt(key, (int)mDevice);
+ }
+
+ LOGD("AudioStreamInALSA::getParameters() %s", param.toString().string());
+ return param.toString();
+#else
+ /* TODO: Implement as per new arch */
+ return keys;
+#endif
+}
+
+
+// ----------------------------------------------------------------------------
+
+struct mixer_info_t
+{
+ mixer_info_t() :
+ elem(0),
+ min(SND_MIXER_VOL_RANGE_MIN),
+ max(SND_MIXER_VOL_RANGE_MAX),
+ mute(false)
+ {
+ }
+
+ snd_mixer_elem_t *elem;
+ long min;
+ long max;
+ long volume;
+ bool mute;
+ char name[ALSA_NAME_MAX];
+};
+
+static int initMixer (snd_mixer_t **mixer, const char *name)
+{
+ int err;
+
+ if ((err = snd_mixer_open(mixer, 0)) < 0) {
+ LOGE("Unable to open mixer: %s", snd_strerror(err));
+ return err;
+ }
+
+ if ((err = snd_mixer_attach(*mixer, name)) < 0) {
+ LOGE("Unable to attach mixer to device %s: %s",
+ name, snd_strerror(err));
+
+ if ((err = snd_mixer_attach(*mixer, "hw:00")) < 0) {
+ LOGE("Unable to attach mixer to device default: %s",
+ snd_strerror(err));
+
+ snd_mixer_close (*mixer);
+ *mixer = NULL;
+ return err;
+ }
+ }
+
+ if ((err = snd_mixer_selem_register(*mixer, NULL, NULL)) < 0) {
+ LOGE("Unable to register mixer elements: %s", snd_strerror(err));
+ snd_mixer_close (*mixer);
+ *mixer = NULL;
+ return err;
+ }
+
+ // Get the mixer controls from the kernel
+ if ((err = snd_mixer_load(*mixer)) < 0) {
+ LOGE("Unable to load mixer elements: %s", snd_strerror(err));
+ snd_mixer_close (*mixer);
+ *mixer = NULL;
+ return err;
+ }
+
+ return 0;
+}
+
+typedef int (*hasVolume_t)(snd_mixer_elem_t*);
+
+static const hasVolume_t hasVolume[] = {
+ snd_mixer_selem_has_playback_volume,
+ snd_mixer_selem_has_capture_volume
+};
+
+typedef int (*getVolumeRange_t)(snd_mixer_elem_t*, long int*, long int*);
+
+static const getVolumeRange_t getVolumeRange[] = {
+ snd_mixer_selem_get_playback_volume_range,
+ snd_mixer_selem_get_capture_volume_range
+};
+
+typedef int (*setVolume_t)(snd_mixer_elem_t*, long int);
+
+static const setVolume_t setVol[] = {
+ snd_mixer_selem_set_playback_volume_all,
+ snd_mixer_selem_set_capture_volume_all
+};
+
+ALSAMixer::ALSAMixer()
+{
+ int err;
+
+ initMixer (&mMixer[SND_PCM_STREAM_PLAYBACK], "AndroidPlayback");
+ initMixer (&mMixer[SND_PCM_STREAM_CAPTURE], "AndroidRecord");
+
+ snd_mixer_selem_id_t *sid;
+ snd_mixer_selem_id_alloca(&sid);
+
+ for (int i = 0; i <= SND_PCM_STREAM_LAST; i++) {
+
+ mixer_info_t *info = mixerMasterProp[i].mInfo = new mixer_info_t;
+
+ property_get (mixerMasterProp[i].propName,
+ info->name,
+ mixerMasterProp[i].propDefault);
+
+ for (snd_mixer_elem_t *elem = snd_mixer_first_elem(mMixer[i]);
+ elem;
+ elem = snd_mixer_elem_next(elem)) {
+
+ if (!snd_mixer_selem_is_active(elem))
+ continue;
+
+ snd_mixer_selem_get_id(elem, sid);
+
+ // Find PCM playback volume control element.
+ const char *elementName = snd_mixer_selem_id_get_name(sid);
+
+ if (hasVolume[i] (elem))
+ LOGD ("Mixer: element name: '%s'", elementName);
+
+ if (info->elem == NULL &&
+ strcmp(elementName, info->name) == 0 &&
+ hasVolume[i] (elem)) {
+
+ info->elem = elem;
+ getVolumeRange[i] (elem, &info->min, &info->max);
+ info->volume = info->max;
+ setVol[i] (elem, info->volume);
+ if (i == SND_PCM_STREAM_PLAYBACK &&
+ snd_mixer_selem_has_playback_switch (elem))
+ snd_mixer_selem_set_playback_switch_all (elem, 1);
+ break;
+ }
+ }
+
+ LOGD ("Mixer: master '%s' %s.", info->name, info->elem ? "found" : "not found");
+
+ for (int j = 0; mixerProp[j][i].routes; j++) {
+
+ mixer_info_t *info = mixerProp[j][i].mInfo = new mixer_info_t;
+
+ property_get (mixerProp[j][i].propName,
+ info->name,
+ mixerProp[j][i].propDefault);
+
+ for (snd_mixer_elem_t *elem = snd_mixer_first_elem(mMixer[i]);
+ elem;
+ elem = snd_mixer_elem_next(elem)) {
+
+ if (!snd_mixer_selem_is_active(elem))
+ continue;
+
+ snd_mixer_selem_get_id(elem, sid);
+
+ // Find PCM playback volume control element.
+ const char *elementName = snd_mixer_selem_id_get_name(sid);
+
+ if (info->elem == NULL &&
+ strcmp(elementName, info->name) == 0 &&
+ hasVolume[i] (elem)) {
+
+ info->elem = elem;
+ getVolumeRange[i] (elem, &info->min, &info->max);
+ info->volume = info->max;
+ setVol[i] (elem, info->volume);
+ if (i == SND_PCM_STREAM_PLAYBACK &&
+ snd_mixer_selem_has_playback_switch (elem))
+ snd_mixer_selem_set_playback_switch_all (elem, 1);
+ break;
+ }
+ }
+ LOGD ("Mixer: route '%s' %s.", info->name, info->elem ? "found" : "not found");
+ }
+ }
+ LOGD("mixer initialized.");
+}
+
+ALSAMixer::~ALSAMixer()
+{
+ for (int i = 0; i <= SND_PCM_STREAM_LAST; i++) {
+ if (mMixer[i]) snd_mixer_close (mMixer[i]);
+ if (mixerMasterProp[i].mInfo) {
+ delete mixerMasterProp[i].mInfo;
+ mixerMasterProp[i].mInfo = NULL;
+ }
+ for (int j = 0; mixerProp[j][i].routes; j++) {
+ if (mixerProp[j][i].mInfo) {
+ delete mixerProp[j][i].mInfo;
+ mixerProp[j][i].mInfo = NULL;
+ }
+ }
+ }
+ LOGD("mixer destroyed.");
+}
+
+status_t ALSAMixer::setMasterVolume(float volume)
+{
+ mixer_info_t *info = mixerMasterProp[SND_PCM_STREAM_PLAYBACK].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ long minVol = info->min;
+ long maxVol = info->max;
+
+ // Make sure volume is between bounds.
+ long vol = minVol + volume * (maxVol - minVol);
+ if (vol > maxVol) vol = maxVol;
+ if (vol < minVol) vol = minVol;
+
+ info->volume = vol;
+ snd_mixer_selem_set_playback_volume_all (info->elem, vol);
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::setMasterGain(float gain)
+{
+ mixer_info_t *info = mixerMasterProp[SND_PCM_STREAM_CAPTURE].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ long minVol = info->min;
+ long maxVol = info->max;
+
+ // Make sure volume is between bounds.
+ long vol = minVol + gain * (maxVol - minVol);
+ if (vol > maxVol) vol = maxVol;
+ if (vol < minVol) vol = minVol;
+
+ info->volume = vol;
+ snd_mixer_selem_set_capture_volume_all (info->elem, vol);
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::setVolume(uint32_t device, float volume)
+{
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_PLAYBACK].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ long minVol = info->min;
+ long maxVol = info->max;
+
+ // Make sure volume is between bounds.
+ long vol = minVol + volume * (maxVol - minVol);
+ if (vol > maxVol) vol = maxVol;
+ if (vol < minVol) vol = minVol;
+
+ info->volume = vol;
+ snd_mixer_selem_set_playback_volume_all (info->elem, vol);
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::setGain(uint32_t device, float gain)
+{
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_CAPTURE].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_CAPTURE].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_CAPTURE].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ long minVol = info->min;
+ long maxVol = info->max;
+
+ // Make sure volume is between bounds.
+ long vol = minVol + gain * (maxVol - minVol);
+ if (vol > maxVol) vol = maxVol;
+ if (vol < minVol) vol = minVol;
+
+ info->volume = vol;
+ snd_mixer_selem_set_capture_volume_all (info->elem, vol);
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::setCaptureMuteState(uint32_t device, bool state)
+{
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_CAPTURE].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_CAPTURE].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_CAPTURE].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ if (snd_mixer_selem_has_capture_switch (info->elem)) {
+
+ int err = snd_mixer_selem_set_capture_switch_all (info->elem, static_cast<int>(!state));
+ if (err < 0) {
+ LOGE("Unable to %s capture mixer switch %s",
+ state ? "enable" : "disable", info->name);
+ return INVALID_OPERATION;
+ }
+ }
+
+ info->mute = state;
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::getCaptureMuteState(uint32_t device, bool *state)
+{
+ if (! state) return BAD_VALUE;
+
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_CAPTURE].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_CAPTURE].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_CAPTURE].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ *state = info->mute;
+ return NO_ERROR;
+ }
+
+ return BAD_VALUE;
+}
+
+status_t ALSAMixer::setPlaybackMuteState(uint32_t device, bool state)
+{
+
+ LOGE("\n set playback mute device %d, state %d \n", device,state);
+
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_PLAYBACK].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ if (snd_mixer_selem_has_playback_switch (info->elem)) {
+
+ int err = snd_mixer_selem_set_playback_switch_all (info->elem, static_cast<int>(!state));
+ if (err < 0) {
+ LOGE("Unable to %s playback mixer switch %s",
+ state ? "enable" : "disable", info->name);
+ return INVALID_OPERATION;
+ }
+ }
+
+ info->mute = state;
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAMixer::getPlaybackMuteState(uint32_t device, bool *state)
+{
+ if (! state) return BAD_VALUE;
+
+ for (int j = 0; mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes; j++)
+ if (mixerProp[j][SND_PCM_STREAM_PLAYBACK].routes & device) {
+
+ mixer_info_t *info = mixerProp[j][SND_PCM_STREAM_PLAYBACK].mInfo;
+ if (!info || !info->elem) return INVALID_OPERATION;
+
+ *state = info->mute;
+ return NO_ERROR;
+ }
+
+ return BAD_VALUE;
+}
+
+// ----------------------------------------------------------------------------
+
+ALSAControl::ALSAControl(const char *device)
+{
+ snd_ctl_open(&mHandle, device, 0);
+}
+
+ALSAControl::~ALSAControl()
+{
+ if (mHandle) snd_ctl_close(mHandle);
+}
+
+status_t ALSAControl::get(const char *name, unsigned int &value, int index)
+{
+ if (!mHandle) return NO_INIT;
+
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *control;
+
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_value_alloca(&control);
+
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
+ snd_ctl_elem_id_set_name(id, name);
+ snd_ctl_elem_info_set_id(info, id);
+
+ int ret = snd_ctl_elem_info(mHandle, info);
+ if (ret < 0) return BAD_VALUE;
+
+ snd_ctl_elem_info_get_id(info, id);
+ snd_ctl_elem_type_t type = snd_ctl_elem_info_get_type(info);
+ unsigned int count = snd_ctl_elem_info_get_count(info);
+ if ((unsigned int)index >= count) return BAD_VALUE;
+
+ snd_ctl_elem_value_set_id(control, id);
+
+ ret = snd_ctl_elem_read(mHandle, control);
+ if (ret < 0) return BAD_VALUE;
+
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ value = snd_ctl_elem_value_get_boolean(control, index);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ value = snd_ctl_elem_value_get_integer(control, index);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ value = snd_ctl_elem_value_get_integer64(control, index);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ value = snd_ctl_elem_value_get_enumerated(control, index);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ value = snd_ctl_elem_value_get_byte(control, index);
+ break;
+ default:
+ return BAD_VALUE;
+ }
+
+ return NO_ERROR;
+}
+
+status_t ALSAControl::set(const char *name, unsigned int value, int index)
+{
+ if (!mHandle) return NO_INIT;
+
+ snd_ctl_elem_id_t *id;
+ snd_ctl_elem_info_t *info;
+ snd_ctl_elem_value_t *control;
+
+ snd_ctl_elem_id_alloca(&id);
+ snd_ctl_elem_info_alloca(&info);
+ snd_ctl_elem_value_alloca(&control);
+
+ snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
+ snd_ctl_elem_id_set_name(id, name);
+ snd_ctl_elem_info_set_id(info, id);
+
+ int ret = snd_ctl_elem_info(mHandle, info);
+ if (ret < 0) return BAD_VALUE;
+
+ snd_ctl_elem_info_get_id(info, id);
+ snd_ctl_elem_type_t type = snd_ctl_elem_info_get_type(info);
+ unsigned int count = snd_ctl_elem_info_get_count(info);
+ if ((unsigned int)index >= count) return BAD_VALUE;
+
+ if (index == -1)
+ index = 0; // Range over all of them
+ else
+ count = index + 1; // Just do the one specified
+
+ snd_ctl_elem_value_set_id(control, id);
+
+ for (unsigned int i = index; i < count; i++)
+ switch (type) {
+ case SND_CTL_ELEM_TYPE_BOOLEAN:
+ snd_ctl_elem_value_set_boolean(control, i, value);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER:
+ snd_ctl_elem_value_set_integer(control, i, value);
+ break;
+ case SND_CTL_ELEM_TYPE_INTEGER64:
+ snd_ctl_elem_value_set_integer64(control, i, value);
+ break;
+ case SND_CTL_ELEM_TYPE_ENUMERATED:
+ snd_ctl_elem_value_set_enumerated(control, i, value);
+ break;
+ case SND_CTL_ELEM_TYPE_BYTES:
+ snd_ctl_elem_value_set_byte(control, i, value);
+ break;
+ default:
+ break;
+ }
+
+ ret = snd_ctl_elem_write(mHandle, control);
+ return (ret < 0) ? BAD_VALUE : NO_ERROR;
+}
+
+// ----------------------------------------------------------------------------
+
+#if defined SEC_IPC
+AudioHardwareIPC::AudioHardwareIPC() :
+ mClient(NULL)
+{
+LOGD("### %s", __func__);
+ int err = 0;
+
+ mClient = OpenClient_RILD();
+ if (mClient == NULL){
+ LOGE("[*] OpenClient_RILD() error\n");
+ err = 1;
+ }
+
+ if (RegisterRequestCompleteHandler(mClient, RIL_REQUEST_OEM_HOOK_RAW,
+ onRawReqComplete) != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] RegisterRequestCompleteHandler() error\n");
+ err = 1;
+ }
+
+ if (RegisterUnsolicitedHandler(mClient, 11004, onUnsol) !=
+ RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] RegisterUnsolicitedHandler() error\n");
+ err = 1;
+ }
+
+ if (!err) LOGD("Success Initializing IPC");
+ else LOGE("Failed Initializing IPC");
+}
+
+AudioHardwareIPC::~AudioHardwareIPC()
+{
+ LOGD("### %s", __func__);
+ if (RegisterRequestCompleteHandler(mClient, RIL_REQUEST_OEM_HOOK_RAW, NULL) != RIL_CLIENT_ERR_SUCCESS)
+ LOGE("RegisterRequestCompleteHandler(NULL) error\n");
+
+ if (RegisterUnsolicitedHandler(mClient, 11004, NULL) != RIL_CLIENT_ERR_SUCCESS)
+ LOGE("RegisterUnsolicitedHandler(NULL) error\n");
+
+ if (Disconnect_RILD(mClient) != RIL_CLIENT_ERR_SUCCESS)
+ LOGE("[*] Disconnect_RILD() error\n");
+
+ if (CloseClient_RILD(mClient) != RIL_CLIENT_ERR_SUCCESS)
+ LOGE("[*] CloseClient_RILD() error\n");
+ mClient = NULL;
+}
+
+status_t AudioHardwareIPC::transmitVolumeIPC(uint32_t type, float volume)
+{
+ int ret = 0;
+ uint32_t level = (uint32_t)(volume * 5);
+
+ if (isConnected_RILD(mClient) == 0) {
+ if (Connect_RILD(mClient) != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] Connect_RILD() error\n");
+ return INVALID_OPERATION;
+ }
+ }
+
+ memset(data, 0, 100);
+ data[0] = OEM_FUNCTION_ID_SOUND;
+ data[1] = OEM_SOUND_SET_VOLUME_CTRL;
+ data[2] = 0x00; // data length
+ data[3] = 0x06; // data length
+ data[4] = type; // volume type
+ data[5] = level; // volume level
+
+ ret = InvokeOemRequestHookRaw(mClient, data, 6); //sizeof(data));
+ if (ret != RIL_CLIENT_ERR_AGAIN && ret != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] InvokeOemRequestHookRaw() error ret = %d\n", ret);
+ return INVALID_OPERATION;
+ }
+ return NO_ERROR;
+}
+
+status_t AudioHardwareIPC::transmitAudioPathIPC(uint32_t path)
+{
+ int ret = 0;
+
+ LOGI("### %s %d ", __func__, path);
+ if (isConnected_RILD(mClient) == 0) {
+ if (Connect_RILD(mClient) != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] Connect_RILD() error\n");
+ return INVALID_OPERATION;
+ }
+ }
+
+ memset(data, 0, 100);
+ data[0] = OEM_FUNCTION_ID_SOUND;
+ data[1] = OEM_SOUND_SET_AUDIO_PATH_CTRL;
+ data[2] = 0x00; // data length
+ data[3] = 0x05; // data length
+ data[4] = path; // audio path
+
+ ret = InvokeOemRequestHookRaw(mClient, data, 5); //sizeof(data));
+ if (ret != RIL_CLIENT_ERR_AGAIN && ret != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] InvokeOemRequestHookRaw() error ret = %d\n", ret);
+ return INVALID_OPERATION;
+ }
+ return NO_ERROR;
+}
+
+
+#if defined SYNCHRONIZE_CP
+status_t AudioHardwareIPC::transmitClock_IPC(uint32_t condition)
+{
+ int ret = 0;
+
+ LOGV("### %s %d ", __func__, condition);
+
+ if (isConnected_RILD(mClient) == 0) {
+ if (Connect_RILD(mClient) != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] Connect_RILD() error\n");
+ return INVALID_OPERATION;
+ }
+ }
+
+ memset(data, 0, 100);
+ data[0] = OEM_FUNCTION_ID_SOUND;
+ data[1] = OEM_SOUND_SET_CLOCK_CTRL;
+ data[2] = 0x00; // data length
+ data[3] = 0x05; // data length
+ data[4] = condition;
+
+ ret = InvokeOemRequestHookRaw(mClient, data, 5); //sizeof(data));
+
+ if (ret != RIL_CLIENT_ERR_AGAIN && ret != RIL_CLIENT_ERR_SUCCESS){
+ LOGE("[*] InvokeOemRequestHookRaw() error ret = %d\n", ret);
+ return INVALID_OPERATION;
+ }
+
+ return NO_ERROR;
+}
+#endif
+
+static int onRawReqComplete(HRilClient client, const void *data, size_t datalen)
+{
+ LOGV("[*] %s(): datalen(%d)\n", __FUNCTION__, datalen);
+ return 0;
+}
+static int onUnsol(HRilClient client, const void *data, size_t datalen)
+{
+ int a;
+ a = ((int *)data)[0];
+ LOGV("%s(): a(%d)\n", __FUNCTION__, a);
+
+ return 0;
+}
+#endif //SEC_IPC
+}; // namespace android
+
diff --git a/libaudio/AudioHardwareALSA.h b/libaudio/AudioHardwareALSA.h
new file mode 100644
index 0000000..690b4db
--- /dev/null
+++ b/libaudio/AudioHardwareALSA.h
@@ -0,0 +1,411 @@
+/* AudioHardwareALSA.h
+ **
+ ** Copyright 2008, Wind River Systems
+ **
+ ** Licensed under the Apache License, Version 2.0 (the "License");
+ ** you may not use this file except in compliance with the License.
+ ** You may obtain a copy of the License at
+ **
+ ** http://www.apache.org/licenses/LICENSE-2.0
+ **
+ ** Unless required by applicable law or agreed to in writing, software
+ ** distributed under the License is distributed on an "AS IS" BASIS,
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ** See the License for the specific language governing permissions and
+ ** limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_HARDWARE_ALSA_H
+#define ANDROID_AUDIO_HARDWARE_ALSA_H
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <alsa/asoundlib.h>
+
+#include <hardware_legacy/AudioHardwareBase.h>
+
+#if defined SEC_IPC
+#include <hardware/hardware.h>
+
+// sangsu fix : headers for IPC
+#include "../libsecril-client/secril-client.h"
+
+// sangsu fix : defines for IPC
+#define OEM_FUNCTION_ID_SOUND 0x08 // sound Main Cmd
+
+//sangsu fix : sound sub command for IPC
+#define OEM_SOUND_SET_VOLUME_CTRL 0x03
+#define OEM_SOUND_GET_VOLUME_CTRL 0x04
+#define OEM_SOUND_SET_AUDIO_PATH_CTRL 0x05
+#define OEM_SOUND_GET_AUDIO_PATH_CTRL 0x06
+
+//sangsu fix : audio path for IPC
+#define OEM_SOUND_AUDIO_PATH_HANDSET 0x01
+#define OEM_SOUND_AUDIO_PATH_HEADSET 0x02
+#define OEM_SOUND_AUDIO_PATH_HANDFREE 0x03
+#define OEM_SOUND_AUDIO_PATH_BLUETOOTH 0x04
+#define OEM_SOUND_AUDIO_PATH_STREOBT 0x05
+#define OEM_SOUND_AUDIO_PATH_SPEAKER 0x06
+#define OEM_SOUND_AUDIO_PATH_HEADSET35 0x07
+#define OEM_SOUND_AUDIO_PATH_BT_NSEC_OFF 0x08
+
+// sangsu fix : volume level for IPC
+#define OEM_SOUND_VOLUME_LEVEL_MUTE 0x00
+#define OEM_SOUND_VOLUME_LEVEL1 0x01
+#define OEM_SOUND_VOLUME_LEVEL2 0x02
+#define OEM_SOUND_VOLUME_LEVEL3 0x03
+#define OEM_SOUND_VOLUME_LEVEL4 0x04
+#define OEM_SOUND_VOLUME_LEVEL5 0x05
+#define OEM_SOUND_VOLUME_LEVEL6 0x06
+#define OEM_SOUND_VOLUME_LEVEL7 0x07
+#define OEM_SOUND_VOLUME_LEVEL8 0x08
+
+// For synchronizing I2S clocking
+#if defined SYNCHRONIZE_CP
+#define OEM_SOUND_SET_CLOCK_CTRL 0x0A
+#define OEM_SOUND_CLOCK_START 0x01
+#define OEM_SOUND_CLOCK_STOP 0x00
+#endif
+
+// For VT
+#if defined VIDEO_TELEPHONY
+#define OEM_SOUND_VIDEO_CALL_STOP 0x00
+#define OEM_SOUND_VIDEO_CALL_START 0x01
+#define OEM_SOUND_SET_VIDEO_CALL_CTRL 0x07
+#endif
+
+// sangsu fix : volume type for IPC
+#define OEM_SOUND_TYPE_VOICE 0x01 // Receiver(0x00) + Voice(0x01)
+#define OEM_SOUND_TYPE_KEYTONE 0x02 // Receiver(0x00) + Key tone (0x02)
+#define OEM_SOUND_TYPE_BELL 0x03 // Receiver(0x00) + Bell (0x03)
+#define OEM_SOUND_TYPE_MESSAGE 0x04 // Receiver(0x00) + Message(0x04)
+#define OEM_SOUND_TYPE_ALARM 0x05 // Receiver(0x00) + Alarm (0x05)
+#define OEM_SOUND_TYPE_SPEAKER 0x11 // SpeakerPhone (0x10) + Voice(0x01)
+#define OEM_SOUND_TYPE_HFKVOICE 0x21 // HFK (0x20) + Voice(0x01)
+#define OEM_SOUND_TYPE_HFKKEY 0x22 // HFK (0x20) + Key tone (0x02)
+#define OEM_SOUND_TYPE_HFKBELL 0x23 // HFK (0x20) + Bell (0x03)
+#define OEM_SOUND_TYPE_HFKMSG 0x24 // HFK (0x20) + Message(0x04)
+#define OEM_SOUND_TYPE_HFKALARM 0x25 // HFK (0x20) + Alarm (0x05)
+#define OEM_SOUND_TYPE_HFKPDA 0x26 // HFK (0x20) + PDA miscellaneous sound (0x06)
+#define OEM_SOUND_TYPE_HEADSET 0x31 // Headset (0x30) + Voice(0x01)
+#define OEM_SOUND_TYPE_BTVOICE 0x41 // BT(0x40) + Voice(0x01)
+#endif
+namespace android
+{
+
+ class AudioHardwareALSA;
+
+ // ----------------------------------------------------------------------------
+
+ class ALSAMixer
+ {
+ public:
+ ALSAMixer();
+ virtual ~ALSAMixer();
+
+ bool isValid() { return !!mMixer[SND_PCM_STREAM_PLAYBACK]; }
+ status_t setMasterVolume(float volume);
+ status_t setMasterGain(float gain);
+
+ status_t setVolume(uint32_t device, float volume);
+ status_t setGain(uint32_t device, float gain);
+
+ status_t setCaptureMuteState(uint32_t device, bool state);
+ status_t getCaptureMuteState(uint32_t device, bool *state);
+ status_t setPlaybackMuteState(uint32_t device, bool state);
+ status_t getPlaybackMuteState(uint32_t device, bool *state);
+
+ private:
+ snd_mixer_t *mMixer[SND_PCM_STREAM_LAST+1];
+ };
+
+ class ALSAControl
+ {
+ public:
+ ALSAControl(const char *device = "default");
+ virtual ~ALSAControl();
+
+ status_t get(const char *name, unsigned int &value, int index = 0);
+ status_t set(const char *name, unsigned int value, int index = -1);
+
+ private:
+ snd_ctl_t *mHandle;
+ };
+
+ class ALSAStreamOps
+ {
+ protected:
+ friend class AudioStreamOutALSA;
+ friend class AudioStreamInALSA;
+
+ struct StreamDefaults
+ {
+ const char * devicePrefix;
+ snd_pcm_stream_t direction; // playback or capture
+ snd_pcm_format_t format;
+ int channels;
+ uint32_t sampleRate;
+ unsigned int latency; // Delay in usec
+ unsigned int bufferSize; // Size of sample buffer
+ };
+
+ ALSAStreamOps();
+ virtual ~ALSAStreamOps();
+
+ status_t set(int *format,
+ uint32_t *channels,
+ uint32_t *rate);
+ virtual uint32_t sampleRate() const;
+ status_t sampleRate(uint32_t rate);
+ virtual size_t bufferSize() const;
+ virtual int format() const;
+ int getAndroidFormat(snd_pcm_format_t format);
+
+ virtual int channelCount() const;
+ status_t channelCount(int channels);
+ uint32_t getAndroidChannels(int channels);
+
+ status_t open(int mode, uint32_t device);
+ void close();
+ status_t setSoftwareParams();
+ status_t setPCMFormat(snd_pcm_format_t format);
+ status_t setHardwareResample(bool resample);
+
+ const char *streamName();
+ virtual status_t setDevice(int mode, uint32_t device, uint32_t audio_mode);
+
+ const char *deviceName(int mode, uint32_t device);
+
+ void setStreamDefaults(StreamDefaults *dev) {
+ mDefaults = dev;
+ }
+
+ Mutex mLock;
+
+ private:
+ snd_pcm_t *mHandle;
+ snd_pcm_hw_params_t *mHardwareParams;
+ snd_pcm_sw_params_t *mSoftwareParams;
+ int mMode;
+ uint32_t mDevice;
+
+ StreamDefaults *mDefaults;
+ };
+
+ // ----------------------------------------------------------------------------
+
+ class AudioStreamOutALSA : public AudioStreamOut, public ALSAStreamOps
+ {
+ public:
+ AudioStreamOutALSA(AudioHardwareALSA *parent);
+ virtual ~AudioStreamOutALSA();
+
+
+ status_t set(int *format,
+ uint32_t *channelCount,
+ uint32_t *sampleRate){
+ return ALSAStreamOps::set(format, channelCount, sampleRate);
+ }
+
+ virtual uint32_t sampleRate() const
+ {
+ return ALSAStreamOps::sampleRate();
+ }
+
+ virtual size_t bufferSize() const
+ {
+ return ALSAStreamOps::bufferSize();
+ }
+
+ //virtual int channelCount() const;
+ virtual uint32_t channels() const;
+
+ virtual int format() const
+ {
+ return ALSAStreamOps::format();
+ }
+
+ virtual uint32_t latency() const;
+
+ virtual ssize_t write(const void *buffer, size_t bytes);
+ virtual status_t dump(int fd, const Vector<String16>& args);
+ virtual status_t setDevice(int mode, uint32_t newDevice, uint32_t audio_mode);
+ virtual status_t setVolume(float left, float right); //Tushar: New arch
+
+ status_t setVolume(float volume);
+
+ status_t standby();
+ bool isStandby();
+
+ virtual status_t setParameters(const String8& keyValuePairs);
+ virtual String8 getParameters(const String8& keys);
+
+ virtual status_t getRenderPosition(uint32_t *dspFrames);
+
+
+ private:
+ AudioHardwareALSA *mParent;
+ bool mPowerLock;
+ };
+
+ class AudioStreamInALSA : public AudioStreamIn, public ALSAStreamOps
+ {
+ public:
+ AudioStreamInALSA(AudioHardwareALSA *parent);
+ virtual ~AudioStreamInALSA();
+
+ status_t set(int *format,
+ uint32_t *channelCount,
+ uint32_t *sampleRate){
+ return ALSAStreamOps::set(format, channelCount, sampleRate);
+ }
+
+ //virtual uint32_t sampleRate() {
+ virtual uint32_t sampleRate() const {
+ return ALSAStreamOps::sampleRate();
+ }
+
+ virtual size_t bufferSize() const
+ {
+ return ALSAStreamOps::bufferSize();
+ }
+
+ //virtual int channelCount() const
+ virtual uint32_t channels() const
+ {
+ return ALSAStreamOps::channelCount();
+ }
+
+ virtual int format() const
+ {
+ return ALSAStreamOps::format();
+ }
+
+ virtual ssize_t read(void* buffer, ssize_t bytes);
+ virtual status_t dump(int fd, const Vector<String16>& args);
+ virtual status_t setDevice(int mode, uint32_t newDevice, uint32_t audio_mode);
+
+ virtual status_t setGain(float gain);
+
+ virtual status_t standby();
+
+ virtual status_t setParameters(const String8& keyValuePairs);
+ virtual String8 getParameters(const String8& keys);
+
+ virtual unsigned int getInputFramesLost() const { return 0; }
+
+ private:
+ AudioHardwareALSA *mParent;
+ bool mPowerLock;
+ };
+
+#if defined SEC_IPC
+ //TODO..implementation has to be done
+ class AudioHardwareIPC
+ {
+ public:
+ AudioHardwareIPC();
+ virtual ~AudioHardwareIPC();
+ status_t transmitVolumeIPC(uint32_t type, float volume);
+ status_t transmitAudioPathIPC(uint32_t path);
+#if defined SYNCHRONIZE_CP
+ status_t transmitClock_IPC(uint32_t condition);
+#endif
+ private:
+ HRilClient mClient;
+ char data[100];
+ };
+#endif
+ class AudioHardwareALSA : public AudioHardwareBase
+ {
+ public:
+ AudioHardwareALSA();
+ virtual ~AudioHardwareALSA();
+
+ /**
+ * check to see if the audio hardware interface has been initialized.
+ * return status based on values defined in include/utils/Errors.h
+ */
+ virtual status_t initCheck();
+
+ /**
+ * put the audio hardware into standby mode to conserve power. Returns
+ * status based on include/utils/Errors.h
+ */
+ virtual status_t standby();
+
+ /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
+ virtual status_t setVoiceVolume(float volume);
+
+ /**
+ * set the audio volume for all audio activities other than voice call.
+ * Range between 0.0 and 1.0. If any value other than NO_ERROR is returned,
+ * the software mixer will emulate this capability.
+ */
+ virtual status_t setMasterVolume(float volume);
+
+ // mic mute
+ virtual status_t setMicMute(bool state);
+ virtual status_t getMicMute(bool* state);
+#if defined TURN_ON_DEVICE_ONLY_USE
+ virtual int setMicStatus(int on); // To deliver status of input stream(activated or not). If it's activated, doesn't turn off codec.
+#endif
+ /** This method creates and opens the audio hardware output stream */
+ virtual AudioStreamOut* openOutputStream(
+ uint32_t devices,
+ int *format=0,
+ uint32_t *channels=0,
+ uint32_t *sampleRate=0,
+ status_t *status=0);
+ virtual void closeOutputStream(AudioStreamOut* out);
+
+ /** This method creates and opens the audio hardware input stream */
+ virtual AudioStreamIn* openInputStream(
+ uint32_t devices,
+ int *format,
+ uint32_t *channels,
+ uint32_t *sampleRate,
+ status_t *status,
+ AudioSystem::audio_in_acoustics acoustics);
+ virtual void closeInputStream(AudioStreamIn* in);
+
+
+
+ protected:
+ /**
+ * doRouting actually initiates the routing. A call to setRouting
+ * or setMode may result in a routing change. The generic logic calls
+ * doRouting when required. If the device has any special requirements these
+ * methods can be overriden.
+ */
+ virtual status_t doRouting(uint32_t device);
+
+ virtual status_t dump(int fd, const Vector<String16>& args);
+
+ friend class AudioStreamOutALSA;
+ friend class AudioStreamInALSA;
+
+ ALSAMixer *mMixer;
+ AudioStreamOutALSA *mOutput;
+ AudioStreamInALSA *mInput;
+#if defined SEC_IPC
+ AudioHardwareIPC *mIPC; //for IPC
+ uint32_t mRoutes[AudioSystem::NUM_MODES];
+#endif
+
+ private:
+ Mutex mLock;
+#if defined TURN_ON_DEVICE_ONLY_USE
+ bool mActivatedInputDevice;
+#endif
+ };
+
+ // ----------------------------------------------------------------------------
+
+#if defined SEC_IPC
+// sangsu fix : global functions for IPC
+static int onRawReqComplete(HRilClient client, const void *data, size_t datalen);
+static int onUnsol(HRilClient client, const void *data, size_t datalen);
+#endif
+}; // namespace android
+#endif // ANDROID_AUDIO_HARDWARE_ALSA_H
diff --git a/libaudio/AudioPolicyManager.cpp b/libaudio/AudioPolicyManager.cpp
new file mode 100644
index 0000000..a2b4651
--- /dev/null
+++ b/libaudio/AudioPolicyManager.cpp
@@ -0,0 +1,1865 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AudioPolicyManager"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+#include "AudioPolicyManager.h"
+#include <media/mediarecorder.h>
+
+namespace android {
+
+
+// ----------------------------------------------------------------------------
+// AudioPolicyInterface implementation
+// ----------------------------------------------------------------------------
+
+
+status_t AudioPolicyManager::setDeviceConnectionState(AudioSystem::audio_devices device,
+ AudioSystem::device_connection_state state,
+ const char *device_address)
+{
+
+ LOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);
+
+ // connect/disconnect only 1 device at a time
+ if (AudioSystem::popCount(device) != 1) return BAD_VALUE;
+
+ if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) {
+ LOGE("setDeviceConnectionState() invalid address: %s", device_address);
+ return BAD_VALUE;
+ }
+
+ // handle output devices
+ if (AudioSystem::isOutputDevice(device)) {
+
+#ifndef WITH_A2DP
+ if (AudioSystem::isA2dpDevice(device)) {
+ LOGE("setDeviceConnectionState() invalid device: %x", device);
+ return BAD_VALUE;
+ }
+#endif
+
+ switch (state)
+ {
+ // handle output device connection
+ case AudioSystem::DEVICE_STATE_AVAILABLE:
+ if (mAvailableOutputDevices & device) {
+ LOGW("setDeviceConnectionState() device already connected: %x", device);
+ return INVALID_OPERATION;
+ }
+ LOGW_IF((getOutputForDevice((uint32_t)device) != 0), "setDeviceConnectionState(): output using unconnected device %x", device);
+
+ LOGV("setDeviceConnectionState() connecting device %x", device);
+
+ // register new device as available
+ mAvailableOutputDevices |= device;
+
+#ifdef WITH_A2DP
+ // handle A2DP device connection
+ if (AudioSystem::isA2dpDevice(device)) {
+ // when an A2DP device is connected, open an A2DP and a duplicated output
+ LOGV("opening A2DP output for device %s", device_address);
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = device;
+ mA2dpOutput = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+ if (mA2dpOutput) {
+ // add A2DP output descriptor
+ mOutputs.add(mA2dpOutput, outputDesc);
+ // set initial stream volume for A2DP device
+ applyStreamVolumes(mA2dpOutput, device);
+ mDuplicatedOutput = mpClientInterface->openDuplicateOutput(mA2dpOutput, mHardwareOutput);
+ if (mDuplicatedOutput != 0) {
+ // If both A2DP and duplicated outputs are open, send device address to A2DP hardware
+ // interface
+ AudioParameter param;
+ param.add(String8("a2dp_sink_address"), String8(device_address));
+ mpClientInterface->setParameters(mA2dpOutput, param.toString());
+ mA2dpDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
+
+ // add duplicated output descriptor
+ AudioOutputDescriptor *dupOutputDesc = new AudioOutputDescriptor();
+ dupOutputDesc->mOutput1 = mOutputs.valueFor(mHardwareOutput);
+ dupOutputDesc->mOutput2 = mOutputs.valueFor(mA2dpOutput);
+ dupOutputDesc->mSamplingRate = outputDesc->mSamplingRate;
+ dupOutputDesc->mFormat = outputDesc->mFormat;
+ dupOutputDesc->mChannels = outputDesc->mChannels;
+ dupOutputDesc->mLatency = outputDesc->mLatency;
+ mOutputs.add(mDuplicatedOutput, dupOutputDesc);
+ applyStreamVolumes(mDuplicatedOutput, device);
+ } else {
+ LOGW("getOutput() could not open duplicated output for %d and %d",
+ mHardwareOutput, mA2dpOutput);
+ mAvailableOutputDevices &= ~device;
+ delete outputDesc;
+ return NO_INIT;
+ }
+ } else {
+ LOGW("setDeviceConnectionState() could not open A2DP output for device %x", device);
+ mAvailableOutputDevices &= ~device;
+ delete outputDesc;
+ return NO_INIT;
+ }
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+
+ if (mA2dpDeviceAddress == mScoDeviceAddress) {
+ // It is normal to suspend twice if we are both in call,
+ // and have the hardware audio output routed to BT SCO
+ if (mPhoneState != AudioSystem::MODE_NORMAL) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)hwOutputDesc->device())) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ }
+
+ // move streams pertaining to STRATEGY_MEDIA to the newly opened A2DP output
+ if (getDeviceForStrategy(STRATEGY_MEDIA) & device) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_MEDIA) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mA2dpOutput);
+ outputDesc->mRefCount[i] = hwOutputDesc->mRefCount[i];
+ hwOutputDesc->mRefCount[i] = 0;
+ }
+ }
+
+ }
+ // move streams pertaining to STRATEGY_DTMF to the newly opened A2DP output
+ if (getDeviceForStrategy(STRATEGY_DTMF) & device) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_DTMF) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mA2dpOutput);
+ outputDesc->mRefCount[i] = hwOutputDesc->mRefCount[i];
+ hwOutputDesc->mRefCount[i] = 0;
+ }
+ }
+
+ }
+ // move streams pertaining to STRATEGY_SONIFICATION to the newly opened duplicated output
+ if (getDeviceForStrategy(STRATEGY_SONIFICATION) & device) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_SONIFICATION) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mDuplicatedOutput);
+ outputDesc->mRefCount[i] =
+ hwOutputDesc->mRefCount[i];
+ mOutputs.valueFor(mDuplicatedOutput)->mRefCount[i] =
+ hwOutputDesc->mRefCount[i];
+ }
+ }
+ }
+ } else
+#endif
+ // handle wired and SCO device connection (accessed via hardware output)
+ {
+
+ uint32_t newDevice = 0;
+ if (AudioSystem::isBluetoothScoDevice(device)) {
+ LOGV("setDeviceConnectionState() BT SCO device, address %s", device_address);
+ // keep track of SCO device address
+ mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
+ // if in call and connecting SCO device, check if we must reroute hardware output
+ if (mPhoneState == AudioSystem::MODE_IN_CALL &&
+ getDeviceForStrategy(STRATEGY_PHONE) == device) {
+ newDevice = device;
+ } else if (mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF) &&
+ getDeviceForStrategy(STRATEGY_DTMF) == device) {
+ newDevice = device;
+ }
+ if ((mA2dpDeviceAddress == mScoDeviceAddress) &&
+ (mPhoneState != AudioSystem::MODE_NORMAL)) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ } else if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET ||
+ device == AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
+ LOGV("setDeviceConnectionState() wired headset device");
+ // if connecting a wired headset, we check the following by order of priority
+ // to request a routing change if necessary:
+ // 1: we are in call or the strategy phone is active on the hardware output:
+ // use device for strategy phone
+ // 2: the strategy sonification is active on the hardware output:
+ // use device for strategy sonification
+ // 3: the strategy media is active on the hardware output:
+ // use device for strategy media
+ // 4: the strategy DTMF is active on the hardware output:
+ // use device for strategy DTMF
+ if (getDeviceForStrategy(STRATEGY_PHONE) == device &&
+ (mPhoneState == AudioSystem::MODE_IN_CALL ||
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
+ newDevice = device;
+ } else if ((getDeviceForStrategy(STRATEGY_SONIFICATION) & device) &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
+ newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
+ } else if ((getDeviceForStrategy(STRATEGY_MEDIA) == device) &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
+ newDevice = device;
+ } else if (getDeviceForStrategy(STRATEGY_DTMF) == device &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = device;
+ }
+ }
+ // request routing change if necessary
+ setOutputDevice(mHardwareOutput, newDevice);
+ }
+ break;
+ // handle output device disconnection
+ case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
+ if (!(mAvailableOutputDevices & device)) {
+ LOGW("setDeviceConnectionState() device not connected: %x", device);
+ return INVALID_OPERATION;
+ }
+
+ uint32_t newDevice = 0;
+ // get usage of disconnected device by all strategies
+ bool wasUsedForMedia = (getDeviceForStrategy(STRATEGY_MEDIA) & device) != 0;
+ bool wasUsedForSonification = (getDeviceForStrategy(STRATEGY_SONIFICATION) & device) != 0;
+ bool wasUsedforPhone = (getDeviceForStrategy(STRATEGY_PHONE) & device) != 0;
+ bool wasUsedforDtmf = (getDeviceForStrategy(STRATEGY_DTMF) & device) != 0;
+ LOGV("setDeviceConnectionState() disconnecting device %x used by media %d, sonification %d, phone %d",
+ device, wasUsedForMedia, wasUsedForSonification, wasUsedforPhone);
+ // remove device from available output devices
+ mAvailableOutputDevices &= ~device;
+
+#ifdef WITH_A2DP
+ // handle A2DP device disconnection
+ if (AudioSystem::isA2dpDevice(device)) {
+ if (mA2dpOutput == 0 || mDuplicatedOutput == 0) {
+ LOGW("setDeviceConnectionState() disconnecting A2DP and no A2DP output!");
+ mAvailableOutputDevices |= device;
+ return INVALID_OPERATION;
+ }
+
+ if (mA2dpDeviceAddress != device_address) {
+ LOGW("setDeviceConnectionState() disconnecting unknow A2DP sink address %s", device_address);
+ mAvailableOutputDevices |= device;
+ return INVALID_OPERATION;
+ }
+
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+ AudioOutputDescriptor *a2dpOutputDesc = mOutputs.valueFor(mA2dpOutput);
+
+ // mute media during 2 seconds to avoid outputing sound on hardware output while music stream
+ // is switched from A2DP output and before music is paused by music application
+ setStrategyMute(STRATEGY_MEDIA, true, mHardwareOutput);
+ setStrategyMute(STRATEGY_MEDIA, false, mHardwareOutput, 2000);
+
+ // If the A2DP device was used by DTMF strategy, move all streams pertaining to DTMF strategy to
+ // hardware output
+ if (wasUsedforDtmf) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_DTMF) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput);
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,
+ a2dpOutputDesc->mRefCount[i]);
+ }
+ }
+ if (a2dpOutputDesc->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ }
+ }
+
+ // If the A2DP device was used by media strategy, move all streams pertaining to media strategy to
+ // hardware output
+ if (wasUsedForMedia) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_MEDIA) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput);
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,
+ a2dpOutputDesc->mRefCount[i]);
+ }
+ }
+ if (a2dpOutputDesc->isUsedByStrategy(STRATEGY_MEDIA)) {
+ newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
+ }
+ }
+
+ // If the A2DP device was used by sonification strategy, move all streams pertaining to
+ // sonification strategy to hardware output.
+ // Note that newDevice is overwritten here giving sonification strategy a higher priority than
+ // media strategy.
+ if (wasUsedForSonification) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_SONIFICATION) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput);
+ }
+ }
+ if (a2dpOutputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) {
+ newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
+ }
+ }
+
+ // close A2DP and duplicated outputs
+ AudioParameter param;
+ param.add(String8("closing"), String8("true"));
+ mpClientInterface->setParameters(mA2dpOutput, param.toString());
+
+ LOGW("setDeviceConnectionState() closing A2DP and duplicated output!");
+ mpClientInterface->closeOutput(mDuplicatedOutput);
+ delete mOutputs.valueFor(mDuplicatedOutput);
+ mOutputs.removeItem(mDuplicatedOutput);
+ mDuplicatedOutput = 0;
+ mpClientInterface->closeOutput(mA2dpOutput);
+ delete mOutputs.valueFor(mA2dpOutput);
+ mOutputs.removeItem(mA2dpOutput);
+ mA2dpOutput = 0;
+ } else
+#endif
+ {
+ if (AudioSystem::isBluetoothScoDevice(device)) {
+ // handle SCO device disconnection
+ if (wasUsedforPhone &&
+ mPhoneState == AudioSystem::MODE_IN_CALL) {
+ // if in call, find new suitable device for phone strategy
+ newDevice = getDeviceForStrategy(STRATEGY_PHONE);
+ } else if (wasUsedforDtmf &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ }
+ if ((mA2dpDeviceAddress == mScoDeviceAddress) &&
+ (mPhoneState != AudioSystem::MODE_NORMAL)) {
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+ } else if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET ||
+ device == AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
+ // if disconnecting a wired headset, we check the following by order of priority
+ // to request a routing change if necessary:
+ // 1: we are in call or the strategy phone is active on the hardware output:
+ // use device for strategy phone
+ // 2: the strategy sonification is active on the hardware output:
+ // use device for strategy sonification
+ // 3: the strategy media is active on the hardware output:
+ // use device for strategy media
+ // 4: the strategy DTMF is active on the hardware output:
+ // use device for strategy DTMF
+ if (wasUsedforPhone &&
+ (mPhoneState == AudioSystem::MODE_IN_CALL ||
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
+ newDevice = getDeviceForStrategy(STRATEGY_PHONE);
+ } else if (wasUsedForSonification &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
+ newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
+ } else if (wasUsedForMedia &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
+ newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
+ } else if (wasUsedforDtmf &&
+ mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)){
+ newDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ }
+ }
+ }
+ // request routing change if necessary
+ setOutputDevice(mHardwareOutput, newDevice);
+
+ // clear A2DP and SCO device address if necessary
+#ifdef WITH_A2DP
+ if (AudioSystem::isA2dpDevice(device)) {
+ mA2dpDeviceAddress = "";
+ }
+#endif
+ if (AudioSystem::isBluetoothScoDevice(device)) {
+ mScoDeviceAddress = "";
+ }
+ } break;
+
+ default:
+ LOGE("setDeviceConnectionState() invalid state: %x", state);
+ return BAD_VALUE;
+ }
+
+ if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
+ device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
+ } else if (device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO ||
+ device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET ||
+ device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
+ device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+ } else {
+ return NO_ERROR;
+ }
+ }
+ // handle input devices
+ if (AudioSystem::isInputDevice(device)) {
+
+ switch (state)
+ {
+ // handle input device connection
+ case AudioSystem::DEVICE_STATE_AVAILABLE: {
+ if (mAvailableInputDevices & device) {
+ LOGW("setDeviceConnectionState() device already connected: %d", device);
+ return INVALID_OPERATION;
+ }
+ mAvailableInputDevices |= device;
+ }
+ break;
+
+ // handle input device disconnection
+ case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
+ if (!(mAvailableInputDevices & device)) {
+ LOGW("setDeviceConnectionState() device not connected: %d", device);
+ return INVALID_OPERATION;
+ }
+ mAvailableInputDevices &= ~device;
+ } break;
+
+ default:
+ LOGE("setDeviceConnectionState() invalid state: %x", state);
+ return BAD_VALUE;
+ }
+
+ audio_io_handle_t activeInput = getActiveInput();
+ if (activeInput != 0) {
+ AudioInputDescriptor *inputDesc = mInputs.valueFor(activeInput);
+ uint32_t newDevice = getDeviceForInputSource(inputDesc->mInputSource);
+ if (newDevice != inputDesc->mDevice) {
+ LOGV("setDeviceConnectionState() changing device from %x to %x for input %d",
+ inputDesc->mDevice, newDevice, activeInput);
+ inputDesc->mDevice = newDevice;
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)newDevice);
+ mpClientInterface->setParameters(activeInput, param.toString());
+ }
+ }
+
+ return NO_ERROR;
+ }
+
+ LOGW("setDeviceConnectionState() invalid device: %x", device);
+ return BAD_VALUE;
+}
+
+AudioSystem::device_connection_state AudioPolicyManager::getDeviceConnectionState(AudioSystem::audio_devices device,
+ const char *device_address)
+{
+ AudioSystem::device_connection_state state = AudioSystem::DEVICE_STATE_UNAVAILABLE;
+ String8 address = String8(device_address);
+ if (AudioSystem::isOutputDevice(device)) {
+ if (device & mAvailableOutputDevices) {
+#ifdef WITH_A2DP
+ if (AudioSystem::isA2dpDevice(device) &&
+ address != "" && mA2dpDeviceAddress != address) {
+ return state;
+ }
+#endif
+ if (AudioSystem::isBluetoothScoDevice(device) &&
+ address != "" && mScoDeviceAddress != address) {
+ return state;
+ }
+ state = AudioSystem::DEVICE_STATE_AVAILABLE;
+ }
+ } else if (AudioSystem::isInputDevice(device)) {
+ if (device & mAvailableInputDevices) {
+ state = AudioSystem::DEVICE_STATE_AVAILABLE;
+ }
+ }
+
+ return state;
+}
+
+void AudioPolicyManager::setPhoneState(int state)
+{
+ LOGV("setPhoneState() state %d", state);
+ uint32_t newDevice = 0;
+ if (state < 0 || state >= AudioSystem::NUM_MODES) {
+ LOGW("setPhoneState() invalid state %d", state);
+ return;
+ }
+
+ if (state == mPhoneState ) {
+ LOGW("setPhoneState() setting same state %d", state);
+ return;
+ }
+
+ // if leaving call state, handle special case of active streams
+ // pertaining to sonification strategy see handleIncallSonification()
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ LOGV("setPhoneState() in call state management: new state is %d", state);
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ handleIncallSonification(stream, false, true);
+ }
+ }
+
+ // store previous phone state for management of sonification strategy below
+ int oldState = mPhoneState;
+ uint32_t oldDtmfDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ uint32_t oldSonificationDevice = getDeviceForStrategy(STRATEGY_SONIFICATION) & ~AudioSystem::DEVICE_OUT_SPEAKER;
+ mPhoneState = state;
+ bool force = false;
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+ // check if a routing change is required for hardware output in the following
+ // order of priority:
+ // 1: a stream pertaining to sonification strategy is active
+ // 2: new state is incall
+ // 3: a stream pertaining to media strategy is active
+ // 4: a stream pertaining to DTMF strategy is active
+ if (hwOutputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) {
+ newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
+ } else if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ newDevice = getDeviceForStrategy(STRATEGY_PHONE);
+ // force routing command to audio hardware when starting call
+ // even if no device change is needed
+ force = true;
+ } else if (hwOutputDesc->isUsedByStrategy(STRATEGY_MEDIA)) {
+ newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
+ } else if (hwOutputDesc->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ }
+
+
+ if (mA2dpOutput != 0) {
+ // If entering or exiting in call state, switch DTMF streams to/from A2DP output
+ // if necessary
+ uint32_t newDtmfDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ uint32_t newSonificationDevice = getDeviceForStrategy(STRATEGY_SONIFICATION) & ~AudioSystem::DEVICE_OUT_SPEAKER;
+ if (state == AudioSystem::MODE_IN_CALL) { // entering in call mode
+ // move DTMF streams from A2DP output to hardware output if necessary
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)oldDtmfDevice) &&
+ !AudioSystem::isA2dpDevice((AudioSystem::audio_devices)newDtmfDevice)) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_DTMF) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput);
+ int refCount = mOutputs.valueFor(mA2dpOutput)->mRefCount[i];
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,
+ refCount);
+ mOutputs.valueFor(mA2dpOutput)->changeRefCount((AudioSystem::stream_type)i,-refCount);
+ }
+ }
+ if (newDevice == 0 && mOutputs.valueFor(mA2dpOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = newDtmfDevice;
+ }
+ }
+ // move SONIFICATION streams from duplicated output to hardware output if necessary
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)oldSonificationDevice) &&
+ !AudioSystem::isA2dpDevice((AudioSystem::audio_devices)newSonificationDevice)) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_SONIFICATION) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mHardwareOutput);
+ int refCount = mOutputs.valueFor(mDuplicatedOutput)->mRefCount[i];
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,
+ refCount);
+ mOutputs.valueFor(mDuplicatedOutput)->changeRefCount((AudioSystem::stream_type)i,-refCount);
+ }
+ }
+ }
+ } else { // exiting in call mode
+ // move DTMF streams from hardware output to A2DP output if necessary
+ if (!AudioSystem::isA2dpDevice((AudioSystem::audio_devices)oldDtmfDevice) &&
+ AudioSystem::isA2dpDevice((AudioSystem::audio_devices)newDtmfDevice)) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_DTMF) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mA2dpOutput);
+ int refCount = hwOutputDesc->mRefCount[i];
+ mOutputs.valueFor(mA2dpOutput)->changeRefCount((AudioSystem::stream_type)i, refCount);
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i, -refCount);
+ }
+ }
+ }
+ // move SONIFICATION streams from hardware output to A2DP output if necessary
+ if (!AudioSystem::isA2dpDevice((AudioSystem::audio_devices)oldSonificationDevice) &&
+ AudioSystem::isA2dpDevice((AudioSystem::audio_devices)newSonificationDevice)) {
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == STRATEGY_SONIFICATION) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, mDuplicatedOutput);
+ int refCount = hwOutputDesc->mRefCount[i];
+ mOutputs.valueFor(mDuplicatedOutput)->changeRefCount((AudioSystem::stream_type)i, refCount);
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i, -refCount);
+ }
+ }
+ }
+ }
+ // suspend A2DP output if SCO device address is the same as A2DP device address.
+ // no need to check that a SCO device is actually connected as mScoDeviceAddress == ""
+ // if none is connected and the test below will fail.
+ if (mA2dpDeviceAddress == mScoDeviceAddress) {
+ if (oldState == AudioSystem::MODE_NORMAL) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ } else if (state == AudioSystem::MODE_NORMAL) {
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+ }
+ }
+
+ // force routing command to audio hardware when ending call
+ // even if no device change is needed
+ if (oldState == AudioSystem::MODE_IN_CALL) {
+ if (newDevice == 0) {
+ newDevice = hwOutputDesc->device();
+ }
+ force = true;
+ }
+ // change routing is necessary
+ setOutputDevice(mHardwareOutput, newDevice, force);
+
+ // if entering in call state, handle special case of active streams
+ // pertaining to sonification strategy see handleIncallSonification()
+ if (state == AudioSystem::MODE_IN_CALL) {
+ LOGV("setPhoneState() in call state management: new state is %d", state);
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ handleIncallSonification(stream, true, true);
+ }
+ }
+
+ // Flag that ringtone volume must be limited to music volume until we exit MODE_RINGTONE
+ if (state == AudioSystem::MODE_RINGTONE &&
+ (hwOutputDesc->isUsedByStream(AudioSystem::MUSIC) ||
+ (systemTime() - mMusicStopTime) < seconds(SONIFICATION_HEADSET_MUSIC_DELAY))) {
+ mLimitRingtoneVolume = true;
+ } else {
+ mLimitRingtoneVolume = false;
+ }
+}
+
+void AudioPolicyManager::setRingerMode(uint32_t mode, uint32_t mask)
+{
+ LOGV("setRingerMode() mode %x, mask %x", mode, mask);
+
+ mRingerMode = mode;
+}
+
+void AudioPolicyManager::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config)
+{
+ LOGV("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);
+
+ switch(usage) {
+ case AudioSystem::FOR_COMMUNICATION:
+ if (config != AudioSystem::FORCE_SPEAKER && config != AudioSystem::FORCE_BT_SCO &&
+ config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ // update hardware output routing immediately if in call, or if there is an active
+ // VOICE_CALL stream, as would be the case with an application that uses this stream
+ // for it to behave like in a telephony app (e.g. voicemail app that plays audio files
+ // streamed or downloaded to the device)
+ if ((mPhoneState == AudioSystem::MODE_IN_CALL) ||
+ (mOutputs.valueFor(mHardwareOutput)->isUsedByStream(AudioSystem::VOICE_CALL))) {
+ uint32_t device = getDeviceForStrategy(STRATEGY_PHONE);
+ setOutputDevice(mHardwareOutput, device);
+ }
+ break;
+ case AudioSystem::FOR_MEDIA:
+ if (config != AudioSystem::FORCE_HEADPHONES && config != AudioSystem::FORCE_BT_A2DP &&
+ config != AudioSystem::FORCE_WIRED_ACCESSORY && config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ break;
+ case AudioSystem::FOR_RECORD:
+ if (config != AudioSystem::FORCE_BT_SCO && config != AudioSystem::FORCE_WIRED_ACCESSORY &&
+ config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_RECORD", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ break;
+ case AudioSystem::FOR_DOCK:
+ if (config != AudioSystem::FORCE_NONE && config != AudioSystem::FORCE_BT_CAR_DOCK &&
+ config != AudioSystem::FORCE_BT_DESK_DOCK && config != AudioSystem::FORCE_WIRED_ACCESSORY) {
+ LOGW("setForceUse() invalid config %d for FOR_DOCK", config);
+ }
+ mForceUse[usage] = config;
+ break;
+ default:
+ LOGW("setForceUse() invalid usage %d", usage);
+ break;
+ }
+}
+
+AudioSystem::forced_config AudioPolicyManager::getForceUse(AudioSystem::force_use usage)
+{
+ return mForceUse[usage];
+}
+
+void AudioPolicyManager::setSystemProperty(const char* property, const char* value)
+{
+ LOGV("setSystemProperty() property %s, value %s", property, value);
+ if (strcmp(property, "ro.camera.sound.forced") == 0) {
+ if (atoi(value)) {
+ LOGV("ENFORCED_AUDIBLE cannot be muted");
+ mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = false;
+ } else {
+ LOGV("ENFORCED_AUDIBLE can be muted");
+ mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = true;
+ }
+ }
+}
+
+audio_io_handle_t AudioPolicyManager::getOutput(AudioSystem::stream_type stream,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::output_flags flags)
+{
+ audio_io_handle_t output = 0;
+ uint32_t latency = 0;
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+ uint32_t device = getDeviceForStrategy(strategy);
+ LOGV("getOutput() stream %d, samplingRate %d, format %d, channels %x, flags %x", stream, samplingRate, format, channels, flags);
+
+
+ // open a direct output if:
+ // 1 a direct output is explicitely requested
+ // 2 the audio format is compressed
+ if ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) ||
+ (format !=0 && !AudioSystem::isLinearPCM(format))) {
+
+ LOGV("getOutput() opening direct output device %x", device);
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = device;
+ outputDesc->mSamplingRate = samplingRate;
+ outputDesc->mFormat = format;
+ outputDesc->mChannels = channels;
+ outputDesc->mLatency = 0;
+ outputDesc->mFlags = (AudioSystem::output_flags)(flags | AudioSystem::OUTPUT_FLAG_DIRECT);
+ outputDesc->mRefCount[stream] = 1;
+ output = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+
+ // only accept an output with the requeted parameters
+ if ((samplingRate != 0 && samplingRate != outputDesc->mSamplingRate) ||
+ (format != 0 && format != outputDesc->mFormat) ||
+ (channels != 0 && channels != outputDesc->mChannels)) {
+ LOGV("getOutput() failed opening direct output: samplingRate %d, format %d, channels %d",
+ samplingRate, format, channels);
+ mpClientInterface->closeOutput(output);
+ delete outputDesc;
+ return 0;
+ }
+ mOutputs.add(output, outputDesc);
+ return output;
+ }
+
+ if (channels != 0 && channels != AudioSystem::CHANNEL_OUT_MONO &&
+ channels != AudioSystem::CHANNEL_OUT_STEREO) {
+ return 0;
+ }
+ // open a non direct output
+
+ // get which output is suitable for the specified stream. The actual routing change will happen
+ // when startOutput() will be called
+ uint32_t device2 = device & ~AudioSystem::DEVICE_OUT_SPEAKER;
+ if (AudioSystem::popCount((AudioSystem::audio_devices)device) == 2) {
+#ifdef WITH_A2DP
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device2)) {
+ // if playing on 2 devices among which one is A2DP, use duplicated output
+ LOGV("getOutput() using duplicated output");
+ LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device in multiple %x selected but A2DP output not opened", device);
+ output = mDuplicatedOutput;
+ } else
+#endif
+ {
+ // if playing on 2 devices among which none is A2DP, use hardware output
+ output = mHardwareOutput;
+ }
+ LOGV("getOutput() using output %d for 2 devices %x", output, device);
+ } else {
+#ifdef WITH_A2DP
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device2)) {
+ // if playing on A2DP device, use a2dp output
+ LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device %x selected but A2DP output not opened", device);
+ output = mA2dpOutput;
+ } else
+#endif
+ {
+ // if playing on not A2DP device, use hardware output
+ output = mHardwareOutput;
+ }
+ }
+
+
+ LOGW_IF((output ==0), "getOutput() could not find output for stream %d, samplingRate %d, format %d, channels %x, flags %x",
+ stream, samplingRate, format, channels, flags);
+
+ return output;
+}
+
+status_t AudioPolicyManager::startOutput(audio_io_handle_t output, AudioSystem::stream_type stream,int session)
+{
+ LOGV("startOutput() output %d, stream %d", output, stream);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("startOutput() unknow output %d", output);
+ return BAD_VALUE;
+ }
+
+ AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+ uint32_t device = getDeviceForStrategy(strategy);
+
+ if (!outputDesc->isUsedByStrategy(strategy)) {
+ // if the stream started is the first active stream in its strategy, check if routing change
+ // must be done on hardware output
+ uint32_t newDevice = 0;
+ if (AudioSystem::popCount((AudioSystem::audio_devices)device) == 2) {
+#ifdef WITH_A2DP
+ uint32_t device2 = device & ~AudioSystem::DEVICE_OUT_SPEAKER;
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device2)) {
+ // if one device is A2DP, selected the second device for hardware output
+ device &= ~device2;
+ } else
+#endif
+ {
+ // we only support speaker + headset and speaker + headphone combinations on hardware output.
+ // other combinations will leave device = 0 and no routing will happen.
+ if (device != (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADSET) &&
+ device != (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) {
+ device = AudioSystem::DEVICE_OUT_SPEAKER;
+ }
+ }
+ }
+
+ // By order of priority
+ // 1 apply routing for phone strategy in any case
+ // 2 apply routing for notification strategy if no stream pertaining to
+ // phone strategies is playing
+ // 3 apply routing for media strategy is not incall and neither phone nor sonification
+ // strategies is active.
+ // 4 apply routing for DTMF strategy if no stream pertaining to
+ // neither phone, sonification nor media strategy is playing
+ if (strategy == STRATEGY_PHONE) {
+ newDevice = device;
+ } else if (!mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE)) {
+ if (strategy == STRATEGY_SONIFICATION) {
+ newDevice = device;
+ } else if (!mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)) {
+ if (strategy == STRATEGY_MEDIA) {
+ newDevice = device;
+ } else if (!mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)) {
+ // strategy == STRATEGY_DTMF
+ newDevice = device;
+ }
+ }
+ }
+
+ // TODO: maybe mute stream is selected device was refused
+ setOutputDevice(mHardwareOutput, newDevice);
+ }
+
+ // incremenent usage count for this stream on the requested output:
+ // NOTE that the usage count is the same for duplicated output and hardware output which is
+ // necassary for a correct control of hardware output routing by startOutput() and stopOutput()
+ outputDesc->changeRefCount(stream, 1);
+
+ // handle special case for sonification while in call
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ handleIncallSonification(stream, true, false);
+ }
+
+ // apply volume rules for current stream and device if necessary
+ checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, outputDesc->device());
+
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManager::stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream,int session)
+{
+ LOGV("stopOutput() output %d, stream %d", output, stream);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("stopOutput() unknow output %d", output);
+ return BAD_VALUE;
+ }
+
+ AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+
+ // handle special case for sonification while in call
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ handleIncallSonification(stream, false, false);
+ }
+
+ if (outputDesc->isUsedByStrategy(strategy)) {
+ // decrement usage count of this stream on the output
+ outputDesc->changeRefCount(stream, -1);
+ if (!outputDesc->isUsedByStrategy(strategy)) {
+ // if the stream is the last of its strategy to use this output, change routing
+ // in the following order or priority:
+ // PHONE > SONIFICATION > MEDIA > DTMF
+ uint32_t newDevice = 0;
+ if (outputDesc->isUsedByStrategy(STRATEGY_PHONE)) {
+ newDevice = getDeviceForStrategy(STRATEGY_PHONE);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) {
+ newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
+ } else if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ newDevice = getDeviceForStrategy(STRATEGY_PHONE);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_MEDIA)) {
+ newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_DTMF)) {
+ newDevice = getDeviceForStrategy(STRATEGY_DTMF);
+ }
+
+ // apply routing change if necessary.
+ // insert a delay of 2 times the audio hardware latency to ensure PCM
+ // buffers in audio flinger and audio hardware are emptied before the
+ // routing change is executed.
+ setOutputDevice(mHardwareOutput, newDevice, false, mOutputs.valueFor(mHardwareOutput)->mLatency*2);
+ }
+ // store time at which the last music track was stopped - see computeVolume()
+ if (stream == AudioSystem::MUSIC) {
+ mMusicStopTime = systemTime();
+ }
+ return NO_ERROR;
+ } else {
+ LOGW("stopOutput() refcount is already 0 for output %d", output);
+ return INVALID_OPERATION;
+ }
+}
+
+void AudioPolicyManager::releaseOutput(audio_io_handle_t output)
+{
+ LOGV("releaseOutput() %d", output);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("releaseOutput() releasing unknown output %d", output);
+ return;
+ }
+ if (mOutputs.valueAt(index)->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT) {
+ mpClientInterface->closeOutput(output);
+ delete mOutputs.valueAt(index);
+ mOutputs.removeItem(output);
+ }
+}
+
+audio_io_handle_t AudioPolicyManager::getInput(int inputSource,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::audio_in_acoustics acoustics)
+{
+ audio_io_handle_t input = 0;
+ uint32_t device = getDeviceForInputSource(inputSource);
+
+ LOGV("getInput() inputSource %d, samplingRate %d, format %d, channels %x, acoustics %x", inputSource, samplingRate, format, channels, acoustics);
+
+ if (device == 0) {
+ return 0;
+ }
+
+ // adapt channel selection to input source
+ switch(inputSource) {
+ case AUDIO_SOURCE_VOICE_UPLINK:
+ channels = AudioSystem::CHANNEL_IN_VOICE_UPLINK;
+ break;
+ case AUDIO_SOURCE_VOICE_DOWNLINK:
+ channels = AudioSystem::CHANNEL_IN_VOICE_DNLINK;
+ break;
+ case AUDIO_SOURCE_VOICE_CALL:
+ channels = (AudioSystem::CHANNEL_IN_VOICE_UPLINK | AudioSystem::CHANNEL_IN_VOICE_DNLINK);
+ break;
+ default:
+ break;
+ }
+
+ AudioInputDescriptor *inputDesc = new AudioInputDescriptor();
+
+ inputDesc->mInputSource = inputSource;
+ inputDesc->mDevice = device;
+ inputDesc->mSamplingRate = samplingRate;
+ inputDesc->mFormat = format;
+ inputDesc->mChannels = channels;
+ inputDesc->mAcoustics = acoustics;
+ inputDesc->mRefCount = 0;
+ input = mpClientInterface->openInput(&inputDesc->mDevice,
+ &inputDesc->mSamplingRate,
+ &inputDesc->mFormat,
+ &inputDesc->mChannels,
+ inputDesc->mAcoustics);
+
+ // only accept input with the exact requested set of parameters
+ if ((samplingRate != inputDesc->mSamplingRate) ||
+ (format != inputDesc->mFormat) ||
+ (channels != inputDesc->mChannels)) {
+ LOGV("getOutput() failed opening input: samplingRate %d, format %d, channels %d",
+ samplingRate, format, channels);
+ mpClientInterface->closeInput(input);
+ delete inputDesc;
+ return 0;
+ }
+ mInputs.add(input, inputDesc);
+ return input;
+}
+
+status_t AudioPolicyManager::startInput(audio_io_handle_t input)
+{
+ LOGV("startInput() input %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("startInput() unknow input %d", input);
+ return BAD_VALUE;
+ }
+ AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
+
+ // refuse 2 active AudioRecord clients at the same time
+ if (getActiveInput() != 0) {
+ LOGW("startInput() input %d failed: other input already started", input);
+ return INVALID_OPERATION;
+ }
+
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)inputDesc->mDevice);
+ mpClientInterface->setParameters(input, param.toString());
+
+ inputDesc->mRefCount = 1;
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManager::stopInput(audio_io_handle_t input)
+{
+ LOGV("stopInput() input %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("stopInput() unknow input %d", input);
+ return BAD_VALUE;
+ }
+ AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
+
+ if (inputDesc->mRefCount == 0) {
+ LOGW("stopInput() input %d already stopped", input);
+ return INVALID_OPERATION;
+ } else {
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), 0);
+ mpClientInterface->setParameters(input, param.toString());
+ inputDesc->mRefCount = 0;
+ return NO_ERROR;
+ }
+}
+
+void AudioPolicyManager::releaseInput(audio_io_handle_t input)
+{
+ LOGV("releaseInput() %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("releaseInput() releasing unknown input %d", input);
+ return;
+ }
+ mpClientInterface->closeInput(input);
+ delete mInputs.valueAt(index);
+ mInputs.removeItem(input);
+ LOGV("releaseInput() exit");
+}
+
+
+
+void AudioPolicyManager::initStreamVolume(AudioSystem::stream_type stream,
+ int indexMin,
+ int indexMax)
+{
+ LOGV("initStreamVolume() stream %d, min %d, max %d", stream , indexMin, indexMax);
+ if (indexMin < 0 || indexMin >= indexMax) {
+ LOGW("initStreamVolume() invalid index limits for stream %d, min %d, max %d", stream , indexMin, indexMax);
+ return;
+ }
+ mStreams[stream].mIndexMin = indexMin;
+ mStreams[stream].mIndexMax = indexMax;
+}
+
+status_t AudioPolicyManager::setStreamVolumeIndex(AudioSystem::stream_type stream, int index)
+{
+
+ if ((index < mStreams[stream].mIndexMin) || (index > mStreams[stream].mIndexMax)) {
+ return BAD_VALUE;
+ }
+
+ // Force max volume if stream cannot be muted
+ if (!mStreams[stream].mCanBeMuted) index = mStreams[stream].mIndexMax;
+
+ LOGV("setStreamVolumeIndex() stream %d, index %d", stream, index);
+ mStreams[stream].mIndexCur = index;
+
+ // compute and apply stream volume on all outputs according to connected device
+ status_t status = NO_ERROR;
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), mOutputs.valueAt(i)->device());
+ if (volStatus != NO_ERROR) {
+ status = volStatus;
+ }
+ }
+ return status;
+}
+
+status_t AudioPolicyManager::getStreamVolumeIndex(AudioSystem::stream_type stream, int *index)
+{
+ if (index == 0) {
+ return BAD_VALUE;
+ }
+ LOGV("getStreamVolumeIndex() stream %d", stream);
+ *index = mStreams[stream].mIndexCur;
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManager::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, "\nAudioPolicyManager Dump: %p\n", this);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Hardware Output: %d\n", mHardwareOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " A2DP Output: %d\n", mA2dpOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Duplicated Output: %d\n", mDuplicatedOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Output devices: %08x\n", mAvailableOutputDevices);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Input devices: %08x\n", mAvailableInputDevices);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " A2DP device address: %s\n", mA2dpDeviceAddress.string());
+ result.append(buffer);
+ snprintf(buffer, SIZE, " SCO device address: %s\n", mScoDeviceAddress.string());
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Phone state: %d\n", mPhoneState);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Ringer mode: %d\n", mRingerMode);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for communications %d\n", mForceUse[AudioSystem::FOR_COMMUNICATION]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for media %d\n", mForceUse[AudioSystem::FOR_MEDIA]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for record %d\n", mForceUse[AudioSystem::FOR_RECORD]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for dock %d\n", mForceUse[AudioSystem::FOR_DOCK]);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+
+ snprintf(buffer, SIZE, "\nOutputs dump:\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ snprintf(buffer, SIZE, "- Output %d dump:\n", mOutputs.keyAt(i));
+ write(fd, buffer, strlen(buffer));
+ mOutputs.valueAt(i)->dump(fd);
+ }
+
+ snprintf(buffer, SIZE, "\nInputs dump:\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ snprintf(buffer, SIZE, "- Input %d dump:\n", mInputs.keyAt(i));
+ write(fd, buffer, strlen(buffer));
+ mInputs.valueAt(i)->dump(fd);
+ }
+
+ snprintf(buffer, SIZE, "\nStreams dump:\n");
+ write(fd, buffer, strlen(buffer));
+ snprintf(buffer, SIZE, " Stream Index Min Index Max Index Cur Mute Count Can be muted\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ snprintf(buffer, SIZE, " %02d", i);
+ mStreams[i].dump(buffer + 3, SIZE);
+ write(fd, buffer, strlen(buffer));
+ }
+
+ return NO_ERROR;
+}
+
+// ----------------------------------------------------------------------------
+// AudioPolicyManager
+// ----------------------------------------------------------------------------
+
+// --- class factory
+
+
+extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface)
+{
+ return new AudioPolicyManager(clientInterface);
+}
+
+extern "C" void destroyAudioPolicyManager(AudioPolicyInterface *interface)
+{
+ delete interface;
+}
+
+AudioPolicyManager::AudioPolicyManager(AudioPolicyClientInterface *clientInterface)
+: mPhoneState(AudioSystem::MODE_NORMAL), mRingerMode(0), mMusicStopTime(0), mLimitRingtoneVolume(false),mTotalEffectsCpuLoad(0),mTotalEffectsMemory(0)
+{
+ mpClientInterface = clientInterface;
+
+ for (int i = 0; i < AudioSystem::NUM_FORCE_USE; i++) {
+ mForceUse[i] = AudioSystem::FORCE_NONE;
+ }
+
+ // devices available by default are speaker, ear piece and microphone
+ mAvailableOutputDevices = AudioSystem::DEVICE_OUT_EARPIECE |
+ AudioSystem::DEVICE_OUT_SPEAKER;
+ mAvailableInputDevices = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+
+ mA2dpDeviceAddress = String8("");
+ mScoDeviceAddress = String8("");
+
+ // open hardware output
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER;
+ mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+
+ if (mHardwareOutput == 0) {
+ LOGE("Failed to initialize hardware output stream, samplingRate: %d, format %d, channels %d",
+ outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels);
+ } else {
+ mOutputs.add(mHardwareOutput, outputDesc);
+ setOutputDevice(mHardwareOutput, (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER, true);
+ }
+
+ mA2dpOutput = 0;
+ mDuplicatedOutput = 0;
+}
+
+AudioPolicyManager::~AudioPolicyManager()
+{
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ mpClientInterface->closeOutput(mOutputs.keyAt(i));
+ delete mOutputs.valueAt(i);
+ }
+ mOutputs.clear();
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ mpClientInterface->closeInput(mInputs.keyAt(i));
+ delete mInputs.valueAt(i);
+ }
+ mInputs.clear();
+}
+
+// ---
+
+audio_io_handle_t AudioPolicyManager::getOutputForDevice(uint32_t device)
+{
+ audio_io_handle_t output = 0;
+ uint32_t lDevice;
+
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ lDevice = mOutputs.valueAt(i)->device();
+ LOGV("getOutputForDevice() output %d devices %x", mOutputs.keyAt(i), lDevice);
+
+ // We are only considering outputs connected to a mixer here => exclude direct outputs
+ if ((lDevice == device) &&
+ !(mOutputs.valueAt(i)->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT)) {
+ output = mOutputs.keyAt(i);
+ LOGV("getOutputForDevice() found output %d for device %x", output, device);
+ break;
+ }
+ }
+ return output;
+}
+
+AudioPolicyManager::routing_strategy AudioPolicyManager::getStrategy(AudioSystem::stream_type stream)
+{
+ // stream to strategy mapping
+ switch (stream) {
+ case AudioSystem::VOICE_CALL:
+ case AudioSystem::BLUETOOTH_SCO:
+ return STRATEGY_PHONE;
+ case AudioSystem::RING:
+ case AudioSystem::NOTIFICATION:
+ case AudioSystem::ALARM:
+ case AudioSystem::ENFORCED_AUDIBLE:
+ return STRATEGY_SONIFICATION;
+ case AudioSystem::DTMF:
+ return STRATEGY_DTMF;
+ default:
+ LOGE("unknown stream type");
+ case AudioSystem::SYSTEM:
+ // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs
+ // while key clicks are played produces a poor result
+ case AudioSystem::TTS:
+ case AudioSystem::MUSIC:
+ return STRATEGY_MEDIA;
+ }
+}
+
+uint32_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strategy)
+{
+ uint32_t device = 0;
+
+ switch (strategy) {
+ case STRATEGY_DTMF:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL) {
+ // when off call, DTMF strategy follows the same rules as MEDIA strategy
+ device = getDeviceForStrategy(STRATEGY_MEDIA);
+ break;
+ }
+ // when in call, DTMF and PHONE strategies follow the same rules
+ // FALL THROUGH
+
+ case STRATEGY_PHONE:
+ // for phone strategy, we first consider the forced use and then the available devices by order
+ // of priority
+ switch (mForceUse[AudioSystem::FOR_COMMUNICATION]) {
+ case AudioSystem::FORCE_BT_SCO:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+ if (device) break;
+ }
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO;
+ if (device) break;
+ // if SCO device is requested but no SCO device is available, fall back to default case
+ // FALL THROUGH
+
+ default: // FORCE_NONE
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() earpiece device not found");
+ }
+ break;
+
+ case AudioSystem::FORCE_SPEAKER:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+ if (device) break;
+ }
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ break;
+ }
+ break;
+
+ case STRATEGY_SONIFICATION:
+
+ // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by
+ // handleIncallSonification().
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ device = getDeviceForStrategy(STRATEGY_PHONE);
+ break;
+ }
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ // The second device used for sonification is the same as the device used by media strategy
+ // FALL THROUGH
+
+ case STRATEGY_MEDIA: {
+ uint32_t device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_AUX_DIGITAL;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ if (device2 == 0) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise
+ device |= device2;
+ // Do not play media stream if in call and the requested device would change the hardware
+ // output routing
+ if (mPhoneState == AudioSystem::MODE_IN_CALL &&
+ !AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device) &&
+ device != getDeviceForStrategy(STRATEGY_PHONE)) {
+ device = 0;
+ LOGV("getDeviceForStrategy() incompatible media and phone devices");
+ }
+ } break;
+
+ default:
+ LOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
+ break;
+ }
+
+ LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
+ return device;
+}
+
+void AudioPolicyManager::setOutputDevice(audio_io_handle_t output, uint32_t device, bool force, int delayMs)
+{
+ LOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs);
+ if (mOutputs.indexOfKey(output) < 0) {
+ LOGW("setOutputDevice() unknown output %d", output);
+ return;
+ }
+#ifdef WITH_A2DP
+ if (output == mHardwareOutput) {
+ // clear A2DP devices from device bit field here so that the caller does not have to
+ // do it in case of multiple device selections
+ uint32_t device2 = device & ~AudioSystem::DEVICE_OUT_SPEAKER;
+ if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device2)) {
+ LOGV("setOutputDevice() removing A2DP device");
+ device &= ~device2;
+ }
+ } else if (output == mA2dpOutput) {
+ // clear hardware devices from device bit field here so that the caller does not have to
+ // do it in case of multiple device selections (the second device is always DEVICE_OUT_SPEAKER)
+ // in this case
+ device &= ~AudioSystem::DEVICE_OUT_SPEAKER;
+ }
+#endif
+
+ // doing this check here allows the caller to call setOutputDevice() without conditions
+ if (device == 0) return;
+
+ uint32_t oldDevice = (uint32_t)mOutputs.valueFor(output)->device();
+ // Do not change the routing if the requested device is the same as current device. Doing this check
+ // here allows the caller to call setOutputDevice() without conditions
+ if (device == oldDevice && !force) {
+ LOGV("setOutputDevice() setting same device %x for output %d", device, output);
+ return;
+ }
+
+ mOutputs.valueFor(output)->mDevice = device;
+ // mute media streams if both speaker and headset are selected
+ if (device == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADSET) ||
+ device == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) {
+ setStrategyMute(STRATEGY_MEDIA, true, output);
+ // wait for the PCM output buffers to empty before proceeding with the rest of the command
+ usleep(mOutputs.valueFor(output)->mLatency*2*1000);
+ }
+ // suspend A2D output if SCO device is selected
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) {
+ if (mA2dpOutput && mScoDeviceAddress == mA2dpDeviceAddress) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ }
+ // do the routing
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)device);
+ mpClientInterface->setParameters(mHardwareOutput, param.toString(), delayMs);
+ // update stream volumes according to new device
+ applyStreamVolumes(output, device, delayMs);
+
+ // if disconnecting SCO device, restore A2DP output
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)oldDevice)) {
+ if (mA2dpOutput && mScoDeviceAddress == mA2dpDeviceAddress) {
+ LOGV("restore A2DP output");
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+ }
+ // if changing from a combined headset + speaker route, unmute media streams
+ if (oldDevice == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADSET) ||
+ oldDevice == (AudioSystem::DEVICE_OUT_SPEAKER | AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) {
+ setStrategyMute(STRATEGY_MEDIA, false, output, delayMs);
+ }
+}
+
+uint32_t AudioPolicyManager::getDeviceForInputSource(int inputSource)
+{
+ uint32_t device;
+
+ switch(inputSource) {
+ case AUDIO_SOURCE_DEFAULT:
+ case AUDIO_SOURCE_MIC:
+ case AUDIO_SOURCE_VOICE_RECOGNITION:
+ if (mForceUse[AudioSystem::FOR_RECORD] == AudioSystem::FORCE_BT_SCO &&
+ mAvailableInputDevices & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
+ device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+ } else if (mAvailableInputDevices & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
+ device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
+ } else {
+ device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+ }
+ break;
+ case AUDIO_SOURCE_CAMCORDER:
+ device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+ break;
+ case AUDIO_SOURCE_VOICE_UPLINK:
+ case AUDIO_SOURCE_VOICE_DOWNLINK:
+ case AUDIO_SOURCE_VOICE_CALL:
+ device = AudioSystem::DEVICE_IN_VOICE_CALL;
+ break;
+ default:
+ LOGW("getInput() invalid input source %d", inputSource);
+ device = 0;
+ break;
+ }
+ return device;
+}
+
+audio_io_handle_t AudioPolicyManager::getActiveInput()
+{
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ if (mInputs.valueAt(i)->mRefCount > 0) {
+ return mInputs.keyAt(i);
+ }
+ }
+ return 0;
+}
+
+float AudioPolicyManager::computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device)
+{
+ float volume = 1.0;
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
+ StreamDescriptor &streamDesc = mStreams[stream];
+
+ if (device == 0) {
+ device = outputDesc->device();
+ }
+
+ int volInt = (100 * (index - streamDesc.mIndexMin)) / (streamDesc.mIndexMax - streamDesc.mIndexMin);
+ volume = AudioSystem::linearToLog(volInt);
+
+ // if a heaset is connected, apply the following rules to ring tones and notifications
+ // to avoid sound level bursts in user's ears:
+ // - always attenuate ring tones and notifications volume by 6dB
+ // - if music is playing, always limit the volume to current music volume,
+ // with a minimum threshold at -36dB so that notification is always perceived.
+ if ((device &
+ (AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP |
+ AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
+ AudioSystem::DEVICE_OUT_WIRED_HEADSET |
+ AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) &&
+ (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION)) {
+ volume *= SONIFICATION_HEADSET_VOLUME_FACTOR;
+ // when the phone is ringing we must consider that music could have been paused just before
+ // by the music application and behave as if music was active if the last music track was
+ // just stopped
+ if (outputDesc->isUsedByStream(AudioSystem::MUSIC) || mLimitRingtoneVolume) {
+ float musicVol = computeVolume(AudioSystem::MUSIC, mStreams[AudioSystem::MUSIC].mIndexCur, output, device);
+ float minVol = (musicVol > SONIFICATION_HEADSET_VOLUME_MIN) ? musicVol : SONIFICATION_HEADSET_VOLUME_MIN;
+ if (volume > minVol) {
+ volume = minVol;
+ LOGV("computeVolume limiting volume to %f musicVol %f", minVol, musicVol);
+ }
+ }
+ }
+
+ return volume;
+}
+
+status_t AudioPolicyManager::checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs, bool force)
+{
+
+ // do not change actual stream volume if the stream is muted
+ if (mStreams[stream].mMuteCount != 0) {
+ LOGV("checkAndSetVolume() stream %d muted count %d", stream, mStreams[stream].mMuteCount);
+ return NO_ERROR;
+ }
+
+ // do not change in call volume if bluetooth is connected and vice versa
+ if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
+ (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
+ LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
+ stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
+ return INVALID_OPERATION;
+ }
+
+ float volume = computeVolume(stream, index, output, device);
+ // do not set volume if the float value did not change
+ if (volume != mOutputs.valueFor(output)->mCurVolume[stream] || force) {
+ mOutputs.valueFor(output)->mCurVolume[stream] = volume;
+ LOGV("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
+ if (stream == AudioSystem::VOICE_CALL ||
+ stream == AudioSystem::DTMF ||
+ stream == AudioSystem::BLUETOOTH_SCO) {
+ float voiceVolume = -1.0;
+ // offset value to reflect actual hardware volume that never reaches 0
+ // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
+ volume = 0.01 + 0.99 * volume;
+ if (stream == AudioSystem::VOICE_CALL) {
+ voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
+ } else if (stream == AudioSystem::BLUETOOTH_SCO) {
+ voiceVolume = 1.0;
+ }
+ if (voiceVolume >= 0 && output == mHardwareOutput) {
+ mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
+ }
+ }
+ mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
+ }
+
+ return NO_ERROR;
+}
+
+void AudioPolicyManager::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs)
+{
+ LOGV("applyStreamVolumes() for output %d and device %x", output, device);
+
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs);
+ }
+}
+
+void AudioPolicyManager::setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs)
+{
+ LOGV("setStrategyMute() strategy %d, mute %d, output %d", strategy, on, output);
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ if (getStrategy((AudioSystem::stream_type)stream) == strategy) {
+ setStreamMute(stream, on, output, delayMs);
+ }
+ }
+}
+
+void AudioPolicyManager::setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs)
+{
+ StreamDescriptor &streamDesc = mStreams[stream];
+ uint32_t device = mOutputs.valueFor(output)->mDevice;
+
+ LOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, streamDesc.mMuteCount);
+
+ if (on) {
+ if (streamDesc.mMuteCount == 0) {
+ if (streamDesc.mCanBeMuted) {
+ checkAndSetVolume(stream, 0, output, device, delayMs);
+ }
+ }
+ // increment mMuteCount after calling checkAndSetVolume() so that volume change is not ignored
+ streamDesc.mMuteCount++;
+ } else {
+ if (streamDesc.mMuteCount == 0) {
+ LOGW("setStreamMute() unmuting non muted stream!");
+ return;
+ }
+ if (--streamDesc.mMuteCount == 0) {
+ checkAndSetVolume(stream, streamDesc.mIndexCur, output, device, delayMs);
+ }
+ }
+}
+
+void AudioPolicyManager::handleIncallSonification(int stream, bool starting, bool stateChange)
+{
+ // if the stream pertains to sonification strategy and we are in call we must
+ // mute the stream if it is low visibility. If it is high visibility, we must play a tone
+ // in the device used for phone strategy and play the tone if the selected device does not
+ // interfere with the device used for phone strategy
+ // if stateChange is true, we are called from setPhoneState() and we must mute or unmute as
+ // many times as there are active tracks on the output
+
+ if (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) {
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(mHardwareOutput);
+ LOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d",
+ stream, starting, outputDesc->mDevice, stateChange);
+ if (outputDesc->isUsedByStream((AudioSystem::stream_type)stream)) {
+ int muteCount = 1;
+ if (stateChange) {
+ muteCount = outputDesc->mRefCount[stream];
+ }
+ if (AudioSystem::isLowVisibility((AudioSystem::stream_type)stream)) {
+ LOGV("handleIncallSonification() low visibility, muteCount %d", muteCount);
+ for (int i = 0; i < muteCount; i++) {
+ setStreamMute(stream, starting, mHardwareOutput);
+ }
+ } else {
+ LOGV("handleIncallSonification() high visibility ");
+ if (outputDesc->mDevice & getDeviceForStrategy(STRATEGY_PHONE)) {
+ LOGV("handleIncallSonification() high visibility muted, muteCount %d", muteCount);
+ for (int i = 0; i < muteCount; i++) {
+ setStreamMute(stream, starting, mHardwareOutput);
+ }
+ }
+ if (starting) {
+ mpClientInterface->startTone(ToneGenerator::TONE_SUP_CALL_WAITING, AudioSystem::VOICE_CALL);
+ } else {
+ mpClientInterface->stopTone();
+ }
+ }
+ }
+ }
+}
+
+uint32_t AudioPolicyManager::getMaxEffectsCpuLoad()
+{
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+}
+
+uint32_t AudioPolicyManager::getMaxEffectsMemory()
+{
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+}
+
+
+uint32_t AudioPolicyManager::getStrategyForStream(AudioSystem::stream_type stream)
+{
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+
+}
+
+audio_io_handle_t AudioPolicyManager::getOutputForEffect(effect_descriptor_t *desc)
+{
+
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+
+}
+
+status_t AudioPolicyManager::registerEffect(effect_descriptor_t *desc,
+ audio_io_handle_t output,
+ uint32_t strategy,
+ int session,
+ int id)
+{
+
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+}
+
+status_t AudioPolicyManager::unregisterEffect(int id)
+{
+//TODO ..newly added function in Gingerbread
+ LOGD("Inside.%s. Need implementation\n",__func__);
+ return 0;
+}
+// --- AudioOutputDescriptor class implementation
+
+AudioPolicyManager::AudioOutputDescriptor::AudioOutputDescriptor()
+ : mSamplingRate(0), mFormat(0), mChannels(0), mLatency(0),
+ mFlags((AudioSystem::output_flags)0), mDevice(0), mOutput1(0), mOutput2(0)
+{
+ // clear usage count for all stream types
+ for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ mRefCount[i] = 0;
+ mCurVolume[i] = -1.0;
+ }
+}
+
+uint32_t AudioPolicyManager::AudioOutputDescriptor::device()
+{
+ uint32_t device = 0;
+ if (isDuplicated()) {
+ device = mOutput1->mDevice | mOutput2->mDevice;
+ } else {
+ device = mDevice;
+ }
+ return device;
+}
+
+void AudioPolicyManager::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta)
+{
+ // forward usage count change to attached outputs
+ if (isDuplicated()) {
+ mOutput1->changeRefCount(stream, delta);
+ mOutput2->changeRefCount(stream, delta);
+ }
+ if ((delta + (int)mRefCount[stream]) < 0) {
+ LOGW("changeRefCount() invalid delta %d for stream %d, refCount %d", delta, stream, mRefCount[stream]);
+ mRefCount[stream] = 0;
+ return;
+ }
+ mRefCount[stream] += delta;
+ LOGV("changeRefCount() stream %d, count %d", stream, mRefCount[stream]);
+}
+
+bool AudioPolicyManager::AudioOutputDescriptor::isUsedByStrategy(routing_strategy strategy)
+{
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (AudioPolicyManager::getStrategy((AudioSystem::stream_type)i) == strategy &&
+ isUsedByStream((AudioSystem::stream_type)i)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+status_t AudioPolicyManager::AudioOutputDescriptor::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Format: %d\n", mFormat);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Channels: %08x\n", mChannels);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Latency: %d\n", mLatency);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Flags %08x\n", mFlags);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Devices %08x\n", mDevice);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Stream volume refCount\n");
+ result.append(buffer);
+ for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ snprintf(buffer, SIZE, " %02d %.03f %d\n", i, mCurVolume[i], mRefCount[i]);
+ result.append(buffer);
+ }
+ write(fd, result.string(), result.size());
+
+ return NO_ERROR;
+}
+
+// --- AudioInputDescriptor class implementation
+
+AudioPolicyManager::AudioInputDescriptor::AudioInputDescriptor()
+ : mSamplingRate(0), mFormat(0), mChannels(0),
+ mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice(0), mRefCount(0)
+{
+}
+
+status_t AudioPolicyManager::AudioInputDescriptor::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Format: %d\n", mFormat);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Channels: %08x\n", mChannels);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Acoustics %08x\n", mAcoustics);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Devices %08x\n", mDevice);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Ref Count %d\n", mRefCount);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+
+ return NO_ERROR;
+}
+
+// --- StreamDescriptor class implementation
+
+void AudioPolicyManager::StreamDescriptor::dump(char* buffer, size_t size)
+{
+ snprintf(buffer, size, " %02d %02d %02d %02d %d\n",
+ mIndexMin,
+ mIndexMax,
+ mIndexCur,
+ mMuteCount,
+ mCanBeMuted);
+}
+
+
+}; // namespace android
diff --git a/libaudio/AudioPolicyManager.h b/libaudio/AudioPolicyManager.h
new file mode 100644
index 0000000..35d323f
--- /dev/null
+++ b/libaudio/AudioPolicyManager.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <utils/Timers.h>
+#include <utils/Errors.h>
+#include <utils/KeyedVector.h>
+#include <hardware_legacy/AudioPolicyInterface.h>
+
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+#define MAX_DEVICE_ADDRESS_LEN 20
+// Attenuation applied to STRATEGY_SONIFICATION streams when a headset is connected: 6dB
+#define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5
+// Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB
+#define SONIFICATION_HEADSET_VOLUME_MIN 0.016
+// Time in seconds during which we consider that music is still active after a music
+// track was stopped - see computeVolume()
+#define SONIFICATION_HEADSET_MUSIC_DELAY 5
+class AudioPolicyManager: public AudioPolicyInterface
+{
+
+public:
+ AudioPolicyManager(AudioPolicyClientInterface *clientInterface);
+ virtual ~AudioPolicyManager();
+
+ // AudioPolicyInterface
+ virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device,
+ AudioSystem::device_connection_state state,
+ const char *device_address);
+ virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
+ const char *device_address);
+ virtual void setPhoneState(int state);
+ virtual void setRingerMode(uint32_t mode, uint32_t mask);
+ virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config);
+ virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage);
+ virtual void setSystemProperty(const char* property, const char* value);
+ virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::output_flags flags);
+ virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream,int session);
+ virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream,int session);
+ virtual void releaseOutput(audio_io_handle_t output);
+ virtual audio_io_handle_t getInput(int inputSource,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::audio_in_acoustics acoustics);
+ // indicates to the audio policy manager that the input starts being used.
+ virtual status_t startInput(audio_io_handle_t input);
+ // indicates to the audio policy manager that the input stops being used.
+ virtual status_t stopInput(audio_io_handle_t input);
+ virtual void releaseInput(audio_io_handle_t input);
+ virtual void initStreamVolume(AudioSystem::stream_type stream,
+ int indexMin,
+ int indexMax);
+ virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index);
+ virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index);
+
+ // return the strategy corresponding to a given stream type
+ virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) ;
+
+ // Audio effect management
+ virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) ;
+ virtual status_t registerEffect(effect_descriptor_t *desc,
+ audio_io_handle_t output,
+ uint32_t strategy,
+ int session,
+ int id) ;
+ virtual status_t unregisterEffect(int id) ;
+
+ virtual status_t dump(int fd);
+
+private:
+
+ enum routing_strategy {
+ STRATEGY_MEDIA,
+ STRATEGY_PHONE,
+ STRATEGY_SONIFICATION,
+ STRATEGY_DTMF,
+ NUM_STRATEGIES
+ };
+
+ // descriptor for audio outputs. Used to maintain current configuration of each opened audio output
+ // and keep track of the usage of this output by each audio stream type.
+ class AudioOutputDescriptor
+ {
+ public:
+ AudioOutputDescriptor();
+
+ status_t dump(int fd);
+
+ uint32_t device();
+ void changeRefCount(AudioSystem::stream_type, int delta);
+ bool isUsedByStrategy(routing_strategy strategy);
+ bool isUsedByStream(AudioSystem::stream_type stream) { return mRefCount[stream] > 0 ? true : false; }
+ bool isDuplicated() { return (mDevice == 0); } // by convention mDevice is 0 for duplicated outputs
+
+ uint32_t mSamplingRate; //
+ uint32_t mFormat; //
+ uint32_t mChannels; // output configuration
+ uint32_t mLatency; //
+ AudioSystem::output_flags mFlags; //
+ uint32_t mDevice; // current device this output is routed to
+ uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using this output
+ AudioOutputDescriptor *mOutput1; // used by duplicated outputs: first output
+ AudioOutputDescriptor *mOutput2; // used by duplicated outputs: second output
+ float mCurVolume[AudioSystem::NUM_STREAM_TYPES]; // current stream volume
+ };
+
+ // descriptor for audio inputs. Used to maintain current configuration of each opened audio input
+ // and keep track of the usage of this input.
+ class AudioInputDescriptor
+ {
+ public:
+ AudioInputDescriptor();
+
+ status_t dump(int fd);
+
+ uint32_t mSamplingRate; //
+ uint32_t mFormat; // input configuration
+ uint32_t mChannels; //
+ AudioSystem::audio_in_acoustics mAcoustics; //
+ uint32_t mDevice; // current device this input is routed to
+ uint32_t mRefCount; // number of AudioRecord clients using this output
+ int mInputSource; // input source selected by application (mediarecorder.h)
+ };
+
+ // stream descriptor used for volume control
+ class StreamDescriptor
+ {
+ public:
+ StreamDescriptor()
+ : mIndexMin(0), mIndexMax(1), mIndexCur(1), mMuteCount(0), mCanBeMuted(true) {}
+
+ void dump(char* buffer, size_t size);
+
+ int mIndexMin; // min volume index
+ int mIndexMax; // max volume index
+ int mIndexCur; // current volume index
+ int mMuteCount; // mute request counter
+ bool mCanBeMuted; // true is the stream can be muted
+ };
+
+ // return the strategy corresponding to a given stream type
+ static routing_strategy getStrategy(AudioSystem::stream_type stream);
+ // return the output handle of an output routed to the specified device, 0 if no output
+ // is routed to the device
+ audio_io_handle_t getOutputForDevice(uint32_t device);
+ // return appropriate device for streams handled by the specified strategy according to current
+ // phone state, connected devices...
+ uint32_t getDeviceForStrategy(routing_strategy strategy);
+ // change the route of the specified output
+ void setOutputDevice(audio_io_handle_t output, uint32_t device, bool force = false, int delayMs = 0);
+ // select input device corresponding to requested audio source
+ uint32_t getDeviceForInputSource(int inputSource);
+ // return io handle of active input or 0 if no input is active
+ audio_io_handle_t getActiveInput();
+ // compute the actual volume for a given stream according to the requested index and a particular
+ // device
+ float computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device);
+ // check that volume change is permitted, compute and send new volume to audio hardware
+ status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs = 0, bool force = false);
+ // apply all stream volumes to the specified output and device
+ void applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs = 0);
+ // Mute or unmute all streams handled by the specified strategy on the specified output
+ void setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs = 0);
+ // Mute or unmute the stream on the specified output
+ void setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs = 0);
+ // handle special cases for sonification strategy while in call: mute streams or replace by
+ // a special tone in the device used for communication
+ void handleIncallSonification(int stream, bool starting, bool stateChange);
+
+ uint32_t getMaxEffectsCpuLoad();
+ uint32_t getMaxEffectsMemory();
+ AudioPolicyClientInterface *mpClientInterface; // audio policy client interface
+ audio_io_handle_t mHardwareOutput; // hardware output handler
+ audio_io_handle_t mA2dpOutput; // A2DP output handler
+ audio_io_handle_t mDuplicatedOutput; // duplicated output handler: outputs to hardware and A2DP.
+
+ KeyedVector<audio_io_handle_t, AudioOutputDescriptor *> mOutputs; // list of output descriptors
+ KeyedVector<audio_io_handle_t, AudioInputDescriptor *> mInputs; // list of input descriptors
+ uint32_t mAvailableOutputDevices; // bit field of all available output devices
+ uint32_t mAvailableInputDevices; // bit field of all available input devices
+ int mPhoneState; // current phone state
+ uint32_t mRingerMode; // current ringer mode
+ AudioSystem::forced_config mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration
+
+ StreamDescriptor mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control
+ String8 mA2dpDeviceAddress; // A2DP device MAC address
+ String8 mScoDeviceAddress; // SCO device MAC address
+ nsecs_t mMusicStopTime; // time when last music stream was stopped
+ bool mLimitRingtoneVolume; // limit ringtone volume to music volume if headset connected
+ uint32_t mTotalEffectsCpuLoad;
+ uint32_t mTotalEffectsMemory;
+};
+
+};
diff --git a/libaudio/AudioPolicyManagerBase.cpp b/libaudio/AudioPolicyManagerBase.cpp
new file mode 100644
index 0000000..1d87c0d
--- /dev/null
+++ b/libaudio/AudioPolicyManagerBase.cpp
@@ -0,0 +1,2121 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AudioPolicyManagerBase"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+#include <hardware_legacy/AudioPolicyManagerBase.h>
+#include <media/mediarecorder.h>
+
+namespace android {
+
+
+// ----------------------------------------------------------------------------
+// AudioPolicyInterface implementation
+// ----------------------------------------------------------------------------
+
+
+status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_devices device,
+ AudioSystem::device_connection_state state,
+ const char *device_address)
+{
+
+ LOGV("setDeviceConnectionState() device: %x, state %d, address %s", device, state, device_address);
+
+ // connect/disconnect only 1 device at a time
+ if (AudioSystem::popCount(device) != 1) return BAD_VALUE;
+
+ if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) {
+ LOGE("setDeviceConnectionState() invalid address: %s", device_address);
+ return BAD_VALUE;
+ }
+
+ // handle output devices
+ if (AudioSystem::isOutputDevice(device)) {
+
+#ifndef WITH_A2DP
+ if (AudioSystem::isA2dpDevice(device)) {
+ LOGE("setDeviceConnectionState() invalid device: %x", device);
+ return BAD_VALUE;
+ }
+#endif
+
+ switch (state)
+ {
+ // handle output device connection
+ case AudioSystem::DEVICE_STATE_AVAILABLE:
+ if (mAvailableOutputDevices & device) {
+ LOGW("setDeviceConnectionState() device already connected: %x", device);
+ return INVALID_OPERATION;
+ }
+ LOGV("setDeviceConnectionState() connecting device %x", device);
+
+ // register new device as available
+ mAvailableOutputDevices |= device;
+
+#ifdef WITH_A2DP
+ // handle A2DP device connection
+ if (AudioSystem::isA2dpDevice(device)) {
+ status_t status = handleA2dpConnection(device, device_address);
+ if (status != NO_ERROR) {
+ mAvailableOutputDevices &= ~device;
+ return status;
+ }
+ } else
+#endif
+ {
+ if (AudioSystem::isBluetoothScoDevice(device)) {
+ LOGV("setDeviceConnectionState() BT SCO device, address %s", device_address);
+ // keep track of SCO device address
+ mScoDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
+#ifdef WITH_A2DP
+ if (mA2dpOutput != 0 &&
+ mPhoneState != AudioSystem::MODE_NORMAL) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+#endif
+ }
+ }
+ break;
+ // handle output device disconnection
+ case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
+ if (!(mAvailableOutputDevices & device)) {
+ LOGW("setDeviceConnectionState() device not connected: %x", device);
+ return INVALID_OPERATION;
+ }
+
+
+ LOGV("setDeviceConnectionState() disconnecting device %x", device);
+ // remove device from available output devices
+ mAvailableOutputDevices &= ~device;
+
+#ifdef WITH_A2DP
+ // handle A2DP device disconnection
+ if (AudioSystem::isA2dpDevice(device)) {
+ status_t status = handleA2dpDisconnection(device, device_address);
+ if (status != NO_ERROR) {
+ mAvailableOutputDevices |= device;
+ return status;
+ }
+ } else
+#endif
+ {
+ if (AudioSystem::isBluetoothScoDevice(device)) {
+ mScoDeviceAddress = "";
+#ifdef WITH_A2DP
+ if (mA2dpOutput != 0 &&
+ mPhoneState != AudioSystem::MODE_NORMAL) {
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+#endif
+ }
+ }
+ } break;
+
+ default:
+ LOGE("setDeviceConnectionState() invalid state: %x", state);
+ return BAD_VALUE;
+ }
+
+ // request routing change if necessary
+ uint32_t newDevice = getNewDevice(mHardwareOutput, false);
+#ifdef WITH_A2DP
+ checkOutputForAllStrategies(newDevice);
+ // A2DP outputs must be closed after checkOutputForAllStrategies() is executed
+ if (state == AudioSystem::DEVICE_STATE_UNAVAILABLE && AudioSystem::isA2dpDevice(device)) {
+ closeA2dpOutputs();
+ }
+#endif
+ updateDeviceForStrategy();
+ setOutputDevice(mHardwareOutput, newDevice);
+
+ if (device == AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
+ device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
+ } else if (device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO ||
+ device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET ||
+ device == AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
+ device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+ } else {
+ return NO_ERROR;
+ }
+ }
+ // handle input devices
+ if (AudioSystem::isInputDevice(device)) {
+
+ switch (state)
+ {
+ // handle input device connection
+ case AudioSystem::DEVICE_STATE_AVAILABLE: {
+ if (mAvailableInputDevices & device) {
+ LOGW("setDeviceConnectionState() device already connected: %d", device);
+ return INVALID_OPERATION;
+ }
+ mAvailableInputDevices |= device;
+ }
+ break;
+
+ // handle input device disconnection
+ case AudioSystem::DEVICE_STATE_UNAVAILABLE: {
+ if (!(mAvailableInputDevices & device)) {
+ LOGW("setDeviceConnectionState() device not connected: %d", device);
+ return INVALID_OPERATION;
+ }
+ mAvailableInputDevices &= ~device;
+ } break;
+
+ default:
+ LOGE("setDeviceConnectionState() invalid state: %x", state);
+ return BAD_VALUE;
+ }
+
+ audio_io_handle_t activeInput = getActiveInput();
+ if (activeInput != 0) {
+ AudioInputDescriptor *inputDesc = mInputs.valueFor(activeInput);
+ uint32_t newDevice = getDeviceForInputSource(inputDesc->mInputSource);
+ if (newDevice != inputDesc->mDevice) {
+ LOGV("setDeviceConnectionState() changing device from %x to %x for input %d",
+ inputDesc->mDevice, newDevice, activeInput);
+ inputDesc->mDevice = newDevice;
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)newDevice);
+ mpClientInterface->setParameters(activeInput, param.toString());
+ }
+ }
+
+ return NO_ERROR;
+ }
+
+ LOGW("setDeviceConnectionState() invalid device: %x", device);
+ return BAD_VALUE;
+}
+
+AudioSystem::device_connection_state AudioPolicyManagerBase::getDeviceConnectionState(AudioSystem::audio_devices device,
+ const char *device_address)
+{
+ AudioSystem::device_connection_state state = AudioSystem::DEVICE_STATE_UNAVAILABLE;
+ String8 address = String8(device_address);
+ if (AudioSystem::isOutputDevice(device)) {
+ if (device & mAvailableOutputDevices) {
+#ifdef WITH_A2DP
+ if (AudioSystem::isA2dpDevice(device) &&
+ address != "" && mA2dpDeviceAddress != address) {
+ return state;
+ }
+#endif
+ if (AudioSystem::isBluetoothScoDevice(device) &&
+ address != "" && mScoDeviceAddress != address) {
+ return state;
+ }
+ state = AudioSystem::DEVICE_STATE_AVAILABLE;
+ }
+ } else if (AudioSystem::isInputDevice(device)) {
+ if (device & mAvailableInputDevices) {
+ state = AudioSystem::DEVICE_STATE_AVAILABLE;
+ }
+ }
+
+ return state;
+}
+
+void AudioPolicyManagerBase::setPhoneState(int state)
+{
+ LOGV("setPhoneState() state %d", state);
+ uint32_t newDevice = 0;
+ if (state < 0 || state >= AudioSystem::NUM_MODES) {
+ LOGW("setPhoneState() invalid state %d", state);
+ return;
+ }
+
+ if (state == mPhoneState ) {
+ LOGW("setPhoneState() setting same state %d", state);
+ return;
+ }
+
+ // if leaving call state, handle special case of active streams
+ // pertaining to sonification strategy see handleIncallSonification()
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ LOGV("setPhoneState() in call state management: new state is %d", state);
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ handleIncallSonification(stream, false, true);
+ }
+ }
+
+ // store previous phone state for management of sonification strategy below
+ int oldState = mPhoneState;
+ mPhoneState = state;
+ bool force = false;
+
+ // are we entering or starting a call
+ if ((oldState != AudioSystem::MODE_IN_CALL) && (state == AudioSystem::MODE_IN_CALL)) {
+ LOGV(" Entering call in setPhoneState()");
+ // force routing command to audio hardware when starting a call
+ // even if no device change is needed
+ force = true;
+ } else if ((oldState == AudioSystem::MODE_IN_CALL) && (state != AudioSystem::MODE_IN_CALL)) {
+ LOGV(" Exiting call in setPhoneState()");
+ // force routing command to audio hardware when exiting a call
+ // even if no device change is needed
+ force = true;
+ }
+
+ // check for device and output changes triggered by new phone state
+ newDevice = getNewDevice(mHardwareOutput, false);
+#ifdef WITH_A2DP
+ checkOutputForAllStrategies(newDevice);
+ // suspend A2DP output if a SCO device is present.
+ if (mA2dpOutput != 0 && mScoDeviceAddress != "") {
+ if (oldState == AudioSystem::MODE_NORMAL) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ } else if (state == AudioSystem::MODE_NORMAL) {
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+ }
+#endif
+ updateDeviceForStrategy();
+
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+
+ // force routing command to audio hardware when ending call
+ // even if no device change is needed
+ if (oldState == AudioSystem::MODE_IN_CALL && newDevice == 0) {
+ newDevice = hwOutputDesc->device();
+ }
+
+ // when changing from ring tone to in call mode, mute the ringing tone
+ // immediately and delay the route change to avoid sending the ring tone
+ // tail into the earpiece or headset.
+ int delayMs = 0;
+ if (state == AudioSystem::MODE_IN_CALL && oldState == AudioSystem::MODE_RINGTONE) {
+ // delay the device change command by twice the output latency to have some margin
+ // and be sure that audio buffers not yet affected by the mute are out when
+ // we actually apply the route change
+ delayMs = hwOutputDesc->mLatency*2;
+ setStreamMute(AudioSystem::RING, true, mHardwareOutput);
+ }
+
+ // change routing is necessary
+ setOutputDevice(mHardwareOutput, newDevice, force, delayMs);
+
+ // if entering in call state, handle special case of active streams
+ // pertaining to sonification strategy see handleIncallSonification()
+ if (state == AudioSystem::MODE_IN_CALL) {
+ LOGV("setPhoneState() in call state management: new state is %d", state);
+ // unmute the ringing tone after a sufficient delay if it was muted before
+ // setting output device above
+ if (oldState == AudioSystem::MODE_RINGTONE) {
+ setStreamMute(AudioSystem::RING, false, mHardwareOutput, MUTE_TIME_MS);
+ }
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ handleIncallSonification(stream, true, true);
+ }
+ }
+
+ // Flag that ringtone volume must be limited to music volume until we exit MODE_RINGTONE
+ if (state == AudioSystem::MODE_RINGTONE &&
+ (hwOutputDesc->mRefCount[AudioSystem::MUSIC] ||
+ (systemTime() - mMusicStopTime) < seconds(SONIFICATION_HEADSET_MUSIC_DELAY))) {
+ mLimitRingtoneVolume = true;
+ } else {
+ mLimitRingtoneVolume = false;
+ }
+}
+
+void AudioPolicyManagerBase::setRingerMode(uint32_t mode, uint32_t mask)
+{
+ LOGV("setRingerMode() mode %x, mask %x", mode, mask);
+
+ mRingerMode = mode;
+}
+
+void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config)
+{
+ LOGV("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mPhoneState);
+
+ bool forceVolumeReeval = false;
+ switch(usage) {
+ case AudioSystem::FOR_COMMUNICATION:
+ if (config != AudioSystem::FORCE_SPEAKER && config != AudioSystem::FORCE_BT_SCO &&
+ config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ break;
+ case AudioSystem::FOR_MEDIA:
+ if (config != AudioSystem::FORCE_HEADPHONES && config != AudioSystem::FORCE_BT_A2DP &&
+ config != AudioSystem::FORCE_WIRED_ACCESSORY && config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_MEDIA", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ break;
+ case AudioSystem::FOR_RECORD:
+ if (config != AudioSystem::FORCE_BT_SCO && config != AudioSystem::FORCE_WIRED_ACCESSORY &&
+ config != AudioSystem::FORCE_NONE) {
+ LOGW("setForceUse() invalid config %d for FOR_RECORD", config);
+ return;
+ }
+ mForceUse[usage] = config;
+ break;
+ case AudioSystem::FOR_DOCK:
+ if (config != AudioSystem::FORCE_NONE && config != AudioSystem::FORCE_BT_CAR_DOCK &&
+ config != AudioSystem::FORCE_BT_DESK_DOCK && config != AudioSystem::FORCE_WIRED_ACCESSORY) {
+ LOGW("setForceUse() invalid config %d for FOR_DOCK", config);
+ }
+ forceVolumeReeval = true;
+ mForceUse[usage] = config;
+ break;
+ default:
+ LOGW("setForceUse() invalid usage %d", usage);
+ break;
+ }
+
+ // check for device and output changes triggered by new phone state
+ uint32_t newDevice = getNewDevice(mHardwareOutput, false);
+#ifdef WITH_A2DP
+ checkOutputForAllStrategies(newDevice);
+#endif
+ updateDeviceForStrategy();
+ setOutputDevice(mHardwareOutput, newDevice);
+ if (forceVolumeReeval) {
+ applyStreamVolumes(mHardwareOutput, newDevice);
+ }
+}
+
+AudioSystem::forced_config AudioPolicyManagerBase::getForceUse(AudioSystem::force_use usage)
+{
+ return mForceUse[usage];
+}
+
+void AudioPolicyManagerBase::setSystemProperty(const char* property, const char* value)
+{
+ LOGV("setSystemProperty() property %s, value %s", property, value);
+ if (strcmp(property, "ro.camera.sound.forced") == 0) {
+ if (atoi(value)) {
+ LOGV("ENFORCED_AUDIBLE cannot be muted");
+ mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = false;
+ } else {
+ LOGV("ENFORCED_AUDIBLE can be muted");
+ mStreams[AudioSystem::ENFORCED_AUDIBLE].mCanBeMuted = true;
+ }
+ }
+}
+
+audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type stream,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::output_flags flags)
+{
+ audio_io_handle_t output = 0;
+ uint32_t latency = 0;
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+ uint32_t device = getDeviceForStrategy(strategy);
+ LOGV("getOutput() stream %d, samplingRate %d, format %d, channels %x, flags %x", stream, samplingRate, format, channels, flags);
+
+#ifdef AUDIO_POLICY_TEST
+ if (mCurOutput != 0) {
+ LOGV("getOutput() test output mCurOutput %d, samplingRate %d, format %d, channels %x, mDirectOutput %d",
+ mCurOutput, mTestSamplingRate, mTestFormat, mTestChannels, mDirectOutput);
+
+ if (mTestOutputs[mCurOutput] == 0) {
+ LOGV("getOutput() opening test output");
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = mTestDevice;
+ outputDesc->mSamplingRate = mTestSamplingRate;
+ outputDesc->mFormat = mTestFormat;
+ outputDesc->mChannels = mTestChannels;
+ outputDesc->mLatency = mTestLatencyMs;
+ outputDesc->mFlags = (AudioSystem::output_flags)(mDirectOutput ? AudioSystem::OUTPUT_FLAG_DIRECT : 0);
+ outputDesc->mRefCount[stream] = 0;
+ mTestOutputs[mCurOutput] = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+ if (mTestOutputs[mCurOutput]) {
+ AudioParameter outputCmd = AudioParameter();
+ outputCmd.addInt(String8("set_id"),mCurOutput);
+ mpClientInterface->setParameters(mTestOutputs[mCurOutput],outputCmd.toString());
+ addOutput(mTestOutputs[mCurOutput], outputDesc);
+ }
+ }
+ return mTestOutputs[mCurOutput];
+ }
+#endif //AUDIO_POLICY_TEST
+
+ // open a direct output if required by specified parameters
+ if (needsDirectOuput(stream, samplingRate, format, channels, flags, device)) {
+
+ LOGV("getOutput() opening direct output device %x", device);
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = device;
+ outputDesc->mSamplingRate = samplingRate;
+ outputDesc->mFormat = format;
+ outputDesc->mChannels = channels;
+ outputDesc->mLatency = 0;
+ outputDesc->mFlags = (AudioSystem::output_flags)(flags | AudioSystem::OUTPUT_FLAG_DIRECT);
+ outputDesc->mRefCount[stream] = 0;
+ output = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+
+ // only accept an output with the requeted parameters
+ if (output == 0 ||
+ (samplingRate != 0 && samplingRate != outputDesc->mSamplingRate) ||
+ (format != 0 && format != outputDesc->mFormat) ||
+ (channels != 0 && channels != outputDesc->mChannels)) {
+ LOGV("getOutput() failed opening direct output: samplingRate %d, format %d, channels %d",
+ samplingRate, format, channels);
+ if (output != 0) {
+ mpClientInterface->closeOutput(output);
+ }
+ delete outputDesc;
+ return 0;
+ }
+ addOutput(output, outputDesc);
+ return output;
+ }
+
+ if (channels != 0 && channels != AudioSystem::CHANNEL_OUT_MONO &&
+ channels != AudioSystem::CHANNEL_OUT_STEREO) {
+ return 0;
+ }
+ // open a non direct output
+
+ // get which output is suitable for the specified stream. The actual routing change will happen
+ // when startOutput() will be called
+ uint32_t a2dpDevice = device & AudioSystem::DEVICE_OUT_ALL_A2DP;
+ if (AudioSystem::popCount((AudioSystem::audio_devices)device) == 2) {
+#ifdef WITH_A2DP
+ if (a2dpUsedForSonification() && a2dpDevice != 0) {
+ // if playing on 2 devices among which one is A2DP, use duplicated output
+ LOGV("getOutput() using duplicated output");
+ LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device in multiple %x selected but A2DP output not opened", device);
+ output = mDuplicatedOutput;
+ } else
+#endif
+ {
+ // if playing on 2 devices among which none is A2DP, use hardware output
+ output = mHardwareOutput;
+ }
+ LOGV("getOutput() using output %d for 2 devices %x", output, device);
+ } else {
+#ifdef WITH_A2DP
+ if (a2dpDevice != 0) {
+ // if playing on A2DP device, use a2dp output
+ LOGW_IF((mA2dpOutput == 0), "getOutput() A2DP device %x selected but A2DP output not opened", device);
+ output = mA2dpOutput;
+ } else
+#endif
+ {
+ // if playing on not A2DP device, use hardware output
+ output = mHardwareOutput;
+ }
+ }
+
+
+ LOGW_IF((output ==0), "getOutput() could not find output for stream %d, samplingRate %d, format %d, channels %x, flags %x",
+ stream, samplingRate, format, channels, flags);
+
+ return output;
+}
+
+status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output,
+ AudioSystem::stream_type stream,
+ int session)
+{
+ LOGV("startOutput() output %d, stream %d, session %d", output, stream, session);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("startOutput() unknow output %d", output);
+ return BAD_VALUE;
+ }
+
+ AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+
+#ifdef WITH_A2DP
+ if (mA2dpOutput != 0 && !a2dpUsedForSonification() && strategy == STRATEGY_SONIFICATION) {
+ setStrategyMute(STRATEGY_MEDIA, true, mA2dpOutput);
+ }
+#endif
+
+ // incremenent usage count for this stream on the requested output:
+ // NOTE that the usage count is the same for duplicated output and hardware output which is
+ // necassary for a correct control of hardware output routing by startOutput() and stopOutput()
+ outputDesc->changeRefCount(stream, 1);
+
+ setOutputDevice(output, getNewDevice(output));
+
+ // handle special case for sonification while in call
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ handleIncallSonification(stream, true, false);
+ }
+
+ // apply volume rules for current stream and device if necessary
+ checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, outputDesc->device());
+
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManagerBase::stopOutput(audio_io_handle_t output,
+ AudioSystem::stream_type stream,
+ int session)
+{
+ LOGV("stopOutput() output %d, stream %d, session %d", output, stream, session);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("stopOutput() unknow output %d", output);
+ return BAD_VALUE;
+ }
+
+ AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
+ routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream);
+
+ // handle special case for sonification while in call
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ handleIncallSonification(stream, false, false);
+ }
+
+ if (outputDesc->mRefCount[stream] > 0) {
+ // decrement usage count of this stream on the output
+ outputDesc->changeRefCount(stream, -1);
+ // store time at which the last music track was stopped - see computeVolume()
+ if (stream == AudioSystem::MUSIC) {
+ mMusicStopTime = systemTime();
+ }
+
+ setOutputDevice(output, getNewDevice(output));
+
+#ifdef WITH_A2DP
+ if (mA2dpOutput != 0 && !a2dpUsedForSonification() &&
+ strategy == STRATEGY_SONIFICATION) {
+ setStrategyMute(STRATEGY_MEDIA,
+ false,
+ mA2dpOutput,
+ mOutputs.valueFor(mHardwareOutput)->mLatency*2);
+ }
+#endif
+ if (output != mHardwareOutput) {
+ setOutputDevice(mHardwareOutput, getNewDevice(mHardwareOutput), true);
+ }
+ return NO_ERROR;
+ } else {
+ LOGW("stopOutput() refcount is already 0 for output %d", output);
+ return INVALID_OPERATION;
+ }
+}
+
+void AudioPolicyManagerBase::releaseOutput(audio_io_handle_t output)
+{
+ LOGV("releaseOutput() %d", output);
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("releaseOutput() releasing unknown output %d", output);
+ return;
+ }
+
+#ifdef AUDIO_POLICY_TEST
+ int testIndex = testOutputIndex(output);
+ if (testIndex != 0) {
+ AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index);
+ if (outputDesc->refCount() == 0) {
+ mpClientInterface->closeOutput(output);
+ delete mOutputs.valueAt(index);
+ mOutputs.removeItem(output);
+ mTestOutputs[testIndex] = 0;
+ }
+ return;
+ }
+#endif //AUDIO_POLICY_TEST
+
+ if (mOutputs.valueAt(index)->mFlags & AudioSystem::OUTPUT_FLAG_DIRECT) {
+ mpClientInterface->closeOutput(output);
+ delete mOutputs.valueAt(index);
+ mOutputs.removeItem(output);
+ }
+}
+
+audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::audio_in_acoustics acoustics)
+{
+ audio_io_handle_t input = 0;
+ uint32_t device = getDeviceForInputSource(inputSource);
+
+ LOGV("getInput() inputSource %d, samplingRate %d, format %d, channels %x, acoustics %x", inputSource, samplingRate, format, channels, acoustics);
+
+ if (device == 0) {
+ return 0;
+ }
+
+ // adapt channel selection to input source
+ switch(inputSource) {
+ case AUDIO_SOURCE_VOICE_UPLINK:
+ channels = AudioSystem::CHANNEL_IN_VOICE_UPLINK;
+ break;
+ case AUDIO_SOURCE_VOICE_DOWNLINK:
+ channels = AudioSystem::CHANNEL_IN_VOICE_DNLINK;
+ break;
+ case AUDIO_SOURCE_VOICE_CALL:
+ channels = (AudioSystem::CHANNEL_IN_VOICE_UPLINK | AudioSystem::CHANNEL_IN_VOICE_DNLINK);
+ break;
+ default:
+ break;
+ }
+
+ AudioInputDescriptor *inputDesc = new AudioInputDescriptor();
+
+ inputDesc->mInputSource = inputSource;
+ inputDesc->mDevice = device;
+ inputDesc->mSamplingRate = samplingRate;
+ inputDesc->mFormat = format;
+ inputDesc->mChannels = channels;
+ inputDesc->mAcoustics = acoustics;
+ inputDesc->mRefCount = 0;
+ input = mpClientInterface->openInput(&inputDesc->mDevice,
+ &inputDesc->mSamplingRate,
+ &inputDesc->mFormat,
+ &inputDesc->mChannels,
+ inputDesc->mAcoustics);
+
+ // only accept input with the exact requested set of parameters
+ if (input == 0 ||
+ (samplingRate != inputDesc->mSamplingRate) ||
+ (format != inputDesc->mFormat) ||
+ (channels != inputDesc->mChannels)) {
+ LOGV("getInput() failed opening input: samplingRate %d, format %d, channels %d",
+ samplingRate, format, channels);
+ if (input != 0) {
+ mpClientInterface->closeInput(input);
+ }
+ delete inputDesc;
+ return 0;
+ }
+ mInputs.add(input, inputDesc);
+ return input;
+}
+
+status_t AudioPolicyManagerBase::startInput(audio_io_handle_t input)
+{
+ LOGV("startInput() input %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("startInput() unknow input %d", input);
+ return BAD_VALUE;
+ }
+ AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
+
+#ifdef AUDIO_POLICY_TEST
+ if (mTestInput == 0)
+#endif //AUDIO_POLICY_TEST
+ {
+ // refuse 2 active AudioRecord clients at the same time
+ if (getActiveInput() != 0) {
+ LOGW("startInput() input %d failed: other input already started", input);
+ return INVALID_OPERATION;
+ }
+ }
+
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)inputDesc->mDevice);
+
+ // use Voice Recognition mode or not for this input based on input source
+ int vr_enabled = inputDesc->mInputSource == AUDIO_SOURCE_VOICE_RECOGNITION ? 1 : 0;
+ param.addInt(String8("vr_mode"), vr_enabled);
+ LOGV("AudioPolicyManager::startInput(%d), setting vr_mode to %d", inputDesc->mInputSource, vr_enabled);
+
+ mpClientInterface->setParameters(input, param.toString());
+
+ inputDesc->mRefCount = 1;
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManagerBase::stopInput(audio_io_handle_t input)
+{
+ LOGV("stopInput() input %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("stopInput() unknow input %d", input);
+ return BAD_VALUE;
+ }
+ AudioInputDescriptor *inputDesc = mInputs.valueAt(index);
+
+ if (inputDesc->mRefCount == 0) {
+ LOGW("stopInput() input %d already stopped", input);
+ return INVALID_OPERATION;
+ } else {
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), 0);
+ mpClientInterface->setParameters(input, param.toString());
+ inputDesc->mRefCount = 0;
+ return NO_ERROR;
+ }
+}
+
+void AudioPolicyManagerBase::releaseInput(audio_io_handle_t input)
+{
+ LOGV("releaseInput() %d", input);
+ ssize_t index = mInputs.indexOfKey(input);
+ if (index < 0) {
+ LOGW("releaseInput() releasing unknown input %d", input);
+ return;
+ }
+ mpClientInterface->closeInput(input);
+ delete mInputs.valueAt(index);
+ mInputs.removeItem(input);
+ LOGV("releaseInput() exit");
+}
+
+void AudioPolicyManagerBase::initStreamVolume(AudioSystem::stream_type stream,
+ int indexMin,
+ int indexMax)
+{
+ LOGV("initStreamVolume() stream %d, min %d, max %d", stream , indexMin, indexMax);
+ if (indexMin < 0 || indexMin >= indexMax) {
+ LOGW("initStreamVolume() invalid index limits for stream %d, min %d, max %d", stream , indexMin, indexMax);
+ return;
+ }
+ mStreams[stream].mIndexMin = indexMin;
+ mStreams[stream].mIndexMax = indexMax;
+}
+
+status_t AudioPolicyManagerBase::setStreamVolumeIndex(AudioSystem::stream_type stream, int index)
+{
+
+ if ((index < mStreams[stream].mIndexMin) || (index > mStreams[stream].mIndexMax)) {
+ return BAD_VALUE;
+ }
+
+ // Force max volume if stream cannot be muted
+ if (!mStreams[stream].mCanBeMuted) index = mStreams[stream].mIndexMax;
+
+ LOGV("setStreamVolumeIndex() stream %d, index %d", stream, index);
+ mStreams[stream].mIndexCur = index;
+
+ // compute and apply stream volume on all outputs according to connected device
+ status_t status = NO_ERROR;
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ status_t volStatus = checkAndSetVolume(stream, index, mOutputs.keyAt(i), mOutputs.valueAt(i)->device());
+ if (volStatus != NO_ERROR) {
+ status = volStatus;
+ }
+ }
+ return status;
+}
+
+status_t AudioPolicyManagerBase::getStreamVolumeIndex(AudioSystem::stream_type stream, int *index)
+{
+ if (index == 0) {
+ return BAD_VALUE;
+ }
+ LOGV("getStreamVolumeIndex() stream %d", stream);
+ *index = mStreams[stream].mIndexCur;
+ return NO_ERROR;
+}
+
+audio_io_handle_t AudioPolicyManagerBase::getOutputForEffect(effect_descriptor_t *desc)
+{
+ LOGV("getOutputForEffect()");
+ // apply simple rule where global effects are attached to the same output as MUSIC streams
+ return getOutput(AudioSystem::MUSIC);
+}
+
+status_t AudioPolicyManagerBase::registerEffect(effect_descriptor_t *desc,
+ audio_io_handle_t output,
+ uint32_t strategy,
+ int session,
+ int id)
+{
+ ssize_t index = mOutputs.indexOfKey(output);
+ if (index < 0) {
+ LOGW("registerEffect() unknown output %d", output);
+ return INVALID_OPERATION;
+ }
+
+ if (mTotalEffectsCpuLoad + desc->cpuLoad > getMaxEffectsCpuLoad()) {
+ LOGW("registerEffect() CPU Load limit exceeded for Fx %s, CPU %f MIPS",
+ desc->name, (float)desc->cpuLoad/10);
+ return INVALID_OPERATION;
+ }
+ if (mTotalEffectsMemory + desc->memoryUsage > getMaxEffectsMemory()) {
+ LOGW("registerEffect() memory limit exceeded for Fx %s, Memory %d KB",
+ desc->name, desc->memoryUsage);
+ return INVALID_OPERATION;
+ }
+ mTotalEffectsCpuLoad += desc->cpuLoad;
+ mTotalEffectsMemory += desc->memoryUsage;
+ LOGV("registerEffect() effect %s, output %d, strategy %d session %d id %d",
+ desc->name, output, strategy, session, id);
+
+ LOGV("registerEffect() CPU %d, memory %d", desc->cpuLoad, desc->memoryUsage);
+ LOGV(" total CPU %d, total memory %d", mTotalEffectsCpuLoad, mTotalEffectsMemory);
+
+ EffectDescriptor *pDesc = new EffectDescriptor();
+ memcpy (&pDesc->mDesc, desc, sizeof(effect_descriptor_t));
+ pDesc->mOutput = output;
+ pDesc->mStrategy = (routing_strategy)strategy;
+ pDesc->mSession = session;
+ mEffects.add(id, pDesc);
+
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManagerBase::unregisterEffect(int id)
+{
+ ssize_t index = mEffects.indexOfKey(id);
+ if (index < 0) {
+ LOGW("unregisterEffect() unknown effect ID %d", id);
+ return INVALID_OPERATION;
+ }
+
+ EffectDescriptor *pDesc = mEffects.valueAt(index);
+
+ if (mTotalEffectsCpuLoad < pDesc->mDesc.cpuLoad) {
+ LOGW("unregisterEffect() CPU load %d too high for total %d",
+ pDesc->mDesc.cpuLoad, mTotalEffectsCpuLoad);
+ pDesc->mDesc.cpuLoad = mTotalEffectsCpuLoad;
+ }
+ mTotalEffectsCpuLoad -= pDesc->mDesc.cpuLoad;
+ if (mTotalEffectsMemory < pDesc->mDesc.memoryUsage) {
+ LOGW("unregisterEffect() memory %d too big for total %d",
+ pDesc->mDesc.memoryUsage, mTotalEffectsMemory);
+ pDesc->mDesc.memoryUsage = mTotalEffectsMemory;
+ }
+ mTotalEffectsMemory -= pDesc->mDesc.memoryUsage;
+ LOGV("unregisterEffect() effect %s, ID %d, CPU %d, memory %d",
+ pDesc->mDesc.name, id, pDesc->mDesc.cpuLoad, pDesc->mDesc.memoryUsage);
+ LOGV(" total CPU %d, total memory %d", mTotalEffectsCpuLoad, mTotalEffectsMemory);
+
+ mEffects.removeItem(id);
+ delete pDesc;
+
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManagerBase::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, "\nAudioPolicyManager Dump: %p\n", this);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Hardware Output: %d\n", mHardwareOutput);
+ result.append(buffer);
+#ifdef WITH_A2DP
+ snprintf(buffer, SIZE, " A2DP Output: %d\n", mA2dpOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Duplicated Output: %d\n", mDuplicatedOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " A2DP device address: %s\n", mA2dpDeviceAddress.string());
+ result.append(buffer);
+#endif
+ snprintf(buffer, SIZE, " SCO device address: %s\n", mScoDeviceAddress.string());
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Output devices: %08x\n", mAvailableOutputDevices);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Input devices: %08x\n", mAvailableInputDevices);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Phone state: %d\n", mPhoneState);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Ringer mode: %d\n", mRingerMode);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for communications %d\n", mForceUse[AudioSystem::FOR_COMMUNICATION]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for media %d\n", mForceUse[AudioSystem::FOR_MEDIA]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for record %d\n", mForceUse[AudioSystem::FOR_RECORD]);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Force use for dock %d\n", mForceUse[AudioSystem::FOR_DOCK]);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+
+ snprintf(buffer, SIZE, "\nOutputs dump:\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ snprintf(buffer, SIZE, "- Output %d dump:\n", mOutputs.keyAt(i));
+ write(fd, buffer, strlen(buffer));
+ mOutputs.valueAt(i)->dump(fd);
+ }
+
+ snprintf(buffer, SIZE, "\nInputs dump:\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ snprintf(buffer, SIZE, "- Input %d dump:\n", mInputs.keyAt(i));
+ write(fd, buffer, strlen(buffer));
+ mInputs.valueAt(i)->dump(fd);
+ }
+
+ snprintf(buffer, SIZE, "\nStreams dump:\n");
+ write(fd, buffer, strlen(buffer));
+ snprintf(buffer, SIZE, " Stream Index Min Index Max Index Cur Can be muted\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ snprintf(buffer, SIZE, " %02d", i);
+ mStreams[i].dump(buffer + 3, SIZE);
+ write(fd, buffer, strlen(buffer));
+ }
+
+ snprintf(buffer, SIZE, "\nTotal Effects CPU: %f MIPS, Total Effects memory: %d KB\n",
+ (float)mTotalEffectsCpuLoad/10, mTotalEffectsMemory);
+ write(fd, buffer, strlen(buffer));
+
+ snprintf(buffer, SIZE, "Registered effects:\n");
+ write(fd, buffer, strlen(buffer));
+ for (size_t i = 0; i < mEffects.size(); i++) {
+ snprintf(buffer, SIZE, "- Effect %d dump:\n", mEffects.keyAt(i));
+ write(fd, buffer, strlen(buffer));
+ mEffects.valueAt(i)->dump(fd);
+ }
+
+
+ return NO_ERROR;
+}
+
+// ----------------------------------------------------------------------------
+// AudioPolicyManagerBase
+// ----------------------------------------------------------------------------
+
+AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clientInterface)
+ :
+#ifdef AUDIO_POLICY_TEST
+ Thread(false),
+#endif //AUDIO_POLICY_TEST
+ mPhoneState(AudioSystem::MODE_NORMAL), mRingerMode(0), mMusicStopTime(0),
+ mLimitRingtoneVolume(false), mTotalEffectsCpuLoad(0), mTotalEffectsMemory(0)
+{
+ mpClientInterface = clientInterface;
+
+ for (int i = 0; i < AudioSystem::NUM_FORCE_USE; i++) {
+ mForceUse[i] = AudioSystem::FORCE_NONE;
+ }
+
+ // devices available by default are speaker, ear piece and microphone
+ mAvailableOutputDevices = AudioSystem::DEVICE_OUT_EARPIECE |
+ AudioSystem::DEVICE_OUT_SPEAKER;
+ mAvailableInputDevices = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+
+#ifdef WITH_A2DP
+ mA2dpOutput = 0;
+ mDuplicatedOutput = 0;
+ mA2dpDeviceAddress = String8("");
+#endif
+ mScoDeviceAddress = String8("");
+
+ // open hardware output
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER;
+ mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+
+ if (mHardwareOutput == 0) {
+ LOGE("Failed to initialize hardware output stream, samplingRate: %d, format %d, channels %d",
+ outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels);
+ } else {
+ addOutput(mHardwareOutput, outputDesc);
+ setOutputDevice(mHardwareOutput, (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER, true);
+ //TODO: configure audio effect output stage here
+ }
+
+ updateDeviceForStrategy();
+#ifdef AUDIO_POLICY_TEST
+ AudioParameter outputCmd = AudioParameter();
+ outputCmd.addInt(String8("set_id"), 0);
+ mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString());
+
+ mTestDevice = AudioSystem::DEVICE_OUT_SPEAKER;
+ mTestSamplingRate = 44100;
+ mTestFormat = AudioSystem::PCM_16_BIT;
+ mTestChannels = AudioSystem::CHANNEL_OUT_STEREO;
+ mTestLatencyMs = 0;
+ mCurOutput = 0;
+ mDirectOutput = false;
+ for (int i = 0; i < NUM_TEST_OUTPUTS; i++) {
+ mTestOutputs[i] = 0;
+ }
+
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ snprintf(buffer, SIZE, "AudioPolicyManagerTest");
+ run(buffer, ANDROID_PRIORITY_AUDIO);
+#endif //AUDIO_POLICY_TEST
+}
+
+AudioPolicyManagerBase::~AudioPolicyManagerBase()
+{
+#ifdef AUDIO_POLICY_TEST
+ exit();
+#endif //AUDIO_POLICY_TEST
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ mpClientInterface->closeOutput(mOutputs.keyAt(i));
+ delete mOutputs.valueAt(i);
+ }
+ mOutputs.clear();
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ mpClientInterface->closeInput(mInputs.keyAt(i));
+ delete mInputs.valueAt(i);
+ }
+ mInputs.clear();
+}
+
+#ifdef AUDIO_POLICY_TEST
+bool AudioPolicyManagerBase::threadLoop()
+{
+ LOGV("entering threadLoop()");
+ while (!exitPending())
+ {
+ String8 command;
+ int valueInt;
+ String8 value;
+
+ Mutex::Autolock _l(mLock);
+ mWaitWorkCV.waitRelative(mLock, milliseconds(50));
+
+ command = mpClientInterface->getParameters(0, String8("test_cmd_policy"));
+ AudioParameter param = AudioParameter(command);
+
+ if (param.getInt(String8("test_cmd_policy"), valueInt) == NO_ERROR &&
+ valueInt != 0) {
+ LOGV("Test command %s received", command.string());
+ String8 target;
+ if (param.get(String8("target"), target) != NO_ERROR) {
+ target = "Manager";
+ }
+ if (param.getInt(String8("test_cmd_policy_output"), valueInt) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_output"));
+ mCurOutput = valueInt;
+ }
+ if (param.get(String8("test_cmd_policy_direct"), value) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_direct"));
+ if (value == "false") {
+ mDirectOutput = false;
+ } else if (value == "true") {
+ mDirectOutput = true;
+ }
+ }
+ if (param.getInt(String8("test_cmd_policy_input"), valueInt) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_input"));
+ mTestInput = valueInt;
+ }
+
+ if (param.get(String8("test_cmd_policy_format"), value) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_format"));
+ int format = AudioSystem::INVALID_FORMAT;
+ if (value == "PCM 16 bits") {
+ format = AudioSystem::PCM_16_BIT;
+ } else if (value == "PCM 8 bits") {
+ format = AudioSystem::PCM_8_BIT;
+ } else if (value == "Compressed MP3") {
+ format = AudioSystem::MP3;
+ }
+ if (format != AudioSystem::INVALID_FORMAT) {
+ if (target == "Manager") {
+ mTestFormat = format;
+ } else if (mTestOutputs[mCurOutput] != 0) {
+ AudioParameter outputParam = AudioParameter();
+ outputParam.addInt(String8("format"), format);
+ mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString());
+ }
+ }
+ }
+ if (param.get(String8("test_cmd_policy_channels"), value) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_channels"));
+ int channels = 0;
+
+ if (value == "Channels Stereo") {
+ channels = AudioSystem::CHANNEL_OUT_STEREO;
+ } else if (value == "Channels Mono") {
+ channels = AudioSystem::CHANNEL_OUT_MONO;
+ }
+ if (channels != 0) {
+ if (target == "Manager") {
+ mTestChannels = channels;
+ } else if (mTestOutputs[mCurOutput] != 0) {
+ AudioParameter outputParam = AudioParameter();
+ outputParam.addInt(String8("channels"), channels);
+ mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString());
+ }
+ }
+ }
+ if (param.getInt(String8("test_cmd_policy_sampleRate"), valueInt) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_sampleRate"));
+ if (valueInt >= 0 && valueInt <= 96000) {
+ int samplingRate = valueInt;
+ if (target == "Manager") {
+ mTestSamplingRate = samplingRate;
+ } else if (mTestOutputs[mCurOutput] != 0) {
+ AudioParameter outputParam = AudioParameter();
+ outputParam.addInt(String8("sampling_rate"), samplingRate);
+ mpClientInterface->setParameters(mTestOutputs[mCurOutput], outputParam.toString());
+ }
+ }
+ }
+
+ if (param.get(String8("test_cmd_policy_reopen"), value) == NO_ERROR) {
+ param.remove(String8("test_cmd_policy_reopen"));
+
+ mpClientInterface->closeOutput(mHardwareOutput);
+ delete mOutputs.valueFor(mHardwareOutput);
+ mOutputs.removeItem(mHardwareOutput);
+
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = (uint32_t)AudioSystem::DEVICE_OUT_SPEAKER;
+ mHardwareOutput = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+ if (mHardwareOutput == 0) {
+ LOGE("Failed to reopen hardware output stream, samplingRate: %d, format %d, channels %d",
+ outputDesc->mSamplingRate, outputDesc->mFormat, outputDesc->mChannels);
+ } else {
+ AudioParameter outputCmd = AudioParameter();
+ outputCmd.addInt(String8("set_id"), 0);
+ mpClientInterface->setParameters(mHardwareOutput, outputCmd.toString());
+ addOutput(mHardwareOutput, outputDesc);
+ }
+ }
+
+
+ mpClientInterface->setParameters(0, String8("test_cmd_policy="));
+ }
+ }
+ return false;
+}
+
+void AudioPolicyManagerBase::exit()
+{
+ {
+ AutoMutex _l(mLock);
+ requestExit();
+ mWaitWorkCV.signal();
+ }
+ requestExitAndWait();
+}
+
+int AudioPolicyManagerBase::testOutputIndex(audio_io_handle_t output)
+{
+ for (int i = 0; i < NUM_TEST_OUTPUTS; i++) {
+ if (output == mTestOutputs[i]) return i;
+ }
+ return 0;
+}
+#endif //AUDIO_POLICY_TEST
+
+// ---
+
+void AudioPolicyManagerBase::addOutput(audio_io_handle_t id, AudioOutputDescriptor *outputDesc)
+{
+ outputDesc->mId = id;
+ mOutputs.add(id, outputDesc);
+}
+
+
+#ifdef WITH_A2DP
+status_t AudioPolicyManagerBase::handleA2dpConnection(AudioSystem::audio_devices device,
+ const char *device_address)
+{
+ // when an A2DP device is connected, open an A2DP and a duplicated output
+ LOGV("opening A2DP output for device %s", device_address);
+ AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor();
+ outputDesc->mDevice = device;
+ mA2dpOutput = mpClientInterface->openOutput(&outputDesc->mDevice,
+ &outputDesc->mSamplingRate,
+ &outputDesc->mFormat,
+ &outputDesc->mChannels,
+ &outputDesc->mLatency,
+ outputDesc->mFlags);
+ if (mA2dpOutput) {
+ // add A2DP output descriptor
+ addOutput(mA2dpOutput, outputDesc);
+
+ //TODO: configure audio effect output stage here
+
+ // set initial stream volume for A2DP device
+ applyStreamVolumes(mA2dpOutput, device);
+ if (a2dpUsedForSonification()) {
+ mDuplicatedOutput = mpClientInterface->openDuplicateOutput(mA2dpOutput, mHardwareOutput);
+ }
+ if (mDuplicatedOutput != 0 ||
+ !a2dpUsedForSonification()) {
+ // If both A2DP and duplicated outputs are open, send device address to A2DP hardware
+ // interface
+ AudioParameter param;
+ param.add(String8("a2dp_sink_address"), String8(device_address));
+ mpClientInterface->setParameters(mA2dpOutput, param.toString());
+ mA2dpDeviceAddress = String8(device_address, MAX_DEVICE_ADDRESS_LEN);
+
+ if (a2dpUsedForSonification()) {
+ // add duplicated output descriptor
+ AudioOutputDescriptor *dupOutputDesc = new AudioOutputDescriptor();
+ dupOutputDesc->mOutput1 = mOutputs.valueFor(mHardwareOutput);
+ dupOutputDesc->mOutput2 = mOutputs.valueFor(mA2dpOutput);
+ dupOutputDesc->mSamplingRate = outputDesc->mSamplingRate;
+ dupOutputDesc->mFormat = outputDesc->mFormat;
+ dupOutputDesc->mChannels = outputDesc->mChannels;
+ dupOutputDesc->mLatency = outputDesc->mLatency;
+ addOutput(mDuplicatedOutput, dupOutputDesc);
+ applyStreamVolumes(mDuplicatedOutput, device);
+ }
+ } else {
+ LOGW("getOutput() could not open duplicated output for %d and %d",
+ mHardwareOutput, mA2dpOutput);
+ mpClientInterface->closeOutput(mA2dpOutput);
+ mOutputs.removeItem(mA2dpOutput);
+ mA2dpOutput = 0;
+ delete outputDesc;
+ return NO_INIT;
+ }
+ } else {
+ LOGW("setDeviceConnectionState() could not open A2DP output for device %x", device);
+ delete outputDesc;
+ return NO_INIT;
+ }
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+
+ if (mScoDeviceAddress != "") {
+ // It is normal to suspend twice if we are both in call,
+ // and have the hardware audio output routed to BT SCO
+ if (mPhoneState != AudioSystem::MODE_NORMAL) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)hwOutputDesc->device())) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ }
+
+ if (!a2dpUsedForSonification()) {
+ // mute music on A2DP output if a notification or ringtone is playing
+ uint32_t refCount = hwOutputDesc->strategyRefCount(STRATEGY_SONIFICATION);
+ for (uint32_t i = 0; i < refCount; i++) {
+ setStrategyMute(STRATEGY_MEDIA, true, mA2dpOutput);
+ }
+ }
+ return NO_ERROR;
+}
+
+status_t AudioPolicyManagerBase::handleA2dpDisconnection(AudioSystem::audio_devices device,
+ const char *device_address)
+{
+ if (mA2dpOutput == 0) {
+ LOGW("setDeviceConnectionState() disconnecting A2DP and no A2DP output!");
+ return INVALID_OPERATION;
+ }
+
+ if (mA2dpDeviceAddress != device_address) {
+ LOGW("setDeviceConnectionState() disconnecting unknow A2DP sink address %s", device_address);
+ return INVALID_OPERATION;
+ }
+
+ // mute media strategy to avoid outputting sound on hardware output while music stream
+ // is switched from A2DP output and before music is paused by music application
+ setStrategyMute(STRATEGY_MEDIA, true, mHardwareOutput);
+ setStrategyMute(STRATEGY_MEDIA, false, mHardwareOutput, MUTE_TIME_MS);
+
+ if (!a2dpUsedForSonification()) {
+ // unmute music on A2DP output if a notification or ringtone is playing
+ uint32_t refCount = mOutputs.valueFor(mHardwareOutput)->strategyRefCount(STRATEGY_SONIFICATION);
+ for (uint32_t i = 0; i < refCount; i++) {
+ setStrategyMute(STRATEGY_MEDIA, false, mA2dpOutput);
+ }
+ }
+ mA2dpDeviceAddress = "";
+ return NO_ERROR;
+}
+
+void AudioPolicyManagerBase::closeA2dpOutputs()
+{
+ LOGV("setDeviceConnectionState() closing A2DP and duplicated output!");
+
+ if (mDuplicatedOutput != 0) {
+ AudioOutputDescriptor *dupOutputDesc = mOutputs.valueFor(mDuplicatedOutput);
+ AudioOutputDescriptor *hwOutputDesc = mOutputs.valueFor(mHardwareOutput);
+ // As all active tracks on duplicated output will be deleted,
+ // and as they were also referenced on hardware output, the reference
+ // count for their stream type must be adjusted accordingly on
+ // hardware output.
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ int refCount = dupOutputDesc->mRefCount[i];
+ hwOutputDesc->changeRefCount((AudioSystem::stream_type)i,-refCount);
+ }
+
+ mpClientInterface->closeOutput(mDuplicatedOutput);
+ delete mOutputs.valueFor(mDuplicatedOutput);
+ mOutputs.removeItem(mDuplicatedOutput);
+ mDuplicatedOutput = 0;
+ }
+ if (mA2dpOutput != 0) {
+ AudioParameter param;
+ param.add(String8("closing"), String8("true"));
+ mpClientInterface->setParameters(mA2dpOutput, param.toString());
+
+ mpClientInterface->closeOutput(mA2dpOutput);
+ delete mOutputs.valueFor(mA2dpOutput);
+ mOutputs.removeItem(mA2dpOutput);
+ mA2dpOutput = 0;
+ }
+}
+
+void AudioPolicyManagerBase::checkOutputForStrategy(routing_strategy strategy, uint32_t &newDevice)
+{
+ uint32_t prevDevice = getDeviceForStrategy(strategy);
+ uint32_t curDevice = getDeviceForStrategy(strategy, false);
+ bool a2dpWasUsed = AudioSystem::isA2dpDevice((AudioSystem::audio_devices)(prevDevice & ~AudioSystem::DEVICE_OUT_SPEAKER));
+ bool a2dpIsUsed = AudioSystem::isA2dpDevice((AudioSystem::audio_devices)(curDevice & ~AudioSystem::DEVICE_OUT_SPEAKER));
+ audio_io_handle_t srcOutput = 0;
+ audio_io_handle_t dstOutput = 0;
+
+ if (a2dpWasUsed && !a2dpIsUsed) {
+ bool dupUsed = a2dpUsedForSonification() && a2dpWasUsed && (AudioSystem::popCount(prevDevice) == 2);
+ dstOutput = mHardwareOutput;
+ if (dupUsed) {
+ LOGV("checkOutputForStrategy() moving strategy %d from duplicated", strategy);
+ srcOutput = mDuplicatedOutput;
+ } else {
+ LOGV("checkOutputForStrategy() moving strategy %d from a2dp", strategy);
+ srcOutput = mA2dpOutput;
+ }
+
+ // do not change newDevice if it was already set before this call by a previous call to
+ // getNewDevice() or checkOutputForStrategy() for a strategy with higher priority
+ if (newDevice == 0 && mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(strategy)) {
+ newDevice = getDeviceForStrategy(strategy, false);
+ }
+ }
+ if (a2dpIsUsed && !a2dpWasUsed) {
+ bool dupUsed = a2dpUsedForSonification() && a2dpIsUsed && (AudioSystem::popCount(curDevice) == 2);
+ srcOutput = mHardwareOutput;
+ if (dupUsed) {
+ LOGV("checkOutputForStrategy() moving strategy %d to duplicated", strategy);
+ dstOutput = mDuplicatedOutput;
+ } else {
+ LOGV("checkOutputForStrategy() moving strategy %d to a2dp", strategy);
+ dstOutput = mA2dpOutput;
+ }
+ }
+
+ if (srcOutput != 0 && dstOutput != 0) {
+ // Move effects associated to this strategy from previous output to new output
+ for (size_t i = 0; i < mEffects.size(); i++) {
+ EffectDescriptor *desc = mEffects.valueAt(i);
+ if (desc->mSession != AudioSystem::SESSION_OUTPUT_STAGE &&
+ desc->mStrategy == strategy &&
+ desc->mOutput == srcOutput) {
+ LOGV("checkOutputForStrategy() moving effect %d to output %d", mEffects.keyAt(i), dstOutput);
+ mpClientInterface->moveEffects(desc->mSession, srcOutput, dstOutput);
+ desc->mOutput = dstOutput;
+ }
+ }
+ // Move tracks associated to this strategy from previous output to new output
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == strategy) {
+ mpClientInterface->setStreamOutput((AudioSystem::stream_type)i, dstOutput);
+ }
+ }
+ }
+}
+
+void AudioPolicyManagerBase::checkOutputForAllStrategies(uint32_t &newDevice)
+{
+ // Check strategies in order of priority so that once newDevice is set
+ // for a given strategy it is not modified by subsequent calls to
+ // checkOutputForStrategy()
+ checkOutputForStrategy(STRATEGY_PHONE, newDevice);
+ checkOutputForStrategy(STRATEGY_SONIFICATION, newDevice);
+ checkOutputForStrategy(STRATEGY_MEDIA, newDevice);
+ checkOutputForStrategy(STRATEGY_DTMF, newDevice);
+}
+
+#endif
+
+uint32_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, bool fromCache)
+{
+ uint32_t device = 0;
+
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
+ // check the following by order of priority to request a routing change if necessary:
+ // 1: we are in call or the strategy phone is active on the hardware output:
+ // use device for strategy phone
+ // 2: the strategy sonification is active on the hardware output:
+ // use device for strategy sonification
+ // 3: the strategy media is active on the hardware output:
+ // use device for strategy media
+ // 4: the strategy DTMF is active on the hardware output:
+ // use device for strategy DTMF
+ if (mPhoneState == AudioSystem::MODE_IN_CALL ||
+ outputDesc->isUsedByStrategy(STRATEGY_PHONE)) {
+ device = getDeviceForStrategy(STRATEGY_PHONE, fromCache);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_SONIFICATION)) {
+ device = getDeviceForStrategy(STRATEGY_SONIFICATION, fromCache);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_MEDIA)) {
+ device = getDeviceForStrategy(STRATEGY_MEDIA, fromCache);
+ } else if (outputDesc->isUsedByStrategy(STRATEGY_DTMF)) {
+ device = getDeviceForStrategy(STRATEGY_DTMF, fromCache);
+ }
+
+ LOGV("getNewDevice() selected device %x", device);
+ return device;
+}
+
+uint32_t AudioPolicyManagerBase::getStrategyForStream(AudioSystem::stream_type stream) {
+ return (uint32_t)getStrategy(stream);
+}
+
+AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy(
+ AudioSystem::stream_type stream) {
+ // stream to strategy mapping
+ switch (stream) {
+ case AudioSystem::VOICE_CALL:
+ case AudioSystem::BLUETOOTH_SCO:
+ return STRATEGY_PHONE;
+ case AudioSystem::RING:
+ case AudioSystem::NOTIFICATION:
+ case AudioSystem::ALARM:
+ case AudioSystem::ENFORCED_AUDIBLE:
+ return STRATEGY_SONIFICATION;
+ case AudioSystem::DTMF:
+ return STRATEGY_DTMF;
+ default:
+ LOGE("unknown stream type");
+ case AudioSystem::SYSTEM:
+ // NOTE: SYSTEM stream uses MEDIA strategy because muting music and switching outputs
+ // while key clicks are played produces a poor result
+ case AudioSystem::TTS:
+ case AudioSystem::MUSIC:
+ return STRATEGY_MEDIA;
+ }
+}
+
+uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, bool fromCache)
+{
+ uint32_t device = 0;
+
+ if (fromCache) {
+ LOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, mDeviceForStrategy[strategy]);
+ return mDeviceForStrategy[strategy];
+ }
+
+ switch (strategy) {
+ case STRATEGY_DTMF:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL) {
+ // when off call, DTMF strategy follows the same rules as MEDIA strategy
+ device = getDeviceForStrategy(STRATEGY_MEDIA, false);
+ break;
+ }
+ // when in call, DTMF and PHONE strategies follow the same rules
+ // FALL THROUGH
+
+ case STRATEGY_PHONE:
+ // for phone strategy, we first consider the forced use and then the available devices by order
+ // of priority
+ switch (mForceUse[AudioSystem::FOR_COMMUNICATION]) {
+ case AudioSystem::FORCE_BT_SCO:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+ if (device) break;
+ }
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO;
+ if (device) break;
+ // if SCO device is requested but no SCO device is available, fall back to default case
+ // FALL THROUGH
+
+ default: // FORCE_NONE
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ if (device) break;
+#ifdef WITH_A2DP
+ // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to A2DP
+ if (mPhoneState != AudioSystem::MODE_IN_CALL) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP;
+ if (device) break;
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
+ if (device) break;
+ }
+#endif
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() earpiece device not found");
+ }
+ break;
+
+ case AudioSystem::FORCE_SPEAKER:
+ if (mPhoneState != AudioSystem::MODE_IN_CALL || strategy != STRATEGY_DTMF) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
+ if (device) break;
+ }
+#ifdef WITH_A2DP
+ // when not in a phone call, phone strategy should route STREAM_VOICE_CALL to
+ // A2DP speaker when forcing to speaker output
+ if (mPhoneState != AudioSystem::MODE_IN_CALL) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
+ if (device) break;
+ }
+#endif
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ break;
+ }
+ break;
+
+ case STRATEGY_SONIFICATION:
+
+ // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by
+ // handleIncallSonification().
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ device = getDeviceForStrategy(STRATEGY_PHONE, false);
+ break;
+ }
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ // The second device used for sonification is the same as the device used by media strategy
+ // FALL THROUGH
+
+ case STRATEGY_MEDIA: {
+ uint32_t device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_AUX_DIGITAL;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ }
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ }
+#ifdef WITH_A2DP
+ if (mA2dpOutput != 0) {
+ if (strategy == STRATEGY_SONIFICATION && !a2dpUsedForSonification()) {
+ break;
+ }
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP;
+ }
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES;
+ }
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
+ }
+ }
+#endif
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ }
+
+ // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise
+ device |= device2;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ } break;
+
+ default:
+ LOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
+ break;
+ }
+
+ LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
+ return device;
+}
+
+void AudioPolicyManagerBase::updateDeviceForStrategy()
+{
+ for (int i = 0; i < NUM_STRATEGIES; i++) {
+ mDeviceForStrategy[i] = getDeviceForStrategy((routing_strategy)i, false);
+ }
+}
+
+void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t device, bool force, int delayMs)
+{
+ LOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs);
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
+
+
+ if (outputDesc->isDuplicated()) {
+ setOutputDevice(outputDesc->mOutput1->mId, device, force, delayMs);
+ setOutputDevice(outputDesc->mOutput2->mId, device, force, delayMs);
+ return;
+ }
+#ifdef WITH_A2DP
+ // filter devices according to output selected
+ if (output == mA2dpOutput) {
+ device &= AudioSystem::DEVICE_OUT_ALL_A2DP;
+ } else {
+ device &= ~AudioSystem::DEVICE_OUT_ALL_A2DP;
+ }
+#endif
+
+ uint32_t prevDevice = (uint32_t)outputDesc->device();
+ // Do not change the routing if:
+ // - the requestede device is 0
+ // - the requested device is the same as current device and force is not specified.
+ // Doing this check here allows the caller to call setOutputDevice() without conditions
+ if ((device == 0 || device == prevDevice) && !force) {
+ LOGV("setOutputDevice() setting same device %x or null device for output %d", device, output);
+ return;
+ }
+
+ outputDesc->mDevice = device;
+ // mute media streams if both speaker and headset are selected
+ if (output == mHardwareOutput && AudioSystem::popCount(device) == 2) {
+ setStrategyMute(STRATEGY_MEDIA, true, output);
+ // wait for the PCM output buffers to empty before proceeding with the rest of the command
+ usleep(outputDesc->mLatency*2*1000);
+ }
+#ifdef WITH_A2DP
+ // suspend A2DP output if SCO device is selected
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) {
+ if (mA2dpOutput != 0) {
+ mpClientInterface->suspendOutput(mA2dpOutput);
+ }
+ }
+#endif
+ // do the routing
+ AudioParameter param = AudioParameter();
+ param.addInt(String8(AudioParameter::keyRouting), (int)device);
+ mpClientInterface->setParameters(mHardwareOutput, param.toString(), delayMs);
+ // update stream volumes according to new device
+ applyStreamVolumes(output, device, delayMs);
+
+#ifdef WITH_A2DP
+ // if disconnecting SCO device, restore A2DP output
+ if (AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)prevDevice)) {
+ if (mA2dpOutput != 0) {
+ LOGV("restore A2DP output");
+ mpClientInterface->restoreOutput(mA2dpOutput);
+ }
+ }
+#endif
+ // if changing from a combined headset + speaker route, unmute media streams
+ if (output == mHardwareOutput && AudioSystem::popCount(prevDevice) == 2) {
+ setStrategyMute(STRATEGY_MEDIA, false, output, delayMs);
+ }
+}
+
+uint32_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource)
+{
+ uint32_t device;
+
+ switch(inputSource) {
+ case AUDIO_SOURCE_DEFAULT:
+ case AUDIO_SOURCE_MIC:
+ case AUDIO_SOURCE_VOICE_RECOGNITION:
+ if (mForceUse[AudioSystem::FOR_RECORD] == AudioSystem::FORCE_BT_SCO &&
+ mAvailableInputDevices & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
+ device = AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET;
+ } else if (mAvailableInputDevices & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
+ device = AudioSystem::DEVICE_IN_WIRED_HEADSET;
+ } else {
+ device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+ }
+ break;
+ case AUDIO_SOURCE_CAMCORDER:
+ if (hasBackMicrophone()) {
+ device = AudioSystem::DEVICE_IN_BACK_MIC;
+ } else {
+ device = AudioSystem::DEVICE_IN_BUILTIN_MIC;
+ }
+ break;
+ case AUDIO_SOURCE_VOICE_UPLINK:
+ case AUDIO_SOURCE_VOICE_DOWNLINK:
+ case AUDIO_SOURCE_VOICE_CALL:
+ device = AudioSystem::DEVICE_IN_VOICE_CALL;
+ break;
+ default:
+ LOGW("getInput() invalid input source %d", inputSource);
+ device = 0;
+ break;
+ }
+ LOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device);
+ return device;
+}
+
+audio_io_handle_t AudioPolicyManagerBase::getActiveInput()
+{
+ for (size_t i = 0; i < mInputs.size(); i++) {
+ if (mInputs.valueAt(i)->mRefCount > 0) {
+ return mInputs.keyAt(i);
+ }
+ }
+ return 0;
+}
+
+float AudioPolicyManagerBase::computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device)
+{
+ float volume = 1.0;
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
+ StreamDescriptor &streamDesc = mStreams[stream];
+
+ if (device == 0) {
+ device = outputDesc->device();
+ }
+
+ int volInt = (100 * (index - streamDesc.mIndexMin)) / (streamDesc.mIndexMax - streamDesc.mIndexMin);
+ volume = AudioSystem::linearToLog(volInt);
+
+ // if a headset is connected, apply the following rules to ring tones and notifications
+ // to avoid sound level bursts in user's ears:
+ // - always attenuate ring tones and notifications volume by 6dB
+ // - if music is playing, always limit the volume to current music volume,
+ // with a minimum threshold at -36dB so that notification is always perceived.
+ if ((device &
+ (AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP |
+ AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
+ AudioSystem::DEVICE_OUT_WIRED_HEADSET |
+ AudioSystem::DEVICE_OUT_WIRED_HEADPHONE)) &&
+ (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) &&
+ streamDesc.mCanBeMuted) {
+ volume *= SONIFICATION_HEADSET_VOLUME_FACTOR;
+ // when the phone is ringing we must consider that music could have been paused just before
+ // by the music application and behave as if music was active if the last music track was
+ // just stopped
+ if (outputDesc->mRefCount[AudioSystem::MUSIC] || mLimitRingtoneVolume) {
+ float musicVol = computeVolume(AudioSystem::MUSIC, mStreams[AudioSystem::MUSIC].mIndexCur, output, device);
+ float minVol = (musicVol > SONIFICATION_HEADSET_VOLUME_MIN) ? musicVol : SONIFICATION_HEADSET_VOLUME_MIN;
+ if (volume > minVol) {
+ volume = minVol;
+ LOGV("computeVolume limiting volume to %f musicVol %f", minVol, musicVol);
+ }
+ }
+ }
+
+ return volume;
+}
+
+status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs, bool force)
+{
+
+ // do not change actual stream volume if the stream is muted
+ if (mOutputs.valueFor(output)->mMuteCount[stream] != 0) {
+ LOGV("checkAndSetVolume() stream %d muted count %d", stream, mOutputs.valueFor(output)->mMuteCount[stream]);
+ return NO_ERROR;
+ }
+
+ // do not change in call volume if bluetooth is connected and vice versa
+ if ((stream == AudioSystem::VOICE_CALL && mForceUse[AudioSystem::FOR_COMMUNICATION] == AudioSystem::FORCE_BT_SCO) ||
+ (stream == AudioSystem::BLUETOOTH_SCO && mForceUse[AudioSystem::FOR_COMMUNICATION] != AudioSystem::FORCE_BT_SCO)) {
+ LOGV("checkAndSetVolume() cannot set stream %d volume with force use = %d for comm",
+ stream, mForceUse[AudioSystem::FOR_COMMUNICATION]);
+ return INVALID_OPERATION;
+ }
+
+ float volume = computeVolume(stream, index, output, device);
+ // do not set volume if the float value did not change
+ if (volume != mOutputs.valueFor(output)->mCurVolume[stream] || force) {
+ mOutputs.valueFor(output)->mCurVolume[stream] = volume;
+ LOGV("setStreamVolume() for output %d stream %d, volume %f, delay %d", output, stream, volume, delayMs);
+ if (stream == AudioSystem::VOICE_CALL ||
+ stream == AudioSystem::DTMF ||
+ stream == AudioSystem::BLUETOOTH_SCO) {
+ float voiceVolume = -1.0;
+ // offset value to reflect actual hardware volume that never reaches 0
+ // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
+ volume = 0.01 + 0.99 * volume;
+ if (stream == AudioSystem::VOICE_CALL) {
+ voiceVolume = (float)index/(float)mStreams[stream].mIndexMax;
+ } else if (stream == AudioSystem::BLUETOOTH_SCO) {
+ voiceVolume = 1.0;
+ }
+ if (voiceVolume >= 0 && output == mHardwareOutput) {
+ mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
+ }
+ }
+ mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs);
+ }
+
+ return NO_ERROR;
+}
+
+void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs)
+{
+ LOGV("applyStreamVolumes() for output %d and device %x", output, device);
+
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs);
+ }
+}
+
+void AudioPolicyManagerBase::setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs)
+{
+ LOGV("setStrategyMute() strategy %d, mute %d, output %d", strategy, on, output);
+ for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) {
+ if (getStrategy((AudioSystem::stream_type)stream) == strategy) {
+ setStreamMute(stream, on, output, delayMs);
+ }
+ }
+}
+
+void AudioPolicyManagerBase::setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs)
+{
+ StreamDescriptor &streamDesc = mStreams[stream];
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output);
+
+ LOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]);
+
+ if (on) {
+ if (outputDesc->mMuteCount[stream] == 0) {
+ if (streamDesc.mCanBeMuted) {
+ checkAndSetVolume(stream, 0, output, outputDesc->device(), delayMs);
+ }
+ }
+ // increment mMuteCount after calling checkAndSetVolume() so that volume change is not ignored
+ outputDesc->mMuteCount[stream]++;
+ } else {
+ if (outputDesc->mMuteCount[stream] == 0) {
+ LOGW("setStreamMute() unmuting non muted stream!");
+ return;
+ }
+ if (--outputDesc->mMuteCount[stream] == 0) {
+ checkAndSetVolume(stream, streamDesc.mIndexCur, output, outputDesc->device(), delayMs);
+ }
+ }
+}
+
+void AudioPolicyManagerBase::handleIncallSonification(int stream, bool starting, bool stateChange)
+{
+ // if the stream pertains to sonification strategy and we are in call we must
+ // mute the stream if it is low visibility. If it is high visibility, we must play a tone
+ // in the device used for phone strategy and play the tone if the selected device does not
+ // interfere with the device used for phone strategy
+ // if stateChange is true, we are called from setPhoneState() and we must mute or unmute as
+ // many times as there are active tracks on the output
+
+ if (getStrategy((AudioSystem::stream_type)stream) == STRATEGY_SONIFICATION) {
+ AudioOutputDescriptor *outputDesc = mOutputs.valueFor(mHardwareOutput);
+ LOGV("handleIncallSonification() stream %d starting %d device %x stateChange %d",
+ stream, starting, outputDesc->mDevice, stateChange);
+ if (outputDesc->mRefCount[stream]) {
+ int muteCount = 1;
+ if (stateChange) {
+ muteCount = outputDesc->mRefCount[stream];
+ }
+ if (AudioSystem::isLowVisibility((AudioSystem::stream_type)stream)) {
+ LOGV("handleIncallSonification() low visibility, muteCount %d", muteCount);
+ for (int i = 0; i < muteCount; i++) {
+ setStreamMute(stream, starting, mHardwareOutput);
+ }
+ } else {
+ LOGV("handleIncallSonification() high visibility");
+ if (outputDesc->device() & getDeviceForStrategy(STRATEGY_PHONE)) {
+ LOGV("handleIncallSonification() high visibility muted, muteCount %d", muteCount);
+ for (int i = 0; i < muteCount; i++) {
+ setStreamMute(stream, starting, mHardwareOutput);
+ }
+ }
+ if (starting) {
+ mpClientInterface->startTone(ToneGenerator::TONE_SUP_CALL_WAITING, AudioSystem::VOICE_CALL);
+ } else {
+ mpClientInterface->stopTone();
+ }
+ }
+ }
+ }
+}
+
+bool AudioPolicyManagerBase::needsDirectOuput(AudioSystem::stream_type stream,
+ uint32_t samplingRate,
+ uint32_t format,
+ uint32_t channels,
+ AudioSystem::output_flags flags,
+ uint32_t device)
+{
+ return ((flags & AudioSystem::OUTPUT_FLAG_DIRECT) ||
+ (format !=0 && !AudioSystem::isLinearPCM(format)));
+}
+
+uint32_t AudioPolicyManagerBase::getMaxEffectsCpuLoad()
+{
+ return MAX_EFFECTS_CPU_LOAD;
+}
+
+uint32_t AudioPolicyManagerBase::getMaxEffectsMemory()
+{
+ return MAX_EFFECTS_MEMORY;
+}
+
+// --- AudioOutputDescriptor class implementation
+
+AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor()
+ : mId(0), mSamplingRate(0), mFormat(0), mChannels(0), mLatency(0),
+ mFlags((AudioSystem::output_flags)0), mDevice(0), mOutput1(0), mOutput2(0)
+{
+ // clear usage count for all stream types
+ for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ mRefCount[i] = 0;
+ mCurVolume[i] = -1.0;
+ mMuteCount[i] = 0;
+ }
+}
+
+uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::device()
+{
+ uint32_t device = 0;
+ if (isDuplicated()) {
+ device = mOutput1->mDevice | mOutput2->mDevice;
+ } else {
+ device = mDevice;
+ }
+ return device;
+}
+
+void AudioPolicyManagerBase::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta)
+{
+ // forward usage count change to attached outputs
+ if (isDuplicated()) {
+ mOutput1->changeRefCount(stream, delta);
+ mOutput2->changeRefCount(stream, delta);
+ }
+ if ((delta + (int)mRefCount[stream]) < 0) {
+ LOGW("changeRefCount() invalid delta %d for stream %d, refCount %d", delta, stream, mRefCount[stream]);
+ mRefCount[stream] = 0;
+ return;
+ }
+ mRefCount[stream] += delta;
+ LOGV("changeRefCount() stream %d, count %d", stream, mRefCount[stream]);
+}
+
+uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::refCount()
+{
+ uint32_t refcount = 0;
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ refcount += mRefCount[i];
+ }
+ return refcount;
+}
+
+uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::strategyRefCount(routing_strategy strategy)
+{
+ uint32_t refCount = 0;
+ for (int i = 0; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
+ if (getStrategy((AudioSystem::stream_type)i) == strategy) {
+ refCount += mRefCount[i];
+ }
+ }
+ return refCount;
+}
+
+
+status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Format: %d\n", mFormat);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Channels: %08x\n", mChannels);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Latency: %d\n", mLatency);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Flags %08x\n", mFlags);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Devices %08x\n", device());
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Stream volume refCount muteCount\n");
+ result.append(buffer);
+ for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) {
+ snprintf(buffer, SIZE, " %02d %.03f %02d %02d\n", i, mCurVolume[i], mRefCount[i], mMuteCount[i]);
+ result.append(buffer);
+ }
+ write(fd, result.string(), result.size());
+
+ return NO_ERROR;
+}
+
+// --- AudioInputDescriptor class implementation
+
+AudioPolicyManagerBase::AudioInputDescriptor::AudioInputDescriptor()
+ : mSamplingRate(0), mFormat(0), mChannels(0),
+ mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice(0), mRefCount(0)
+{
+}
+
+status_t AudioPolicyManagerBase::AudioInputDescriptor::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, " Sampling rate: %d\n", mSamplingRate);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Format: %d\n", mFormat);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Channels: %08x\n", mChannels);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Acoustics %08x\n", mAcoustics);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Devices %08x\n", mDevice);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Ref Count %d\n", mRefCount);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+
+ return NO_ERROR;
+}
+
+// --- StreamDescriptor class implementation
+
+void AudioPolicyManagerBase::StreamDescriptor::dump(char* buffer, size_t size)
+{
+ snprintf(buffer, size, " %02d %02d %02d %d\n",
+ mIndexMin,
+ mIndexMax,
+ mIndexCur,
+ mCanBeMuted);
+}
+
+// --- EffectDescriptor class implementation
+
+status_t AudioPolicyManagerBase::EffectDescriptor::dump(int fd)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+
+ snprintf(buffer, SIZE, " Output: %d\n", mOutput);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Strategy: %d\n", mStrategy);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Session: %d\n", mSession);
+ result.append(buffer);
+ snprintf(buffer, SIZE, " Name: %s\n", mDesc.name);
+ result.append(buffer);
+ write(fd, result.string(), result.size());
+
+ return NO_ERROR;
+}
+
+
+
+}; // namespace android
diff --git a/libaudio/NOTICE b/libaudio/NOTICE
new file mode 100644
index 0000000..ada44e1
--- /dev/null
+++ b/libaudio/NOTICE
@@ -0,0 +1,191 @@
+
+ Copyright (c) 2005-2008, The Android Open Source Project
+ Copyright 2008 Wind River Systems
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/libcamera/Android.mk b/libcamera/Android.mk
new file mode 100644
index 0000000..192af24
--- /dev/null
+++ b/libcamera/Android.mk
@@ -0,0 +1,45 @@
+# When zero we link against libqcamera; when 1, we dlopen libqcamera.
+ifeq ($(BOARD_CAMERA_LIBRARIES),libcamera)
+
+DLOPEN_LIBSECCAMERA:=1
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDLOPEN_LIBSECCAMERA=$(DLOPEN_LIBSECCAMERA)
+LOCAL_CFLAGS += -DSWP1_CAMERA_ADD_ADVANCED_FUNCTION
+
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/../libs3cjpeg
+
+
+LOCAL_SRC_FILES:= \
+ SecCamera.cpp \
+ SecCameraHWInterface.cpp
+
+
+LOCAL_SHARED_LIBRARIES:= libutils libui liblog libbinder libcutils
+LOCAL_SHARED_LIBRARIES+= libs3cjpeg
+LOCAL_SHARED_LIBRARIES+= libcamera_client
+
+#Enable the below code to show the video output (without GUI) on TV
+#ifeq ($(BOARD_USES_HDMI), true)
+#LOCAL_CFLAGS+=-DENABLE_HDMI_DISPLAY \
+# -DBOARD_HDMI_STD=$(BOARD_HDMI_STD)
+#
+#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
+#LOCAL_SHARED_LIBRARIES+= libhdmi
+#endif
+
+ifeq ($(DLOPEN_LIBSECCAMERA),1)
+LOCAL_SHARED_LIBRARIES+= libdl
+endif
+
+LOCAL_MODULE:= libcamera
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
+
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
new file mode 100644
index 0000000..186421e
--- /dev/null
+++ b/libcamera/SecCamera.cpp
@@ -0,0 +1,3932 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+************************************
+* Filename: SecCamera.cpp
+* Author: Sachin P. Kamat
+* Purpose: This file interacts with the Camera and JPEG drivers.
+*************************************
+*/
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SecCamera"
+#define ADD_THUMB_IMG 1
+
+#include <utils/Log.h>
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/poll.h>
+#include "SecCamera.h"
+#include "cutils/properties.h"
+
+#ifdef BOARD_USES_SDTV
+#include "TvOut.h"
+#endif
+
+using namespace android;
+
+#ifdef BOARD_USES_SDTV
+#include "utils/Timers.h"
+//#define MEASURE_DURATION_TVOUT
+sp<TvOut> mtvoutcamera;
+static bool suspendTvInit = false ;
+#define TVOUT_RESUME_TIME 4
+#endif
+
+//#define PERFORMANCE //Uncomment to measure performance
+//#define DUMP_YUV //Uncomment to take a dump of YUV frame during capture
+
+#define CHECK(return_value) \
+ if(return_value < 0) \
+ { \
+ LOGE("%s::%d fail. errno: %s\n", __func__,__LINE__, strerror(errno)); \
+ return -1; \
+ } \
+
+#define CHECK_PTR(return_value) \
+ if(return_value < 0) \
+ { \
+ LOGE("%s::%d fail\n", __func__,__LINE__); \
+ return NULL; \
+ } \
+
+#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
+#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
+#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
+
+namespace android {
+
+// ======================================================================
+// Camera controls
+
+static struct timeval time_start;
+static struct timeval time_stop;
+static int cam_id = 0;
+
+unsigned long measure_time(struct timeval *start, struct timeval *stop)
+{
+
+ unsigned long sec, usec, time;
+
+ sec = stop->tv_sec - start->tv_sec;
+
+ if (stop->tv_usec >= start->tv_usec) {
+ usec = stop->tv_usec - start->tv_usec;
+ } else {
+ usec = stop->tv_usec + 1000000 - start->tv_usec;
+ sec--;
+ }
+
+ time = (sec * 1000000) + usec;
+
+ return time;
+}
+
+static inline unsigned long check_performance()
+{
+ unsigned long time = 0;
+ static unsigned long max=0, min=0xffffffff;
+
+ if(time_start.tv_sec == 0 && time_start.tv_usec == 0) {
+ gettimeofday(&time_start, NULL);
+ } else {
+ gettimeofday(&time_stop, NULL);
+ time = measure_time(&time_start, &time_stop);
+ if(max < time) max = time;
+ if(min > time) min = time;
+ LOGV("Interval: %lu us (%2.2lf fps), min:%2.2lf fps, max:%2.2lf fps\n", time, 1000000.0/time, 1000000.0/max, 1000000.0/min);
+ gettimeofday(&time_start, NULL);
+ }
+
+ return time;
+}
+
+static int close_buffers(struct fimc_buffer *buffers)
+{
+ int i;
+
+ for (i = 0; i < MAX_BUFFERS; i++) {
+ if (buffers[i].start)
+ {
+ munmap(buffers[i].start, buffers[i].length);
+ //LOGV("munmap():virt. addr[%d]: 0x%x size = %d\n", i, (unsigned int) buffers[i].start, buffers[i].length);
+ buffers[i].start = NULL;
+ }
+ }
+
+ return 0;
+}
+
+static int get_pixel_depth(unsigned int fmt)
+{
+ int depth = 0;
+
+ switch (fmt) {
+ case V4L2_PIX_FMT_NV12:
+ depth = 12;
+ break;
+ case V4L2_PIX_FMT_NV12T:
+ depth = 12;
+ break;
+ case V4L2_PIX_FMT_NV21:
+ depth = 12;
+ break;
+ case V4L2_PIX_FMT_YUV420:
+ depth = 12;
+ break;
+
+ case V4L2_PIX_FMT_RGB565:
+ case V4L2_PIX_FMT_YUYV:
+ case V4L2_PIX_FMT_YVYU:
+ case V4L2_PIX_FMT_UYVY:
+ case V4L2_PIX_FMT_VYUY:
+ case V4L2_PIX_FMT_NV16:
+ case V4L2_PIX_FMT_NV61:
+ case V4L2_PIX_FMT_YUV422P:
+ depth = 16;
+ break;
+
+ case V4L2_PIX_FMT_RGB32:
+ depth = 32;
+ break;
+ }
+
+ return depth;
+}
+
+#define ALIGN_W(x) ((x+0x7F)&(~0x7F)) // Set as multiple of 128
+#define ALIGN_H(x) ((x+0x1F)&(~0x1F)) // Set as multiple of 32
+#define ALIGN_BUF(x) ((x+0x1FFF)&(~0x1FFF)) // Set as multiple of 8K
+
+static int init_yuv_buffers(struct fimc_buffer *buffers, int width, int height, unsigned int fmt)
+{
+ int i, len;
+
+ len = (width * height * get_pixel_depth(fmt)) / 8;
+
+
+ for (i = 0; i < MAX_BUFFERS; i++)
+ {
+ if(fmt==V4L2_PIX_FMT_NV12T)
+ {
+ buffers[i].start = NULL;
+ buffers[i].length = ALIGN_BUF(ALIGN_W(width) * ALIGN_H(height))+ ALIGN_BUF(ALIGN_W(width) * ALIGN_H(height/2));
+ }
+ else
+ {
+ buffers[i].start = NULL;
+ buffers[i].length = len;
+ }
+ }
+
+ return 0;
+}
+
+static int fimc_poll(struct pollfd *events)
+{
+ int ret;
+
+ ret = poll(events, 1, 5000);
+ if (ret < 0) {
+ LOGE("ERR(%s):poll error\n", __FUNCTION__);
+ return ret;
+ }
+
+ if (ret == 0) {
+ LOGE("ERR(%s):No data in 5 secs..\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+static int fimc_esd_poll(struct pollfd *events)
+{
+ int ret;
+
+ ret = poll(events, 1, 1000);
+
+ if (ret < 0) {
+ LOGE("ERR(%s):poll error\n", __FUNCTION__);
+ return ret;
+ }
+
+ if (ret == 0) {
+ LOGE("ERR(%s):No data in 1 secs.. Camera Device Reset \n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+#ifdef DUMP_YUV
+static int save_yuv(struct fimc_buffer *m_buffers_c, int width, int height, int depth, int index, int frame_count)
+{
+ FILE *yuv_fp = NULL;
+ char filename[100], *buffer = NULL;
+
+ /* file create/open, note to "wb" */
+ yuv_fp = fopen("/sdcard/camera_dump.yuv", "wb");
+ if (yuv_fp==NULL)
+ {
+ LOGE("Save YUV] file open error");
+ return -1;
+ }
+
+ buffer = (char *) malloc(m_buffers_c[index].length);
+ if(buffer == NULL)
+ {
+ LOGE("Save YUV] buffer alloc failed");
+ if(yuv_fp) fclose(yuv_fp);
+ return -1;
+ }
+
+ memcpy(buffer, m_buffers_c[index].start, m_buffers_c[index].length);
+
+ fflush(stdout);
+
+ fwrite(buffer, 1, m_buffers_c[index].length, yuv_fp);
+
+ fflush(yuv_fp);
+
+ if(yuv_fp)
+ fclose(yuv_fp);
+ if(buffer)
+ free(buffer);
+
+ return 0;
+}
+#endif //DUMP_YUV
+
+static int fimc_v4l2_querycap(int fp)
+{
+ struct v4l2_capability cap;
+ int ret = 0;
+
+ ret = ioctl(fp, VIDIOC_QUERYCAP, &cap);
+
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_QUERYCAP failed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+ LOGE("ERR(%s):no capture devices\n", __FUNCTION__);
+ return -1;
+ }
+
+ return ret;
+}
+
+static int fimc_v4l2_enuminput(int fp)
+{
+ struct v4l2_input input;
+
+ input.index = cam_id;
+ if(ioctl(fp, VIDIOC_ENUMINPUT, &input) != 0)
+ {
+ LOGE("ERR(%s):No matching index found\n", __FUNCTION__);
+ return -1;
+ }
+ LOGI("Name of input channel[%d] is %s\n", input.index, input.name);
+
+ return input.index;
+}
+
+
+static int fimc_v4l2_s_input(int fp, int index)
+{
+ struct v4l2_input input;
+ int ret;
+
+ input.index = index;
+
+ ret = ioctl(fp, VIDIOC_S_INPUT, &input);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_INPUT failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+
+static int fimc_v4l2_s_fmt(int fp, int width, int height, unsigned int fmt, int flag_capture)
+{
+ struct v4l2_format v4l2_fmt;
+ struct v4l2_pix_format pixfmt;
+ int ret;
+
+ v4l2_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+ memset(&pixfmt, 0, sizeof(pixfmt));
+
+ pixfmt.width = width;
+ pixfmt.height = height;
+ pixfmt.pixelformat = fmt;
+
+ pixfmt.sizeimage = (width * height * get_pixel_depth(fmt)) / 8;
+
+ pixfmt.field = V4L2_FIELD_NONE;
+
+ v4l2_fmt.fmt.pix = pixfmt;
+
+ /* Set up for capture */
+ ret = ioctl(fp, VIDIOC_S_FMT, &v4l2_fmt);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_FMT failed\n", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int fimc_v4l2_s_fmt_cap(int fp, int width, int height, unsigned int fmt)
+{
+ struct v4l2_format v4l2_fmt;
+ struct v4l2_pix_format pixfmt;
+ int ret;
+
+ memset(&pixfmt, 0, sizeof(pixfmt));
+
+ v4l2_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+ pixfmt.width = width;
+ pixfmt.height = height;
+ pixfmt.pixelformat = fmt;
+ if (fmt == V4L2_PIX_FMT_JPEG){
+ pixfmt.colorspace = V4L2_COLORSPACE_JPEG;
+ }
+
+ pixfmt.sizeimage = (width * height * get_pixel_depth(fmt)) / 8;
+
+ v4l2_fmt.fmt.pix = pixfmt;
+
+ //LOGE("ori_w %d, ori_h %d, w %d, h %d\n", width, height, v4l2_fmt.fmt.pix.width, v4l2_fmt.fmt.pix.height);
+
+ /* Set up for capture */
+ ret = ioctl(fp, VIDIOC_S_FMT, &v4l2_fmt);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_FMT failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+
+static int fimc_v4l2_enum_fmt(int fp, unsigned int fmt)
+{
+ struct v4l2_fmtdesc fmtdesc;
+ int found = 0;
+
+ fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ fmtdesc.index = 0;
+
+ while (ioctl(fp, VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
+ if (fmtdesc.pixelformat == fmt) {
+ LOGD("passed fmt = %d found pixel format[%d]: %s\n", fmt, fmtdesc.index, fmtdesc.description);
+ found = 1;
+ break;
+ }
+
+ fmtdesc.index++;
+ }
+
+ if (!found) {
+ LOGE("unsupported pixel format\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int fimc_v4l2_reqbufs(int fp, enum v4l2_buf_type type, int nr_bufs)
+{
+ struct v4l2_requestbuffers req;
+ int ret;
+
+ req.count = nr_bufs;
+ req.type = type;
+ req.memory = V4L2_MEMORY_MMAP;
+
+ ret = ioctl(fp, VIDIOC_REQBUFS, &req);
+ if(ret < 0) {
+ LOGE("ERR(%s):VIDIOC_REQBUFS failed\n", __FUNCTION__);
+ return -1;
+ }
+
+ return req.count;
+}
+
+static int fimc_v4l2_querybuf(int fp, struct fimc_buffer *buffers, enum v4l2_buf_type type, int nr_frames)
+{
+ struct v4l2_buffer v4l2_buf;
+ int i, ret;
+
+ for(i = 0; i < nr_frames; i++)
+ {
+ v4l2_buf.type = type;
+ v4l2_buf.memory = V4L2_MEMORY_MMAP;
+ v4l2_buf.index = i;
+
+ ret = ioctl(fp , VIDIOC_QUERYBUF, &v4l2_buf);
+ if(ret < 0)
+ {
+ LOGE("ERR(%s):VIDIOC_QUERYBUF failed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if(nr_frames == 1)
+ {
+ buffers[i].length = v4l2_buf.length;
+ if ((buffers[i].start = (char *) mmap(0, v4l2_buf.length, \
+ PROT_READ | PROT_WRITE, MAP_SHARED, \
+ fp, v4l2_buf.m.offset)) < 0)
+ {
+ LOGE("%s %d] mmap() failed\n",__FUNCTION__, __LINE__);
+ return -1;
+ }
+
+ //LOGV("buffers[%d].start = %p v4l2_buf.length = %d", i, buffers[i].start, v4l2_buf.length);
+ }
+ else
+ {
+
+#if defined DUMP_YUV || defined (SEND_YUV_RECORD_DATA)
+ buffers[i].length = v4l2_buf.length;
+ if ((buffers[i].start = (char *) mmap(0, v4l2_buf.length, \
+ PROT_READ | PROT_WRITE, MAP_SHARED, \
+ fp, v4l2_buf.m.offset)) < 0)
+ {
+ LOGE("%s %d] mmap() failed\n",__FUNCTION__, __LINE__);
+ return -1;
+ }
+
+ //LOGV("buffers[%d].start = %p v4l2_buf.length = %d", i, buffers[i].start, v4l2_buf.length);
+#endif
+ }
+
+ }
+
+ return 0;
+}
+
+static int fimc_v4l2_streamon(int fp)
+{
+ enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ int ret;
+
+ ret = ioctl(fp, VIDIOC_STREAMON, &type);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_STREAMON failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+
+static int fimc_v4l2_streamoff(int fp)
+{
+ enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ int ret;
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGE("%s()", __FUNCTION__);
+#endif
+ ret = ioctl(fp, VIDIOC_STREAMOFF, &type);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_STREAMOFF failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ret;
+}
+
+static int fimc_v4l2_qbuf(int fp, int index)
+{
+ struct v4l2_buffer v4l2_buf;
+ int ret;
+
+ v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ v4l2_buf.memory = V4L2_MEMORY_MMAP;
+ v4l2_buf.index = index;
+
+ ret = ioctl(fp, VIDIOC_QBUF, &v4l2_buf);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_QBUF failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int fimc_v4l2_dqbuf(int fp)
+{
+ struct v4l2_buffer v4l2_buf;
+ int ret;
+
+ v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ v4l2_buf.memory = V4L2_MEMORY_MMAP;
+
+ ret = ioctl(fp, VIDIOC_DQBUF, &v4l2_buf);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_DQBUF failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return v4l2_buf.index;
+}
+
+static int fimc_v4l2_g_ctrl(int fp, unsigned int id)
+{
+ struct v4l2_control ctrl;
+ int ret;
+
+ ctrl.id = id;
+
+ ret = ioctl(fp, VIDIOC_G_CTRL, &ctrl);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_G_CTRL failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return ctrl.value;
+}
+
+static int fimc_v4l2_s_ctrl(int fp, unsigned int id, unsigned int value)
+{
+ struct v4l2_control ctrl;
+ int ret;
+
+ ctrl.id = id;
+ ctrl.value = value;
+
+ ret = ioctl(fp, VIDIOC_S_CTRL, &ctrl);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_CTRL failed, ret: %d\n", __FUNCTION__, ret);
+ return ret;
+ }
+
+ return ctrl.value;
+}
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+static int fimc_v4l2_s_ext_ctrl(int fp, unsigned int id, void * value)
+{
+ struct v4l2_ext_controls ctrls;
+ struct v4l2_ext_control ctrl;
+ int ret;
+
+ ctrl.id = id;
+ ctrl.reserved = value;
+
+ ctrls.ctrl_class = V4L2_CTRL_CLASS_CAMERA;
+ ctrls.count = 1;
+ ctrls.controls = &ctrl;
+
+ ret = ioctl(fp, VIDIOC_S_EXT_CTRLS, &ctrls);
+ if (ret < 0)
+ LOGE("ERR(%s):VIDIOC_S_EXT_CTRLS failed\n", __FUNCTION__);
+
+ return ret;
+}
+#endif
+static int fimc_v4l2_g_parm(int fp)
+{
+ struct v4l2_streamparm stream;
+ int ret;
+
+ stream.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+ ret = ioctl(fp, VIDIOC_G_PARM, &stream);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_G_PARM failed\n", __FUNCTION__);
+ return -1;
+ }
+
+// LOGV("timeperframe: numerator %d, denominator %d\n", \
+ stream.parm.capture.timeperframe.numerator, \
+ stream.parm.capture.timeperframe.denominator);
+
+ return 0;
+}
+
+static int fimc_v4l2_s_parm(int fp, int fps_numerator, int fps_denominator)
+{
+ struct v4l2_streamparm stream;
+ int ret;
+
+ stream.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ stream.parm.capture.capturemode = 0;
+ stream.parm.capture.timeperframe.numerator = fps_numerator;
+ stream.parm.capture.timeperframe.denominator = fps_denominator;
+
+ ret = ioctl(fp, VIDIOC_S_PARM, &stream);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_PARM failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return 0;
+}
+
+#if 0
+static int fimc_v4l2_s_parm_ex(int fp, int mode, int no_dma_op) //Kamat: not present in new code
+{
+ struct v4l2_streamparm stream;
+ int ret;
+
+ stream.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ stream.parm.capture.capturemode = mode;
+ if(no_dma_op)
+ stream.parm.capture.reserved[0] = 100;
+
+ ret = ioctl(fp, VIDIOC_S_PARM, &stream);
+ if (ret < 0) {
+ LOGE("ERR(%s):VIDIOC_S_PARM_EX failed\n", __FUNCTION__);
+ return ret;
+ }
+
+ return 0;
+}
+#endif
+
+// ======================================================================
+// Constructor & Destructor
+
+SecCamera::SecCamera() :
+ m_focus_mode(1),
+ m_iso(0),
+ m_camera_id(CAMERA_ID_BACK),
+ m_preview_v4lformat(-1),
+ m_preview_width (0),
+ m_preview_height (0),
+ m_preview_max_width (MAX_BACK_CAMERA_PREVIEW_WIDTH),
+ m_preview_max_height (MAX_BACK_CAMERA_PREVIEW_HEIGHT),
+ m_snapshot_v4lformat(-1),
+ m_snapshot_width (0),
+ m_snapshot_height (0),
+ m_snapshot_max_width (MAX_BACK_CAMERA_SNAPSHOT_WIDTH),
+ m_snapshot_max_height (MAX_BACK_CAMERA_SNAPSHOT_HEIGHT),
+ m_angle(0),
+ m_fps(30),
+ m_autofocus(AUTO_FOCUS_ON),
+ m_white_balance(WHITE_BALANCE_AUTO),
+ m_brightness(BRIGHTNESS_NORMAL),
+ m_image_effect(IMAGE_EFFECT_NONE),
+ #ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ m_anti_banding(0),
+ m_flash_mode(1),
+ m_metering(2),
+ m_contrast(2),
+ m_saturation(2),
+ m_sharpness(2),
+ m_wdr(0),
+ m_anti_shake(0),
+ m_zoom_level(0),
+ m_object_tracking(0),
+ m_smart_auto(0),
+ m_beauty_shot(0),
+ m_vintage_mode(1),
+ m_face_detect(0),
+ m_gps_latitude(0),
+ m_gps_longitude(0),
+ m_gps_altitude(0),
+ m_gps_timestamp(0),
+ m_vtmode(0),
+ m_sensor_mode(0),
+ m_exif_orientation(1),
+ m_blur_level(0),
+ m_chk_dataline(0),
+ m_video_gamma(0),
+ m_slow_ae(0),
+ #else
+ m_image_effect(IMAGE_EFFECT_ORIGINAL),
+ #endif
+ m_flag_camera_start(0),
+ m_jpeg_thumbnail_width (0),
+ m_jpeg_thumbnail_height(0),
+ m_jpeg_quality(100),
+ m_camera_af_flag(-1),
+ m_shot_mode(0)
+{
+ LOGV("%s()", __FUNCTION__);
+#ifdef BOARD_USES_SDTV
+ nsecs_t before1, after1;
+
+#ifdef MEASURE_DURATION_TVOUT
+ before1 = systemTime(SYSTEM_TIME_MONOTONIC);
+#endif
+ //suspend
+ if(mtvoutcamera == 0) {
+ mtvoutcamera = TvOut::connect();
+ }
+ if(mtvoutcamera != 0 )
+ {
+ if (mtvoutcamera->isEnabled() )
+ {
+ mtvoutcamera->DisableTvOut() ; // //TvOutSuspend("Tvout is not available! so what can i do, close camera or any other app which uses fimc");
+ suspendTvInit = true;
+ }
+ }
+
+#ifdef MEASURE_DURATION_TVOUT
+ after1 = systemTime(SYSTEM_TIME_MONOTONIC);
+ LOGD("%s: MEASURE_DURATION_TVOUT duration=%lld", __func__, ns2us(after1-before1));
+#endif
+
+#endif
+ initCamera();
+}
+
+int SecCamera::flagCreate(void) const
+{
+ LOGV("%s() : %d", __FUNCTION__, m_flag_init);
+ return m_flag_init;
+}
+
+SecCamera::~SecCamera()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ DeinitCamera();
+#ifdef BOARD_USES_SDTV
+ nsecs_t before1, after1;
+
+#ifdef MEASURE_DURATION_TVOUT
+ before1 = systemTime(SYSTEM_TIME_MONOTONIC);
+#endif
+
+ //resume
+ if(mtvoutcamera != 0 )
+ {
+ if (!mtvoutcamera->isEnabled() && (mtvoutcamera->isSuspended() ))
+ {
+ mtvoutcamera->TvOutResume(TVOUT_RESUME_TIME);
+ }
+ }
+ suspendTvInit = false;
+#ifdef MEASURE_DURATION_TVOUT
+ after1 = systemTime(SYSTEM_TIME_MONOTONIC);
+ LOGD("%s: MEASURE_DURATION_TVOUT duration=%lld", __func__, ns2us(after1-before1));
+#endif
+#endif
+}
+
+int SecCamera::initCamera()
+{
+ LOGV("%s()", __FUNCTION__);
+ int ret = 0, index = 0;
+
+ if(!m_flag_init)
+ {
+ /* Arun C
+ * Reset the lense position only during camera starts; don't do
+ * reset between shot to shot
+ */
+ m_camera_af_flag = -1;
+
+#ifdef BOARD_USES_SDTV
+ nsecs_t before1, after1;
+
+#ifdef MEASURE_DURATION_TVOUT
+ before1 = systemTime(SYSTEM_TIME_MONOTONIC);
+#endif
+
+ //suspend
+ if(mtvoutcamera == 0) {
+ mtvoutcamera = TvOut::connect();
+ }
+
+
+
+ if(mtvoutcamera != 0 )
+ {
+
+ if ( mtvoutcamera->isEnabled() )
+ {
+
+ mtvoutcamera->DisableTvOut() ;
+ suspendTvInit = true;
+ }
+ }
+
+#ifdef MEASURE_DURATION_TVOUT
+ after1 = systemTime(SYSTEM_TIME_MONOTONIC);
+ LOGD("%s: MEASURE_DURATION_TVOUT duration=%lld", __func__, ns2us(after1-before1));
+#endif
+
+
+#endif
+#ifndef JPEG_FROM_SENSOR
+ m_jpeg_fd = SsbSipJPEGEncodeInit();
+ LOGD("(%s):JPEG device open ID = %d\n", __FUNCTION__,m_jpeg_fd);
+ if(m_jpeg_fd < 0)
+ {
+ m_jpeg_fd = 0;
+ LOGE("ERR(%s):Cannot open a jpeg device file\n", __FUNCTION__);
+ return -1;
+ }
+#endif
+
+ m_cam_fd_temp = -1;
+ m_cam_fd2_temp = -1;
+
+ m_cam_fd = open(CAMERA_DEV_NAME, O_RDWR);
+ if (m_cam_fd < 0)
+ {
+ LOGE("ERR(%s):Cannot open %s (error : %s)\n", __FUNCTION__, CAMERA_DEV_NAME, strerror(errno));
+#ifndef JPEG_FROM_SENSOR
+ SsbSipJPEGEncodeDeInit(m_jpeg_fd);
+#endif
+ return -1;
+ }
+
+ if(m_cam_fd < 3) { // for 0, 1, 2
+ LOGE("ERR(%s):m_cam_fd is %d\n", __FUNCTION__, m_cam_fd);
+
+ close(m_cam_fd);
+
+ m_cam_fd_temp = open(CAMERA_DEV_NAME_TEMP, O_CREAT);
+
+ LOGE("ERR(%s):m_cam_fd_temp is %d\n", __FUNCTION__, m_cam_fd_temp);
+
+ m_cam_fd = open(CAMERA_DEV_NAME, O_RDWR);
+
+ if(m_cam_fd < 3) { // for 0, 1, 2
+ LOGE("ERR(%s):retring to open %s is failed, %d\n", __FUNCTION__, CAMERA_DEV_NAME, m_cam_fd);
+
+ if (m_cam_fd < 0){
+ return -1;
+ }
+ else{
+ close(m_cam_fd);
+ m_cam_fd = -1;
+ }
+
+ if(m_cam_fd_temp != -1){
+ close(m_cam_fd_temp);
+ m_cam_fd_temp = -1;
+ }
+ return -1;
+ }
+ }
+
+ LOGE("initCamera: m_cam_fd(%d), m_jpeg_fd(%d)", m_cam_fd, m_jpeg_fd);
+
+ ret = fimc_v4l2_querycap(m_cam_fd);
+ CHECK(ret);
+ index = fimc_v4l2_enuminput(m_cam_fd);
+ CHECK(index);
+ ret = fimc_v4l2_s_input(m_cam_fd, index);
+ CHECK(ret);
+
+#ifdef DUAL_PORT_RECORDING
+ m_cam_fd2 = open(CAMERA_DEV_NAME2, O_RDWR);
+ if (m_cam_fd2 < 0)
+ {
+ LOGE("ERR(%s):Cannot open %s (error : %s)\n", __FUNCTION__, CAMERA_DEV_NAME2, strerror(errno));
+ return -1;
+ }
+ if(m_cam_fd2 < 3) { // for 0, 1, 2
+ LOGE("ERR(%s):m_cam_fd2 is %d\n", __FUNCTION__, m_cam_fd2);
+
+ close(m_cam_fd2);
+
+ m_cam_fd2_temp = open(CAMERA_DEV_NAME2_TEMP, O_CREAT);
+
+ LOGE("ERR(%s):m_cam_fd2_temp is %d\n", __FUNCTION__, m_cam_fd2_temp);
+
+ m_cam_fd2 = open(CAMERA_DEV_NAME2, O_RDWR);
+
+ if(m_cam_fd2 < 3) { // for 0, 1, 2
+ LOGE("ERR(%s):retring to open %s is failed, %d\n", __FUNCTION__, CAMERA_DEV_NAME2, m_cam_fd2);
+
+ if (m_cam_fd2 < 0){
+ return -1;
+ }
+ else{
+ close(m_cam_fd2);
+ m_cam_fd2 = -1;
+ }
+
+ if(m_cam_fd2_temp != -1){
+ close(m_cam_fd2_temp);
+ m_cam_fd2_temp = -1;
+ }
+
+ return -1;
+ }
+ }
+
+ if(m_cam_fd_temp != -1){
+ close(m_cam_fd_temp);
+ m_cam_fd_temp = -1;
+ }
+
+ if(m_cam_fd2_temp != -1){
+ close(m_cam_fd2_temp);
+ m_cam_fd2_temp = -1;
+ }
+
+ LOGE("initCamera: m_cam_fd2(%d)", m_cam_fd2);
+
+ ret = fimc_v4l2_querycap(m_cam_fd2);
+ CHECK(ret);
+ index = fimc_v4l2_enuminput(m_cam_fd2);
+ CHECK(index);
+ ret = fimc_v4l2_s_input(m_cam_fd2, index);
+ CHECK(ret);
+#endif
+ setExifFixedAttribute();
+
+ m_flag_init = 1;
+ }
+ return 0;
+}
+
+void SecCamera::resetCamera()
+{
+ LOGV("%s()", __FUNCTION__);
+ DeinitCamera();
+ initCamera();
+}
+
+void SecCamera::DeinitCamera()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ if(m_flag_init)
+ {
+#ifndef JPEG_FROM_SENSOR
+ if(m_jpeg_fd > 0)
+ {
+ if(SsbSipJPEGEncodeDeInit(m_jpeg_fd) != JPEG_OK)
+ {
+ LOGE("ERR(%s):Fail on SsbSipJPEGEncodeDeInit\n", __FUNCTION__);
+ }
+ m_jpeg_fd = 0;
+ }
+#endif
+ LOGE("DeinitCamera: m_cam_fd(%d)", m_cam_fd);
+ if(m_cam_fd > -1)
+ {
+ close(m_cam_fd);
+ m_cam_fd = -1;
+ }
+#ifdef DUAL_PORT_RECORDING
+ LOGE("DeinitCamera: m_cam_fd2(%d)", m_cam_fd2);
+ if(m_cam_fd2 > -1)
+ {
+ close(m_cam_fd2);
+ m_cam_fd2 = -1;
+ }
+#endif
+ if(m_cam_fd_temp != -1){
+ close(m_cam_fd_temp);
+ m_cam_fd_temp = -1;
+ }
+
+ if(m_cam_fd2_temp != -1){
+ close(m_cam_fd2_temp);
+ m_cam_fd2_temp = -1;
+ }
+
+#ifdef BOARD_USES_SDTV
+ nsecs_t before1, after1;
+
+#ifdef MEASURE_DURATION_TVOUT
+ before1 = systemTime(SYSTEM_TIME_MONOTONIC);
+#endif
+
+ if(mtvoutcamera == 0) {
+ mtvoutcamera = TvOut::connect();
+
+ }
+
+ //resume
+ if(mtvoutcamera != 0 )
+ {
+
+ if(mtvoutcamera->isSuspended())
+ {
+ mtvoutcamera->TvOutResume(TVOUT_RESUME_TIME);
+ }
+ }
+#ifdef MEASURE_DURATION_TVOUT
+ after1 = systemTime(SYSTEM_TIME_MONOTONIC);
+ LOGD("%s: MEASURE_DURATION_TVOUT duration=%lld", __func__, ns2us(after1-before1));
+#endif
+#endif
+ m_flag_init = 0;
+ usleep(100000); //100 ms delay to allow proper closure of fimc device.
+ }
+}
+
+
+int SecCamera::getCameraFd(void)
+{
+ return m_cam_fd;
+}
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+int SecCamera::setCameraSensorReset(void)
+{
+ int ret = 0;
+
+ LOGV("%s", __FUNCTION__);
+
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_RESET, 0);
+ CHECK(ret);
+
+ return ret;
+}
+
+int SecCamera::setDefultIMEI(int imei)
+{
+ LOGV("%s(m_default_imei (%d))", __FUNCTION__, imei);
+
+ if(m_default_imei != imei)
+ {
+ m_default_imei = imei;
+ }
+ return 0;
+}
+
+int SecCamera::getDefultIMEI(void)
+{
+ return m_default_imei;
+}
+
+
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+
+// ======================================================================
+// Preview
+
+int SecCamera::flagPreviewStart(void)
+{
+ LOGV("%s:started(%d)", __func__, m_flag_camera_start);
+
+ return m_flag_camera_start > 0;
+}
+
+int SecCamera::startPreview(void)
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGV("%s()", __FUNCTION__);
+#else /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ LOGE("%s()", __FUNCTION__);
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+ // aleady started
+ if(m_flag_camera_start > 0)
+ {
+ LOGE("ERR(%s):Preview was already started\n", __FUNCTION__);
+ return 0;
+ }
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ memset(&m_events_c, 0, sizeof(m_events_c));
+ m_events_c.fd = m_cam_fd;
+ m_events_c.events = POLLIN | POLLERR;
+
+ /* enum_fmt, s_fmt sample */
+ int ret = fimc_v4l2_enum_fmt(m_cam_fd,m_preview_v4lformat);
+ CHECK(ret);
+ ret = fimc_v4l2_s_fmt(m_cam_fd, m_preview_width,m_preview_height,m_preview_v4lformat, 0);
+ CHECK(ret);
+
+ init_yuv_buffers(m_buffers_c, m_preview_width, m_preview_height, m_preview_v4lformat);
+ ret = fimc_v4l2_reqbufs(m_cam_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, MAX_BUFFERS);
+ CHECK(ret);
+ ret = fimc_v4l2_querybuf(m_cam_fd, m_buffers_c, V4L2_BUF_TYPE_VIDEO_CAPTURE, MAX_BUFFERS);
+ CHECK(ret);
+
+ /* g_parm, s_parm sample */
+ ret = fimc_v4l2_g_parm(m_cam_fd);
+ CHECK(ret);
+ ret = fimc_v4l2_s_parm(m_cam_fd, 1, m_fps);
+ CHECK(ret);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGE("%s()m_preview_width: %d m_preview_height: %d m_angle: %d\n", __FUNCTION__, m_preview_width,m_preview_height,m_angle);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_ROTATION, m_angle);
+ CHECK(ret);
+
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CHECK_DATALINE, m_chk_dataline);
+ CHECK(ret);
+
+ if(m_camera_id == CAMERA_ID_BACK)
+ {
+ /*Should be set before starting preview*/
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ANTI_BANDING, m_anti_banding);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ISO, m_iso);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS, m_brightness);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FRAME_RATE, m_fps);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_METERING, m_metering);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_GAMMA, m_video_gamma);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_SLOW_AE, m_slow_ae);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EFFECT, m_image_effect);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_WHITE_BALANCE, m_white_balance);
+ CHECK(ret);
+ }
+ else
+ {
+ /* VT mode setting */
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_VT_MODE, m_vtmode);
+ CHECK(ret);
+ }
+
+#endif
+ /* start with all buffers in queue */
+ for (int i = 0; i < MAX_BUFFERS; i++)
+ {
+ ret = fimc_v4l2_qbuf(m_cam_fd, i);
+ CHECK(ret);
+ }
+
+ ret = fimc_v4l2_streamon(m_cam_fd);
+ CHECK(ret);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ m_flag_camera_start = 1; //Kamat check
+
+ if(m_camera_id == CAMERA_ID_BACK) {
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EFFECT, m_image_effect);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_WHITE_BALANCE, m_white_balance);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ISO, m_iso);
+ CHECK(ret);
+ if(m_focus_mode ==FOCUS_MODE_FACEDETECT)
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, FOCUS_MODE_AUTO);
+ else{
+ if(m_shot_mode == 2){ //Panorama shot
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, m_focus_mode);
+ CHECK(ret);
+ m_camera_af_flag = -1;
+ }
+ else if(m_shot_mode == 3){ //Smile shot
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, m_focus_mode);
+ CHECK(ret);
+ m_camera_af_flag = -1;
+ }
+ else if (m_camera_af_flag < 0) { //After captur, Focus is fixed.
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, m_focus_mode);
+ CHECK(ret);
+ m_camera_af_flag = 0;
+ }
+ }
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FRAME_RATE, m_fps);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_METERING, m_metering);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SATURATION, m_saturation);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CONTRAST, m_contrast);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ZOOM, m_zoom_level);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SENSOR_MODE, m_sensor_mode);
+ CHECK(ret);
+ // Apply the scene mode only in camera not in camcorder
+ if (!m_sensor_mode)
+ {
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SCENE_MODE, m_scene_mode);
+ CHECK(ret);
+ }
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS, m_brightness);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SHARPNESS, m_sharpness);
+ CHECK(ret);
+ }
+ else // In case VGA camera
+ {
+ /* Brightness setting */
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS, m_brightness);
+ CHECK(ret);
+ }
+#endif
+
+ // It is a delay for a new frame, not to show the previous bigger ugly picture frame.
+ ret = fimc_poll(&m_events_c);
+ CHECK(ret);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGE("%s: get the first frame of the preview\n", __FUNCTION__);
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+#ifndef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ m_flag_camera_start = 1; //Kamat check
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+#ifdef ENABLE_HDMI_DISPLAY
+ hdmi_initialize(m_preview_width,m_preview_height);
+ hdmi_gl_initialize(0);
+ hdmi_gl_streamoff(0);
+#endif
+#ifdef BOARD_USES_SDTV
+
+ if(suspendTvInit ==true )
+ {
+ if(!mtvoutcamera->isSuspended())
+ {
+ mtvoutcamera->TvOutSuspend("") ;
+ }
+ }
+
+#endif
+
+ return 0;
+}
+
+int SecCamera::stopPreview(void)
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGE("%s()", __FUNCTION__);
+
+ close_buffers(m_buffers_c);
+
+ if(m_flag_camera_start == 0) {
+ LOGE("%s: m_flag_camera_start is zero", __FUNCTION__);
+ return 0;
+ }
+#else /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ LOGV("%s()", __FUNCTION__);
+
+ close_buffers(m_buffers_c);
+
+ if(m_flag_camera_start == 0)
+ return 0;
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+#ifdef ENABLE_HDMI_DISPLAY
+ hdmi_deinitialize();
+ hdmi_gl_streamon(0);
+#endif
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ int ret = fimc_v4l2_streamoff(m_cam_fd);
+
+ m_flag_camera_start = 0; //Kamat check
+ CHECK(ret);
+
+ return ret;
+}
+
+//Recording
+#ifdef DUAL_PORT_RECORDING
+int SecCamera::startRecord(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ // aleady started
+ if(m_flag_record_start > 0)
+ {
+ LOGE("ERR(%s):Preview was already started\n", __FUNCTION__);
+ return 0;
+ }
+
+ if(m_cam_fd2 <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ memset(&m_events_c2, 0, sizeof(m_events_c2));
+ m_events_c2.fd = m_cam_fd2;
+ m_events_c2.events = POLLIN | POLLERR;
+
+ int m_record_v4lformat = V4L2_PIX_FMT_NV12T; //Kamat: set suitably
+ /* enum_fmt, s_fmt sample */
+ int ret = fimc_v4l2_enum_fmt(m_cam_fd2,m_record_v4lformat);
+ CHECK(ret);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGE("%s: m_recording_width = %d, m_recording_height = %d\n", __FUNCTION__, m_recording_width, m_recording_height);
+
+ ret = fimc_v4l2_s_fmt(m_cam_fd2, m_recording_width, m_recording_height,m_record_v4lformat, 0);
+
+ CHECK(ret);
+
+ init_yuv_buffers(m_buffers_c2, m_recording_width, m_recording_height, m_record_v4lformat);
+#else /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ ret = fimc_v4l2_s_fmt(m_cam_fd2, m_preview_width,m_preview_height,m_record_v4lformat, 0);
+ CHECK(ret);
+
+ init_yuv_buffers(m_buffers_c2, m_preview_width, m_preview_height, m_record_v4lformat);
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+ ret = fimc_v4l2_reqbufs(m_cam_fd2, V4L2_BUF_TYPE_VIDEO_CAPTURE, MAX_BUFFERS);
+ CHECK(ret);
+ ret = fimc_v4l2_querybuf(m_cam_fd2, m_buffers_c2, V4L2_BUF_TYPE_VIDEO_CAPTURE, MAX_BUFFERS);
+ CHECK(ret);
+
+ /* g_parm, s_parm sample */
+ ret = fimc_v4l2_g_parm(m_cam_fd2);
+ CHECK(ret);
+ ret = fimc_v4l2_s_parm(m_cam_fd2, 1, m_fps);
+ CHECK(ret);
+
+ /* start with all buffers in queue */
+ for (int i = 0; i < MAX_BUFFERS; i++)
+ {
+ ret = fimc_v4l2_qbuf(m_cam_fd2, i);
+ CHECK(ret);
+ }
+
+ ret = fimc_v4l2_streamon(m_cam_fd2);
+ CHECK(ret);
+
+ // It is a delay for a new frame, not to show the previous bigger ugly picture frame.
+ ret = fimc_poll(&m_events_c2);
+ CHECK(ret);
+
+ m_flag_record_start = 1; //Kamat check
+
+ return 0;
+}
+
+int SecCamera::stopRecord(void)
+{
+ if(m_flag_record_start == 0)
+ return 0;
+
+ LOGV("%s()", __FUNCTION__);
+
+ close_buffers(m_buffers_c2);
+
+ if(m_cam_fd2 <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ int ret = fimc_v4l2_streamoff(m_cam_fd2);
+
+ m_flag_record_start = 0; //Kamat check
+ CHECK(ret);
+
+ return 0;
+}
+
+unsigned int SecCamera::getRecPhyAddrY(int index)
+{
+ unsigned int addr_y;
+
+ addr_y = fimc_v4l2_s_ctrl(m_cam_fd2, V4L2_CID_PADDR_Y, index);
+ CHECK((int)addr_y);
+ return addr_y;
+}
+
+unsigned int SecCamera::getRecPhyAddrC(int index)
+{
+ unsigned int addr_c;
+
+ addr_c = fimc_v4l2_s_ctrl(m_cam_fd2, V4L2_CID_PADDR_CBCR, index);
+ CHECK((int)addr_c);
+ return addr_c;
+}
+#endif //DUAL_PORT_RECORDING
+
+unsigned int SecCamera::getPhyAddrY(int index)
+{
+ unsigned int addr_y;
+
+ addr_y = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_PADDR_Y, index);
+ CHECK((int)addr_y);
+ return addr_y;
+}
+
+unsigned int SecCamera::getPhyAddrC(int index)
+{
+ unsigned int addr_c;
+
+ addr_c = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_PADDR_CBCR, index);
+ CHECK((int)addr_c);
+ return addr_c;
+}
+
+#ifdef SEND_YUV_RECORD_DATA
+#define PAGE_ALIGN(x) ((x+0xFFF)&(~0xFFF)) // Set as multiple of 4K
+void SecCamera::getYUVBuffers(unsigned char** virYAddr, unsigned char** virCAddr, int index)
+{
+ *virYAddr = (unsigned char*)m_buffers_c[index].start;
+ //*virCAddr = (unsigned char*)m_buffers_c[index].start + PAGE_ALIGN(m_preview_width * m_preview_height);
+ *virCAddr = (unsigned char*)m_buffers_c[index].start + ALIGN_TO_8KB(ALIGN_TO_128B(m_preview_width) * ALIGN_TO_32B(m_preview_height));
+}
+#endif
+
+void SecCamera::pausePreview()
+{
+ fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_STREAM_PAUSE, 0);
+}
+
+int SecCamera::getPreview()
+{
+ int index;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ int ret;
+#endif
+
+#ifdef PERFORMANCE
+
+ LOG_TIME_DEFINE(0)
+ LOG_TIME_DEFINE(1)
+
+ LOG_TIME_START(0)
+ fimc_poll(&m_events_c);
+ LOG_TIME_END(0)
+ LOG_CAMERA("fimc_poll interval: %lu us", LOG_TIME(0));
+
+ LOG_TIME_START(1)
+ index = fimc_v4l2_dqbuf(m_cam_fd);
+ LOG_TIME_END(1)
+ LOG_CAMERA("fimc_dqbuf interval: %lu us", LOG_TIME(1));
+
+#else
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_flag_camera_start == 0 || fimc_esd_poll(&m_events_c) == 0)
+ {
+ LOGE("ERR(%s):Start Camera Device Reset \n", __FUNCTION__);
+ /* GAUDI Project([arun.c@samsung.com]) 2010.05.20. [Implemented ESD code] */
+ /*
+ * When there is no data for more than 1 second from the camera we inform
+ * the FIMC driver by calling fimc_v4l2_s_input() with a special value = 1000
+ * FIMC driver identify that there is something wrong with the camera
+ * and it restarts the sensor.
+ */
+ stopPreview();
+ /* Reset Only Camera Device */
+ ret = fimc_v4l2_querycap(m_cam_fd);
+ CHECK(ret);
+ index = fimc_v4l2_enuminput(m_cam_fd);
+ CHECK(index);
+ ret = fimc_v4l2_s_input(m_cam_fd, 1000);
+ CHECK(ret);
+ //setCameraSensorReset();
+ ret = startPreview();
+
+ if(ret < 0) {
+ LOGE("ERR(%s): startPreview() return %d\n", __FUNCTION__, ret);
+
+ return 0;
+ }
+ }
+#else /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ fimc_poll(&m_events_c);
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ index = fimc_v4l2_dqbuf(m_cam_fd);
+#endif
+ if(!(0 <= index && index < MAX_BUFFERS))
+ {
+ LOGE("ERR(%s):wrong index = %d\n", __FUNCTION__, index);
+ return -1;
+ }
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ ret = fimc_v4l2_qbuf(m_cam_fd, index); //Kamat: is it overhead?
+#else /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+ int ret = fimc_v4l2_qbuf(m_cam_fd, index); //Kamat: is it overhead?
+#endif /* SWP1_CAMERA_ADD_ADVANCED_FUNCTION */
+
+ CHECK(ret);
+
+#ifdef ENABLE_HDMI_DISPLAY
+ hdmi_set_v_param(getPhyAddrY(index), getPhyAddrC (index),m_preview_width,m_preview_height);
+#endif
+ return index;
+
+}
+
+#ifdef DUAL_PORT_RECORDING
+int SecCamera::getRecord()
+{
+ int index;
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_flag_record_start == 0) {
+ LOGE("%s: m_flag_record_start is 0", __FUNCTION__);
+ startRecord();
+ }
+#endif
+
+#ifdef PERFORMANCE
+
+ LOG_TIME_DEFINE(0)
+ LOG_TIME_DEFINE(1)
+
+ LOG_TIME_START(0)
+ fimc_poll(&m_events_c2);
+ LOG_TIME_END(0)
+ LOG_CAMERA("fimc_poll interval: %lu us", LOG_TIME(0));
+
+ LOG_TIME_START(1)
+ index = fimc_v4l2_dqbuf(m_cam_fd2);
+ LOG_TIME_END(1)
+ LOG_CAMERA("fimc_dqbuf interval: %lu us", LOG_TIME(1));
+
+#else
+ fimc_poll(&m_events_c2);
+ index = fimc_v4l2_dqbuf(m_cam_fd2);
+#endif
+ if(!(0 <= index && index < MAX_BUFFERS))
+ {
+ LOGE("ERR(%s):wrong index = %d\n", __FUNCTION__, index);
+ return -1;
+ }
+
+ int ret = fimc_v4l2_qbuf(m_cam_fd2, index); //Kamat: is it overhead?
+ CHECK(ret);
+
+ return index;
+}
+#endif //DUAL_PORT_RECORDING
+
+int SecCamera::setPreviewSize(int width, int height, int pixel_format)
+{
+ LOGV("%s(width(%d), height(%d), format(%d))", __FUNCTION__, width, height, pixel_format);
+
+ int v4lpixelformat = pixel_format;
+
+#if defined(LOG_NDEBUG) && LOG_NDEBUG == 0
+ if(v4lpixelformat == V4L2_PIX_FMT_YUV420) { LOGV("PreviewFormat:V4L2_PIX_FMT_YUV420"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_NV12) { LOGV("PreviewFormat:V4L2_PIX_FMT_NV12"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_NV12T) { LOGV("PreviewFormat:V4L2_PIX_FMT_NV12T"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_NV21) { LOGV("PreviewFormat:V4L2_PIX_FMT_NV21"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_YUV422P) { LOGV("PreviewFormat:V4L2_PIX_FMT_YUV422P"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_YUYV) { LOGV("PreviewFormat:V4L2_PIX_FMT_YUYV"); }
+ else if(v4lpixelformat == V4L2_PIX_FMT_RGB565) { LOGV("PreviewFormat:V4L2_PIX_FMT_RGB565"); }
+ else { LOGV("PreviewFormat:UnknownFormat"); }
+#endif
+ m_preview_width = width;
+ m_preview_height = height;
+ m_preview_v4lformat = v4lpixelformat;
+
+ return 0;
+}
+
+int SecCamera::getPreviewSize(int * width, int * height, int * frame_size)
+{
+ *width = m_preview_width;
+ *height = m_preview_height;
+ *frame_size = m_frameSize(m_preview_v4lformat, m_preview_width, m_preview_height);
+
+ return 0;
+}
+
+int SecCamera::getPreviewMaxSize(int * width, int * height)
+{
+ *width = m_preview_max_width;
+ *height = m_preview_max_height;
+
+ return 0;
+}
+
+int SecCamera::getPreviewPixelFormat(void)
+{
+ return m_preview_v4lformat;
+}
+
+
+// ======================================================================
+// Snapshot
+#ifdef JPEG_FROM_SENSOR
+/*
+ * Devide getJpeg() as two funcs, setSnapshotCmd() & getJpeg() because of the shutter sound timing.
+ * Here, just send the capture cmd to camera ISP to start JPEG capture.
+ */
+int SecCamera::setSnapshotCmd(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ int ret = 0;
+
+ LOG_TIME_DEFINE(0)
+ LOG_TIME_DEFINE(1)
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return 0;
+ }
+
+ if(m_flag_camera_start > 0)
+ {
+ LOG_TIME_START(0)
+ stopPreview();
+ LOG_TIME_END(0)
+ }
+
+ memset(&m_events_c, 0, sizeof(m_events_c));
+ m_events_c.fd = m_cam_fd;
+ m_events_c.events = POLLIN | POLLERR;
+
+ LOG_TIME_START(1) // prepare
+ int nframe = 1;
+
+ ret = fimc_v4l2_enum_fmt(m_cam_fd,m_snapshot_v4lformat);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_fmt_cap(m_cam_fd, m_snapshot_width, m_snapshot_height, V4L2_PIX_FMT_JPEG);
+ CHECK_PTR(ret);
+ init_yuv_buffers(m_buffers_c, m_snapshot_width, m_snapshot_height, m_snapshot_v4lformat);
+
+ ret = fimc_v4l2_reqbufs(m_cam_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, nframe);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_querybuf(m_cam_fd, m_buffers_c, V4L2_BUF_TYPE_VIDEO_CAPTURE, nframe);
+ CHECK_PTR(ret);
+
+ ret = fimc_v4l2_g_parm(m_cam_fd);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_parm(m_cam_fd, 1, m_fps);
+ CHECK_PTR(ret);
+
+ ret = fimc_v4l2_qbuf(m_cam_fd, 0);
+ CHECK_PTR(ret);
+
+ ret = fimc_v4l2_streamon(m_cam_fd);
+ CHECK_PTR(ret);
+ LOG_TIME_END(1)
+
+ return 0;
+}
+
+/*
+ * Set Jpeg quality & exif info and get JPEG data from camera ISP
+ */
+unsigned char* SecCamera::getJpeg(int* jpeg_size, unsigned int* phyaddr)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ int index, ret = 0;
+ unsigned char* addr;
+
+ LOG_TIME_DEFINE(2)
+/* kidggang (10.7.5) - Problem - After jpegquality is capture, operation setting is normal.
+
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_QUALITY, m_jpeg_quality);
+ CHECK_PTR(ret);
+*/
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ //exif orient info
+// ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EXIF_ORIENTATION, m_exif_orientation); //kidggang
+// CHECK_PTR(ret);
+#if 0//def SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ //set gps information
+ ret = fimc_v4l2_s_ext_ctrl(m_cam_fd, V4L2_CID_CAMERA_GPS_LATITUDE, &m_gps_latitude);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_ext_ctrl(m_cam_fd, V4L2_CID_CAMERA_GPS_LONGITUDE, &m_gps_longitude);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_ext_ctrl(m_cam_fd, V4L2_CID_CAMERA_GPS_ALTITUDE, &m_gps_altitude);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_ext_ctrl(m_cam_fd, V4L2_CID_CAMERA_GPS_TIMESTAMP, &m_gps_timestamp);
+ CHECK_PTR(ret);
+#endif
+
+/* kidggang
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CAPTURE, 0);
+ CHECK_PTR(ret);*/
+
+ // capture
+ ret = fimc_poll(&m_events_c);
+ CHECK_PTR(ret);
+ index = fimc_v4l2_dqbuf(m_cam_fd);
+ if(!(0 <= index && index < MAX_BUFFERS))
+ {
+ LOGE("ERR(%s):wrong index = %d\n", __FUNCTION__, index);
+ return NULL;
+ }
+#endif
+
+ *jpeg_size = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_MAIN_SIZE);
+ CHECK_PTR(*jpeg_size);
+ int main_offset = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_MAIN_OFFSET);
+ CHECK_PTR(main_offset);
+ m_postview_offset = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET);
+ CHECK_PTR(m_postview_offset);
+
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_STREAM_PAUSE, 0);
+ CHECK_PTR(ret);
+ LOGV("\nsnapshot dqueued buffer = %d snapshot_width = %d snapshot_height = %d\n\n",index, m_snapshot_width, m_snapshot_height);
+
+ addr = (unsigned char*)(m_buffers_c[index].start) + main_offset;
+ *phyaddr = getPhyAddrY(index) + m_postview_offset;
+
+ LOG_TIME_START(2) // post
+ ret = fimc_v4l2_streamoff(m_cam_fd);
+ CHECK_PTR(ret);
+ LOG_TIME_END(2)
+
+#if 0 //temporary blocked for build
+ LOG_CAMERA("getSnapshotAndJpeg intervals : stopPreview(%lu), prepare(%lu), capture(%lu), memcpy(%lu), yuv2Jpeg(%lu), post(%lu) us"
+ , LOG_TIME(0), LOG_TIME(1), LOG_TIME(2), LOG_TIME(3), LOG_TIME(4), LOG_TIME(5));
+#endif
+ return addr;
+}
+
+int SecCamera::getExif(unsigned char *pExifDst, unsigned char *pThumbSrc)
+{
+ JpegEncoder jpgEnc;
+#if ADD_THUMB_IMG
+ int inFormat = JPG_MODESEL_YCBCR;
+ int outFormat = JPG_422;
+ switch(m_snapshot_v4lformat) {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV12T:
+ case V4L2_PIX_FMT_YUV420:
+ outFormat = JPG_420;
+ break;
+ case V4L2_PIX_FMT_YUYV:
+ case V4L2_PIX_FMT_UYVY:
+ case V4L2_PIX_FMT_YUV422P:
+ outFormat = JPG_422;
+ break;
+ }
+
+ if (jpgEnc.setConfig(JPEG_SET_ENCODE_IN_FORMAT, inFormat) != JPG_SUCCESS)
+ return -1;
+
+ if (jpgEnc.setConfig(JPEG_SET_SAMPING_MODE, outFormat) != JPG_SUCCESS)
+ return -1;
+
+ if (jpgEnc.setConfig(JPEG_SET_ENCODE_QUALITY, JPG_QUALITY_LEVEL_2) != JPG_SUCCESS)
+ return -1;
+
+ int thumbWidth, thumbHeight, thumbSrcSize;
+ getPostViewConfig(&thumbWidth, &thumbHeight, &thumbSrcSize);
+ if (jpgEnc.setConfig(JPEG_SET_ENCODE_WIDTH, thumbWidth) != JPG_SUCCESS)
+ return -1;
+
+ if (jpgEnc.setConfig(JPEG_SET_ENCODE_HEIGHT, thumbHeight) != JPG_SUCCESS)
+ return -1;
+
+ char *pInBuf = (char *)jpgEnc.getInBuf(thumbSrcSize);
+ if(pInBuf == NULL)
+ return -1;
+ memcpy(pInBuf, pThumbSrc, thumbSrcSize);
+ unsigned int thumbSize;
+ jpgEnc.encode(&thumbSize, NULL);
+
+ mExifInfo.enableThumb = true;
+#else
+ mExifInfo.enableThumb = false;
+#endif
+
+ unsigned int exifSize;
+ setExifChangedAttribute();
+ jpgEnc.makeExif(pExifDst, &mExifInfo, &exifSize, true);
+
+ return exifSize;
+}
+
+void SecCamera::getPostViewConfig(int* width, int* height, int* size)
+{
+ if(m_preview_width == 1024)
+ {
+ *width = BACK_CAMERA_POSTVIEW_WIDE_WIDTH;
+ *height = BACK_CAMERA_POSTVIEW_HEIGHT;
+ *size = BACK_CAMERA_POSTVIEW_WIDE_WIDTH * BACK_CAMERA_POSTVIEW_HEIGHT * BACK_CAMERA_POSTVIEW_BPP/8;
+
+ }
+ else
+ {
+ *width = BACK_CAMERA_POSTVIEW_WIDTH;
+ *height = BACK_CAMERA_POSTVIEW_HEIGHT;
+ *size = BACK_CAMERA_POSTVIEW_WIDTH * BACK_CAMERA_POSTVIEW_HEIGHT * BACK_CAMERA_POSTVIEW_BPP/8;
+ }
+ LOGV("[5B] m_preview_width : %d, mPostViewWidth = %d mPostViewHeight = %d mPostViewSize = %d", m_preview_width, *width, *height, *size);
+}
+
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+int SecCamera::getPostViewOffset(void)
+{
+ return m_postview_offset;
+}
+#endif
+
+#else //#ifdef JPEG_FROM_SENSOR
+int SecCamera::getJpegFd(void)
+{
+ return m_jpeg_fd;
+}
+
+void SecCamera::SetJpgAddr(unsigned char *addr)
+{
+ SetMapAddr(addr);
+}
+
+#if 0
+int SecCamera::getSnapshot(unsigned char * buffer, unsigned int buffer_size)
+{
+ LOGV("%s(buffer(%p), size(%d))", __FUNCTION__, buffer, buffer_size);
+
+ if(getSnapshotAndJpeg(buffer, buffer_size, NULL, NULL) == 0)
+ return -1;
+
+ return 0;
+}
+#endif
+
+#endif
+
+unsigned char* SecCamera::getSnapshotAndJpeg()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ int index;
+ //unsigned int addr;
+ unsigned char* addr;
+ int ret = 0;
+
+ LOG_TIME_DEFINE(0)
+ LOG_TIME_DEFINE(1)
+ LOG_TIME_DEFINE(2)
+ LOG_TIME_DEFINE(3)
+ LOG_TIME_DEFINE(4)
+ LOG_TIME_DEFINE(5)
+
+ //fimc_v4l2_streamoff(m_cam_fd); [zzangdol] remove - it is separate in HWInterface with camera_id
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return 0;
+ }
+
+ if(m_flag_camera_start > 0)
+ {
+ LOG_TIME_START(0)
+ stopPreview();
+ LOG_TIME_END(0)
+ }
+
+ memset(&m_events_c, 0, sizeof(m_events_c));
+ m_events_c.fd = m_cam_fd;
+ m_events_c.events = POLLIN | POLLERR;
+
+#if defined(LOG_NDEBUG) && LOG_NDEBUG == 0
+ if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUV420) { LOGV("SnapshotFormat:V4L2_PIX_FMT_YUV420"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV12) { LOGV("SnapshotFormat:V4L2_PIX_FMT_NV12"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV12T) { LOGV("SnapshotFormat:V4L2_PIX_FMT_NV12T"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV21) { LOGV("SnapshotFormat:V4L2_PIX_FMT_NV21"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUV422P) { LOGV("SnapshotFormat:V4L2_PIX_FMT_YUV422P"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUYV) { LOGV("SnapshotFormat:V4L2_PIX_FMT_YUYV"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_UYVY) { LOGV("SnapshotFormat:V4L2_PIX_FMT_UYVY"); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_RGB565) { LOGV("SnapshotFormat:V4L2_PIX_FMT_RGB565"); }
+ else { LOGV("SnapshotFormat:UnknownFormat"); }
+#endif
+
+ LOG_TIME_START(1) // prepare
+ int nframe = 1;
+
+ LOGE("[zzangdol] w %d, h %d\n", m_snapshot_width, m_snapshot_height);
+
+ ret = fimc_v4l2_enum_fmt(m_cam_fd,m_snapshot_v4lformat);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_fmt_cap(m_cam_fd, m_snapshot_width, m_snapshot_height, m_snapshot_v4lformat);
+ CHECK_PTR(ret);
+ init_yuv_buffers(m_buffers_c, m_snapshot_width, m_snapshot_height, m_snapshot_v4lformat);
+
+ ret = fimc_v4l2_reqbufs(m_cam_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, nframe);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_querybuf(m_cam_fd, m_buffers_c, V4L2_BUF_TYPE_VIDEO_CAPTURE, nframe);
+ CHECK_PTR(ret);
+
+ /* g_parm, s_parm sample */
+ ret = fimc_v4l2_g_parm(m_cam_fd);
+ CHECK_PTR(ret);
+ ret = fimc_v4l2_s_parm(m_cam_fd, 1, m_fps);
+ CHECK_PTR(ret);
+
+ ret = fimc_v4l2_qbuf(m_cam_fd, 0);
+ CHECK_PTR(ret);
+
+ ret = fimc_v4l2_streamon(m_cam_fd);//zzangdolp
+ CHECK_PTR(ret);
+ LOG_TIME_END(1)
+
+ LOG_TIME_START(2) // capture
+ fimc_poll(&m_events_c);
+ index = fimc_v4l2_dqbuf(m_cam_fd);
+ fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_STREAM_PAUSE, 0);
+ LOGV("\nsnapshot dqueued buffer = %d snapshot_width = %d snapshot_height = %d\n\n",index, m_snapshot_width, m_snapshot_height);
+
+#ifdef DUMP_YUV
+ save_yuv(m_buffers_c, m_snapshot_width, m_snapshot_height, 16, index, 0);
+#endif
+ LOG_TIME_END(2)
+
+ //addr = getPhyAddrY(index);
+ addr = (unsigned char*)m_buffers_c[index].start;
+ if(addr == 0)
+ {
+ LOGE("%s] Physical address 0");
+ }
+ LOG_TIME_START(5) // post
+ fimc_v4l2_streamoff(m_cam_fd);
+#ifdef DUMP_YUV
+ close_buffers(m_buffers_c);
+#endif
+ LOG_TIME_END(5)
+
+ LOG_CAMERA("getSnapshotAndJpeg intervals : stopPreview(%lu), prepare(%lu), capture(%lu), memcpy(%lu), yuv2Jpeg(%lu), post(%lu) us"
+ , LOG_TIME(0), LOG_TIME(1), LOG_TIME(2), LOG_TIME(3), LOG_TIME(4), LOG_TIME(5));
+
+ return addr;
+}
+
+
+int SecCamera::setSnapshotSize(int width, int height)
+{
+ LOGV("%s(width(%d), height(%d))", __FUNCTION__, width, height);
+
+ m_snapshot_width = width;
+ m_snapshot_height = height;
+
+ return 0;
+}
+
+int SecCamera::getSnapshotSize(int * width, int * height, int * frame_size)
+{
+ *width = m_snapshot_width;
+ *height = m_snapshot_height;
+
+ int frame = 0;
+
+ frame = m_frameSize(m_snapshot_v4lformat, m_snapshot_width, m_snapshot_height);
+
+ // set it big.
+ if(frame == 0)
+ frame = m_snapshot_width * m_snapshot_height * BPP;
+
+ *frame_size = frame;
+
+ return 0;
+}
+
+int SecCamera::getSnapshotMaxSize(int * width, int * height)
+{
+ switch(m_camera_id)
+ {
+ case CAMERA_ID_FRONT:
+ m_snapshot_max_width = MAX_FRONT_CAMERA_SNAPSHOT_WIDTH;
+ m_snapshot_max_height = MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT;
+ break;
+
+ default:
+ case CAMERA_ID_BACK:
+ m_snapshot_max_width = MAX_BACK_CAMERA_SNAPSHOT_WIDTH;
+ m_snapshot_max_height = MAX_BACK_CAMERA_SNAPSHOT_HEIGHT;
+ break;
+ }
+
+ *width = m_snapshot_max_width;
+ *height = m_snapshot_max_height;
+
+ return 0;
+}
+
+int SecCamera::setSnapshotPixelFormat(int pixel_format)
+{
+ int v4lpixelformat= pixel_format;
+
+ if(m_snapshot_v4lformat != v4lpixelformat)
+ {
+ m_snapshot_v4lformat = v4lpixelformat;
+ }
+
+
+#if defined(LOG_NDEBUG) && LOG_NDEBUG == 0
+ if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUV420) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_YUV420", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV12) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_NV12", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV12T) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_NV12T", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_NV21) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_NV21", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUV422P) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_YUV422P", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_YUYV) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_YUYV", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_UYVY) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_UYVY", __FUNCTION__); }
+ else if(m_snapshot_v4lformat == V4L2_PIX_FMT_RGB565) { LOGE("%s():SnapshotFormat:V4L2_PIX_FMT_RGB565", __FUNCTION__); }
+ else { LOGE("SnapshotFormat:UnknownFormat"); }
+#endif
+
+ return 0;
+}
+
+int SecCamera::getSnapshotPixelFormat(void)
+{
+ return m_snapshot_v4lformat;
+}
+
+
+// ======================================================================
+// Settings
+
+int SecCamera::setCameraId(int camera_id)
+{
+ if( camera_id != CAMERA_ID_FRONT
+ && camera_id != CAMERA_ID_BACK)
+ {
+ LOGE("ERR(%s)::Invalid camera id(%d)\n", __func__, camera_id);
+ return -1;
+ }
+ if(m_camera_id == camera_id)
+ return 0;
+
+ LOGV("%s(camera_id(%d))", __FUNCTION__, camera_id);
+
+ switch(camera_id)
+ {
+ case CAMERA_ID_FRONT:
+
+ m_preview_max_width = MAX_FRONT_CAMERA_PREVIEW_WIDTH;
+ m_preview_max_height = MAX_FRONT_CAMERA_PREVIEW_HEIGHT;
+ m_snapshot_max_width = MAX_FRONT_CAMERA_SNAPSHOT_WIDTH;
+ m_snapshot_max_height = MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT;
+ cam_id = 1;
+ break;
+
+ case CAMERA_ID_BACK:
+ m_preview_max_width = MAX_BACK_CAMERA_PREVIEW_WIDTH;
+ m_preview_max_height = MAX_BACK_CAMERA_PREVIEW_HEIGHT;
+ m_snapshot_max_width = MAX_BACK_CAMERA_SNAPSHOT_WIDTH;
+ m_snapshot_max_height = MAX_BACK_CAMERA_SNAPSHOT_HEIGHT;
+ cam_id = 0;
+ break;
+ }
+
+ m_camera_id = camera_id;
+
+ resetCamera();
+
+ return 0;
+}
+
+int SecCamera::getCameraId(void)
+{
+ return m_camera_id;
+}
+
+// -----------------------------------
+
+int SecCamera::setAutofocus(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_AUTO_FOCUS, AUTO_FOCUS_ON) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_AUTO_FOCUS", __FUNCTION__);
+ return -1;
+ }
+#else
+ // kcoolsw : turn on setAutofocus initially..
+ if(m_autofocus != AUTO_FOCUS_ON)
+ {
+ m_autofocus = AUTO_FOCUS_ON;
+ }
+#endif
+
+ return 0;
+}
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+int SecCamera::getAutoFocusResult(void)
+{
+ int af_result = 0;
+ af_result = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_AUTO_FOCUS_RESULT);
+ return af_result;
+}
+int SecCamera::cancelAutofocus(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_AUTO_FOCUS, AUTO_FOCUS_OFF) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_AUTO_FOCUS", __FUNCTION__);
+ return -1;
+ }
+
+ usleep(1000);
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_AUTO_FOCUS, AUTO_FOCUS_STATUS) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_AUTO_FOCUS", __FUNCTION__);
+ return -1;
+ }
+ return 0;
+}
+#endif
+// -----------------------------------
+
+int SecCamera::zoomIn(void)
+{
+ LOGV("%s()", __FUNCTION__);
+ return 0;
+}
+
+int SecCamera::zoomOut(void)
+{
+ LOGV("%s()", __FUNCTION__);
+ return 0;
+}
+
+// -----------------------------------
+
+int SecCamera::SetRotate(int angle)
+{
+ LOGE("%s(angle(%d))", __FUNCTION__, angle);
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_angle != angle)
+ {
+ switch(angle)
+ {
+ case -360 :
+ case 0 :
+ case 360 :
+ m_angle = 0;
+ break;
+
+ case -270 :
+ case 90 :
+ m_angle = 90;
+ break;
+
+ case -180 :
+ case 180 :
+ m_angle = 180;
+ break;
+
+ case -90 :
+ case 270 :
+ m_angle = 270;
+ break;
+
+ default :
+ LOGE("ERR(%s):Invalid angle(%d)", __FUNCTION__, angle);
+ return -1;
+ }
+
+
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_ROTATION, angle) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_ROTATION", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+int SecCamera::getRotate(void)
+{
+ LOGV("%s():angle(%d)", __FUNCTION__, m_angle);
+ return m_angle;
+}
+
+void SecCamera::setFrameRate(int frame_rate)
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGV("%s(FrameRate(%d))", __FUNCTION__, frame_rate);
+
+ if(frame_rate < FRAME_RATE_AUTO || FRAME_RATE_MAX < frame_rate )
+ LOGE("ERR(%s):Invalid frame_rate(%d)", __FUNCTION__, frame_rate);
+
+ if(m_fps != frame_rate)
+ {
+ m_fps = frame_rate;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FRAME_RATE, frame_rate) < 0)
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FRAME_RATE", __FUNCTION__);
+ }
+ }
+#else
+ m_fps = frame_rate;
+#endif
+
+}
+
+/* kidggang (10.7.5) - Problem - After jpegquality is capture, operation setting is normal.
+void SecCamera::setJpegQuality(int quality)
+{
+ m_jpeg_quality = quality;
+}
+*/
+// -----------------------------------
+
+int SecCamera::setVerticalMirror(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_VFLIP, 0) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_VFLIP", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
+
+int SecCamera::setHorizontalMirror(void)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return -1;
+ }
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_HFLIP, 0) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_HFLIP", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
+
+// -----------------------------------
+
+int SecCamera::setWhiteBalance(int white_balance)
+{
+ LOGV("%s(white_balance(%d))", __FUNCTION__, white_balance);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(white_balance <= WHITE_BALANCE_BASE || WHITE_BALANCE_MAX <= white_balance)
+#else
+ if(white_balance < WHITE_BALANCE_AUTO || WHITE_BALANCE_SUNNY < white_balance)
+#endif
+ {
+ LOGE("ERR(%s):Invalid white_balance(%d)", __FUNCTION__, white_balance);
+ return -1;
+ }
+
+ if(m_white_balance != white_balance)
+ {
+ m_white_balance = white_balance;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_WHITE_BALANCE, white_balance) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_WHITE_BALANCE", __FUNCTION__);
+ return -1;
+ }
+ }
+#endif
+ }
+
+ return 0;
+}
+
+int SecCamera::getWhiteBalance(void)
+{
+ LOGV("%s():white_balance(%d)", __FUNCTION__, m_white_balance);
+ return m_white_balance;
+}
+
+// -----------------------------------
+
+int SecCamera::setBrightness(int brightness)
+{
+ LOGV("%s(brightness(%d))", __FUNCTION__, brightness);
+
+ if(brightness < BRIGHTNESS_MINUS_4|| BRIGHTNESS_PLUS_4< brightness )
+ {
+ LOGE("ERR(%s):Invalid brightness(%d)", __FUNCTION__, brightness);
+ return -1;
+ }
+
+ if(m_brightness != brightness)
+ {
+ m_brightness = brightness;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS, brightness) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_BRIGHTNESS", __FUNCTION__);
+ return -1;
+ }
+ }
+#endif
+ }
+
+ return 0;
+}
+
+int SecCamera::getBrightness(void)
+{
+ LOGV("%s():brightness(%d)", __FUNCTION__, m_brightness);
+ return m_brightness;
+}
+
+// -----------------------------------
+
+int SecCamera::setImageEffect(int image_effect)
+{
+ LOGV("%s(image_effect(%d))", __FUNCTION__, image_effect);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(image_effect <= IMAGE_EFFECT_BASE || IMAGE_EFFECT_MAX <= image_effect)
+#else
+ if(image_effect < IMAGE_EFFECT_ORIGINAL || IMAGE_EFFECT_SILHOUETTE < image_effect)
+#endif
+ {
+ LOGE("ERR(%s):Invalid image_effect(%d)", __FUNCTION__, image_effect);
+ return -1;
+ }
+
+ if(m_image_effect != image_effect)
+ {
+ m_image_effect = image_effect;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EFFECT, image_effect) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_EFFECT", __FUNCTION__);
+ return -1;
+ }
+ }
+#endif
+ }
+
+ return 0;
+}
+
+int SecCamera::getImageEffect(void)
+{
+ LOGV("%s():image_effect(%d)", __FUNCTION__, m_image_effect);
+ return m_image_effect;
+}
+
+// ======================================================================
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+int SecCamera::setAntiBanding(int anti_banding)
+{
+ LOGV("%s(anti_banding(%d))", __FUNCTION__, anti_banding);
+
+ if(anti_banding < ANTI_BANDING_AUTO|| ANTI_BANDING_OFF < anti_banding)
+ {
+ LOGE("ERR(%s):Invalid anti_banding (%d)", __FUNCTION__, anti_banding);
+ return -1;
+ }
+
+ if(m_anti_banding != anti_banding)
+ {
+ m_anti_banding = anti_banding;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ANTI_BANDING, anti_banding) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_ANTI_BANDING", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+//======================================================================
+int SecCamera::setSceneMode(int scene_mode)
+{
+ LOGV("%s(scene_mode(%d))", __FUNCTION__, scene_mode);
+
+ if(scene_mode <= SCENE_MODE_BASE || SCENE_MODE_MAX <= scene_mode)
+ {
+ LOGE("ERR(%s):Invalid scene_mode (%d)", __FUNCTION__, scene_mode);
+ return -1;
+ }
+
+ if(m_scene_mode != scene_mode)
+ {
+ m_scene_mode = scene_mode;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SCENE_MODE, m_scene_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SCENE_MODE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getSceneMode(void)
+{
+ return m_scene_mode;
+}
+
+//======================================================================
+
+int SecCamera::setFlashMode(int flash_mode)
+{
+ LOGV("%s(flash_mode(%d))", __FUNCTION__, flash_mode);
+
+ if(flash_mode <= FLASH_MODE_BASE || FLASH_MODE_MAX <= flash_mode)
+ {
+ LOGE("ERR(%s):Invalid flash_mode (%d)", __FUNCTION__, flash_mode);
+ return -1;
+ }
+
+ if(m_flash_mode != flash_mode)
+ {
+ m_flash_mode = flash_mode;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FLASH_MODE, flash_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FLASH_MODE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getFlashMode(void)
+{
+ return m_flash_mode;
+}
+
+//======================================================================
+
+int SecCamera::setISO(int iso_value)
+{
+ LOGV("%s(iso_value(%d))", __FUNCTION__, iso_value);
+ if(iso_value <ISO_AUTO || ISO_MAX <= iso_value)
+ {
+ LOGE("ERR(%s):Invalid iso_value (%d)", __FUNCTION__, iso_value);
+ return -1;
+ }
+
+ if(m_iso != iso_value)
+ {
+ m_iso = iso_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ISO, iso_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_ISO", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getISO(void)
+{
+ return m_iso;
+}
+
+//======================================================================
+
+int SecCamera::setContrast(int contrast_value)
+{
+ LOGV("%s(contrast_value(%d))", __FUNCTION__, contrast_value);
+
+ if(contrast_value <CONTRAST_MINUS_2|| CONTRAST_MAX<= contrast_value)
+ {
+ LOGE("ERR(%s):Invalid contrast_value (%d)", __FUNCTION__, contrast_value);
+ return -1;
+ }
+
+ if(m_contrast != contrast_value)
+ {
+ m_contrast = contrast_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CONTRAST, contrast_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_CONTRAST", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getContrast(void)
+{
+ return m_contrast;
+}
+
+//======================================================================
+
+int SecCamera::setSaturation(int saturation_value)
+{
+ LOGV("%s(saturation_value(%d))", __FUNCTION__, saturation_value);
+
+ if(saturation_value <SATURATION_MINUS_2|| SATURATION_MAX<= saturation_value)
+ {
+ LOGE("ERR(%s):Invalid saturation_value (%d)", __FUNCTION__, saturation_value);
+ return -1;
+ }
+
+ if(m_saturation!= saturation_value)
+ {
+ m_saturation = saturation_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SATURATION, saturation_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SATURATION", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getSaturation(void)
+{
+ return m_saturation;
+}
+
+//======================================================================
+
+int SecCamera::setSharpness(int sharpness_value)
+{
+ LOGV("%s(sharpness_value(%d))", __FUNCTION__, sharpness_value);
+
+ if(sharpness_value <SHARPNESS_MINUS_2|| SHARPNESS_MAX<= sharpness_value)
+ {
+ LOGE("ERR(%s):Invalid sharpness_value (%d)", __FUNCTION__, sharpness_value);
+ return -1;
+ }
+
+ if(m_sharpness!= sharpness_value)
+ {
+ m_sharpness = sharpness_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SHARPNESS, sharpness_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SHARPNESS", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getSharpness(void)
+{
+ return m_sharpness;
+}
+
+//======================================================================
+
+int SecCamera::setWDR(int wdr_value)
+{
+ LOGV("%s(wdr_value(%d))", __FUNCTION__, wdr_value);
+
+ if(wdr_value<WDR_OFF || WDR_MAX<= wdr_value)
+ {
+ LOGE("ERR(%s):Invalid wdr_value (%d)", __FUNCTION__, wdr_value);
+ return -1;
+ }
+
+ if(m_wdr!= wdr_value)
+ {
+ m_wdr = wdr_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_WDR, wdr_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_WDR", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getWDR(void)
+{
+ return m_wdr;
+}
+
+//======================================================================
+
+int SecCamera::setAntiShake(int anti_shake)
+{
+ LOGV("%s(anti_shake(%d))", __FUNCTION__, anti_shake);
+
+ if(anti_shake<ANTI_SHAKE_OFF || ANTI_SHAKE_MAX<= anti_shake)
+ {
+ LOGE("ERR(%s):Invalid anti_shake (%d)", __FUNCTION__, anti_shake);
+ return -1;
+ }
+
+ if(m_anti_shake!= anti_shake)
+ {
+ m_anti_shake = anti_shake;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ANTI_SHAKE, anti_shake) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_ANTI_SHAKE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getAntiShake(void)
+{
+ return m_anti_shake;
+}
+
+//======================================================================
+
+
+int SecCamera::setMetering(int metering_value)
+{
+ LOGV("%s(metering (%d))", __FUNCTION__, metering_value);
+
+ if(metering_value <= METERING_BASE || METERING_MAX <= metering_value)
+ {
+ LOGE("ERR(%s):Invalid metering_value (%d)", __FUNCTION__, metering_value);
+ return -1;
+ }
+
+ if(m_metering != metering_value)
+ {
+ m_metering = metering_value;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_METERING, metering_value) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_METERING", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getMetering(void)
+{
+ return m_metering;
+}
+
+//======================================================================
+
+int SecCamera::setJpegQuality(int jpeg_quality)
+{
+ LOGV("%s(jpeg_quality (%d))", __FUNCTION__, jpeg_quality);
+
+ if(jpeg_quality < JPEG_QUALITY_ECONOMY|| JPEG_QUALITY_MAX<= jpeg_quality)
+ {
+ LOGE("ERR(%s):Invalid jpeg_quality (%d)", __FUNCTION__, jpeg_quality);
+ return -1;
+ }
+
+ if(m_jpeg_quality != jpeg_quality)
+ {
+ m_jpeg_quality = jpeg_quality;
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAM_JPEG_QUALITY, jpeg_quality) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAM_JPEG_QUALITY", __FUNCTION__);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getJpegQuality(void)
+{
+ return m_jpeg_quality;
+}
+
+//======================================================================
+
+int SecCamera::setZoom(int zoom_level)
+{
+ LOGV("%s(zoom_level (%d))", __FUNCTION__, zoom_level);
+
+ if(zoom_level < ZOOM_LEVEL_0|| ZOOM_LEVEL_MAX<= zoom_level)
+ {
+ LOGE("ERR(%s):Invalid zoom_level (%d)", __FUNCTION__, zoom_level);
+ return -1;
+ }
+
+ if(m_zoom_level != zoom_level)
+ {
+ m_zoom_level = zoom_level;
+
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ZOOM, zoom_level) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_ZOOM", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getZoom(void)
+{
+ return m_zoom_level;
+}
+
+//======================================================================
+
+int SecCamera::setObjectTracking(int object_tracking)
+{
+ LOGV("%s(object_tracking (%d))", __FUNCTION__, object_tracking);
+
+ if(object_tracking < OBJECT_TRACKING_OFF|| OBJECT_TRACKING_MAX<= object_tracking)
+ {
+ LOGE("ERR(%s):Invalid object_tracking (%d)", __FUNCTION__, object_tracking);
+ return -1;
+ }
+
+ if(m_object_tracking != object_tracking)
+ {
+ m_object_tracking = object_tracking;
+ }
+
+ return 0;
+}
+
+int SecCamera::getObjectTracking(void)
+{
+ return m_object_tracking;
+}
+
+int SecCamera::getObjectTrackingStatus(void)
+{
+ int obj_status = 0;
+ obj_status = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJ_TRACKING_STATUS);
+ return obj_status;
+}
+
+int SecCamera::setObjectTrackingStartStop(int start_stop)
+{
+ LOGV("%s(object_tracking_start_stop (%d))", __FUNCTION__, start_stop);
+
+ if(m_object_tracking_start_stop != start_stop)
+ {
+ m_object_tracking_start_stop = start_stop;
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP, start_stop) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP", __FUNCTION__);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::setTouchAFStartStop(int start_stop)
+{
+ LOGV("%s(touch_af_start_stop (%d))", __FUNCTION__, start_stop);
+
+ if(m_touch_af_start_stop != start_stop)
+ {
+ m_touch_af_start_stop = start_stop;
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_TOUCH_AF_START_STOP, start_stop) < 0)
+{
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_TOUCH_AF_START_STOP", __FUNCTION__);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+//======================================================================
+
+int SecCamera::setSmartAuto(int smart_auto)
+{
+ LOGV("%s(smart_auto (%d))", __FUNCTION__, smart_auto);
+
+ if(smart_auto < SMART_AUTO_OFF|| SMART_AUTO_MAX <= smart_auto)
+ {
+ LOGE("ERR(%s):Invalid smart_auto (%d)", __FUNCTION__, smart_auto);
+ return -1;
+ }
+
+ if(m_smart_auto != smart_auto)
+ {
+ m_smart_auto = smart_auto;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SMART_AUTO, smart_auto) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SMART_AUTO", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getSmartAuto(void)
+{
+ return m_smart_auto;
+}
+
+int SecCamera::getAutosceneStatus(void)
+{
+ int autoscene_status = -1;
+
+ if(getSmartAuto() == SMART_AUTO_ON)
+ {
+ autoscene_status = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_SMART_AUTO_STATUS);
+
+ if((autoscene_status < SMART_AUTO_STATUS_AUTO) || (autoscene_status > SMART_AUTO_STATUS_MAX))
+ {
+ LOGE("ERR(%s):Invalid getAutosceneStatus (%d)", __FUNCTION__, autoscene_status);
+ return -1;
+ }
+ }
+ //LOGV("%s() autoscene_status (%d)", __FUNCTION__, autoscene_status);
+ return autoscene_status;
+}
+//======================================================================
+
+int SecCamera::setBeautyShot(int beauty_shot)
+{
+ LOGV("%s(beauty_shot (%d))", __FUNCTION__, beauty_shot);
+
+ if(beauty_shot < BEAUTY_SHOT_OFF|| BEAUTY_SHOT_MAX <= beauty_shot)
+ {
+ LOGE("ERR(%s):Invalid beauty_shot (%d)", __FUNCTION__, beauty_shot);
+ return -1;
+ }
+
+ if(m_beauty_shot != beauty_shot)
+ {
+ m_beauty_shot = beauty_shot;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BEAUTY_SHOT, beauty_shot) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_BEAUTY_SHOT", __FUNCTION__);
+ return -1;
+ }
+
+ setFaceDetect(FACE_DETECT_BEAUTY_ON);
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getBeautyShot(void)
+{
+ return m_beauty_shot;
+}
+
+//======================================================================
+
+int SecCamera::setVintageMode(int vintage_mode)
+{
+ LOGV("%s(vintage_mode(%d))", __FUNCTION__, vintage_mode);
+
+ if(vintage_mode <= VINTAGE_MODE_BASE || VINTAGE_MODE_MAX <= vintage_mode)
+ {
+ LOGE("ERR(%s):Invalid vintage_mode (%d)", __FUNCTION__, vintage_mode);
+ return -1;
+ }
+
+ if(m_vintage_mode != vintage_mode)
+ {
+ m_vintage_mode = vintage_mode;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_VINTAGE_MODE, vintage_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_VINTAGE_MODE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getVintageMode(void)
+{
+ return m_vintage_mode;
+}
+
+//======================================================================
+
+int SecCamera::setFocusMode(int focus_mode)
+{
+ LOGV("%s(focus_mode(%d))", __FUNCTION__, focus_mode);
+
+ if(FOCUS_MODE_MAX <= focus_mode)
+ {
+ LOGE("ERR(%s):Invalid focus_mode (%d)", __FUNCTION__, focus_mode);
+ return -1;
+ }
+
+ if(m_focus_mode != focus_mode)
+ {
+ m_focus_mode = focus_mode;
+
+ if (m_focus_mode != FOCUS_MODE_FACEDETECT)
+ {
+ m_face_detect = FACE_DETECT_OFF;
+ if(m_flag_camera_start)
+ {
+// setFaceDetect(m_face_detect);
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, focus_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FOCUS_MODE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ m_face_detect = FACE_DETECT_NORMAL_ON;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, FOCUS_MODE_AUTO) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FOCUS_MODE", __FUNCTION__);
+ return -1;
+ }
+
+// setFaceDetect(m_face_detect);
+ }
+ }
+ }
+
+ return 0;
+}
+
+int SecCamera::getFocusMode(void)
+{
+ return m_focus_mode;
+}
+
+//======================================================================
+
+ int SecCamera::setFaceDetect(int face_detect)
+ {
+ LOGV("%s(face_detect(%d))", __FUNCTION__, face_detect);
+
+// if(m_face_detect != face_detect)
+ {
+ m_face_detect = face_detect;
+ if(m_flag_camera_start)
+ {
+ if(m_face_detect != FACE_DETECT_OFF)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, FOCUS_MODE_AUTO) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FOCUS_MODin face detecion", __FUNCTION__);
+ return -1;
+ }
+ }
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FACE_DETECTION, face_detect) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FACE_DETECTION", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+ int SecCamera::getFaceDetect(void)
+ {
+ return m_face_detect;
+ }
+
+ //======================================================================
+
+ int SecCamera::setGPSLatitude(const char * gps_latitude)
+ {
+ double conveted_latitude = 0;
+ LOGV("%s(gps_latitude(%s))", __FUNCTION__, gps_latitude);
+ if(gps_latitude == NULL)
+ m_gps_latitude = 0;
+ else
+ {
+ conveted_latitude = atof(gps_latitude);
+ m_gps_latitude = (long)(conveted_latitude *10000 /1);
+ }
+
+ LOGV("%s(m_gps_latitude(%ld))", __FUNCTION__, m_gps_latitude);
+ return 0;
+ }
+ int SecCamera::setGPSLongitude(const char * gps_longitude)
+ {
+ double conveted_longitude = 0;
+ LOGV("%s(gps_longitude(%s))", __FUNCTION__, gps_longitude);
+ if(gps_longitude == NULL)
+ m_gps_longitude = 0;
+ else
+ {
+ conveted_longitude = atof(gps_longitude);
+ m_gps_longitude = (long)(conveted_longitude *10000 /1);
+ }
+
+ LOGV("%s(m_gps_longitude(%ld))", __FUNCTION__, m_gps_longitude);
+ return 0;
+ }
+ int SecCamera::setGPSAltitude(const char * gps_altitude)
+ {
+ double conveted_altitude = 0;
+ LOGV("%s(gps_altitude(%s))", __FUNCTION__, gps_altitude);
+ if(gps_altitude == NULL)
+ m_gps_altitude = 0;
+ else
+ {
+ conveted_altitude = atof(gps_altitude);
+ m_gps_altitude = (long)(conveted_altitude *100 /1);
+ }
+
+ LOGV("%s(m_gps_altitude(%ld))", __FUNCTION__, m_gps_altitude);
+ return 0;
+ }
+ int SecCamera::setGPSTimeStamp(const char * gps_timestamp)
+ {
+ LOGV("%s(gps_timestamp(%s))", __FUNCTION__, gps_timestamp);
+ if(gps_timestamp == NULL)
+ m_gps_timestamp = 0;
+ else
+ m_gps_timestamp = atol(gps_timestamp);
+
+ LOGV("%s(m_gps_timestamp(%ld))", __FUNCTION__, m_gps_timestamp);
+ return 0;
+ }
+
+ //======================================================================
+ int SecCamera::setAEAWBLockUnlock(int ae_lockunlock, int awb_lockunlock)
+ {
+ LOGV("%s(ae_lockunlock(%d) , (awb_lockunlock(%d))", __FUNCTION__, ae_lockunlock, awb_lockunlock);
+ int ae_awb_status = 1;
+#if 0
+ if(ae_lockunlock == 0 && awb_lockunlock ==0)
+ ae_awb_status = AE_UNLOCK_AWB_UNLOCK;
+ else if (ae_lockunlock == 1 && awb_lockunlock ==0)
+ ae_awb_status = AE_LOCK_AWB_UNLOCK;
+ else if (ae_lockunlock == 1 && awb_lockunlock ==0)
+ ae_awb_status = AE_UNLOCK_AWB_LOCK;
+ else
+ ae_awb_status = AE_LOCK_AWB_LOCK;
+#endif
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK, ae_awb_status) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_AE_AWB_LOCKUNLOCK", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+ }
+
+ int SecCamera::setFaceDetectLockUnlock(int facedetect_lockunlock)
+ {
+ LOGV("%s(facedetect_lockunlock(%d))", __FUNCTION__, facedetect_lockunlock);
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK, facedetect_lockunlock) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+ }
+
+ int SecCamera::setObjectPosition(int x, int y)
+ {
+ LOGV("%s(setObjectPosition(x=%d, y=%d))", __FUNCTION__, x, y);
+
+ if(m_preview_width ==640)
+ x = x - 80;
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_X, x) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_X", __FUNCTION__);
+ return -1;
+ }
+
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_Y, y) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_Y", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+ }
+
+ //======================================================================
+
+ int SecCamera::setGamma(int gamma)
+ {
+ LOGV("%s(gamma(%d))", __FUNCTION__, gamma);
+
+ if(gamma<GAMMA_OFF|| GAMMA_MAX<= gamma)
+ {
+ LOGE("ERR(%s):Invalid gamma (%d)", __FUNCTION__, gamma);
+ return -1;
+ }
+
+ if(m_video_gamma!= gamma)
+ {
+ m_video_gamma = gamma;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_GAMMA, gamma) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_GAMMA", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ //======================================================================
+
+ int SecCamera::setSlowAE(int slow_ae)
+ {
+ LOGV("%s(slow_ae(%d))", __FUNCTION__, slow_ae);
+
+ if(slow_ae<GAMMA_OFF|| GAMMA_MAX<= slow_ae)
+ {
+ LOGE("ERR(%s):Invalid slow_ae (%d)", __FUNCTION__, slow_ae);
+ return -1;
+ }
+
+ if(m_slow_ae!= slow_ae)
+ {
+ m_slow_ae = slow_ae;
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_SLOW_AE, slow_ae) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_SLOW_AE", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ //======================================================================
+
+ int SecCamera::setRecordingSize(int width, int height)
+ {
+ LOGE("%s(width(%d), height(%d))", __FUNCTION__, width, height);
+
+ m_recording_width = width;
+ m_recording_height = height;
+
+ return 0;
+ }
+
+ //======================================================================
+
+int SecCamera::setExifOrientationInfo(int orientationInfo)
+{
+ LOGV("%s(orientationInfo(%d))", __FUNCTION__, orientationInfo);
+
+ if(orientationInfo < 0)
+ {
+ LOGE("ERR(%s):Invalid orientationInfo (%d)", __FUNCTION__, orientationInfo);
+ return -1;
+ }
+ m_exif_orientation = orientationInfo;
+
+ return 0;
+}
+
+ //======================================================================
+int SecCamera::setBatchReflection()
+{
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BATCH_REFLECTION, 1) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_BATCH_REFLECTION", __FUNCTION__);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/*Video call*/
+int SecCamera::setVTmode(int vtmode)
+{
+ LOGV("%s(vtmode (%d))", __FUNCTION__, vtmode);
+
+ if(vtmode < VT_MODE_OFF || VT_MODE_MAX <= vtmode)
+ {
+ LOGE("ERR(%s):Invalid vtmode (%d)", __FUNCTION__, vtmode);
+ return -1;
+ }
+
+ if(m_vtmode != vtmode)
+ {
+ m_vtmode = vtmode;
+ }
+
+ return 0;
+}
+
+/* Camcorder fix fps */
+int SecCamera::setSensorMode(int sensor_mode)
+{
+ LOGV("%s(sensor_mode (%d))", __FUNCTION__, sensor_mode);
+
+ if(sensor_mode < SENSOR_MODE_CAMERA || SENSOR_MODE_MOVIE < sensor_mode)
+ {
+ LOGE("ERR(%s):Invalid sensor mode (%d)", __FUNCTION__, sensor_mode);
+ return -1;
+ }
+
+ if(m_sensor_mode != sensor_mode)
+ {
+ m_sensor_mode = sensor_mode;
+ }
+
+ return 0;
+}
+
+/* Shot mode */
+/* SINGLE = 0
+* CONTINUOUS = 1
+* PANORAMA = 2
+* SMILE = 3
+* SELF = 6
+*/
+int SecCamera::setShotMode(int shot_mode)
+{
+ LOGV("%s(shot_mode (%d))", __FUNCTION__, shot_mode);
+ if(shot_mode < SHOT_MODE_SINGLE || SHOT_MODE_SELF < shot_mode)
+ {
+ LOGE("ERR(%s):Invalid shot_mode (%d)", __FUNCTION__, shot_mode);
+ return -1;
+ }
+ m_shot_mode = shot_mode;
+
+ return 0;
+}
+
+int SecCamera::getVTmode(void)
+{
+ return m_vtmode;
+}
+
+int SecCamera::setBlur(int blur_level)
+{
+ LOGV("%s(level (%d))", __FUNCTION__, blur_level);
+
+ if(blur_level < BLUR_LEVEL_0|| BLUR_LEVEL_MAX <= blur_level)
+ {
+ LOGE("ERR(%s):Invalid level (%d)", __FUNCTION__, blur_level);
+ return -1;
+ }
+
+ if(m_blur_level != blur_level)
+ {
+ m_blur_level = blur_level;
+
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_VGA_BLUR, blur_level) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_VGA_BLUR", __FUNCTION__);
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
+
+int SecCamera::getBlur(void)
+{
+ return m_blur_level;
+}
+
+
+int SecCamera::setDataLineCheck(int chk_dataline)
+{
+ LOGV("%s(chk_dataline (%d))", __FUNCTION__, chk_dataline);
+
+ if(chk_dataline < CHK_DATALINE_OFF || CHK_DATALINE_MAX<= chk_dataline)
+ {
+ LOGE("ERR(%s):Invalid chk_dataline (%d)", __FUNCTION__, chk_dataline);
+ return -1;
+ }
+
+ if(m_chk_dataline != chk_dataline)
+ {
+ m_chk_dataline = chk_dataline;
+ }
+
+ return 0;
+}
+
+int SecCamera::getDataLineCheck(void)
+{
+ return m_chk_dataline;
+}
+
+int SecCamera::setDataLineCheckStop(void)
+{
+ LOGV("%s", __FUNCTION__);
+
+ if(m_flag_camera_start)
+ {
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CHECK_DATALINE_STOP, 1) < 0)
+ {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_CHECK_DATALINE_STOP", __FUNCTION__);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+#endif
+
+// ======================================================================
+// Jpeg
+
+#ifndef JPEG_FROM_SENSOR
+unsigned char * SecCamera::getJpeg(unsigned char *snapshot_data, int snapshot_size, int * size)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ if(m_cam_fd <= 0)
+ {
+ LOGE("ERR(%s):Camera was closed\n", __FUNCTION__);
+ return NULL;
+ }
+
+ unsigned char * jpeg_data = NULL;
+ int jpeg_size = 0;
+
+ jpeg_data = yuv2Jpeg(snapshot_data, snapshot_size, &jpeg_size, m_snapshot_width, m_snapshot_height, m_snapshot_v4lformat);
+
+ *size = jpeg_size;
+ return jpeg_data;
+}
+#endif
+
+#ifndef JPEG_FROM_SENSOR
+unsigned char * SecCamera::yuv2Jpeg(unsigned char * raw_data, int raw_size,int * jpeg_size,int width, int height, int pixel_format)
+{
+ LOGV("%s:raw_data(%p), raw_size(%d), jpeg_size(%d), width(%d), height(%d), format(%d)",
+ __FUNCTION__, raw_data, raw_size, *jpeg_size, width, height, pixel_format);
+
+ if(m_jpeg_fd <= 0)
+ {
+ LOGE("ERR(%s):JPEG device was closed\n", __FUNCTION__);
+ return NULL;
+ }
+ if(pixel_format == V4L2_PIX_FMT_RGB565)
+ {
+ LOGE("ERR(%s):It doesn't support V4L2_PIX_FMT_RGB565\n", __FUNCTION__);
+ return NULL;
+ }
+
+ unsigned char * InBuf = NULL;
+ unsigned char * OutBuf = NULL;
+ unsigned char * jpeg_data = NULL;
+ long frameSize;
+ exif_file_info_t ExifInfo;
+
+ int input_file_format = JPG_MODESEL_YCBCR;
+
+ int out_file_format = JPG_422;
+ switch(pixel_format)
+ {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV12T:
+ case V4L2_PIX_FMT_YUV420:
+ out_file_format = JPG_420;
+ break;
+ case V4L2_PIX_FMT_YUYV:
+ case V4L2_PIX_FMT_UYVY:
+ case V4L2_PIX_FMT_YUV422P:
+ out_file_format = JPG_422;
+ break;
+ }
+
+ //////////////////////////////////////////////////////////////
+ // 2. set encode config. //
+ //////////////////////////////////////////////////////////////
+ LOGV("Step 1 : JPEG_SET_ENCODE_IN_FORMAT(JPG_MODESEL_YCBCR)");
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_ENCODE_IN_FORMAT, input_file_format) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_ENCODE_IN_FORMAT\n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 2 : JPEG_SET_SAMPING_MODE(JPG_422)");
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_SAMPING_MODE, out_file_format) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_SAMPING_MODE\n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 3 : JPEG_SET_ENCODE_WIDTH(%d)", width);
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_ENCODE_WIDTH, width) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_ENCODE_WIDTH \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 4 : JPEG_SET_ENCODE_HEIGHT(%d)", height);
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_ENCODE_HEIGHT, height) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_ENCODE_HEIGHT \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 5 : JPEG_SET_ENCODE_QUALITY(JPG_QUALITY_LEVEL_2)");
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_ENCODE_QUALITY, JPG_QUALITY_LEVEL_2) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_ENCODE_QUALITY \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+#if (INCLUDE_JPEG_THUMBNAIL == 1)
+
+ LOGV("Step 6a : JPEG_SET_ENCODE_THUMBNAIL(TRUE)");
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_ENCODE_THUMBNAIL, TRUE) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_ENCODE_THUMBNAIL \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 6b : JPEG_SET_THUMBNAIL_WIDTH(%d)", m_jpeg_thumbnail_width);
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_THUMBNAIL_WIDTH, m_jpeg_thumbnail_width) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_THUMBNAIL_WIDTH(%d) \n", __FUNCTION__, m_jpeg_thumbnail_height);
+ goto YUV2JPEG_END;
+ }
+
+ LOGV("Step 6c : JPEG_SET_THUMBNAIL_HEIGHT(%d)", m_jpeg_thumbnail_height);
+ if (SsbSipJPEGSetEncConfig(JPEG_SET_THUMBNAIL_HEIGHT, m_jpeg_thumbnail_height) != JPEG_OK) {
+ LOGE("ERR(%s):Fail on JPEG_SET_THUMBNAIL_HEIGHT(%d) \n", __FUNCTION__, m_jpeg_thumbnail_height);
+ goto YUV2JPEG_END;
+ }
+
+#endif
+
+ if(raw_size == 0) //Kamat: This is our code path
+ {
+ unsigned int addr_y;
+ int width, height,frame_size;
+ getSnapshotSize(&width, &height, &frame_size);
+ if(raw_data == NULL)
+ {
+ LOGE("%s %d] Raw data is NULL \n",__func__,__LINE__);
+ goto YUV2JPEG_END;
+ }
+ else //Kamat: our path
+ {
+ addr_y = (unsigned int)raw_data;
+ }
+
+ SsbSipJPEGSetEncodeInBuf(m_jpeg_fd, addr_y, frame_size);
+ }
+ else
+ {
+ //////////////////////////////////////////////////////////////
+ // 4. get Input buffer address //
+ //////////////////////////////////////////////////////////////
+ LOGV("Step 7 : Input buffer size(0x%X", raw_size);
+ InBuf = (unsigned char *)SsbSipJPEGGetEncodeInBuf(m_jpeg_fd, raw_size);
+ if(InBuf == NULL)
+ {
+ LOGE("ERR(%s):Fail on SsbSipJPEGGetEncodeInBuf \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+ //////////////////////////////////////////////////////////////
+ // 5. put YUV stream to Input buffer
+ //////////////////////////////////////////////////////////////
+ LOGV("Step 8: memcpy(InBuf(%p), raw_data(%p), raw_size(%d)", InBuf, raw_data, raw_size);
+ memcpy(InBuf, raw_data, raw_size);
+ }
+
+ //////////////////////////////////////////////////////////////
+ // 6. Make Exif info parameters
+ //////////////////////////////////////////////////////////////
+ LOGV("Step 9: m_makeExifParam()");
+ memset(&ExifInfo, 0x00, sizeof(exif_file_info_t));
+ m_makeExifParam(&ExifInfo);
+
+ //////////////////////////////////////////////////////////////
+ // 7. Encode YUV stream
+ //////////////////////////////////////////////////////////////
+ LOGV("Step a: SsbSipJPEGEncodeExe()");
+ if(SsbSipJPEGEncodeExe(m_jpeg_fd, &ExifInfo, JPEG_USE_SW_SCALER) != JPEG_OK) //with Exif
+ {
+ LOGE("ERR(%s):Fail on SsbSipJPEGEncodeExe \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+ //////////////////////////////////////////////////////////////
+ // 8. get output buffer address
+ //////////////////////////////////////////////////////////////
+ LOGV("Step b: SsbSipJPEGGetEncodeOutBuf()");
+ OutBuf = (unsigned char *)SsbSipJPEGGetEncodeOutBuf(m_jpeg_fd, &frameSize);
+ if(OutBuf == NULL)
+ {
+ LOGE("ERR(%s):Fail on SsbSipJPEGGetEncodeOutBuf \n", __FUNCTION__);
+ goto YUV2JPEG_END;
+ }
+ //////////////////////////////////////////////////////////////
+ // 9. write JPEG result file
+ //////////////////////////////////////////////////////////////
+ LOGV("Done");
+ jpeg_data = OutBuf;
+ *jpeg_size = (int)frameSize;
+
+YUV2JPEG_END :
+
+ return jpeg_data;
+}
+#endif
+
+int SecCamera::setJpegThumbnailSize(int width, int height)
+{
+ LOGV("%s(width(%d), height(%d))", __FUNCTION__, width, height);
+
+ m_jpeg_thumbnail_width = width;
+ m_jpeg_thumbnail_height = height;
+
+ return 0;
+}
+
+int SecCamera::getJpegThumbnailSize(int * width, int * height)
+{
+ if(width)
+ *width = m_jpeg_thumbnail_width;
+ if(height)
+ *height = m_jpeg_thumbnail_height;
+
+ return 0;
+}
+
+void SecCamera::setExifFixedAttribute()
+{
+ //2 0th IFD TIFF Tags
+ //3 Maker
+ strcpy((char *)mExifInfo.maker, EXIF_DEF_MAKER);
+ //3 Model
+ strcpy((char *)mExifInfo.model, EXIF_DEF_MODEL);
+ //3 Software
+ property_get("ro.build.PDA", (char *)mExifInfo.software, EXIF_DEF_SOFTWARE);
+ //3 YCbCr Positioning
+ mExifInfo.ycbcr_positioning = EXIF_DEF_YCBCR_POSITIONING;
+
+ //2 0th IFD Exif Private Tags
+ //3 F Number
+ mExifInfo.fnumber.num = EXIF_DEF_FNUMBER_NUM;
+ mExifInfo.fnumber.den = EXIF_DEF_FNUMBER_DEN;
+ //3 Exposure Program
+ mExifInfo.exposure_program = EXIF_DEF_EXPOSURE_PROGRAM;
+ //3 Exif Version
+ memcpy(mExifInfo.exif_version, EXIF_DEF_EXIF_VERSION, sizeof(mExifInfo.exif_version));
+ //3 Aperture
+ uint32_t av = APEX_FNUM_TO_APERTURE((double)mExifInfo.fnumber.num/mExifInfo.fnumber.den);
+ mExifInfo.aperture.num = av*EXIF_DEF_APEX_DEN;
+ mExifInfo.aperture.den = EXIF_DEF_APEX_DEN;
+ //3 Maximum lens aperture
+ mExifInfo.max_aperture.num = mExifInfo.aperture.num;
+ mExifInfo.max_aperture.den = mExifInfo.aperture.den;
+ //3 Flash
+ mExifInfo.flash = EXIF_DEF_FLASH;
+ //3 Lens Focal Length
+ mExifInfo.focal_length.num = EXIF_DEF_FOCAL_LEN_NUM;
+ mExifInfo.focal_length.den = EXIF_DEF_FOCAL_LEN_DEN;
+ //3 User Comments
+ strcpy((char *)mExifInfo.user_comment, EXIF_DEF_USERCOMMENTS);
+ //3 Color Space information
+ mExifInfo.color_space = EXIF_DEF_COLOR_SPACE;
+ //3 Exposure Mode
+ mExifInfo.exposure_mode = EXIF_DEF_EXPOSURE_MODE;
+
+ //2 0th IFD GPS Info Tags
+ unsigned char gps_version[4] = {0x02, 0x02, 0x00, 0x00};
+ memcpy(mExifInfo.gps_version_id, gps_version, sizeof(gps_version));
+
+ //2 1th IFD TIFF Tags
+ mExifInfo.compression_scheme = EXIF_DEF_COMPRESSION;
+ mExifInfo.x_resolution.num = EXIF_DEF_RESOLUTION_NUM;
+ mExifInfo.x_resolution.den = EXIF_DEF_RESOLUTION_DEN;
+ mExifInfo.y_resolution.num = EXIF_DEF_RESOLUTION_NUM;
+ mExifInfo.y_resolution.den = EXIF_DEF_RESOLUTION_DEN;
+ mExifInfo.resolution_unit = EXIF_DEF_RESOLUTION_UNIT;
+}
+
+void SecCamera::setExifChangedAttribute()
+{
+ //2 0th IFD TIFF Tags
+ //3 Width
+ mExifInfo.width = m_snapshot_width;
+ //3 Height
+ mExifInfo.height = m_snapshot_height;
+ //3 Orientation
+ switch(m_exif_orientation) {
+ case 0:
+ mExifInfo.orientation = EXIF_ORIENTATION_UP;
+ break;
+ case 90:
+ mExifInfo.orientation = EXIF_ORIENTATION_90;
+ break;
+ case 180:
+ mExifInfo.orientation = EXIF_ORIENTATION_180;
+ break;
+ case 270:
+ mExifInfo.orientation = EXIF_ORIENTATION_270;
+ break;
+ default:
+ mExifInfo.orientation = EXIF_ORIENTATION_UP;
+ break;
+ }
+ //3 Date time
+ time_t rawtime;
+ struct tm *timeinfo;
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ strftime((char *)mExifInfo.date_time, 20, "%Y:%m:%d %H:%M:%S", timeinfo);
+
+ //2 0th IFD Exif Private Tags
+ //3 Exposure Time
+ int shutterSpeed = fimc_v4l2_s_ctrl(m_cam_fd,
+ V4L2_CID_CAMERA_GET_SHT_TIME,
+ 0);
+ mExifInfo.exposure_time.num = 1;
+ mExifInfo.exposure_time.den = 1000000.0/shutterSpeed; /* us -> sec */
+
+ //3 ISO Speed Rating
+ int iso = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_GET_ISO, 0);
+ if (m_iso == ISO_AUTO) {
+ mExifInfo.iso_speed_rating = iso;
+ }
+ else {
+ switch(m_iso) {
+ case ISO_50:
+ mExifInfo.iso_speed_rating = 50;
+ break;
+ case ISO_100:
+ mExifInfo.iso_speed_rating = 100;
+ break;
+ case ISO_200:
+ mExifInfo.iso_speed_rating = 200;
+ break;
+ case ISO_400:
+ mExifInfo.iso_speed_rating = 400;
+ break;
+ case ISO_800:
+ mExifInfo.iso_speed_rating = 800;
+ break;
+ case ISO_1600:
+ mExifInfo.iso_speed_rating = 1600;
+ break;
+ default:
+ mExifInfo.iso_speed_rating = iso;
+ break;
+ }
+ }
+
+ uint32_t av, tv, bv, sv, ev;
+ av = APEX_FNUM_TO_APERTURE((double)mExifInfo.fnumber.num/mExifInfo.fnumber.den);
+ tv = APEX_EXPOSURE_TO_SHUTTER((double)mExifInfo.exposure_time.num/mExifInfo.exposure_time.den);
+ sv = APEX_ISO_TO_FILMSENSITIVITY(iso);
+ bv = av + tv - sv;
+ ev = av + tv;
+ LOGD("Shutter speed=%d us, iso=%d\n", shutterSpeed, iso);
+ LOGD("AV=%d, TV=%d, SV=%d\n", av, tv, sv);
+
+ //3 Shutter Speed
+ mExifInfo.shutter_speed.num = tv*EXIF_DEF_APEX_DEN;
+ mExifInfo.shutter_speed.den = EXIF_DEF_APEX_DEN;
+ //3 Brightness
+ mExifInfo.brightness.num = bv*EXIF_DEF_APEX_DEN;
+ mExifInfo.brightness.den = EXIF_DEF_APEX_DEN;
+ //3 Exposure Bias
+ if (m_scene_mode == SCENE_MODE_BEACH_SNOW) {
+ mExifInfo.exposure_bias.num = 1*EXIF_DEF_APEX_DEN;
+ mExifInfo.exposure_bias.den = EXIF_DEF_APEX_DEN;
+ }
+ else {
+ mExifInfo.exposure_bias.num = 0;
+ mExifInfo.exposure_bias.den = 0;
+ }
+ //3 Metering Mode
+ switch(m_metering) {
+ case METERING_SPOT:
+ mExifInfo.metering_mode = EXIF_METERING_SPOT;
+ break;
+ case METERING_MATRIX:
+ mExifInfo.metering_mode = EXIF_METERING_AVERAGE;
+ break;
+ case METERING_CENTER:
+ mExifInfo.metering_mode = EXIF_METERING_CENTER;
+ break;
+ default :
+ mExifInfo.metering_mode = EXIF_METERING_AVERAGE;
+ break;
+ }
+ //3 White Balance
+ if(m_white_balance == WHITE_BALANCE_AUTO)
+ mExifInfo.white_balance = EXIF_WB_AUTO;
+ else
+ mExifInfo.white_balance = EXIF_WB_MANUAL;
+ //3 Scene Capture Type
+ switch(m_scene_mode) {
+ case SCENE_MODE_PORTRAIT:
+ mExifInfo.scene_capture_type = EXIF_SCENE_PORTRAIT;
+ break;
+ case SCENE_MODE_LANDSCAPE:
+ mExifInfo.scene_capture_type = EXIF_SCENE_LANDSCAPE;
+ break;
+ case SCENE_MODE_NIGHTSHOT:
+ mExifInfo.scene_capture_type = EXIF_SCENE_NIGHT;
+ break;
+ default:
+ mExifInfo.scene_capture_type = EXIF_SCENE_STANDARD;
+ break;
+ }
+
+ //2 0th IFD GPS Info Tags
+ if (m_gps_latitude != 0 && m_gps_longitude != 0) {
+ if (m_gps_latitude > 0)
+ strcpy((char *)mExifInfo.gps_latitude_ref, "N");
+ else
+ strcpy((char *)mExifInfo.gps_latitude_ref, "S");
+
+ if (m_gps_longitude > 0)
+ strcpy((char *)mExifInfo.gps_longitude_ref, "E");
+ else
+ strcpy((char *)mExifInfo.gps_longitude_ref, "W");
+
+ if (m_gps_altitude > 0)
+ mExifInfo.gps_altitude_ref = 0;
+ else
+ mExifInfo.gps_altitude_ref = 1;
+
+ double latitude = fabs(m_gps_latitude/10000.0);
+ double longitude = fabs(m_gps_longitude/10000.0);
+ double altitude = fabs(m_gps_altitude/100.0);
+
+ mExifInfo.gps_latitude[0].num = (uint32_t)latitude;
+ mExifInfo.gps_latitude[0].den = 1;
+ mExifInfo.gps_latitude[1].num = (uint32_t)((latitude - mExifInfo.gps_latitude[0].num) * 60);
+ mExifInfo.gps_latitude[1].den = 1;
+ mExifInfo.gps_latitude[2].num = (uint32_t)((((latitude - mExifInfo.gps_latitude[0].num) * 60)
+ - mExifInfo.gps_latitude[1].num) * 60);
+ mExifInfo.gps_latitude[2].den = 1;
+
+ mExifInfo.gps_longitude[0].num = (uint32_t)longitude;
+ mExifInfo.gps_longitude[0].den = 1;
+ mExifInfo.gps_longitude[1].num = (uint32_t)((longitude - mExifInfo.gps_longitude[0].num) * 60);
+ mExifInfo.gps_longitude[1].den = 1;
+ mExifInfo.gps_longitude[2].num = (uint32_t)((((longitude - mExifInfo.gps_longitude[0].num) * 60)
+ - mExifInfo.gps_longitude[1].num) * 60);
+ mExifInfo.gps_longitude[2].den = 1;
+
+ mExifInfo.gps_altitude.num = (uint32_t)altitude;
+ mExifInfo.gps_altitude.den = 1;
+
+ mExifInfo.enableGps = true;
+ }
+ else {
+ mExifInfo.enableGps = false;
+ }
+
+ //2 1th IFD TIFF Tags
+ int thumbWidth, thumbHeight, thumbSrcSize;
+ getPostViewConfig(&thumbWidth, &thumbHeight, &thumbSrcSize);
+ mExifInfo.widthThumb = thumbWidth;
+ mExifInfo.heightThumb = thumbHeight;
+}
+
+// ======================================================================
+// Conversions
+
+inline int SecCamera::m_frameSize(int format, int width, int height)
+{
+ int size = 0;
+
+ switch(format)
+ {
+ case V4L2_PIX_FMT_YUV420 :
+ case V4L2_PIX_FMT_NV12 :
+ case V4L2_PIX_FMT_NV21 :
+ size = (width * height * 3 / 2);
+ break;
+
+ case V4L2_PIX_FMT_NV12T:
+ size = ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)) + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height/2));
+ break;
+
+ case V4L2_PIX_FMT_YUV422P :
+ case V4L2_PIX_FMT_YUYV :
+ case V4L2_PIX_FMT_UYVY :
+ size = (width * height * 2);
+ break;
+
+ default :
+ LOGE("ERR(%s):Invalid V4L2 pixel format(%d)\n", __FUNCTION__, format);
+ case V4L2_PIX_FMT_RGB565 :
+ size = (width * height * BPP);
+ break;
+ }
+
+ return size;
+}
+
+status_t SecCamera::dump(int fd, const Vector<String16>& args)
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+ snprintf(buffer, 255, "dump(%d)\n", fd);
+ result.append(buffer);
+ ::write(fd, result.string(), result.size());
+ return NO_ERROR;
+}
+
+}; // namespace android
diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h
new file mode 100644
index 0000000..e504ca6
--- /dev/null
+++ b/libcamera/SecCamera.h
@@ -0,0 +1,886 @@
+/*
+**
+** Copyright 2008, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifndef ANDROID_HARDWARE_CAMERA_SEC_H
+#define ANDROID_HARDWARE_CAMERA_SEC_H
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+
+#include <linux/videodev2.h>
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+#include <videodev2_samsung.h>
+#endif
+
+#include "JpegEncoder.h"
+
+#ifdef ENABLE_HDMI_DISPLAY
+#include "hdmi_lib.h"
+#endif
+
+#include <camera/CameraHardwareInterface.h>
+
+namespace android {
+
+#define PREVIEW_USING_MMAP //Define this if the preview data is to be shared using memory mapped technique instead of passing physical address.
+
+#define JPEG_FROM_SENSOR //Define this if the JPEG images are obtained directly from camera sensor. Else on chip JPEG encoder will be used.
+
+//#define DUAL_PORT_RECORDING //Define this if 2 fimc ports are needed for recording.
+
+//#define SEND_YUV_RECORD_DATA //Define this to copy YUV data to encoder instead of sharing the physical address.
+
+#define INCLUDE_JPEG_THUMBNAIL 1 //Valid only for on chip JPEG encoder
+
+#if defined PREVIEW_USING_MMAP
+#define DUAL_PORT_RECORDING
+#endif
+
+#if defined JPEG_FROM_SENSOR
+#define DIRECT_DELIVERY_OF_POSTVIEW_DATA //Define this if postview data is needed in buffer instead of zero copy.
+#endif
+
+#if defined(LOG_NDEBUG) && LOG_NDEBUG == 0
+#define LOG_CAMERA LOGD
+#define LOG_CAMERA_PREVIEW LOGD
+
+#define LOG_TIME_DEFINE(n) \
+ struct timeval time_start_##n, time_stop_##n; unsigned long log_time_##n = 0;
+
+#define LOG_TIME_START(n) \
+ gettimeofday(&time_start_##n, NULL);
+
+#define LOG_TIME_END(n) \
+ gettimeofday(&time_stop_##n, NULL); log_time_##n = measure_time(&time_start_##n, &time_stop_##n);
+
+#define LOG_TIME(n) \
+ log_time_##n
+
+#else
+#define LOG_CAMERA(...)
+#define LOG_CAMERA_PREVIEW(...)
+#define LOG_TIME_DEFINE(n)
+#define LOG_TIME_START(n)
+#define LOG_TIME_END(n)
+#define LOG_TIME(n)
+#endif
+
+#define LCD_WIDTH 480
+#define LCD_HEIGHT 800
+
+#define JOIN(x, y) JOIN_AGAIN(x, y)
+#define JOIN_AGAIN(x, y) x ## y
+
+#define FRONT_CAM VGA
+#define BACK_CAM CE147
+
+#if !defined (FRONT_CAM) || !defined(BACK_CAM)
+#error "Please define the Camera module"
+#endif
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+#define CE147_PREVIEW_WIDTH 640
+#define CE147_PREVIEW_HEIGHT 480
+#define CE147_SNAPSHOT_WIDTH 2560
+#define CE147_SNAPSHOT_HEIGHT 1920
+#else
+#define CE147_PREVIEW_WIDTH 1280
+#define CE147_PREVIEW_HEIGHT 720
+#define CE147_SNAPSHOT_WIDTH 2592
+#define CE147_SNAPSHOT_HEIGHT 1936
+#endif
+
+#define CE147_POSTVIEW_WIDTH 640
+#define CE147_POSTVIEW_WIDE_WIDTH 800
+#define CE147_POSTVIEW_HEIGHT 480
+#define CE147_POSTVIEW_BPP 16
+
+#define VGA_PREVIEW_WIDTH 640
+#define VGA_PREVIEW_HEIGHT 480
+#define VGA_SNAPSHOT_WIDTH 640
+#define VGA_SNAPSHOT_HEIGHT 480
+
+#define MAX_BACK_CAMERA_PREVIEW_WIDTH JOIN(BACK_CAM,_PREVIEW_WIDTH)
+#define MAX_BACK_CAMERA_PREVIEW_HEIGHT JOIN(BACK_CAM,_PREVIEW_HEIGHT)
+#define MAX_BACK_CAMERA_SNAPSHOT_WIDTH JOIN(BACK_CAM,_SNAPSHOT_WIDTH)
+#define MAX_BACK_CAMERA_SNAPSHOT_HEIGHT JOIN(BACK_CAM,_SNAPSHOT_HEIGHT)
+#define BACK_CAMERA_POSTVIEW_WIDTH JOIN(BACK_CAM,_POSTVIEW_WIDTH)
+#define BACK_CAMERA_POSTVIEW_WIDE_WIDTH JOIN(BACK_CAM,_POSTVIEW_WIDE_WIDTH)
+#define BACK_CAMERA_POSTVIEW_HEIGHT JOIN(BACK_CAM,_POSTVIEW_HEIGHT)
+#define BACK_CAMERA_POSTVIEW_BPP JOIN(BACK_CAM,_POSTVIEW_BPP)
+
+#define MAX_FRONT_CAMERA_PREVIEW_WIDTH JOIN(FRONT_CAM,_PREVIEW_WIDTH)
+#define MAX_FRONT_CAMERA_PREVIEW_HEIGHT JOIN(FRONT_CAM,_PREVIEW_HEIGHT)
+#define MAX_FRONT_CAMERA_SNAPSHOT_WIDTH JOIN(FRONT_CAM,_SNAPSHOT_WIDTH)
+#define MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT JOIN(FRONT_CAM,_SNAPSHOT_HEIGHT)
+
+#define DEFAULT_JPEG_THUMBNAIL_WIDTH 256
+#define DEFAULT_JPEG_THUMBNAIL_HEIGHT 192
+
+#define CAMERA_DEV_NAME "/dev/video0"
+
+#ifdef DUAL_PORT_RECORDING
+#define CAMERA_DEV_NAME2 "/dev/video2"
+#endif
+#define CAMERA_DEV_NAME_TEMP "/data/videotmp_000"
+#define CAMERA_DEV_NAME2_TEMP "/data/videotemp_002"
+
+
+#define BPP 2
+#define MIN(x, y) ((x < y) ? x : y)
+#define MAX_BUFFERS 8
+
+/*
+ * V 4 L 2 F I M C E X T E N S I O N S
+ *
+*/
+#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
+#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1)
+#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2)
+#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3)
+#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4)
+#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53)
+
+#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32)
+#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33)
+#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34)
+#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35)
+#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36)
+#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37)
+
+#define TPATTERN_COLORBAR 1
+#define TPATTERN_HORIZONTAL 2
+#define TPATTERN_VERTICAL 3
+
+#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U')
+
+/* FOURCC for FIMC specific */
+#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y')
+#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6')
+#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1')
+#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
+/*
+ * U S E R D E F I N E D T Y P E S
+ *
+*/
+
+struct fimc_buffer {
+ void *start;
+ size_t length;
+};
+
+struct yuv_fmt_list {
+ const char *name;
+ const char *desc;
+ unsigned int fmt;
+ int depth;
+ int planes;
+};
+
+//s1 [Apply factory standard]
+struct camsensor_date_info {
+ unsigned int year;
+ unsigned int month;
+ unsigned int date;
+};
+
+
+class SecCamera {
+public:
+
+ enum CAMERA_ID
+ {
+ CAMERA_ID_BACK = 1,
+ CAMERA_ID_FRONT = 2,
+ };
+
+ enum AUTO_FOCUS
+ {
+ AUTO_FOCUS_OFF,
+ AUTO_FOCUS_ON,
+ AUTO_FOCUS_STATUS,
+ };
+
+ enum WHILTE_BALANCE
+ {
+ #ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ WHITE_BALANCE_BASE,
+ WHITE_BALANCE_AUTO,
+ WHITE_BALANCE_DAYLIGHT,
+ WHITE_BALANCE_CLOUDY,
+ WHITE_BALANCE_INCANDESCENT,
+ WHITE_BALANCE_FLUORESCENT,
+ WHITE_BALANCE_MAX,
+ #else
+ WHITE_BALANCE_AUTO,
+ WHITE_BALANCE_INDOOR3100,
+ WHITE_BALANCE_OUTDOOR5100,
+ WHITE_BALANCE_INDOOR2000,
+ WHITE_BALANCE_HALT,
+ WHITE_BALANCE_CLOUDY,
+ WHITE_BALANCE_SUNNY,
+ #endif
+ };
+
+ enum BRIGHTNESS
+ {
+ BRIGHTNESS_MINUS_4= 0,
+ BRIGHTNESS_MINUS_3,
+ BRIGHTNESS_MINUS_2,
+ BRIGHTNESS_MINUS_1,
+ BRIGHTNESS_NORMAL,
+ BRIGHTNESS_PLUS_1,
+ BRIGHTNESS_PLUS_2,
+ BRIGHTNESS_PLUS_3,
+ BRIGHTNESS_PLUS_4,
+ };
+
+ enum IMAGE_EFFECT
+ {
+ #ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ IMAGE_EFFECT_BASE,
+ IMAGE_EFFECT_NONE,
+ IMAGE_EFFECT_BNW,
+ IMAGE_EFFECT_SEPIA,
+ IMAGE_EFFECT_AQUA,
+ IMAGE_EFFECT_ANTIQUE,
+ IMAGE_EFFECT_NEGATIVE,
+ IMAGE_EFFECT_SHARPEN,
+ IMAGE_EFFECT_MAX,
+ #else
+ IMAGE_EFFECT_ORIGINAL,
+ IMAGE_EFFECT_ARBITRARY,
+ IMAGE_EFFECT_NEGATIVE,
+ IMAGE_EFFECT_FREEZE,
+ IMAGE_EFFECT_EMBOSSING,
+ IMAGE_EFFECT_SILHOUETTE,
+ #endif
+ };
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ enum SCENE_MODE
+ {
+ SCENE_MODE_BASE,
+ SCENE_MODE_NONE,
+ SCENE_MODE_PORTRAIT,
+ SCENE_MODE_NIGHTSHOT,
+ SCENE_MODE_BACK_LIGHT,
+ SCENE_MODE_LANDSCAPE,
+ SCENE_MODE_SPORTS,
+ SCENE_MODE_PARTY_INDOOR,
+ SCENE_MODE_BEACH_SNOW,
+ SCENE_MODE_SUNSET,
+ SCENE_MODE_DUSK_DAWN,
+ SCENE_MODE_FALL_COLOR,
+ SCENE_MODE_FIREWORKS,
+ SCENE_MODE_TEXT,
+ SCENE_MODE_CANDLE_LIGHT,
+ SCENE_MODE_MAX,
+ };
+
+ enum FLASH_MODE
+ {
+ FLASH_MODE_BASE,
+ FLASH_MODE_OFF,
+ FLASH_MODE_AUTO,
+ FLASH_MODE_ON,
+ FLASH_MODE_TORCH,
+ FLASH_MODE_MAX,
+ };
+
+ enum ISO
+ {
+ ISO_AUTO,
+ ISO_50,
+ ISO_100,
+ ISO_200,
+ ISO_400,
+ ISO_800,
+ ISO_1600,
+ ISO_SPORTS,
+ ISO_NIGHT,
+ ISO_MOVIE,
+ ISO_MAX,
+ };
+
+ enum METERING
+ {
+ METERING_BASE = 0,
+ METERING_MATRIX,
+ METERING_CENTER,
+ METERING_SPOT,
+ METERING_MAX,
+ };
+
+ enum CONTRAST
+ {
+ CONTRAST_MINUS_2 = 0,
+ CONTRAST_MINUS_1,
+ CONTRAST_NORMAL,
+ CONTRAST_PLUS_1,
+ CONTRAST_PLUS_2,
+ CONTRAST_MAX,
+ };
+
+ enum SATURATION
+ {
+ SATURATION_MINUS_2= 0,
+ SATURATION_MINUS_1,
+ SATURATION_NORMAL,
+ SATURATION_PLUS_1,
+ SATURATION_PLUS_2,
+ SATURATION_MAX,
+ };
+
+ enum SHARPNESS
+ {
+ SHARPNESS_MINUS_2 = 0,
+ SHARPNESS_MINUS_1,
+ SHARPNESS_NORMAL,
+ SHARPNESS_PLUS_1,
+ SHARPNESS_PLUS_2,
+ SHARPNESS_MAX,
+ };
+
+ enum WDR
+ {
+ WDR_OFF,
+ WDR_ON,
+ WDR_MAX,
+ };
+
+ enum ANTI_SHAKE
+ {
+ ANTI_SHAKE_OFF,
+ ANTI_SHAKE_ON,
+ ANTI_SHAKE_MAX,
+ };
+
+ enum JPEG_QUALITY
+ {
+ JPEG_QUALITY_ECONOMY = 0,
+ JPEG_QUALITY_NORMAL = 50,
+ JPEG_QUALITY_SUPERFINE = 100,
+ JPEG_QUALITY_MAX,
+ };
+
+ enum ZOOM_LEVEL
+ {
+ ZOOM_LEVEL_0 = 0,
+ ZOOM_LEVEL_1,
+ ZOOM_LEVEL_2,
+ ZOOM_LEVEL_3,
+ ZOOM_LEVEL_4,
+ ZOOM_LEVEL_5,
+ ZOOM_LEVEL_6,
+ ZOOM_LEVEL_7,
+ ZOOM_LEVEL_8,
+ ZOOM_LEVEL_9,
+ ZOOM_LEVEL_10,
+ ZOOM_LEVEL_11,
+ ZOOM_LEVEL_12,
+ ZOOM_LEVEL_MAX,
+ };
+
+ enum OBJECT_TRACKING
+ {
+ OBJECT_TRACKING_OFF,
+ OBJECT_TRACKING_ON,
+ OBJECT_TRACKING_MAX,
+ };
+
+ enum OBJECT_TRACKING_STAUS
+ {
+ OBJECT_TRACKING_STATUS_BASE,
+ OBJECT_TRACKING_STATUS_PROGRESSING,
+ OBJECT_TRACKING_STATUS_SUCCESS,
+ OBJECT_TRACKING_STATUS_FAIL,
+ OBJECT_TRACKING_STATUS_MISSING,
+ OBJECT_TRACKING_STATUS_MAX,
+ };
+
+ enum SMART_AUTO
+ {
+ SMART_AUTO_OFF,
+ SMART_AUTO_ON,
+ SMART_AUTO_MAX,
+ };
+
+ enum BEAUTY_SHOT
+ {
+ BEAUTY_SHOT_OFF,
+ BEAUTY_SHOT_ON,
+ BEAUTY_SHOT_MAX,
+ };
+
+ enum VINTAGE_MODE
+ {
+ VINTAGE_MODE_BASE,
+ VINTAGE_MODE_OFF,
+ VINTAGE_MODE_NORMAL,
+ VINTAGE_MODE_WARM,
+ VINTAGE_MODE_COOL,
+ VINTAGE_MODE_BNW,
+ VINTAGE_MODE_MAX,
+ };
+
+ enum FOCUS_MODE
+ {
+ FOCUS_MODE_AUTO,
+ FOCUS_MODE_MACRO,
+ FOCUS_MODE_FACEDETECT,
+ FOCUS_MODE_AUTO_DEFAULT,
+ FOCUS_MODE_MACRO_DEFAULT,
+ FOCUS_MODE_FACEDETECT_DEFAULT,
+ FOCUS_MODE_MAX,
+ };
+
+ enum FACE_DETECT
+ {
+ FACE_DETECT_OFF,
+ FACE_DETECT_NORMAL_ON,
+ FACE_DETECT_BEAUTY_ON,
+ FACE_DETECT_NO_LINE,
+ FACE_DETECT_MAX,
+ };
+
+ enum AE_AWB_LOCK_UNLOCK
+ {
+ AE_UNLOCK_AWB_UNLOCK = 0,
+ AE_LOCK_AWB_UNLOCK,
+ AE_UNLOCK_AWB_LOCK,
+ AE_LOCK_AWB_LOCK,
+ AE_AWB_MAX
+ };
+
+ enum FRAME_RATE
+ {
+ FRAME_RATE_AUTO = 0,
+ FRAME_RATE_15 = 15,
+ FRAME_RATE_30 = 30,
+ FRAME_RATE_60 = 60,
+ FRAME_RATE_120 = 120,
+ FRAME_RATE_MAX
+ };
+ enum ANTI_BANDING
+ {
+ ANTI_BANDING_AUTO = 0,
+ ANTI_BANDING_50HZ = 1,
+ ANTI_BANDING_60HZ = 2,
+ ANTI_BANDING_OFF = 3,
+ };
+
+ enum SMART_AUTO_SCENE
+ {
+ SMART_AUTO_STATUS_AUTO = 0,
+ SMART_AUTO_STATUS_LANDSCAPE,
+ SMART_AUTO_STATUS_PORTRAIT,
+ SMART_AUTO_STATUS_MACRO,
+ SMART_AUTO_STATUS_NIGHT,
+ SMART_AUTO_STATUS_PORTRAIT_NIGHT,
+ SMART_AUTO_STATUS_BACKLIT,
+ SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
+ SMART_AUTO_STATUS_ANTISHAKE,
+ SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
+ SMART_AUTO_STATUS_MAX,
+ };
+
+ enum GAMMA
+ {
+ GAMMA_OFF,
+ GAMMA_ON,
+ GAMMA_MAX,
+ };
+
+ enum SLOW_AE
+ {
+ SLOW_AE_OFF,
+ SLOW_AE_ON,
+ SLOW_AE_MAX,
+ };
+
+ /*VT call*/
+ enum VT_MODE
+ {
+ VT_MODE_OFF,
+ VT_MODE_ON,
+ VT_MODE_MAX,
+ };
+
+ /*Camera sensor mode - Camcorder fix fps*/
+ enum SENSOR_MODE
+ {
+ SENSOR_MODE_CAMERA,
+ SENSOR_MODE_MOVIE,
+ };
+
+ /*Camera Shot mode*/
+ enum SHOT_MODE
+ {
+ SHOT_MODE_SINGLE = 0,
+ SHOT_MODE_CONTINUOUS = 1,
+ SHOT_MODE_PANORAMA = 2,
+ SHOT_MODE_SMILE = 3,
+ SHOT_MODE_SELF = 6,
+ };
+
+ enum BLUR_LEVEL
+ {
+ BLUR_LEVEL_0 = 0,
+ BLUR_LEVEL_1,
+ BLUR_LEVEL_2,
+ BLUR_LEVEL_3,
+ BLUR_LEVEL_MAX,
+ };
+
+ enum CHK_DATALINE
+ {
+ CHK_DATALINE_OFF,
+ CHK_DATALINE_ON,
+ CHK_DATALINE_MAX,
+ };
+
+ enum FACE_LOCK
+ {
+ FACE_LOCK_OFF,
+ FACE_LOCK_ON,
+ FIRST_FACE_TRACKING,
+ FACE_LOCK_MAX
+ };
+
+ int m_touch_af_start_stop;
+ int m_focus_mode;
+ int m_iso;
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ struct gps_info_latiude {
+ unsigned int north_south;
+ unsigned int dgree;
+ unsigned int minute;
+ unsigned int second;
+ }gpsInfoLatitude;
+ struct gps_info_longitude {
+ unsigned int east_west;
+ unsigned int dgree;
+ unsigned int minute;
+ unsigned int second;
+ }gpsInfoLongitude;
+ struct gps_info_altitude {
+ unsigned int plus_minus;
+ unsigned int dgree;
+ unsigned int minute;
+ unsigned int second;
+ }gpsInfoAltitude;
+#endif
+
+
+#endif
+
+ SecCamera();
+ ~SecCamera();
+
+ static SecCamera * createInstance(void)
+ {
+ static SecCamera singleton;
+ return &singleton;
+ }
+ status_t dump(int fd, const Vector<String16>& args);
+
+ int flagCreate(void) const;
+
+
+ int setCameraId(int camera_id);
+ int getCameraId(void);
+
+ int startPreview(void);
+ int stopPreview (void);
+#ifdef DUAL_PORT_RECORDING
+ int startRecord(void);
+ int stopRecord (void);
+ int getRecord(void);
+ unsigned int getRecPhyAddrY(int);
+ unsigned int getRecPhyAddrC(int);
+#endif
+ int flagPreviewStart(void);
+ // int getPreview (unsigned char * buffer, unsigned int buffer_size);
+ int getPreview(void);
+ //int getPreview(int *offset, int *size, unsigned char * buffer, unsigned int buffer_size);
+ int setPreviewSize(int width, int height, int pixel_format);
+ int getPreviewSize(int * width, int * height, int * frame_size);
+ int getPreviewMaxSize(int * width, int * height);
+ int getPreviewPixelFormat(void);
+ int setPreviewImage(int index, unsigned char * buffer, int size);
+
+
+ int getSnapshot(unsigned char * buffer, unsigned int buffer_size);
+ int setSnapshotSize(int width, int height);
+ int getSnapshotSize(int * width, int * height, int * frame_size);
+ int getSnapshotMaxSize(int * width, int * height);
+ int setSnapshotPixelFormat(int pixel_format);
+ int getSnapshotPixelFormat(void);
+
+ unsigned char * getJpeg (unsigned char *snapshot_data, int snapshot_size, int * size);
+ unsigned char * yuv2Jpeg (unsigned char * raw_data, int raw_size,
+ int * jpeg_size,
+ int width, int height, int pixel_format);
+
+ int setJpegThumbnailSize(int width, int height);
+ int getJpegThumbnailSize(int * width, int * height);
+
+ int setAutofocus(void);
+ int zoomIn(void);
+ int zoomOut(void);
+
+ int SetRotate(int angle);
+ int getRotate(void);
+
+ int setVerticalMirror(void);
+ int setHorizontalMirror(void);
+
+ int setWhiteBalance(int white_balance);
+ int getWhiteBalance(void);
+
+ int setBrightness(int brightness);
+ int getBrightness(void);
+
+ int setImageEffect(int image_effect);
+ int getImageEffect(void);
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ int setSceneMode(int scene_mode);
+ int getSceneMode(void);
+
+ int setFlashMode(int flash_mode);
+ int getFlashMode(void);
+
+ int setMetering(int metering_value);
+ int getMetering(void);
+
+ int setISO(int iso_value);
+ int getISO(void);
+
+ int setContrast(int contrast_value);
+ int getContrast(void);
+
+ int setSaturation(int saturation_value);
+ int getSaturation(void);
+
+ int setSharpness(int sharpness_value);
+ int getSharpness(void);
+
+ int setWDR(int wdr_value);
+ int getWDR(void);
+
+ int setAntiShake(int anti_shake);
+ int getAntiShake(void);
+
+ int setJpegQuality(int jpeg_qality);
+ int getJpegQuality(void);
+
+ int setZoom(int zoom_level);
+ int getZoom(void);
+
+ int setObjectTracking(int object_tracking);
+ int getObjectTracking(void);
+ int getObjectTrackingStatus(void);
+
+ int setSmartAuto(int smart_auto);
+ int getSmartAuto(void);
+ int getAutosceneStatus(void);
+
+ int setBeautyShot(int beauty_shot);
+ int getBeautyShot(void);
+
+ int setVintageMode(int vintage_mode);
+ int getVintageMode(void);
+
+ int setFocusMode(int focus_mode);
+ int getFocusMode(void);
+
+ int setFaceDetect(int face_detect);
+ int getFaceDetect(void);
+
+ int setGPSLatitude(const char * gps_latitude);
+ int setGPSLongitude(const char * gps_longitude);
+ int setGPSAltitude(const char * gps_altitude);
+ int setGPSTimeStamp(const char * gps_timestamp);
+ int cancelAutofocus(void);
+ int setAEAWBLockUnlock(int ae_lockunlock, int awb_lockunlock);
+ int setFaceDetectLockUnlock(int facedetect_lockunlock);
+ int setObjectPosition(int x, int y);
+ int setObjectTrackingStartStop(int start_stop);
+ int setTouchAFStartStop(int start_stop);
+ int setCAFStatus(int on_off);
+ int getAutoFocusResult(void);
+ int setAntiBanding(int anti_banding);
+ int getPostview(void);
+ int setRecordingSize(int width, int height);
+ int setGamma(int gamma);
+ int setSlowAE(int slow_ae);
+ int setExifOrientationInfo(int orientationInfo);
+ int setBatchReflection(void);
+ int setSnapshotCmd(void);
+ int setCameraSensorReset(void); //s1_camera [ Defense process by ESD input ]
+ int setSensorMode(int sensor_mode); /* Camcorder fix fps */
+ int setShotMode(int shot_mode); /* Shot mode */
+ /*VT call*/
+ int setVTmode(int vtmode);
+ int getVTmode(void);
+ int setBlur(int blur_level);
+ int getBlur(void);
+ int setDataLineCheck(int chk_dataline);
+ int getDataLineCheck(void);
+ int setDataLineCheckStop(void);
+ int setDefultIMEI(int imei);
+ int getDefultIMEI(void);
+#endif
+
+ void setFrameRate(int frame_rate);
+// void setJpegQuality(int quality);
+ unsigned char* getJpeg(int*, unsigned int*);
+ unsigned char* getSnapshotAndJpeg(void);
+ //[zzangdol] add function
+ int getExif(unsigned char *pExifDst, unsigned char *pThumbSrc);
+
+#ifdef JPEG_FROM_SENSOR
+ void getPostViewConfig(int*, int*, int*);
+#endif
+
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+ int getPostViewOffset(void);
+#endif
+ int getCameraFd(void);
+ int getJpegFd(void);
+ void SetJpgAddr(unsigned char *addr);
+ unsigned int getPhyAddrY(int);
+ unsigned int getPhyAddrC(int);
+#ifdef SEND_YUV_RECORD_DATA
+ void getYUVBuffers(unsigned char** virYAddr, unsigned char** virCaddr, int index);
+#endif
+ void pausePreview();
+ int initCamera();
+ void DeinitCamera();
+
+private:
+ int m_flag_init;
+
+ int m_camera_id;
+
+ int m_cam_fd;
+
+ int m_cam_fd_temp;
+ int m_cam_fd2_temp;
+#ifdef DUAL_PORT_RECORDING
+ int m_cam_fd2;
+ struct pollfd m_events_c2;
+ int m_flag_record_start;
+ struct fimc_buffer m_buffers_c2[MAX_BUFFERS];
+#endif
+
+ int m_preview_v4lformat;
+ int m_preview_width;
+ int m_preview_height;
+ int m_preview_max_width;
+ int m_preview_max_height;
+
+ int m_snapshot_v4lformat;
+ int m_snapshot_width;
+ int m_snapshot_height;
+ int m_snapshot_max_width;
+ int m_snapshot_max_height;
+
+ int m_angle;
+ int m_fps;
+ int m_autofocus;
+ int m_white_balance;
+ int m_brightness;
+ int m_image_effect;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ int m_anti_banding;
+ int m_scene_mode;
+ int m_flash_mode;
+// int m_iso;
+ int m_metering;
+ int m_contrast;
+ int m_saturation;
+ int m_sharpness;
+ int m_wdr;
+ int m_anti_shake;
+// int m_jpeg_quality;
+ int m_zoom_level;
+ int m_object_tracking;
+ int m_smart_auto;
+ int m_beauty_shot;
+ int m_vintage_mode;
+// int m_focus_mode;
+ int m_face_detect;
+ int m_object_tracking_start_stop;
+ int m_recording_width;
+ int m_recording_height;
+ long m_gps_latitude;
+ long m_gps_longitude;
+ long m_gps_altitude;
+ long m_gps_timestamp;
+ int m_vtmode;
+ int m_sensor_mode; /*Camcorder fix fps */
+ int m_shot_mode; /* Shot mode */
+ int m_exif_orientation;
+ int m_blur_level;
+ int m_chk_dataline;
+ int m_video_gamma;
+ int m_slow_ae;
+ int m_caf_on_off;
+ int m_default_imei;
+ int m_camera_af_flag;
+#endif
+
+ int m_flag_camera_start;
+
+ int m_jpeg_fd;
+ int m_jpeg_thumbnail_width;
+ int m_jpeg_thumbnail_height;
+ int m_jpeg_quality;
+
+ int m_postview_offset;
+
+ exif_attribute_t mExifInfo;
+
+ struct fimc_buffer m_buffers_c[MAX_BUFFERS];
+ struct pollfd m_events_c;
+
+ inline int m_frameSize(int format, int width, int height);
+
+ void setExifChangedAttribute();
+ void setExifFixedAttribute();
+ void resetCamera();
+};
+
+extern unsigned long measure_time(struct timeval *start, struct timeval *stop);
+
+}; // namespace android
+
+#endif // ANDROID_HARDWARE_CAMERA_SEC_H
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
new file mode 100644
index 0000000..5c2dc76
--- /dev/null
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -0,0 +1,2370 @@
+/*
+**
+** Copyright 2008, The Android Open Source Project
+** Copyright@ Samsung Electronics Co. LTD
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "CameraHardwareSec"
+#include <utils/Log.h>
+
+#include "SecCameraHWInterface.h"
+#include <utils/threads.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#ifdef SEND_YUV_RECORD_DATA
+#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
+#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
+#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
+#define RECORD_HEAP_SIZE (ALIGN_TO_8KB(ALIGN_TO_128B(1280) * ALIGN_TO_32B(720)) + ALIGN_TO_8KB(ALIGN_TO_128B(1280) * ALIGN_TO_32B(720/2)))
+#endif
+
+namespace android {
+
+struct ADDRS
+{
+ unsigned int addr_y;
+ unsigned int addr_cbcr;
+};
+
+struct ADDRS_CAP
+{
+ unsigned int addr_y;
+ unsigned int width;
+ unsigned int height;
+};
+
+CameraHardwareSec::CameraHardwareSec()
+ : mParameters(),
+ mPreviewHeap(0),
+ mRawHeap(0),
+ mRecordHeap(0),
+ mJpegHeap(0),
+ mSecCamera(NULL),
+ mPreviewRunning(false),
+ mPreviewFrameSize(0),
+ mRawFrameSize(0),
+ mPreviewFrameRateMicrosec(33000),
+ mNotifyCb(0),
+ mDataCb(0),
+ mDataCbTimestamp(0),
+ mCallbackCookie(0),
+ mMsgEnabled(0),
+ mCurrentPreviewFrame(0),
+ mRecordRunning(false)
+#ifdef JPEG_FROM_SENSOR
+ ,
+ mPostViewWidth(0),
+ mPostViewHeight(0),
+ mPostViewSize(0)
+#endif
+ #ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ ,
+ mObjectTrackingStatus(0),
+ mSmartautosceneRunning(false),
+ mSmartautoscene_current_status(0),
+ mSmartautoscene_previous_status(0)
+ #endif
+{
+ LOGV("%s()", __FUNCTION__);
+ int ret = 0;
+ mNoHwHandle = 0;
+
+ mSecCamera = SecCamera::createInstance();
+ if(mSecCamera == NULL)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera object creation", __FUNCTION__);
+ }
+
+ ret = mSecCamera->initCamera();
+ if(ret < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera init", __FUNCTION__);
+ }
+
+ if(mSecCamera->flagCreate() == 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->flagCreate()", __FUNCTION__);
+ }
+
+#ifndef PREVIEW_USING_MMAP
+ int previewHeapSize = sizeof(struct ADDRS) * kBufferCount;
+ LOGV("mPreviewHeap : MemoryHeapBase(previewHeapSize(%d))", previewHeapSize);
+ mPreviewHeap = new MemoryHeapBase(previewHeapSize);
+ if (mPreviewHeap->getHeapID() < 0)
+ {
+ LOGE("ERR(%s): Preview heap creation fail", __func__);
+ mPreviewHeap.clear();
+ }
+#endif
+
+#ifdef SEND_YUV_RECORD_DATA
+ int recordHeapSize = RECORD_HEAP_SIZE;
+#else
+ int recordHeapSize = sizeof(struct ADDRS) * kBufferCount;
+#endif
+ LOGV("mRecordHeap : MemoryHeapBase(recordHeapSize(%d))", recordHeapSize);
+ mRecordHeap = new MemoryHeapBase(recordHeapSize);
+ if (mRecordHeap->getHeapID() < 0)
+ {
+ LOGE("ERR(%s): Record heap creation fail", __func__);
+ mRecordHeap.clear();
+ }
+
+#ifdef JPEG_FROM_SENSOR
+ mSecCamera->getPostViewConfig(&mPostViewWidth, &mPostViewHeight, &mPostViewSize);
+ LOGV("mPostViewWidth = %d mPostViewHeight = %d mPostViewSize = %d",mPostViewWidth,mPostViewHeight,mPostViewSize);
+#endif
+
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+ int rawHeapSize = mPostViewSize;
+#else
+ int rawHeapSize = sizeof(struct ADDRS_CAP);
+#endif
+ LOGV("mRawHeap : MemoryHeapBase(previewHeapSize(%d))", rawHeapSize);
+ mRawHeap = new MemoryHeapBase(rawHeapSize);
+ if (mRawHeap->getHeapID() < 0)
+ {
+ LOGE("ERR(%s): Raw heap creation fail", __func__);
+ mRawHeap.clear();
+ }
+
+ initDefaultParameters();
+}
+
+void CameraHardwareSec::initDefaultParameters()
+{
+ if(mSecCamera == NULL)
+ {
+ LOGE("ERR(%s):mSecCamera object is NULL", __FUNCTION__);
+ return;
+ }
+
+ CameraParameters p;
+
+ int preview_max_width = 0;
+ int preview_max_height = 0;
+ int snapshot_max_width = 0;
+ int snapshot_max_height = 0;
+
+ int camera_id = 1;
+
+ p.set("camera-id", camera_id);
+
+ if(camera_id == 1)
+ mSecCamera->setCameraId(SecCamera::CAMERA_ID_BACK);
+ else
+ mSecCamera->setCameraId(SecCamera::CAMERA_ID_FRONT);
+
+ if(mSecCamera->getPreviewMaxSize(&preview_max_width, &preview_max_height) < 0)
+ {
+ LOGE("getPreviewMaxSize fail (%d / %d) \n", preview_max_width, preview_max_height);
+ preview_max_width = LCD_WIDTH;
+ preview_max_height = LCD_HEIGHT;
+ }
+ if(mSecCamera->getSnapshotMaxSize(&snapshot_max_width, &snapshot_max_height) < 0)
+ {
+ LOGE("getSnapshotMaxSize fail (%d / %d) \n", snapshot_max_width, snapshot_max_height);
+ snapshot_max_width = LCD_WIDTH;
+ snapshot_max_height = LCD_HEIGHT;
+ }
+
+#ifdef PREVIEW_USING_MMAP
+ p.setPreviewFormat("yuv420sp");
+#else
+ p.setPreviewFormat("yuv420sp_custom");
+#endif
+ p.setPreviewSize(preview_max_width, preview_max_height);
+ p.setPreviewFrameRate(30);
+
+ p.setPictureFormat("jpeg");
+ p.setPictureSize(snapshot_max_width, snapshot_max_height);
+ p.set("jpeg-quality", "100"); // maximum quality
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ p.set("preview-size-values","640x480,800x480"); //s1_camera [ 3-party application ¿¡¼­ get supported preview size ¾ÈµÇ´Â Çö»ó ¼öÁ¤ ]
+ p.set("picture-size-values","2560x1920,2048x1536,1600x1200,640x480,2560x1536,2048x1232,1600x960,800x480");
+ p.set("preview-format-values", "yuv420sp");
+ p.set("preview-frame-rate-values", "15,30");
+ p.set("picture-format-values", "jpeg");
+ p.set(CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES, "160x120,0x0");
+ p.set(CameraParameters::KEY_VIDEO_FRAME_FORMAT, CameraParameters::PIXEL_FORMAT_YUV420SP);
+ p.set("focus-mode-values", "auto,macro");
+ p.set("antibanding-values", "auto,50hz,60hz,off");
+ p.set("effect-values", "none,mono,negative,sepia");
+ p.set("flash-mode-values", "off");
+// p.set("focus-mode-values", "auto,infinity,macro");
+ p.set("scene-mode-values", "auto,portrait,landscape,night,beach,snow,sunset,fireworks,sports,party,candlelight");
+ p.set("whitebalance-values", "auto,incandescent,fluorescent,daylight,cloudy-daylight");
+//add the max and min for adjust value[20100728 giung.jung]
+ p.set("sharpness-min", 0);
+ p.set("sharpness-max", 4);
+ p.set("saturation-min", 0);
+ p.set("saturation-max", 4);
+ p.set("contrast-min", 0);
+ p.set("contrast-max", 4);
+
+#else
+ // List supported picture size values //Kamat
+ p.set("picture-size-values", "2560x1920,2048x1536,1600x1200,1280x960");
+#endif
+ // These values must be multiples of 16, so we can't do 427x320, which is the exact size on
+ // screen we want to display at. 480x360 doesn't work either since it's a multiple of 8.
+ p.set(CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH, "160");
+ p.set(CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT, "120");
+ p.set(CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY, "100");
+
+ p.set("rotation", 0);
+ p.set("whitebalance", "auto");
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ p.set("effect", "none");
+ p.set("scene-mode", "auto");
+ p.set("vintagemode", "off");
+ p.set("sharpness", 2);
+ p.set("contrast", 2);
+ p.set("saturation", 2);
+ p.set("iso", "auto");
+ p.set("metering", "center");
+ //p.set("facedetect", 0);
+ p.set("flash-mode", "off");
+ p.set("focus-mode", "auto");
+ p.set("anti-shake", 0);
+ p.set("wdr", 0);
+ p.set("smart-auto",0);
+ p.set("beauty-shot", 0);
+ p.set("antibanding", "auto");
+ p.set("video_recording_gamma", "off");
+ p.set("slow_ae", "off");
+ p.set("vtmode", 0);
+ p.set("chk_dataline", 0);
+ p.set("blur", 0);
+#else
+ p.set("image-effects", "original");
+#endif
+
+ p.set(CameraParameters::KEY_ZOOM, "0");
+ p.set(CameraParameters::KEY_ZOOM_SUPPORTED, "true");
+ p.set(CameraParameters::KEY_MAX_ZOOM, "12");
+ p.set(CameraParameters::KEY_ZOOM_RATIOS, "100,125,150,175,200,225,250,275,300,324,350,375,400");
+
+ p.set(CameraParameters::KEY_FOCAL_LENGTH, "3.79");
+
+ p.set(CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE, "51.2");
+ p.set(CameraParameters::KEY_VERTICAL_VIEW_ANGLE, "39.4");
+
+ p.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, "0");
+ p.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "4");
+ p.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-4");
+ p.set(CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5");
+
+ p.set("AppShutterSound", 0);
+ if (setParameters(p) != NO_ERROR)
+ {
+ LOGE("ERR(%s):Fail on setParameters(p)", __FUNCTION__);
+ }
+}
+
+CameraHardwareSec::~CameraHardwareSec()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ mSecCamera->DeinitCamera();
+
+ if(mRawHeap != NULL)
+ mRawHeap.clear();
+
+ if(mJpegHeap != NULL)
+ mJpegHeap.clear();
+
+ if(mPreviewHeap != NULL)
+ mPreviewHeap.clear();
+
+ if(mRecordHeap != NULL)
+ mRecordHeap.clear();
+
+ mSecCamera = NULL;
+
+ singleton.clear();
+}
+
+sp<IMemoryHeap> CameraHardwareSec::getPreviewHeap() const
+{
+ return mPreviewHeap;
+}
+
+sp<IMemoryHeap> CameraHardwareSec::getRawHeap() const
+{
+ return mRawHeap;
+}
+
+//Kamat added: New code as per eclair framework
+void CameraHardwareSec::setCallbacks(notify_callback notify_cb,
+ data_callback data_cb,
+ data_callback_timestamp data_cb_timestamp,
+ void* user)
+{
+ Mutex::Autolock lock(mLock);
+ mNotifyCb = notify_cb;
+ mDataCb = data_cb;
+ mDataCbTimestamp = data_cb_timestamp;
+ mCallbackCookie = user;
+}
+
+void CameraHardwareSec::enableMsgType(int32_t msgType)
+{
+ Mutex::Autolock lock(mLock);
+ mMsgEnabled |= msgType;
+}
+
+void CameraHardwareSec::disableMsgType(int32_t msgType)
+{
+ Mutex::Autolock lock(mLock);
+ mMsgEnabled &= ~msgType;
+}
+
+bool CameraHardwareSec::msgTypeEnabled(int32_t msgType)
+{
+ Mutex::Autolock lock(mLock);
+ return (mMsgEnabled & msgType);
+}
+
+// ---------------------------------------------------------------------------
+
+int CameraHardwareSec::previewThread()
+{
+ int index;
+
+ index = mSecCamera->getPreview();
+ if(index < 0)
+ {
+ LOGE("ERR(%s):Fail on SecCamera->getPreview()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+
+ nsecs_t timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
+
+#ifdef PREVIEW_USING_MMAP
+ int width, height, frame_size, offset;
+ mSecCamera->getPreviewSize(&width, &height, &frame_size);
+
+ offset = (frame_size+8)*index;
+ sp<MemoryBase> buffer = new MemoryBase(mPreviewHeap, offset, frame_size);
+
+ unsigned int phyYAddr = mSecCamera->getPhyAddrY(index);
+ unsigned int phyCAddr = mSecCamera->getPhyAddrC(index);
+ if(phyYAddr == 0xffffffff || phyCAddr == 0xffffffff)
+ {
+ LOGE("ERR(%s):Fail on SecCamera. Invalid PhyAddr, Y addr = %0x C addr = %0x", __FUNCTION__, phyYAddr, phyCAddr);
+ return UNKNOWN_ERROR;
+ }
+ memcpy(static_cast<unsigned char *>(mPreviewHeap->base()) + (offset+frame_size ), &phyYAddr, 4);
+ memcpy(static_cast<unsigned char *>(mPreviewHeap->base()) + (offset+frame_size+4), &phyCAddr, 4);
+#else
+ unsigned int phyYAddr = mSecCamera->getPhyAddrY(index);
+ unsigned int phyCAddr = mSecCamera->getPhyAddrC(index);
+ if(phyYAddr == 0xffffffff || phyCAddr == 0xffffffff)
+ {
+ LOGE("ERR(%s):Fail on SecCamera getPhyAddr Y addr = %0x C addr = %0x", __FUNCTION__, phyYAddr, phyCAddr);
+ return UNKNOWN_ERROR;
+ }
+ struct ADDRS *addrs = (struct ADDRS *)mPreviewHeap->base();
+
+ sp<MemoryBase> buffer = new MemoryBase(mPreviewHeap, index * sizeof(struct ADDRS), sizeof(struct ADDRS));
+ addrs[index].addr_y = phyYAddr;
+ addrs[index].addr_cbcr = phyCAddr;
+#endif //PREVIEW_USING_MMAP
+
+ // Notify the client of a new frame. //Kamat --eclair
+ if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME)
+ {
+ mDataCb(CAMERA_MSG_PREVIEW_FRAME, buffer, mCallbackCookie);
+ }
+// LOG_CAMERA_PREVIEW("previewThread: addr_y(0x%08X) addr_cbcr(0x%08X)", addrs[index].addr_y, addrs[index].addr_cbcr);
+
+ if(mRecordRunning == true)
+ {
+#ifdef SEND_YUV_RECORD_DATA
+ int width, height, frame_size;
+ unsigned char* virYAddr;
+ unsigned char* virCAddr;
+ mSecCamera->getPreviewSize(&width, &height, &frame_size);
+ mSecCamera->getYUVBuffers(&virYAddr, &virCAddr, index);
+ sp<MemoryBase> buffer = new MemoryBase(mRecordHeap, 0, frame_size);
+ //memcpy(mRecordHeap->base(), (void*)virYAddr, width*height);
+ //memcpy(mRecordHeap->base()+(width*height),(void*)virCAddr, width*height*0.5);
+ memcpy(mRecordHeap->base(), (void*)virYAddr, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
+ memcpy(mRecordHeap->base() + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)),(void*)virCAddr, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height/2)));
+#else
+#ifdef DUAL_PORT_RECORDING
+ int index = mSecCamera->getRecord();
+ if(index < 0)
+ {
+ LOGE("ERR(%s):Fail on SecCamera->getRecord()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+ unsigned int phyYAddr = mSecCamera->getRecPhyAddrY(index);
+ unsigned int phyCAddr = mSecCamera->getRecPhyAddrC(index);
+ if(phyYAddr == 0xffffffff || phyCAddr == 0xffffffff)
+ {
+ LOGE("ERR(%s):Fail on SecCamera getRectPhyAddr Y addr = %0x C addr = %0x", __FUNCTION__, phyYAddr, phyCAddr);
+ return UNKNOWN_ERROR;
+ }
+#endif//DUAL_PORT_RECORDING
+ struct ADDRS *addrs = (struct ADDRS *)mRecordHeap->base();
+
+ sp<MemoryBase> buffer = new MemoryBase(mRecordHeap, index * sizeof(struct ADDRS), sizeof(struct ADDRS));
+ addrs[index].addr_y = phyYAddr;
+ addrs[index].addr_cbcr = phyCAddr;
+#endif
+ // Notify the client of a new frame. //Kamat --eclair
+ if (mMsgEnabled & CAMERA_MSG_VIDEO_FRAME)
+ {
+ //nsecs_t timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
+ mDataCbTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME, buffer, mCallbackCookie);
+ }
+ }
+#ifdef DUAL_PORT_RECORDING
+ else if(mRecordRunning == false)
+ {
+ if(mSecCamera->stopRecord() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->stopRecord()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+ }
+#endif
+
+// buffer.clear();
+
+ // Wait for it...
+ if(mTimeStart.tv_sec == 0 && mTimeStart.tv_usec == 0)
+ {
+ gettimeofday(&mTimeStart, NULL);
+ } else
+ {
+ gettimeofday(&mTimeStop, NULL);
+ long time = measure_time(&mTimeStart, &mTimeStop);
+
+ int delay = (mPreviewFrameRateMicrosec > time) ? mPreviewFrameRateMicrosec - time : 0;
+ usleep(delay);
+ //LOG_CAMERA_PREVIEW("delay = %d time = %ld us\n ", delay, time);
+ gettimeofday(&mTimeStart, NULL);
+ }
+
+ return NO_ERROR;
+}
+
+status_t CameraHardwareSec::startPreview()
+{
+ int ret = 0; //s1 [Apply factory standard]
+
+ LOGE("%s()", __FUNCTION__);
+
+ Mutex::Autolock lock(mLock);
+ if (mPreviewThread != 0) {
+ // already running
+ return INVALID_OPERATION;
+ }
+
+ memset(&mTimeStart, 0, sizeof(mTimeStart));
+ memset(&mTimeStop, 0, sizeof(mTimeStop));
+
+ mSecCamera->stopPreview();
+
+#if 1 //s1 [Apply factory standard]
+ ret = mSecCamera->startPreview();
+ LOGE("%s : return startPreview %d", __FUNCTION__, ret);
+
+ if(ret < 0)
+#else
+ if(mSecCamera->startPreview() < 0)
+#endif
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->startPreview()", __FUNCTION__);
+ if (mMsgEnabled & CAMERA_MSG_ERROR)
+ {
+ mNotifyCb(CAMERA_MSG_ERROR, -2, 0, mCallbackCookie);
+ }
+ return -1; //UNKNOWN_ERROR;
+ }
+
+#ifdef PREVIEW_USING_MMAP
+ if(mPreviewHeap != NULL)
+ mPreviewHeap.clear();
+ int width, height, frame_size;
+ mSecCamera->getPreviewSize(&width, &height, &frame_size);
+ int previewHeapSize = (frame_size+8) * kBufferCount;
+ LOGD("MemoryHeapBase(fd(%d), size(%d), width(%d), height(%d))", (int)mSecCamera->getCameraFd(), (size_t)(previewHeapSize), width, height);
+ mPreviewHeap = new MemoryHeapBase((int)mSecCamera->getCameraFd(), (size_t)(previewHeapSize), (uint32_t)0);
+#endif
+
+#ifdef JPEG_FROM_SENSOR
+ mSecCamera->getPostViewConfig(&mPostViewWidth, &mPostViewHeight, &mPostViewSize);
+ LOGE("CameraHardwareSec: mPostViewWidth = %d mPostViewHeight = %d mPostViewSize = %d",mPostViewWidth,mPostViewHeight,mPostViewSize);
+#endif
+
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+ int rawHeapSize = mPostViewSize;
+#else
+ int rawHeapSize = sizeof(struct ADDRS_CAP);
+#endif
+ LOGE("CameraHardwareSec: mRawHeap : MemoryHeapBase(previewHeapSize(%d))", rawHeapSize);
+ mRawHeap = new MemoryHeapBase(rawHeapSize);
+ if (mRawHeap->getHeapID() < 0)
+ {
+ LOGE("ERR(%s): Raw heap creation fail", __func__);
+ mRawHeap.clear();
+ }
+
+#if 0
+ mSecCamera->getPostViewConfig(&mPostViewWidth, &mPostViewHeight, &mPostViewSize);
+ struct ADDRS_CAP *addrs = (struct ADDRS_CAP *)mRawHeap->base();
+
+ LOGE("[5B 1] mPostViewWidth = %d mPostViewHeight = %d mPostViewSize = %d",mPostViewWidth,mPostViewHeight);
+
+ addrs[0].width = mPostViewWidth;
+ addrs[0].height = mPostViewHeight;
+
+#endif
+
+ mPreviewRunning = true;
+ mPreviewThread = new PreviewThread(this);
+ return NO_ERROR;
+}
+
+void CameraHardwareSec::stopPreview()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ sp<PreviewThread> previewThread;
+
+ { // scope for the lock
+ Mutex::Autolock lock(mLock);
+ previewThread = mPreviewThread;
+ }
+
+ // don't hold the lock while waiting for the thread to quit
+// if (previewThread != 0) {
+// previewThread->requestExitAndWait();
+// }
+
+ Mutex::Autolock lock(mLock);
+ mPreviewThread.clear();
+
+ if(!mNoHwHandle)
+ if(mSecCamera->stopPreview() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->stopPreview()", __FUNCTION__);
+ }
+
+ mPreviewRunning = false;
+}
+
+bool CameraHardwareSec::previewEnabled() {
+ LOGV("%s() : %d", __FUNCTION__, mPreviewThread != 0);
+ return mPreviewThread != 0;
+}
+
+// ---------------------------------------------------------------------------
+
+status_t CameraHardwareSec::startRecording()
+{
+ LOGV("%s()", __FUNCTION__);
+
+#ifdef DUAL_PORT_RECORDING
+ if(mSecCamera->startRecord() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->startRecord()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+#endif
+
+ mRecordRunning = true;
+ return NO_ERROR;
+}
+
+void CameraHardwareSec::stopRecording()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ mRecordRunning = false;
+}
+
+bool CameraHardwareSec::recordingEnabled()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ return mRecordRunning;
+}
+
+void CameraHardwareSec::releaseRecordingFrame(const sp<IMemory>& mem)
+{
+ LOG_CAMERA_PREVIEW("%s()", __FUNCTION__);
+
+// ssize_t offset; size_t size;
+// sp<MemoryBase> mem1 = mem;
+// sp<MemoryHeapBase> heap = mem->getMemory(&offset, &size);
+// sp<IMemoryHeap> heap = mem->getMemory(&offset, &size);
+
+// mem1.clear();
+// heap.clear();
+}
+
+// ---------------------------------------------------------------------------
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+int CameraHardwareSec::smartautosceneThread()
+{
+
+ mSmartautoscene_current_status = mSecCamera->getAutosceneStatus();
+
+ if(mSmartautoscene_current_status < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->getAutosceneStatus()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+
+ if(mSmartautoscene_current_status != mSmartautoscene_previous_status)
+ {
+ //if (mMsgEnabled & CAMERA_MSG_SMARTAUTO_SCENE_STATUS)
+ //mNotifyCb(CAMERA_MSG_SMARTAUTO_SCENE_STATUS, mSmartautoscene_current_status, 0, mCallbackCookie);
+ LOGE("%s CAMERA_MSG_SMARTAUTO_SCENE_STATUS(%d) Callback!!!!!!!! ", __FUNCTION__,mSmartautoscene_current_status);
+ mSmartautoscene_previous_status = mSmartautoscene_current_status;
+ }
+ else
+ {
+ LOGE("%s current_status(%d) is same with previous_status(%d)", __FUNCTION__,mSmartautoscene_current_status,mSmartautoscene_previous_status);
+ }
+ usleep(2000*1000); //2000ms delay
+ LOGE("DELAY(2000ms)!!!!!!!");
+ return NO_ERROR;
+}
+
+status_t CameraHardwareSec::startSmartautoscene()
+{
+ LOGV("%s()", __FUNCTION__);
+
+// Mutex::Autolock lock(mLock);
+
+ if (mSmartautosceneThread != 0) {
+ // already running
+ return INVALID_OPERATION;
+ }
+
+ mSmartautosceneRunning = true;
+ mSmartautosceneThread = new SmartautosceneThread(this);
+ return NO_ERROR;
+}
+
+void CameraHardwareSec::stopSmartautoscene()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ sp<SmartautosceneThread> smartautosceneThread;
+
+ { // scope for the lock
+// Mutex::Autolock lock(mLock);
+ smartautosceneThread = mSmartautosceneThread;
+ }
+
+ // don't hold the lock while waiting for the thread to quit
+ if (smartautosceneThread != 0) {
+ smartautosceneThread->requestExitAndWait();
+ }
+
+// Mutex::Autolock lock(mLock);
+ mSmartautosceneThread.clear();
+
+ mSmartautosceneRunning = false;
+}
+
+bool CameraHardwareSec::smartautosceneEnabled() {
+ LOGV("%s() : %d", __FUNCTION__, mSmartautosceneThread != 0);
+ return mSmartautosceneThread != 0;
+}
+
+#endif
+
+
+int CameraHardwareSec::beginAutoFocusThread(void *cookie)
+{
+ LOGV("%s()", __FUNCTION__);
+ CameraHardwareSec *c = (CameraHardwareSec *)cookie;
+ return c->autoFocusThread();
+}
+
+int CameraHardwareSec::autoFocusThread()
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ int count =0;
+ int af_status =0 ;
+#endif
+
+ LOGV("%s()", __FUNCTION__);
+// usleep(50000); // 1frame delay 50ms
+ if(mSecCamera->setAutofocus() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setAutofocus()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+// usleep(10000);
+ af_status = mSecCamera->getAutoFocusResult();
+
+ if (af_status == 0x01)
+ {
+ LOGV("%s() AF Success!!", __FUNCTION__);
+ if (mMsgEnabled & CAMERA_MSG_FOCUS)
+ mNotifyCb(CAMERA_MSG_FOCUS, true, 0, mCallbackCookie);
+ }
+ else if (af_status == 0x02)
+ {
+ LOGV("%s() AF Cancelled !!", __FUNCTION__);
+ if (mMsgEnabled & CAMERA_MSG_FOCUS)
+ mNotifyCb(CAMERA_MSG_FOCUS, 0x02, 0, mCallbackCookie);
+ }
+ else
+ {
+ LOGV("%s() AF Fail !!", __FUNCTION__);
+ if (mMsgEnabled & CAMERA_MSG_FOCUS)
+ mNotifyCb(CAMERA_MSG_FOCUS, false, 0, mCallbackCookie);
+ }
+#else
+ if (mMsgEnabled & CAMERA_MSG_FOCUS)
+ mNotifyCb(CAMERA_MSG_FOCUS, true, 0, mCallbackCookie);
+#endif
+ return NO_ERROR;
+}
+
+status_t CameraHardwareSec::autoFocus()
+{
+ LOGV("%s()", __FUNCTION__);
+ Mutex::Autolock lock(mLock);
+ if (createThread(beginAutoFocusThread, this) == false)
+ return UNKNOWN_ERROR;
+ return NO_ERROR;
+}
+
+/* 2009.10.14 by icarus for added interface */
+status_t CameraHardwareSec::cancelAutoFocus()
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGV("%s()", __FUNCTION__);
+
+ if(mSecCamera->cancelAutofocus() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->cancelAutofocus()", __FUNCTION__);
+ return UNKNOWN_ERROR;
+ }
+#endif
+ return NO_ERROR;
+}
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+status_t CameraHardwareSec::objectTracking(int onoff)
+{
+ LOGV("%s() onoff = %d", __FUNCTION__, onoff);
+
+ Mutex::Autolock lock(mLock);
+ if(onoff)
+ {
+ if (mObjectTrackingThread == 0) {
+ mObjectTrackingThread = new ObjectTrackingThread(this);
+ }
+ mObjectTrackingRunning=true;
+ }
+ else
+ {
+ if (mObjectTrackingThread != 0) {
+ mObjectTrackingThread->requestExitAndWait();
+ }
+ mObjectTrackingThread.clear();
+ mObjectTrackingRunning=false;
+ }
+ return 0;
+}
+
+int CameraHardwareSec::save_jpeg( unsigned char * real_jpeg, int jpeg_size)
+{
+ FILE *yuv_fp = NULL;
+ char filename[100], *buffer = NULL;
+
+ /* file create/open, note to "wb" */
+ yuv_fp = fopen("/data/camera_dump.jpeg", "wb");
+ if (yuv_fp==NULL)
+ {
+ LOGE("Save jpeg file open error");
+ return -1;
+ }
+
+ LOGE("[BestIQ] real_jpeg size ========> %d\n", jpeg_size);
+ buffer = (char *) malloc(jpeg_size);
+ if(buffer == NULL)
+ {
+ LOGE("Save YUV] buffer alloc failed");
+ if(yuv_fp) fclose(yuv_fp);
+ return -1;
+ }
+
+ memcpy(buffer, real_jpeg, jpeg_size);
+
+ fflush(stdout);
+
+ fwrite(buffer, 1, jpeg_size, yuv_fp);
+
+ fflush(yuv_fp);
+
+ if(yuv_fp)
+ fclose(yuv_fp);
+ if(buffer)
+ free(buffer);
+
+ return 0;
+}
+
+
+int CameraHardwareSec::objectTrackingThread()
+{
+ int new_obj_status;
+ new_obj_status = mSecCamera->getObjectTrackingStatus();
+#if 0 //temp till define callback msg
+ if (mObjectTrackingStatus != new_obj_status)
+ {
+ mObjectTrackingStatus = new_obj_status;
+ if (mMsgEnabled & CAMERA_MSG_OBJ_TRACKING)
+ mNotifyCb(CAMERA_MSG_OBJ_TRACKING, new_obj_status, 0, mCallbackCookie);
+ }
+#endif
+ usleep(100000); //100ms
+ return NO_ERROR;
+}
+#endif
+/*static*/ int CameraHardwareSec::beginPictureThread(void *cookie)
+{
+ LOGV("%s()", __FUNCTION__);
+ CameraHardwareSec *c = (CameraHardwareSec *)cookie;
+ return c->pictureThread();
+}
+
+void CameraHardwareSec::save_postview(const char *fname, uint8_t *buf, uint32_t size)
+{
+ int nw, cnt = 0;
+ uint32_t written = 0;
+
+ LOGD("opening file [%s]\n", fname);
+ int fd = open(fname, O_RDWR | O_CREAT);
+ if (fd < 0) {
+ LOGE("failed to create file [%s]: %s", fname, strerror(errno));
+ return;
+ }
+
+ LOGD("writing %d bytes to file [%s]\n", size, fname);
+ while (written < size) {
+ nw = ::write(fd,
+ buf + written,
+ size - written);
+ if (nw < 0) {
+ LOGE("failed to write to file %d [%s]: %s",written,fname, strerror(errno));
+ break;
+ }
+ written += nw;
+ cnt++;
+ }
+ LOGD("done writing %d bytes to file [%s] in %d passes\n",size, fname, cnt);
+ ::close(fd);
+}
+
+int CameraHardwareSec::pictureThread()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ int jpeg_size = 0;
+ int ret = NO_ERROR;
+ unsigned char * jpeg_data = NULL;
+ int postview_offset = 0;
+ unsigned char * postview_data = NULL;
+
+ //unsigned int addr;
+ unsigned char * addr = NULL;
+ int mPostViewWidth, mPostViewHeight, mPostViewSize;
+ int cap_width, cap_height, cap_frame_size;
+
+ mSecCamera->getPostViewConfig(&mPostViewWidth, &mPostViewHeight, &mPostViewSize);
+ int postviewHeapSize = mPostViewWidth*mPostViewHeight*2; //*size = (BACK_CAMERA_POSTVIEW_WIDTH * BACK_CAMERA_POSTVIEW_HEIGHT * BACK_CAMERA_POSTVIEW_BPP)/8;
+ mSecCamera->getSnapshotSize(&cap_width, &cap_height, &cap_frame_size);
+ LOGE("[kidggang]:func(%s):line(%d)&cap_width(%d), &cap_height(%d), &cap_frame_size(%d)\n",__FUNCTION__,__LINE__,cap_width, cap_height, cap_frame_size);
+
+// sp<MemoryBase> buffer = new MemoryBase(mRawHeap, 0, postviewHeapSize);
+
+ LOG_TIME_DEFINE(0)
+ LOG_TIME_START(0)
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+ sp<MemoryBase> buffer = new MemoryBase(mRawHeap, 0, mPostViewSize+8);
+#else
+ sp<MemoryBase> buffer = new MemoryBase(mRawHeap, 0, sizeof(struct ADDRS_CAP));
+#endif
+
+ struct ADDRS_CAP *addrs = (struct ADDRS_CAP *)mRawHeap->base();
+
+#ifdef JPEG_FROM_SENSOR
+ addrs[0].width = mPostViewWidth;
+ addrs[0].height = mPostViewHeight;
+ LOGV("[5B] mPostViewWidth = %d mPostViewHeight = %d\n",mPostViewWidth,mPostViewHeight);
+#else
+ mParameters.getPictureSize((int*)&addrs[0].width, (int*)&addrs[0].height);
+#endif
+
+
+ if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK) { //[zzangdol] CAMERA_ID_BACK
+#ifndef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if (mMsgEnabled & CAMERA_MSG_SHUTTER)
+ {
+ mNotifyCb(CAMERA_MSG_SHUTTER, 0, 0, mCallbackCookie);
+ }
+#endif
+ }//[zzangdol]CAMERA_ID_BACK
+
+ if (mMsgEnabled & CAMERA_MSG_RAW_IMAGE)
+ {
+ LOG_TIME_DEFINE(1)
+ LOG_TIME_START(1)
+
+ int picture_size, picture_width, picture_height;
+ mSecCamera->getSnapshotSize(&picture_width, &picture_height, &picture_size);
+ int picture_format = mSecCamera->getSnapshotPixelFormat();
+
+ unsigned int phyAddr;
+#ifdef JPEG_FROM_SENSOR
+ // Modified the shutter sound timing for Jpeg capture
+ if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK)
+ mSecCamera->setSnapshotCmd();
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if (mMsgEnabled & CAMERA_MSG_SHUTTER)
+ {
+ mNotifyCb(CAMERA_MSG_SHUTTER, 0, 0, mCallbackCookie);
+ }
+#endif
+
+ if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK){ //[zzangdol] CAMERA_ID_BACK
+ jpeg_data = mSecCamera->getJpeg(&jpeg_size, &phyAddr);
+ if(jpeg_data == NULL)
+ {
+ LOGE("ERR(%s):Fail on SecCamera->getSnapshot()", __FUNCTION__);
+ ret = UNKNOWN_ERROR;
+ }
+ }//[zzangdol] CAMERA_ID_BACK
+ else
+ {
+ addr = mSecCamera->getSnapshotAndJpeg();
+ //LOGV("[zzangdol] getSnapshotAndJpeg\n");
+ }
+#else
+ phyAddr = mSecCamera->getSnapshotAndJpeg();
+ jpeg_data = mSecCamera->yuv2Jpeg((unsigned char*)phyAddr, 0, &jpeg_size, picture_width, picture_height, picture_format);
+#endif
+
+#ifdef DIRECT_DELIVERY_OF_POSTVIEW_DATA
+ postview_offset = mSecCamera->getPostViewOffset();
+ if(jpeg_data != NULL)
+ memcpy(mRawHeap->base(), jpeg_data+postview_offset, mPostViewSize);
+#else
+ addrs[0].addr_y = phyAddr;
+#endif
+
+ LOG_TIME_END(1)
+ LOG_CAMERA("getSnapshotAndJpeg interval: %lu us", LOG_TIME(1));
+ }
+
+ int JpegImageSize, JpegExifSize;
+ sp<MemoryHeapBase> PostviewHeap = new MemoryHeapBase(mPostViewSize);
+ sp<MemoryHeapBase> JpegHeap = new MemoryHeapBase(4300000);
+ decodeInterleaveData(jpeg_data, 4261248, mPostViewWidth, mPostViewHeight,
+ &JpegImageSize, JpegHeap->base(), PostviewHeap->base());
+
+ sp<MemoryBase> postview = new MemoryBase(PostviewHeap, 0, postviewHeapSize);
+ memcpy(mRawHeap->base(),PostviewHeap->base(), postviewHeapSize);
+#if 0//def SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ if (mMsgEnabled & CAMERA_MSG_POSTVIEW_FRAME)
+ {
+ int postviewHeapSize = mPostViewSize;
+ sp<MemoryHeapBase> mPostviewHeap = new MemoryHeapBase(postviewHeapSize);
+
+ postview_data = jpeg_data + postview_offset;
+ sp<MemoryBase> postview = new MemoryBase(mPostviewHeap, 0, postviewHeapSize);
+
+ if(postview_data != NULL)
+ memcpy(mPostviewHeap->base(), postview_data, postviewHeapSize);
+
+ mDataCb(CAMERA_MSG_POSTVIEW_FRAME, postview, mCallbackCookie);
+ }
+#endif //#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+
+ if (mMsgEnabled & CAMERA_MSG_COMPRESSED_IMAGE)
+ {
+ if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK){
+ sp<MemoryHeapBase> ExifHeap = new MemoryHeapBase(EXIF_FILE_SIZE + JPG_STREAM_BUF_SIZE);
+ JpegExifSize = mSecCamera->getExif((unsigned char *)ExifHeap->base(),
+ (unsigned char *)PostviewHeap->base());
+
+ LOGE("JpegExifSize=%d", JpegExifSize);
+ unsigned char *ExifStart = (unsigned char *)JpegHeap->base() + 2;
+ unsigned char *ImageStart = ExifStart + JpegExifSize;
+
+ memmove(ImageStart, ExifStart, JpegImageSize - 2);
+ memcpy(ExifStart, ExifHeap->base(), JpegExifSize);
+ sp<MemoryBase> mem = new MemoryBase(JpegHeap, 0, JpegImageSize + JpegExifSize);
+
+ mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);
+
+ mDataCb(CAMERA_MSG_RAW_IMAGE, buffer, mCallbackCookie);
+ }//[zzangdol] CAMERA_ID_BACK
+ else
+ {
+ LOGV("[zzangdol] COMPRESSED_IMAGE\n");
+ //mSecCamera->getSnapshotSize(&cap_width, &cap_height, &cap_frame_size);
+ //sp<MemoryHeapBase> mHeap = new MemoryHeapBase((int)mSecCamera->getCameraFd(), (size_t)(cap_frame_size * kBufferCount), (uint32_t)0);
+ sp<MemoryHeapBase> mHeap = new MemoryHeapBase(2000000);
+ memcpy(mHeap->base(), addr, cap_frame_size);
+ sp<MemoryBase> mem = new MemoryBase(mHeap , 0, cap_frame_size);
+ //save_postview("/data/front.yuv", (uint8_t *)mHeap->base(), yuv_frame_size2);
+ mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, mCallbackCookie);//[zzangdol]
+ }
+ }
+
+ LOG_TIME_END(0)
+ LOG_CAMERA("pictureThread interval: %lu us", LOG_TIME(0));
+
+ return ret;
+}
+
+status_t CameraHardwareSec::takePicture()
+{
+ LOGV("%s()", __FUNCTION__);
+
+ stopPreview();
+ mNoHwHandle = 0;
+
+ if (createThread(beginPictureThread, this) == false)
+ return -1;
+
+ return NO_ERROR;
+}
+
+status_t CameraHardwareSec::cancelPicture()
+{
+ return NO_ERROR;
+}
+
+int CameraHardwareSec::decodeInterleaveData(unsigned char *pInterleaveData,
+ int interleaveDataSize,
+ int yuvWidth,
+ int yuvHeight,
+ int *pJpegSize,
+ void *pJpegData,
+ void *pYuvData)
+{
+ if (pInterleaveData == NULL)
+ return false;
+
+ bool ret = true;
+ unsigned int *interleave_ptr = (unsigned int *)pInterleaveData;
+ unsigned char *jpeg_ptr = (unsigned char *)pJpegData;
+ unsigned char *yuv_ptr = (unsigned char *)pYuvData;
+ unsigned char *p;
+ int jpeg_size = 0;
+ int yuv_size = 0;
+
+ int i = 0;
+
+ LOGE("decodeInterleaveData Start~~~");
+ while(i < interleaveDataSize) {
+ if ((*interleave_ptr == 0xFFFFFFFF) ||
+ (*interleave_ptr == 0x02FFFFFF) ||
+ (*interleave_ptr == 0xFF02FFFF)) {
+ // Padding Data
+// LOGE("%d(%x) padding data\n", i, *interleave_ptr);
+ interleave_ptr++;
+ i += 4;
+ }
+ else if ((*interleave_ptr & 0xFFFF) == 0x05FF) {
+ // Start-code of YUV Data
+// LOGE("%d(%x) yuv data\n", i, *interleave_ptr);
+ p = (unsigned char *)interleave_ptr;
+ p += 2;
+ i += 2;
+
+ // Extract YUV Data
+ if (pYuvData != NULL) {
+ memcpy(yuv_ptr, p, yuvWidth * 2);
+ yuv_ptr += yuvWidth * 2;
+ yuv_size += yuvWidth * 2;
+ }
+ p += yuvWidth * 2;
+ i += yuvWidth * 2;
+
+ // Check End-code of YUV Data
+ if ((*p == 0xFF) && (*(p + 1) == 0x06)) {
+ interleave_ptr = (unsigned int *)(p + 2);
+ i += 2;
+ } else {
+ ret = false;
+ break;
+ }
+
+ }
+ else {
+ // Extract JPEG Data
+// LOGE("%d(%x) jpg data, jpeg_size = %d bytes\n", i, *interleave_ptr, jpeg_size);
+ if (pJpegData != NULL) {
+ memcpy(jpeg_ptr, interleave_ptr, 4);
+ jpeg_ptr += 4;
+ jpeg_size += 4;
+ }
+ interleave_ptr++;
+ i += 4;
+ }
+ }
+ if (ret) {
+ if (pJpegData != NULL) {
+ // Remove Padding after EOI
+ for (i=0; i<3; i++) {
+ if (*(--jpeg_ptr) != 0xFF) {
+ break;
+ }
+ jpeg_size--;
+ }
+ *pJpegSize = jpeg_size;
+
+ }
+ // Check YUV Data Size
+ if (pYuvData != NULL) {
+ if (yuv_size != (yuvWidth * yuvHeight * 2)) {
+ ret = false;
+ }
+ }
+ }
+ LOGE("decodeInterleaveData End~~~");
+ return ret;
+}
+
+status_t CameraHardwareSec::dump(int fd, const Vector<String16>& args) const
+{
+ const size_t SIZE = 256;
+ char buffer[SIZE];
+ String8 result;
+ AutoMutex lock(&mLock);
+ if (mSecCamera != 0) {
+ mSecCamera->dump(fd, args);
+ mParameters.dump(fd, args);
+ snprintf(buffer, 255, " preview frame(%d), size (%d), running(%s)\n", mCurrentPreviewFrame, mPreviewFrameSize, mPreviewRunning?"true": "false");
+ result.append(buffer);
+ } else {
+ result.append("No camera client yet.\n");
+ }
+ write(fd, result.string(), result.size());
+ return NO_ERROR;
+}
+
+status_t CameraHardwareSec::setParameters(const CameraParameters& params)
+{
+ LOGV("%s()", __FUNCTION__);
+
+ Mutex::Autolock lock(mLock);
+
+ status_t ret = NO_ERROR;
+
+ mParameters = params;
+
+ // set camera id
+ int new_camera_id = params.getInt("camera-id");
+ if(0 <= new_camera_id)
+ {
+ if(mSecCamera->setCameraId(new_camera_id) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setCameraId(camera_id(%d))", __FUNCTION__, new_camera_id);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // preview size
+ int new_preview_width = 0;
+ int new_preview_height = 0;
+ params.getPreviewSize(&new_preview_width, &new_preview_height);
+ const char * new_str_preview_format = params.getPreviewFormat();
+ if(0 < new_preview_width && 0 < new_preview_height && new_str_preview_format != NULL)
+ {
+ int new_preview_format = 0;
+
+ if (strcmp(new_str_preview_format, "rgb565") == 0)
+ new_preview_format = V4L2_PIX_FMT_RGB565;
+ else if (strcmp(new_str_preview_format, "yuv420sp") == 0)
+ new_preview_format = V4L2_PIX_FMT_NV21; //Kamat
+ else if (strcmp(new_str_preview_format, "yuv420sp_custom") == 0)
+ new_preview_format = V4L2_PIX_FMT_NV12T; //Kamat
+ else if (strcmp(new_str_preview_format, "yuv420p") == 0)
+ new_preview_format = V4L2_PIX_FMT_YUV420;
+ else if (strcmp(new_str_preview_format, "yuv422i") == 0)
+ new_preview_format = V4L2_PIX_FMT_YUYV;
+ else if (strcmp(new_str_preview_format, "yuv422p") == 0)
+ new_preview_format = V4L2_PIX_FMT_YUV422P;
+ else
+ new_preview_format = V4L2_PIX_FMT_NV21; //for 3rd party
+
+ if(mSecCamera->setPreviewSize(new_preview_width, new_preview_height, new_preview_format) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setPreviewSize(width(%d), height(%d), format(%d))", __FUNCTION__, new_preview_width, new_preview_height, new_preview_format);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ int new_picture_width = 0;
+ int new_picture_height = 0;
+ params.getPictureSize(&new_picture_width, &new_picture_height);
+ if(0 < new_picture_width && 0 < new_picture_height)
+ {
+ if(mSecCamera->setSnapshotSize(new_picture_width, new_picture_height) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSnapshotSize(width(%d), height(%d))", __FUNCTION__, new_picture_width, new_picture_height);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // picture format
+ const char * new_str_picture_format = params.getPictureFormat();
+ if(new_str_picture_format != NULL)
+ {
+ int new_picture_format = 0;
+
+ if (strcmp(new_str_picture_format, "rgb565") == 0)
+ new_picture_format = V4L2_PIX_FMT_RGB565;
+ else if (strcmp(new_str_picture_format, "yuv420sp") == 0)
+ new_picture_format = V4L2_PIX_FMT_NV21; //Kamat: Default format
+ else if (strcmp(new_str_picture_format, "yuv420sp_custom") == 0)
+ new_picture_format = V4L2_PIX_FMT_NV12T;
+ else if (strcmp(new_str_picture_format, "yuv420p") == 0)
+ new_picture_format = V4L2_PIX_FMT_YUV420;
+ else if (strcmp(new_str_picture_format, "yuv422i") == 0)
+ new_picture_format = V4L2_PIX_FMT_YUYV;
+ else if (strcmp(new_str_picture_format, "uyv422i_custom") == 0) //Zero copy UYVY format
+ new_picture_format = V4L2_PIX_FMT_UYVY;
+ else if (strcmp(new_str_picture_format, "uyv422i") == 0) //Non-zero copy UYVY format
+ new_picture_format = V4L2_PIX_FMT_UYVY;
+ else if (strcmp(new_str_picture_format, "jpeg") == 0)
+#ifdef JPEG_FROM_SENSOR
+ new_picture_format = V4L2_PIX_FMT_UYVY;
+#else
+ new_picture_format = V4L2_PIX_FMT_YUYV;
+#endif
+ else if (strcmp(new_str_picture_format, "yuv422p") == 0)
+ new_picture_format = V4L2_PIX_FMT_YUV422P;
+ else
+ new_picture_format = V4L2_PIX_FMT_NV21; //for 3rd party
+
+ if(mSecCamera->setSnapshotPixelFormat(new_picture_format) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSnapshotPixelFormat(format(%d))", __FUNCTION__, new_picture_format);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ //JPEG image quality
+ int new_jpeg_quality = params.getInt("jpeg-quality");
+
+ if (new_jpeg_quality < 1 || new_jpeg_quality > 100) {
+ LOGE("ERR(%s): Invalid quality(%d))", __FUNCTION__, new_jpeg_quality);
+
+ new_jpeg_quality = 100;
+
+ mParameters.set("jpeg-quality", "100");
+ }
+
+ mSecCamera->setJpegQuality(new_jpeg_quality);
+#else
+ //JPEG image quality
+ int new_jpeg_quality = params.getInt("jpeg-quality");
+ if (new_jpeg_quality < 0)
+ {
+ LOGW("JPEG-image quality is not specified or is negative, defaulting to 100");
+ new_jpeg_quality = 100;
+ mParameters.set("jpeg-quality", "100");
+ }
+ mSecCamera->setJpegQuality(new_jpeg_quality);
+#endif
+
+ // JPEG thumbnail size
+ int new_jpeg_thumbnail_width = params.getInt("jpeg-thumbnail-width");
+ int new_jpeg_thumbnail_height= params.getInt("jpeg-thumbnail-height");
+
+ if(0 < new_jpeg_thumbnail_width && 0 < new_jpeg_thumbnail_height)
+ {
+ if(mSecCamera->setJpegThumbnailSize(new_jpeg_thumbnail_width, new_jpeg_thumbnail_height) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setJpegThumbnailSize(width(%d), height(%d))", __FUNCTION__, new_jpeg_thumbnail_width, new_jpeg_thumbnail_height);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // frame rate
+ int new_frame_rate = params.getPreviewFrameRate();
+ if(new_frame_rate < 5 || new_frame_rate > 30)
+ {
+ new_frame_rate = 30;
+ }
+
+ mParameters.setPreviewFrameRate(new_frame_rate);
+ // Calculate how long to wait between frames.
+ mPreviewFrameRateMicrosec = (int)(1000000.0f / float(new_frame_rate));
+
+ LOGD("frame rate:%d, mPreviewFrameRateMicrosec:%d", new_frame_rate, mPreviewFrameRateMicrosec);
+
+ mSecCamera->setFrameRate(new_frame_rate);
+
+ //vt mode
+ int new_vtmode = params.getInt("vtmode");
+ if(0 <= new_vtmode)
+ {
+ if(mSecCamera->setVTmode(new_vtmode) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setVTMode(%d)", __FUNCTION__, new_vtmode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // rotation
+ int new_rotation = params.getInt("rotation");
+ int new_exif_rotation = 1;
+ if(new_rotation != -1)
+ {
+ if(new_vtmode == SecCamera::VT_MODE_ON ) // vt preview rotation
+ {
+ LOGE("ERR(%s):VT mode is on. Rotate(%d))", __FUNCTION__, new_rotation);
+
+ if(mSecCamera->SetRotate(new_rotation) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->SetRotate(rotation(%d))", __FUNCTION__, new_rotation);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ else //exif orientation information
+ {
+ if(mSecCamera->SetRotate(0) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->SetRotate(rotation(%d))", __FUNCTION__, new_rotation);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(new_rotation == 0)
+ new_exif_rotation = 1;
+ else if (new_rotation == 90)
+ new_exif_rotation = 6;
+ else if (new_rotation == 180)
+ new_exif_rotation = 3;
+ else if (new_rotation == 270)
+ new_exif_rotation = 8;
+ else
+ new_exif_rotation = 1;
+ }
+ }
+
+#ifndef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ // brightness
+ int new_exposure_compensation = params.getInt(CameraParameters::KEY_EXPOSURE_COMPENSATION);
+ int max_exposure_compensation = params.getInt(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION);
+ int min_exposure_compensation = params.getInt(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION);
+
+ if( (min_exposure_compensation <= new_exposure_compensation) &&
+ (max_exposure_compensation >= new_exposure_compensation) )
+ {
+ if(mSecCamera->setBrightness(new_exposure_compensation) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setBrightness(brightness(%d))", __FUNCTION__, new_exposure_compensation);
+ ret = UNKNOWN_ERROR;
+ }
+
+ }
+
+ // whitebalance
+ const char * new_white_str = params.get("whitebalance");
+ if(new_white_str != NULL)
+ {
+ int new_white = -1;
+
+ if(strcmp(new_white_str, "auto") == 0)
+ new_white = SecCamera::WHITE_BALANCE_AUTO;
+ else if(strcmp(new_white_str, "indoor3100") == 0)
+ new_white = SecCamera::WHITE_BALANCE_INDOOR3100;
+ else if(strcmp(new_white_str, "outdoor5100") == 0)
+ new_white = SecCamera::WHITE_BALANCE_OUTDOOR5100;
+ else if(strcmp(new_white_str, "indoor2000") == 0)
+ new_white = SecCamera::WHITE_BALANCE_INDOOR2000;
+ else if(strcmp(new_white_str, "halt") == 0)
+ new_white = SecCamera::WHITE_BALANCE_HALT;
+ else if(strcmp(new_white_str, "cloudy") == 0)
+ new_white = SecCamera::WHITE_BALANCE_CLOUDY;
+ else if(strcmp(new_white_str, "sunny") == 0)
+ new_white = SecCamera::WHITE_BALANCE_SUNNY;
+ else
+ {
+ LOGE("ERR(%s):Invalid white balance(%s)", __FUNCTION__, new_white_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_white)
+ {
+ // white_balance
+ if(mSecCamera->setWhiteBalance(new_white) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setWhiteBalance(white(%d))", __FUNCTION__, new_white);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // image effect
+ const char * new_image_effect_str = params.get("image-effects");
+ if(new_image_effect_str != NULL)
+ {
+ int new_image_effect = -1;
+
+ if(strcmp(new_image_effect_str, "original") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_ORIGINAL;
+ else if(strcmp(new_image_effect_str, "arbitrary") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_ARBITRARY;
+ else if(strcmp(new_image_effect_str, "negative") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_NEGATIVE;
+ else if(strcmp(new_image_effect_str, "freeze") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_FREEZE;
+ else if(strcmp(new_image_effect_str, "embossing") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_EMBOSSING;
+ else if(strcmp(new_image_effect_str, "silhouette") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_SILHOUETTE;
+ else
+ {
+ LOGE("ERR(%s):Invalid effect(%s)", __FUNCTION__, new_image_effect_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(new_image_effect >= 0)
+ {
+ // white_balance
+ if(mSecCamera->setImageEffect(new_image_effect) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setImageEffect(effect(%d))", __FUNCTION__, new_image_effect);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+#else
+ // scene mode
+ const char * new_scene_mode_str = params.get("scene-mode");
+
+ LOGV("%s() new_scene_mode_str %s", __FUNCTION__,new_scene_mode_str);
+
+ if(new_scene_mode_str != NULL)
+ {
+ int new_scene_mode = -1;
+
+ const char * new_iso_str = NULL;
+ const char * new_metering_str = NULL;
+ int new_exposure_compensation = 0;
+ const char * new_white_str = NULL;
+ int new_sharpness = 0;
+ int new_saturation = 0;
+ const char * new_focus_mode_str = NULL;
+ const char * new_flash_mode_str = NULL;
+
+ if(strcmp(new_scene_mode_str, "auto") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_NONE;
+
+ new_iso_str = params.get("iso");
+ new_metering_str = params.get("metering");
+ new_exposure_compensation = params.getInt(CameraParameters::KEY_EXPOSURE_COMPENSATION);
+ new_white_str = params.get("whitebalance");
+ new_sharpness = params.getInt("sharpness");
+ new_saturation = params.getInt("saturation");
+ new_focus_mode_str = params.get("focus-mode");
+ new_flash_mode_str = params.get("flash-mode");
+ }
+ else
+ {
+ if(strcmp(new_scene_mode_str, "portrait") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_PORTRAIT;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_MINUS_1);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "facedetect");
+ }
+ else if(strcmp(new_scene_mode_str, "landscape") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_LANDSCAPE;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "matrix");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_PLUS_1);
+ mParameters.set("saturation", SecCamera::SATURATION_PLUS_1);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "sports") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_SPORTS;
+
+ mParameters.set("iso", "sports");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "party") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_PARTY_INDOOR;
+
+ mParameters.set("iso", "200");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_PLUS_1);
+ mParameters.set("focus-mode", "auto");
+ }
+ else if((strcmp(new_scene_mode_str, "beach") == 0) || (strcmp(new_scene_mode_str, "snow") == 0))
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_BEACH_SNOW;
+
+ mParameters.set("iso", "50");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_PLUS_2);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_PLUS_1);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "sunset") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_SUNSET;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "daylight");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "dusk-dawn") == 0) //added
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_DUSK_DAWN;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "fluorescent");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "fall-color") == 0) //added
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_FALL_COLOR;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_PLUS_2);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "night") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_NIGHTSHOT;
+
+ mParameters.set("iso", "night");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "back-light") == 0) //added
+ {
+ const char * flash_mode_str = params.get("flash-mode");
+
+ new_scene_mode = SecCamera::SCENE_MODE_BACK_LIGHT;
+
+ mParameters.set("iso", "auto");
+ if(strcmp(flash_mode_str, "off") == 0)
+ mParameters.set("metering", "spot");
+ else
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ }
+ else if(strcmp(new_scene_mode_str, "fireworks") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_FIREWORKS;
+
+ mParameters.set("iso", "50");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else if(strcmp(new_scene_mode_str, "text") == 0) //added
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_TEXT;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "auto");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_PLUS_2);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "macro");
+ }
+ else if(strcmp(new_scene_mode_str, "candlelight") == 0)
+ {
+ new_scene_mode = SecCamera::SCENE_MODE_CANDLE_LIGHT;
+
+ mParameters.set("iso", "auto");
+ mParameters.set("metering", "center");
+ mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION, SecCamera::BRIGHTNESS_NORMAL);
+ mParameters.set("whitebalance", "daylight");
+ mParameters.set("sharpness", SecCamera::SHARPNESS_NORMAL);
+ mParameters.set("saturation", SecCamera::SATURATION_NORMAL);
+ mParameters.set("focus-mode", "auto");
+ mParameters.set("flash-mode", "off");
+ }
+ else
+ {
+ LOGE("%s::unmatched scene_mode(%s)", __FUNCTION__, new_scene_mode_str); //action, night-portrait, theatre, steadyphoto
+ ret = UNKNOWN_ERROR;
+ }
+
+ new_iso_str = mParameters.get("iso");
+ new_metering_str = mParameters.get("metering");
+ new_exposure_compensation = mParameters.getInt(CameraParameters::KEY_EXPOSURE_COMPENSATION);
+ new_white_str = mParameters.get("whitebalance");
+ new_sharpness = mParameters.getInt("sharpness");
+ new_saturation = mParameters.getInt("saturation");
+ new_focus_mode_str = mParameters.get("focus-mode");
+ new_flash_mode_str = mParameters.get("flash-mode");
+ }
+
+ // 1. ISO
+ if(new_iso_str != NULL )
+ {
+ int new_iso = -1;
+ if(strcmp(new_iso_str, "auto") == 0)
+ new_iso = SecCamera::ISO_AUTO;
+ else if(strcmp(new_iso_str, "50") == 0)
+ new_iso = SecCamera::ISO_50;
+ else if(strcmp(new_iso_str, "100") == 0)
+ new_iso = SecCamera::ISO_100;
+ else if(strcmp(new_iso_str, "200") == 0)
+ new_iso = SecCamera::ISO_200;
+ else if(strcmp(new_iso_str, "400") == 0)
+ new_iso = SecCamera::ISO_400;
+ else if(strcmp(new_iso_str, "800") == 0)
+ new_iso = SecCamera::ISO_800;
+ else if(strcmp(new_iso_str, "1600") == 0)
+ new_iso = SecCamera::ISO_1600;
+ else if(strcmp(new_iso_str, "sports") == 0)
+ new_iso = SecCamera::ISO_SPORTS;
+ else if(strcmp(new_iso_str, "night") == 0)
+ new_iso = SecCamera::ISO_NIGHT;
+ else if(strcmp(new_iso_str, "movie") == 0)
+ new_iso = SecCamera::ISO_MOVIE;
+ else
+ {
+ LOGE("%s::unmatched iso(%d)", __FUNCTION__, new_iso);
+ ret = UNKNOWN_ERROR;
+ }
+ if(0 <= new_iso)
+ {
+ if(mSecCamera->setISO(new_iso) < 0)
+ {
+ LOGE("%s::mSecCamera->setISO(%d) fail", __FUNCTION__, new_iso);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // 2. metering
+ if(new_metering_str != NULL )
+ {
+ int new_metering = -1;
+ if(strcmp(new_metering_str, "matrix") == 0)
+ new_metering = SecCamera::METERING_MATRIX;
+ else if(strcmp(new_metering_str, "center") == 0)
+ new_metering = SecCamera::METERING_CENTER;
+ else if(strcmp(new_metering_str, "spot") == 0)
+ new_metering = SecCamera::METERING_SPOT;
+ else
+ {
+ LOGE("%s::unmatched metering(%s)", __FUNCTION__, new_metering_str);
+ ret = UNKNOWN_ERROR;
+ }
+ if(0 <= new_metering)
+ {
+ if(mSecCamera->setMetering(new_metering) < 0)
+ {
+ LOGE("%s::mSecCamera->setMetering(%d) fail", __FUNCTION__, new_metering);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // 3. brightness
+ int max_exposure_compensation = params.getInt(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION);
+ int min_exposure_compensation = params.getInt(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION);
+
+ if( (min_exposure_compensation <= new_exposure_compensation) &&
+ (max_exposure_compensation >= new_exposure_compensation) )
+ {
+ if(mSecCamera->setBrightness(new_exposure_compensation) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setBrightness(brightness(%d))", __FUNCTION__, new_exposure_compensation);
+ ret = UNKNOWN_ERROR;
+ }
+
+ }
+
+ // 4. whitebalance
+ if(new_white_str != NULL)
+ {
+ int new_white = -1;
+
+ if(strcmp(new_white_str, "auto") == 0)
+ new_white = SecCamera::WHITE_BALANCE_AUTO;
+ else if(strcmp(new_white_str, "daylight") == 0)
+ new_white = SecCamera::WHITE_BALANCE_DAYLIGHT;
+ else if((strcmp(new_white_str, "cloudy") == 0) || (strcmp(new_white_str, "cloudy-daylight") == 0))
+ new_white = SecCamera::WHITE_BALANCE_CLOUDY;
+ else if(strcmp(new_white_str, "fluorescent") == 0)
+ new_white = SecCamera::WHITE_BALANCE_FLUORESCENT;
+ else if(strcmp(new_white_str, "incandescent") == 0)
+ new_white = SecCamera::WHITE_BALANCE_INCANDESCENT;
+ else
+ {
+ LOGE("ERR(%s):Invalid white balance(%s)", __FUNCTION__, new_white_str); //twilight, shade, warm_flourescent
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_white)
+ {
+ // white_balance
+ if(mSecCamera->setWhiteBalance(new_white) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setWhiteBalance(white(%d))", __FUNCTION__, new_white);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ //5. sharpness
+ if(0 <= new_sharpness)
+ {
+ if(mSecCamera->setSharpness(new_sharpness) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSharpness(%d)", __FUNCTION__,new_sharpness);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //6. saturation
+ if(0 <= new_saturation)
+ {
+ if(mSecCamera->setSaturation(new_saturation) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSaturation(%d)", __FUNCTION__, new_saturation);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // 7. focus mode
+ if(new_focus_mode_str != NULL)
+ {
+ int new_focus_mode = -1;
+
+ if((strcmp(new_focus_mode_str, "auto") == 0) || (strcmp(new_focus_mode_str, "fixed") == 0) ||(strcmp(new_focus_mode_str, "infinity") == 0))
+ new_focus_mode = SecCamera::FOCUS_MODE_AUTO;
+ else if(strcmp(new_focus_mode_str, "macro") == 0)
+ new_focus_mode = SecCamera::FOCUS_MODE_MACRO;
+ else if(strcmp(new_focus_mode_str, "facedetect") == 0)
+ new_focus_mode = SecCamera::FOCUS_MODE_FACEDETECT;
+ else
+ {
+ LOGE("%s::unmatched focus_mode(%s)", __FUNCTION__, new_focus_mode_str); //infinity
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_focus_mode)
+ {
+ if(mSecCamera->setFocusMode(new_focus_mode) < 0)
+ {
+ LOGE("%s::mSecCamera->setFocusMode(%d) fail", __FUNCTION__, new_focus_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // 8. flash..
+ if(new_flash_mode_str != NULL )
+ {
+ int new_flash_mode = -1;
+ if(strcmp(new_flash_mode_str, "off") == 0)
+ new_flash_mode = SecCamera::FLASH_MODE_OFF;
+ else if(strcmp(new_flash_mode_str, "auto") == 0)
+ new_flash_mode = SecCamera::FLASH_MODE_AUTO;
+ else if(strcmp(new_flash_mode_str, "on") == 0)
+ new_flash_mode = SecCamera::FLASH_MODE_ON;
+ else if(strcmp(new_flash_mode_str, "torch") == 0)
+ new_flash_mode = SecCamera::FLASH_MODE_TORCH;
+ else
+ {
+ LOGE("%s::unmatched flash_mode(%s)", __FUNCTION__, new_flash_mode_str); //red-eye
+ ret = UNKNOWN_ERROR;
+ }
+ if(0 <= new_flash_mode)
+ {
+ if(mSecCamera->setFlashMode(new_flash_mode) < 0)
+ {
+ LOGE("%s::mSecCamera->setFlashMode(%d) fail", __FUNCTION__, new_flash_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // 9. scene..
+ if(0 <= new_scene_mode)
+ {
+ if(mSecCamera->setSceneMode(new_scene_mode) < 0)
+ {
+ LOGE("%s::mSecCamera->setSceneMode(%d) fail", __FUNCTION__, new_scene_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+
+ // image effect
+ const char * new_image_effect_str = params.get("effect");
+ if(new_image_effect_str != NULL)
+ {
+ int new_image_effect = -1;
+
+ if((strcmp(new_image_effect_str, "auto") == 0) || (strcmp(new_image_effect_str, "none") == 0))
+ new_image_effect = SecCamera::IMAGE_EFFECT_NONE;
+ else if((strcmp(new_image_effect_str, "bnw") == 0) || (strcmp(new_image_effect_str, "mono") == 0))
+ new_image_effect = SecCamera::IMAGE_EFFECT_BNW;
+ else if(strcmp(new_image_effect_str, "sepia") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_SEPIA;
+ else if(strcmp(new_image_effect_str, "aqua") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_AQUA;
+ else if(strcmp(new_image_effect_str, "antique") == 0) //added at samsung
+ new_image_effect = SecCamera::IMAGE_EFFECT_ANTIQUE;
+ else if(strcmp(new_image_effect_str, "negative") == 0)
+ new_image_effect = SecCamera::IMAGE_EFFECT_NEGATIVE;
+ else if(strcmp(new_image_effect_str, "sharpen") == 0) //added at samsung
+ new_image_effect = SecCamera::IMAGE_EFFECT_SHARPEN;
+ else
+ {
+ LOGE("ERR(%s):Invalid effect(%s)", __FUNCTION__, new_image_effect_str); //posterize, whiteboard, blackboard, solarize
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(new_image_effect >= 0)
+ {
+ if(mSecCamera->setImageEffect(new_image_effect) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setImageEffect(effect(%d))", __FUNCTION__, new_image_effect);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ //antiBanding
+ const char * new_antibanding_str = params.get("antibanding");
+ if(new_antibanding_str != NULL)
+ {
+ int new_antibanding = -1;
+
+ if(strcmp(new_antibanding_str,"auto") == 0)
+ new_antibanding = SecCamera::ANTI_BANDING_AUTO;
+ else if(strcmp(new_antibanding_str,"50hz") == 0)
+ new_antibanding = SecCamera::ANTI_BANDING_50HZ;
+ else if(strcmp(new_antibanding_str,"60hz") == 0)
+ new_antibanding = SecCamera::ANTI_BANDING_60HZ;
+ else if(strcmp(new_antibanding_str,"off") == 0)
+ new_antibanding = SecCamera::ANTI_BANDING_OFF;
+ else
+ {
+ LOGE("%s::unmatched antibanding(%s)", __FUNCTION__, new_antibanding_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_antibanding)
+ {
+ if(mSecCamera->setAntiBanding(new_antibanding) < 0)
+ {
+ LOGE("%s::mSecCamera->setAntiBanding(%d) fail", __FUNCTION__, new_antibanding);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ }
+
+ //contrast
+ int new_contrast = params.getInt("contrast");
+ if(0 <= new_contrast)
+ {
+ if(mSecCamera->setContrast(new_contrast) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setContrast(%d)", __FUNCTION__, new_contrast);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //WDR
+ int new_wdr = params.getInt("wdr");
+ if(0 <= new_wdr)
+ {
+ if(mSecCamera->setWDR(new_wdr) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setWDR(%d)", __FUNCTION__, new_wdr);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //anti shake
+ int new_anti_shake = params.getInt("anti-shake");
+ if(0 <= new_anti_shake)
+ {
+ if(mSecCamera->setAntiShake(new_anti_shake) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setWDR(%d)", __FUNCTION__, new_anti_shake);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //zoom
+ int new_zoom_level = params.getInt(CameraParameters::KEY_ZOOM);
+ if(0 <= new_zoom_level)
+ {
+ if(mSecCamera->setZoom(new_zoom_level) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setZoom(%d)", __FUNCTION__, new_zoom_level);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //object tracking
+ int new_obj_tracking = params.getInt("obj-tracking");
+ if(0 <= new_obj_tracking)
+ {
+ if(mSecCamera->setObjectTracking(new_obj_tracking) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setObjectTracking(%d)", __FUNCTION__, new_obj_tracking);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // smart auto
+ int new_smart_auto = params.getInt("smart-auto");
+ if(0 <= new_smart_auto)
+ {
+ if(mSecCamera->setSmartAuto(new_smart_auto) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSmartAuto(%d)", __FUNCTION__, new_smart_auto);
+ ret = UNKNOWN_ERROR;
+ }
+
+ //smart auto on => start Smartautoscene Thread
+ if(mSecCamera->getSmartAuto() == 1)
+ {
+ if(startSmartautoscene() == INVALID_OPERATION)
+ {
+ LOGE("Smartautoscene thread is already running");
+ }
+ else
+ LOGE("Smartautoscene thread start");
+ }
+ //smart auto off => stop Smartautoscene Thread
+ else
+ {
+ if(mSmartautosceneRunning == true)
+ {
+ stopSmartautoscene();
+ LOGV("Smartautoscene thread stop");
+ }
+ else
+ LOGV("Smartautoscene thread was already stop");
+ }
+ }
+
+ // beauty_shot
+ int new_beauty_shot = params.getInt("face_beauty");
+ if(0 <= new_beauty_shot)
+ {
+ if(mSecCamera->setBeautyShot(new_beauty_shot) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setBeautyShot(%d)", __FUNCTION__, new_beauty_shot);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ // vintage mode
+ const char * new_vintage_mode_str = params.get("vintagemode");
+ if(new_vintage_mode_str != NULL)
+ {
+ int new_vintage_mode = -1;
+
+ if(strcmp(new_vintage_mode_str, "off") == 0)
+ new_vintage_mode = SecCamera::VINTAGE_MODE_OFF;
+ else if(strcmp(new_vintage_mode_str, "normal") == 0)
+ new_vintage_mode = SecCamera::VINTAGE_MODE_NORMAL;
+ else if(strcmp(new_vintage_mode_str, "warm") == 0)
+ new_vintage_mode = SecCamera::VINTAGE_MODE_WARM;
+ else if(strcmp(new_vintage_mode_str, "cool") == 0)
+ new_vintage_mode = SecCamera::VINTAGE_MODE_COOL;
+ else if(strcmp(new_vintage_mode_str, "bnw") == 0)
+ new_vintage_mode = SecCamera::VINTAGE_MODE_BNW;
+ else
+ {
+ LOGE("%s::unmatched vintage_mode(%d)", __FUNCTION__, new_vintage_mode);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_vintage_mode)
+ {
+ if(mSecCamera->setVintageMode(new_vintage_mode) < 0)
+ {
+ LOGE("%s::mSecCamera->setVintageMode(%d) fail", __FUNCTION__, new_vintage_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ // gps latitude
+ const char * new_gps_latitude_str = params.get("gps-latitude");
+ if(mSecCamera->setGPSLatitude(new_gps_latitude_str) < 0)
+ {
+ LOGE("%s::mSecCamera->setGPSLatitude(%s) fail", __FUNCTION__, new_gps_latitude_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ // gps longitude
+ const char * new_gps_longitute_str = params.get("gps-longitude");
+ if(mSecCamera->setGPSLongitude(new_gps_longitute_str) < 0)
+ {
+ LOGE("%s::mSecCamera->setGPSLongitude(%s) fail", __FUNCTION__, new_gps_longitute_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ // gps altitude
+ const char * new_gps_altitude_str = params.get("gps-altitude");
+ if(mSecCamera->setGPSAltitude(new_gps_altitude_str) < 0)
+ {
+ LOGE("%s::mSecCamera->setGPSAltitude(%s) fail", __FUNCTION__, new_gps_altitude_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ // gps timestamp
+ const char * new_gps_timestamp_str = params.get("gps-timestamp");
+ if(mSecCamera->setGPSTimeStamp(new_gps_timestamp_str) < 0)
+ {
+ LOGE("%s::mSecCamera->setGPSTimeStamp(%s) fail", __FUNCTION__, new_gps_timestamp_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ // Recording size
+ int new_recording_width = params.getInt("recording-size-width");
+ int new_recording_height= params.getInt("recording-size-height");
+
+ if(0 < new_recording_width && 0 < new_recording_height) {
+ if(mSecCamera->setRecordingSize(new_recording_width, new_recording_height) < 0) {
+ LOGE("ERR(%s):Fail on mSecCamera->setRecordingSize(width(%d), height(%d))", __FUNCTION__, new_recording_width, new_recording_height);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ else {
+ if(mSecCamera->setRecordingSize(new_preview_width, new_preview_height) < 0) {
+ LOGE("ERR(%s):Fail on mSecCamera->setRecordingSize(width(%d), height(%d))", __FUNCTION__, new_preview_width, new_preview_height);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //gamma
+ const char * new_gamma_str = params.get("video_recording_gamma");
+ if(new_gamma_str != NULL)
+ {
+ int new_gamma = -1;
+
+ if(strcmp(new_gamma_str, "off") == 0)
+ new_gamma = SecCamera::GAMMA_OFF;
+ else if(strcmp(new_gamma_str, "on") == 0)
+ new_gamma = SecCamera::GAMMA_ON;
+ else
+ {
+ LOGE("%s::unmatched gamma(%s)", __FUNCTION__, new_gamma_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_gamma)
+ {
+ if(mSecCamera->setGamma(new_gamma) < 0)
+ {
+ LOGE("%s::mSecCamera->setGamma(%d) fail", __FUNCTION__, new_gamma);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ //slow ae
+ const char * new_slow_ae_str = params.get("slow_ae");
+ if(new_slow_ae_str != NULL)
+ {
+ int new_slow_ae = -1;
+
+ if(strcmp(new_slow_ae_str, "off") == 0)
+ new_slow_ae = SecCamera::SLOW_AE_OFF;
+ else if(strcmp(new_slow_ae_str, "on") == 0)
+ new_slow_ae = SecCamera::SLOW_AE_ON;
+ else
+ {
+ LOGE("%s::unmatched slow_ae(%s)", __FUNCTION__, new_slow_ae_str);
+ ret = UNKNOWN_ERROR;
+ }
+
+ if(0 <= new_slow_ae)
+ {
+ if(mSecCamera->setSlowAE(new_slow_ae) < 0)
+ {
+ LOGE("%s::mSecCamera->setSlowAE(%d) fail", __FUNCTION__, new_slow_ae);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ }
+
+ //exif orientation info
+ int new_exif_orientation = params.getInt("exifOrientation"); //kidggang
+ if(0 <= new_exif_orientation)
+ {
+ if(mSecCamera->setExifOrientationInfo(new_exif_orientation) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setExifOrientationInfo(%d)", __FUNCTION__, new_exif_orientation);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ /*Camcorder fix fps*/
+ int new_sensor_mode = params.getInt("cam_mode");
+ if(0 <= new_sensor_mode)
+ {
+ if(mSecCamera->setSensorMode(new_sensor_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setSensorMode(%d)", __FUNCTION__, new_sensor_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ else
+ {
+ new_sensor_mode=0;
+ }
+
+ /*Shot mode*/
+ int new_shot_mode = params.getInt("shot_mode");
+ if(0 <= new_shot_mode)
+ {
+ if(mSecCamera->setShotMode(new_shot_mode) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setShotMode(%d)", __FUNCTION__, new_shot_mode);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+ else
+ {
+ new_shot_mode=0;
+ }
+
+ //blur for Video call
+ int new_blur_level = params.getInt("blur");
+ if(0 <= new_blur_level)
+ {
+ if(mSecCamera->setBlur(new_blur_level) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setBlur(%d)", __FUNCTION__, new_blur_level);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+
+ // chk_dataline
+ int new_dataline = params.getInt("chk_dataline");
+ if(0 <= new_dataline)
+ {
+ if(mSecCamera->setDataLineCheck(new_dataline) < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setDataLineCheck(%d)", __FUNCTION__, new_dataline);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+
+ //Batch Command
+ if(new_camera_id == SecCamera::CAMERA_ID_BACK)
+ {
+ if(mSecCamera->setBatchReflection() < 0)
+ {
+ LOGE("ERR(%s):Fail on mSecCamera->setBatchCmd", __FUNCTION__);
+ ret = UNKNOWN_ERROR;
+ }
+ }
+#endif
+
+ return ret;
+}
+
+CameraParameters CameraHardwareSec::getParameters() const
+{
+ LOGV("%s()", __FUNCTION__);
+ Mutex::Autolock lock(mLock);
+ return mParameters;
+}
+
+status_t CameraHardwareSec::sendCommand(int32_t command, int32_t arg1, int32_t arg2)
+{
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ LOGV("%s() : command = %d, arg1 =%d, arg2= %d", __FUNCTION__,command, arg1, arg2);
+ switch(command)
+ {
+ case COMMAND_AE_AWB_LOCK_UNLOCK:
+ mSecCamera->setAEAWBLockUnlock(arg1, arg2);
+ break;
+ case COMMAND_FACE_DETECT_LOCK_UNLOCK:
+ mSecCamera->setFaceDetectLockUnlock(arg1);
+ break;
+ case COMMAND_OBJECT_POSITION:
+ mSecCamera->setObjectPosition(arg1, arg2);
+ break;
+ case COMMAND_OBJECT_TRACKING_STARTSTOP:
+ mSecCamera->setObjectTrackingStartStop(arg1);
+ objectTracking(arg1);
+ break;
+ case CONTINUOUS_SHOT_START_CAPTURE:
+ break;
+ case CONTINUOUS_SHOT_STOP_AND_ENCODING:
+ mSecCamera->setAEAWBLockUnlock(arg1, arg2);
+ LOGV("Continuous shot command received");
+ break;
+ case COMMAND_TOUCH_AF_STARTSTOP:
+ mSecCamera->setTouchAFStartStop(arg1);
+ break;
+ case COMMAND_CHECK_DATALINE:
+ mSecCamera->setDataLineCheckStop();
+ break;
+ case COMMAND_DEFAULT_IMEI:
+ mSecCamera->setDefultIMEI(arg1);
+ break;
+ defualt:
+ LOGV("%s()", __FUNCTION__);
+ break;
+ }
+
+ return NO_ERROR;
+#else
+ return BAD_VALUE;
+#endif
+}
+
+void CameraHardwareSec::release()
+{
+ LOGV("%s()", __FUNCTION__);
+}
+
+wp<CameraHardwareInterface> CameraHardwareSec::singleton;
+
+sp<CameraHardwareInterface> CameraHardwareSec::createInstance()
+{
+ LOGV("%s()", __FUNCTION__);
+ if (singleton != 0) {
+ sp<CameraHardwareInterface> hardware = singleton.promote();
+ if (hardware != 0) {
+ return hardware;
+ }
+ }
+ sp<CameraHardwareInterface> hardware(new CameraHardwareSec());
+ singleton = hardware;
+ return hardware;
+}
+#if 0
+extern "C" sp<CameraHardwareInterface> openCameraHardware()
+{
+ LOGV("%s()", __FUNCTION__);
+ return CameraHardwareSec::createInstance();
+}
+#endif
+
+static CameraInfo sCameraInfo[] = {
+ {
+ CAMERA_FACING_BACK,
+ 90, /* orientation */
+ }
+};
+
+extern "C" int HAL_getNumberOfCameras()
+{
+ return sizeof(sCameraInfo) / sizeof(sCameraInfo[0]);
+}
+
+extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo* cameraInfo)
+{
+ memcpy(cameraInfo, &sCameraInfo[cameraId], sizeof(CameraInfo));
+}
+
+extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId)
+{
+ return CameraHardwareSec::createInstance();
+}
+
+}; // namespace android
diff --git a/libcamera/SecCameraHWInterface.h b/libcamera/SecCameraHWInterface.h
new file mode 100644
index 0000000..9e4fb79
--- /dev/null
+++ b/libcamera/SecCameraHWInterface.h
@@ -0,0 +1,257 @@
+/*
+**
+** Copyright 2008, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifndef ANDROID_HARDWARE_CAMERA_HARDWARE_SEC_H
+#define ANDROID_HARDWARE_CAMERA_HARDWARE_SEC_H
+
+#include "SecCamera.h"
+#include <utils/threads.h>
+#include <camera/CameraHardwareInterface.h>
+#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
+#include <utils/threads.h>
+
+namespace android {
+class CameraHardwareSec : public CameraHardwareInterface {
+public:
+ virtual sp<IMemoryHeap> getPreviewHeap() const;
+ virtual sp<IMemoryHeap> getRawHeap() const;
+
+//Kamat --eclair
+ virtual void setCallbacks(notify_callback notify_cb,
+ data_callback data_cb,
+ data_callback_timestamp data_cb_timestamp,
+ void* user);
+
+ virtual void enableMsgType(int32_t msgType);
+ virtual void disableMsgType(int32_t msgType);
+ virtual bool msgTypeEnabled(int32_t msgType);
+
+ virtual status_t startPreview();
+ virtual void stopPreview();
+ virtual bool previewEnabled();
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ virtual status_t startSmartautoscene();
+ virtual void stopSmartautoscene();
+ virtual bool smartautosceneEnabled();
+#endif
+
+ virtual status_t startRecording();
+ virtual void stopRecording();
+ virtual bool recordingEnabled();
+ virtual void releaseRecordingFrame(const sp<IMemory>& mem);
+
+ virtual status_t autoFocus();
+ virtual status_t cancelAutoFocus();
+ virtual status_t takePicture();
+ virtual status_t cancelPicture();
+ virtual status_t dump(int fd, const Vector<String16>& args) const;
+ virtual status_t setParameters(const CameraParameters& params);
+ virtual CameraParameters getParameters() const;
+ virtual status_t sendCommand(int32_t command, int32_t arg1,
+ int32_t arg2);
+ virtual void release();
+
+ static sp<CameraHardwareInterface> createInstance();
+
+private:
+ CameraHardwareSec();
+ virtual ~CameraHardwareSec();
+
+ static wp<CameraHardwareInterface> singleton;
+
+ static const int kBufferCount = MAX_BUFFERS;
+ static const int kBufferCountForRecord = MAX_BUFFERS;
+
+ class PreviewThread : public Thread {
+ CameraHardwareSec* mHardware;
+ public:
+ PreviewThread(CameraHardwareSec* hw):
+#ifdef SINGLE_PROCESS
+ // In single process mode this thread needs to be a java thread,
+ // since we won't be calling through the binder.
+ Thread(true),
+#else
+ Thread(false),
+#endif
+ mHardware(hw) { }
+ virtual void onFirstRef() {
+ run("CameraPreviewThread", PRIORITY_URGENT_DISPLAY);
+ }
+ virtual bool threadLoop() {
+ int ret = mHardware->previewThread();
+ // loop until we need to quit
+ if(ret == NO_ERROR)
+ return true;
+ else
+ return false;
+ }
+ };
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ class SmartautosceneThread : public Thread {
+ CameraHardwareSec* mHardware;
+ public:
+ SmartautosceneThread(CameraHardwareSec* hw):
+#ifdef SINGLE_PROCESS
+ // In single process mode this thread needs to be a java thread,
+ // since we won't be calling through the binder.
+ Thread(true),
+#else
+ Thread(false),
+#endif
+ mHardware(hw) { }
+ virtual void onFirstRef() {
+ run("CameraSmartautosceneThread", PRIORITY_URGENT_DISPLAY);
+ }
+ virtual bool threadLoop() {
+ int ret = mHardware->smartautosceneThread();
+ // loop until we need to quit
+ if(ret == NO_ERROR)
+ return true;
+ else
+ return false;
+ }
+ };
+#endif
+ void initDefaultParameters();
+ void initHeapLocked();
+
+ int previewThread();
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ int smartautosceneThread();
+#endif
+
+ static int beginAutoFocusThread(void *cookie);
+ int autoFocusThread();
+
+ static int beginPictureThread(void *cookie);
+ int pictureThread();
+ int save_jpeg( unsigned char * real_jpeg, int jpeg_size);
+ void save_postview(const char *fname, uint8_t *buf, uint32_t size);
+ int decodeInterleaveData(unsigned char *pInterleaveData,
+ int interleaveDataSize,
+ int yuvWidth,
+ int yuvHeight,
+ int *pJpegSize,
+ void *pJpegData,
+ void *pYuvData);
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ static int beginObjectTrackingThread(void *cookie);
+ int objectTrackingThread();
+ status_t objectTracking(int onoff);
+#endif
+
+ mutable Mutex mLock;
+
+ CameraParameters mParameters;
+
+ sp<MemoryHeapBase> mPreviewHeap;
+ sp<MemoryHeapBase> mRawHeap;
+ sp<MemoryHeapBase> mRecordHeap;
+ sp<MemoryHeapBase> mJpegHeap;
+ sp<MemoryBase> mBuffers[kBufferCount];
+ sp<MemoryBase> mRecordBuffers[kBufferCountForRecord];
+
+ SecCamera *mSecCamera;
+ bool mPreviewRunning;
+ int mPreviewFrameSize;
+ int mRawFrameSize;
+ int mPreviewFrameRateMicrosec;
+
+
+ // protected by mLock
+ sp<PreviewThread> mPreviewThread;
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ sp<SmartautosceneThread> mSmartautosceneThread;
+#endif
+ notify_callback mNotifyCb;
+ data_callback mDataCb;
+ data_callback_timestamp mDataCbTimestamp;
+ void *mCallbackCookie;
+
+ int32_t mMsgEnabled;
+
+ // only used from PreviewThread
+ int mCurrentPreviewFrame;
+ int mCurrentRecordFrame;
+
+ bool mRecordRunning;
+#ifdef JPEG_FROM_SENSOR
+ int mPostViewWidth;
+ int mPostViewHeight;
+ int mPostViewSize;
+#endif
+
+ int mNoHwHandle;
+ struct timeval mTimeStart;
+ struct timeval mTimeStop;
+
+#ifdef SWP1_CAMERA_ADD_ADVANCED_FUNCTION
+ enum COMMAND_DEFINE
+ {
+ COMMAND_AE_AWB_LOCK_UNLOCK = 1101,
+ COMMAND_FACE_DETECT_LOCK_UNLOCK = 1102,
+ COMMAND_OBJECT_POSITION = 1103,
+ COMMAND_OBJECT_TRACKING_STARTSTOP = 1104,
+ COMMAND_TOUCH_AF_STARTSTOP = 1105,
+ COMMAND_CHECK_DATALINE = 1106,
+ CONTINUOUS_SHOT_START_CAPTURE = 1023,
+ CONTINUOUS_SHOT_STOP_AND_ENCODING = 1024,
+ COMMAND_DEFAULT_IMEI = 1107,
+ };
+
+class ObjectTrackingThread : public Thread {
+ CameraHardwareSec* mHardware;
+ public:
+ ObjectTrackingThread(CameraHardwareSec* hw):
+#ifdef SINGLE_PROCESS
+ // In single process mode this thread needs to be a java thread,
+ // since we won't be calling through the binder.
+ Thread(true),
+#else
+ Thread(false),
+#endif
+ mHardware(hw) { }
+ virtual void onFirstRef() {
+ run("CameraObjectTrackingThread", PRIORITY_URGENT_DISPLAY);
+ }
+ virtual bool threadLoop() {
+ int ret = mHardware->objectTrackingThread();
+ // loop until we need to quit
+ if(ret == NO_ERROR)
+ return true;
+ else
+ return false;
+ }
+ };
+ bool mObjectTrackingRunning;
+ sp<ObjectTrackingThread> mObjectTrackingThread;
+ int mObjectTrackingStatus;
+
+ bool mSmartautosceneRunning;
+ int mSmartautoscene_current_status;
+ int mSmartautoscene_previous_status;
+ int af_thread_status;
+#endif
+};
+
+}; // namespace android
+
+#endif